Oracle Positioning Java for the Enterprise

I read a couple articles stating the Oracle is positioning Java for the enterprise market. Specifically they intend for it to be used mainly for enterprise middleware. Thus Java will be poised to run on the server side.

Oracle has the trademark to Java. They plan to use this influence to direct the future of Java. Their latest plans are in stark contrast to Sun Microsystems, who had a more broad perspective on the application of Java.

Personally I don't care what Oracle plans. Right now I am writing a program to run on my workstation (client). And it is being written in Java. The developers will truly shape how Java is going to be used. Don't worry where Oracle wants to take Java. They will come around.

Oracle in Charge

I needed to compile an applet I wrote a year or two ago. However I have this new laptop at home. No problem. I decided to download and install the latest Java Development Kit from Sun. Ooops. They are not Sun Microsystems any more. Oracle bought them out.

It was clearly evident from the new install program. The JDK install prominently displayed Oracle Corporation on the screen. They are the new master now. It remains to be seen whether this is a good thing or not. I do know one fact. Oracle is not going anywhere in the near future. They got profits from their databases and other offerings.

Maybe Oracle can take Java to the next level.

Guessing can be Hot

I read this blog entry by a seasoned game developer. He gives hints on how to practically come up to speed on game development. Strangely enough, he advises you to truly start at the beginning. Assignment number 1 is to write a number guessing game. My Java skills are a bit rusty. So I figured I would give it a go.

Here is the stickler. I could not recall how to generate random numbers. Sure I can look it up with Google. But a strong Java developer knows this stuff by heart. I seemed to recall Math.random once I saw it. But that is for doubles. I needed some ints. And the java.util.Random class was just what the doctor ordered.

You can instantiate the Random class without any parameters. Or you can pass a seed for the random number generated as a parameter to the constructor. Once you have a Random object, just call the nextInt method and you get a number between 0 and n-1 (n is the parameter you pass nextInt).

Now I had my number guessing program working in no time. I decided to add a little spice to the program that was not required. No I don't have Guess jeans models popping up on the screen. I just let the user keep guessing until they arrive at the solution. And I throw in some taunts as responses when you guess is wrong. Good stuff.

Java App Version One

It is about time for me to get down to business and code a prototype for my app ideas. Previously I had thought I needed a polished product. But version 1 does not need all that. It just needs to get done. Then I will try it out for myself and see what to change in version 2.

Of course I am going to use Java as the programming language. The eventual product will be a web app displayed in HTML. However the first version might even just be text based. We shall see. I will probably post a link to my alpha version when it is ready for distribution.

SonarJ Architecture Review

We have a relatively new developer on our project. He is a seasoned application developer. So you know he gets down into the trenches of our source code. It is funny how he is disturbed about how many things were done wrong in our system. Many of us know about these problems. But we are too busy or too worried about breaking things to fix them.

There is a new version of a solution called SonarJ that could assist with our problems. It analyzes code and detects your application architectures, and identifies things you have done wrong. You can get a clear view of how bad things are with their metric dashboard.

SonarJ goes even further by projecting the impact of refactoring your code. It does this without disrupting your code baseline. The tool can grab code from your IDE or your build project. And if it was not clear from the name, the tool targets code written in the Java programming language.

Event Based

Java has always used event based programming to deal with user interfaces. Initially would generate events and send them to components. The component would information the system whether it processed the event. If so, that was the end of the processing. Otherwise the system would forward the event to another component, and so on until one did process the event.

By the time Java 1.1 was released, event processing had changed. A new delegation model was adopted which implements the observer pattern. Any components interested in an event implement a listener interface. They register with the system to handle the event. This makes the system's job easier. When the event fires, all listeners registered for that event get notified. More than one component can receive and process the event.

If your component's event processing is going to take any real time, you should do the work in a separate worker thread to keep the system responsive for the user.

Abstract Window Toolkit

I have read an intro chapter on the Abstract Window Toolkit (AWT). It is implemented via the "java.awt" package. The package provides a number of graphic user interface components. Examples are buttons, scrollbars, and checkboxes.

Two of the most useful components are the TextField and TextArea. The TextField is a single line of input from the user, while the TextArea is a multiple line edit control.

Checkboxes are components. They can be grouped using a CheckboxGroup class, which itself is not a component.

A LayoutManager interface has been defined to determine how components are placed on a screen. There are 5 different implementations of the LayoutManager provided to you by the AWT.

Let's talk about a few more AWT concepts. A container is an area on the screen which holds other components. A windows is a top level one on the screen that has no menu bar or border. It is used to create popup messages. If the user provides input in a such a window, it is then called a dialog. A frame, on the other hand, is a window that has a title, border, and buttons like maximize/minimize.

The last idea which I shall expound upon later is that of events. The entire AWT system is driven by events. AWT manages these events, and sends them to interested components. For example, an event is generated when the user clicks the mouse button. The AWT catches this, and sends the information to component(s) that had previously requested mouse press events.