I am learning Jakarta Struts.
( My usual plan of attack when learning a new programing language, is to buy a few books by intelligent authors. I read the books cover to cover to get the big picture, and to try to find the “Clue” or “Way” of the language. Then I do a tiny goofy project to actualy get code written down, going back over the book to find out the specific ways concepts are implimented. Finaly, I do a small real world app. )
Up until the past two weeks, I had had little experince with Java. From the intoductory books I had read, I belived that the way of Java was to break everything down into business related objects and avoid the use of getters and setters. I regarded Java as a verbose, brittle way of programing that was horribly unsuited to web coding.
About half way through my first read through of Struts in Action, I came across a sentance that ran something like this, “It is generaly agreed that the best way to build multi layered applications is to only pass primitives, (Numbers, Strings, Collections) accross layers.” I was quite staggered - this was totaly against everything I thought good Java programing stood for.
Now I am learning “real” web programing Java. Other than the mass of classes created, it is very similar my MVC PHP coding I am already doing.
Part of the Way of Programing Struts is to use Beans. Beans are nothing more than classes with get and set methods on every attirbute. This makes the class open, and eliminates the need for other classes to know what they are dealing with. If you are a filling station, and the Bean that drove up has a setFuelLevel() method, then you can fill it up. It does not matter if that particular object subclasses MotorizedVehicle or not. For all you care it could be a GasCan. Beans are nothing more than a way of doing Duck Typing in Java.
Struts solves many of the little ickies in web programing - forms, messages, control flow. Time will tell if Struts is worth the verbosity that comes with using Java.
Now I’m building my tiny goof-off application - it’s a way based control panel to command the mythical rodents that live under the Center and chew on network cables.