Wednesday, February 03, 2010

And yet another great idea.. that turns out to be an old one.

Before, I had these ideas before:

1- The first idea is already there now, it’s the Spring OSGi Server.
2- The second idea is, as I read once, already implemented by Google now, you upload a picture of something and search for this place, it gets you more information about the place and what is it and stuff like this. But the only difference is that Google’s implementation is for known landscapes and sights. I mean something like the Pizza Tower, Pyramids, etc.

Today, while I was reading JavaLobby, I stumbled upon this article about Fork-Join programming in Java. I didn’t know what fork-join means, so I opened the URL here.
Which turned to be an idea that I had about a year ago:

Why can’t we have a way in Java that would let us execute a method implementation in a way that is not serial, but parallel with defining dependency between the code.
For example:

public void someMethod() {
String s = “something”; //variable declaration 1
Method1(); //do not depend on variable s
Method2(s);// depends on variable s
Method3(); //depends on method1

- Now, let’s assume the previous code, method 1 doesn’t depend on variable s and can be launched in separate thread.
- Method 2, depends on variable s; but it doesn’t depend on method 1. Method 3 must be executed after method1

The idea is simply to use some way to define method1 with no dependency, so one of the processors can execute it first thing (with same priority as variable declaration).
And then a way to have method2 depends on variable declaration. That means that method2 must be in queue to variable declaration. It can only start after variable declaration is finished.
And a way to have method3 depends on method1. Well, I guess you got the idea. Of course, we can have one line of code depends on many other lines.

The idea I had was generally and basically based on a way to define the dependencies between code lines and execute them in different threads. I know, I know.. not so fancy implementation with lots and lots of issues and concerns.

Now, back to fork-join development in Java and this article: First of all, I did not know that there is a name for this approach. And I sure didn’t know that there is a JSR for it Java (JSR 166).

I’m really happy that, although I didn’t study computer science, I have such ideas. It means, I’m thinking.. :-D
But, also, it means I need to study computer science before thinking about something else. :-(