Search WebSpherePower's 6,973 WebSphere, Java, and Eclipse article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Using a reusable code approach to HTML select option lists, part VI (continued)

The basic pattern is almost always the same
Generally speaking, when you select some function to make reusable, you usually end up with a very similar set of elements in the resulting framework. Those elements include:

  • The Java Interface defining the desired behavior;

  • An abstract class that implements the Interface and provides common code;

  • One or more specialized abstract classes that extend the base code and provide code common to a particular category of implementing classes;

  • Any number of implementing classes that either extend the base code directly or extend one of the specialized abstract classes;

  • External configuration parameters to select and configure your implementing classes;

  • Some type of component factory to configure components based on the configuration.

I chose the OptionListSource as my example, but I could have just as easily chosen to use something else, such as formatting a menu for inclusion on a rendered page. Instead of creating SimpleOptionListSource objects and SqlOptionListSource objects we would have been dealing with VerticalNavigationFormatter objects and PullDownHorizontalNavigationFormatter objects and DirectoryTreeNavigationFormatter objects. Whether you're dealing with something as simple as a list of valid values or as complex as an enterprise application event management subsystem, the process is virtually the same: define the standard behavior in an interface, implement as much of the common logic as you can in an abstract class of base code, and then extend that base to create specialized abstract classes and/or final implementing classes.

By applying this pattern consistently, you'll begin to amass a portfolio of reusable components from which you can mix and match various elements to assemble applications rather than writing all of the code from scratch every time.

Summary
Well, that's about it! For those of you that found the actual code useful, I have compiled a .jar file containing all of the examples that we have used in this series. You're welcome to take them and do with them as you see fit. In fact, I would be interested in seeing any extensions or enhancements that anyone might come up with. But again, I hope that you took away more from this little series than just the code examples, because from my perspective at least, the real benefit lies in the ideas behind the code more than it does the software itself. Either way, I hope you enjoyed this little adventure as much as I did, and if you made it this far, thanks for hanging in there with me!

Product availability and resources
For more information on Echo Technogoly Group, Inc., visit http://www.teametg.com.

Easy, flexible article reprints
ZATZ now offers a quick, easy, flexible and inexpensive way to use article reprints in your marketing and promotion efforts. You can now get article reprints for a one-time fee of only $200. For details, visit http://mediakit.zatz.com/reprints.

Jeff Chilton is Vice President of Fulfillment at Echo Technology Group, Inc., an IT consulting firm that specializes in enterprise-focused best practices. He can be reached at jchilton@teametg.com


« Previous  ·  1  ·  2
Other articles you might like
Home > Projects > Reusable Code (5 articles)
   Using a reusable code approach to HTML select option lists, part V
   Using a reusable code approach to HTML select option lists, part IV
   Using a reusable code approach to HTML select option lists: part III
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent WebSpherePower Articles
A perfect 10: celebrating 10 years online
You can help bring security and safety back to White House email
Introducing the WebSpherePower RSS feeds
From New Jersey to Palm Bay, Florida
A WebSphere pot o' gold
How Elvis entered the building and CES went out the window
WebSphere Application Server 6: what's it all mean?
WebSpherePower News
Legal question: Can HP keep Hurd from going to Oracle?
Caringo announces integration with Symantec EV 9.0
Cisco & Citrix marry on virty PCs
Take Heed, Tech Giants: Edison's Failed Plot To Hijack Hollywood
IBM code unchains virtual workloads
Oracle names H-P ex-CEO Mark Hurd as co-president
Cloud Messaging Provider, Linxter, Releases SDK for Java and Android
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Introducing the Jones family and their full-family backup challenges
David Gewirtz Online: CNN commentary and analysis
DominoPower: Lotus must open source Notes and Domino
OutlookPower: Hands on debugging a broken Outlook forwarding rule
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login