• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Best Practices sanity check

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am in the process of developing my first "real" app using SWT Designer from Instantiations for the UI layer.

I planned to use the ClientBilling example discussed the SWT Designer's docs as a model to follow in completing my first app, and I'm wondering if the ClientBilling example really represents a best practices approach.

A class diagram is here:
http://www.arkadia-systems.com/clientbilling/ClientBilling.jpg

Individual source files are here:
http://www.arkadia-systems.com/clientbilling/ClientBillingUI.java
http://www.arkadia-systems.com/clientbilling/ClientBillingProc.java

Others are here also, just use the appropriate class name if interested.

Full source may be downloaded from: http://www.cs.umanitoba.ca/~eclipse/ClientBilling.zip

ClientBillingUI class has:

Fields: 54
Methods: 12
Lines of code per method min: 9, max 273, avg: 63
Lines of code: 1041

I get the idea from Fowler's Refactoring (sections on Long Method and Large Class) that this code may not be well designed from a best practices viewpoint.

I would really appreciate any comments from those more familiar than I with Today's best practices regarding this app. Specifically in terms of good/bad design and future maintainability.


Thanks, your comments are very much appreciated.

-Glen
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right to be sceptical - that code is far from being something that I would call "best". From the first skim over the UI class I'd even say that it's a mostly procedural program.

I'd bet that when I had to work on that code, after a day of refactoring the UI class alone would be broken down into a couple of dozen classes.

One of the very first things I would do is replacing the int constants at the top with the State/Strategy pattern and the ifs with polymorphic behavior.

I would also start to extract subpanels into their own classes.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic