Wednesday, June 01, 2005

Java Studio Creator: Not The Same Code

I posted this over on Javaranch earlier but wanted to get some feedback from those that might not visit us over there. Here is what I had to say:

So I downloaded JSC today to give it another whirl. The last time I tried it was when it was still an RC. Ran decent on my 3 GHz with 1 Gig RAM but still not up to par with IDEA or Eclipse. I excepted this though since it's based on Netbeans and Netbeans is still creepy crawly even on good machines.

Performance aside, it worked fairly well. I was able to create some basic forms and throw some navigation in there and move from page to page. The issues I had came when I started to look at the generated code. Hardly any of it follows the guidelines/practices that are taught in books. I'd asume this is because in the books we aren't using an IDE. But it is still interesting.

For example, I've always considered it best practice to load a dropdown list via a getter method in the backing bean that loads the list and binds it to the dropdown component. When I look at the same code using JSC this is all down in the constructor of the backing bean.

Another interesting note is how you are taught in books to create getter and setter methods for the values of the components. So for a login form you'd have

private String username;
private String password;

and then getters and setters and in the componet you would specifiy the value accordingly. In JSC it uses all component binding. So you call getValue() of the component instead of getUsername() or whatever. Not that this is a bad way, just different than what is generally taught in books.

I realize you can't expect IDE generated code to be as neat as what you write yourself but it would be nice if the things you learned from reading the books on JSF carried over to the IDE that just so happens to be made by Sun who just so happened to create the JSF specification.

So who's breaking the rules? Hand coders or the IDE?


Darrin said...

No arguement about the code change, but as far as who is corect, does it really matter?

Everyone sees things from their perspective. For me, being more of a architect than a bit twiddler (and I say that with the utmost respect to the bit twiddlers out there), another layer between me and the machine isn’t such a bad thing. I know, using an IDE can cause code bloat (having worked for years with Visual C++/MFC I can attest to that fact), but as long as you use the IDE to maintain the code, does it really matter that much? Yes if you have to tweak the underlying code that gets generated (with JSC, you shouldn’t have to do that often) then it might cause you some heartburn, but so would looking at code by any other person who’s style did not match your own (ever take a look at some C++ code?).

To me this is kind of like the argument many of us had about moving from assembler to a higher level language like C. You remember the arguments (it’s slower, it’s bigger, etc.). Then came along C++ and we heard it all over again (code bloat, inefficient, etc.). Next it was going to Java from C++, but we (at least those here) got over that too.

The thing is that the bottom line is the bottom line. Using IDEs like Creator or JBuilder, or (insert favorite here) help speed up development and reduce the learning curve for both new development and maintenance greatly. Yes, you might get “better” (reading “tighter”) code by doing things by hand, but by the time your team gets things out, a smaller team using tools can beat you to market.

Chuck Reynolds said...

Hi There,
The easiest money you'll ever make...

I just came across this brand new program that's

taking the internet by storm!

If you want to make an avalanche of instant cash

without lifting a finger, then you've GOT to see this:

sic code list

This amazing turnkey system allows you to profit

like crazy even if you don't have a list, website or

product of your own...and it really works!

sic code list>


Chuck Reynolds

PS. There's absolutely no hype here and you owe

it to yourself to check it out'll be

the easiest money you'll ever make!

sic code list