Can't get my mind off Swing GUI design

March 11, 2005

root access: A Revolting Development for VB; an Opportunity for Python

To each his own I guess. I was thrilled to be able to abandon VB6 development. It was a painful time. Cocoa, Python, Java, please anything but VB6. If die-hard VB developers don't like VB.NET, that tells me it must be a lot better... but still not good enough to bother looking at it.

Which reminds me of my current frustration... Java Swing GUI development. I can't stop thinking about it. Using NetBeans to develop Java GUIs (as we are in SENG 330) reminds me an awful lot of of VB development. Double click a button, it generates code in the "module" that represents the form (in NetBeans it's worse than VB because it's actually a subclass of JFrame, which is a subclass of java.awt.Window, ie:, it's a View class).

As a trained Cocoa developer, the idea of putting pure application logic in a view class makes me want to scream and flee, but so far two Software Engineering professors at UVic have validated the approach, so it seems I'll likely have to follow (baah, baah) to have my work accepted. I think the JFrame subclass is taking the role of the Controller in the MVC style advocated in the Cocoa community, but I think it would be better to have that logic in a POJO that contains and controls a standard JFrame.

One of the design patterns we learned is "High Cohesion" (paired with "Low Couling", these were deemed very important). IMHO it is NOT very cohesive to have a class whose primary responsibility is displaying something on the screen and forwarding user events to its subcomponents to be tightly coupled to a domain layer controller.

And then there's the GoF principle, favour composition over inheritance...

Taking a deep breath...

Software Design is subjective, still as much of an art as it is a science. We have design patterns and principles, but there is more than one school of thought.