| By Jochen Krebs | Article Rating: |
|
| November 28, 2006 09:00 AM EST | Reads: |
17,492 |
The Related patterns section within the pattern template contains important clues to other patterns that might be applicable in the context of the object. For example, according to the pattern catalog, the State pattern is often related to Flyweight and Singleton[GoF]. This information must trigger a new set of questions to the software engineer - for example, "Are there any parts of my solution that could also benefit from the use of the Flyweight or the Singleton pattern?" - and cause the engineer to examine the existing approach.
Our solution using the State pattern currently has one drawback. If our timesheet system will handle, say, 5,000 timesheets in the approved state, we would also carry 5,000 instances of the Approved state. Also, with every state change, we would create a new instance of a new state and the Java garbage collector would need to collect the old state objects. This might not be very critical for our timesheet application, but in other scenarios this could be very expensive in terms of resources. Figure 9 shows just a small number of timesheets and associated states that would multiply thousands of times in our application, as it is thus far designed.
In our timesheet example, the states "approved, submitted. and entered" are good candidates for Flyweight objects because there is no need to add any additional attributes to one of the states to distinguish these instances. With the Flyweight pattern, we are actually able to improve the State pattern solution even further, as shown in Figure 10.
Our timesheet application now contains only three different state instances at any given moment, which increases maintainability and performance.
However, applying the Flyweight [GoF] pattern raises a new challenge for our designer. Instead of creating a new instance of a particular state object or carrying the flyweight objects around as parameters, we would like to achieve visibility to this one instance of state in that particular situation. The Singleton [GoF] pattern serves exactly this purpose. We could either implement each state as a Singleton, or create a factory of states which creates and manages the states. The latter method would increase maintainability even more through separation of concerns.
In pattern-driven development, the destination may be the origin for new patterns. For example, the State pattern often harmonizes with the Flyweight and Singleton patterns. However, Flyweight and Singleton have further associations to even more patterns, and so on. For simplicity, I have limited my illustration of these pattern relationships to the GoF catalog; the Also Known As section of the pattern template opens the door to other catalogs as well.
Pattern-Driven Development in Service-Oriented Architectures
In service-oriented architectures (SOA), there are services, providers,
and consumers, just as there are responsibilities, receivers, and
senders in object-oriented architectures. The difference is that the
application-centric design approach, (e.g. the timesheet application)
is elevated to the orchestration of services aligning the IT system
with, for example, the business processes. So far, our design for the
timesheet application has been driven by technology and a requirements
change. To include the timesheet application in a SOA, services must be
exposed so that human and non-human interfaces can be consumed.
In SOA design, the isolated view of the timesheet application would be replaced by a view of how the services of the timesheet application harmonize with other services from other applications. Depending on business requirements, the timesheet application could be seen in light of an organizational payroll process or in combination with a cost-breakdown-structure for product management. Exposing or modifying existing services or creating new services becomes a critical task for the enterprise and application architect. A more flexible and maintainable system built with patterns is therefore a critical element for a successful SOA.
Earlier in this article, I showed how patterns promote the application of additional related patterns, even across catalogs. We also saw that patterns exist in various forms, from helping with design decisions on an object level to patterns on an application level (i.e., assigning responsibilities vs. GoF patterns). The pattern-driven approach helps provide flexible and maintainable services in an SOA, and the SOA itself can drive and stimulate the pattern-driven approach. Business modeling patterns as well as architectural/network patterns motivated through an SOA can drive pattern-driven development top-down, whereas the pattern-driven application design prepares a successful SOA bottom-up.
Conclusion
Finding a matching pattern for a
problem not only presents a solution to a problem, but also means in
many cases the beginning of a new search and further evaluation of
related patterns. This type of search/discovery/exploration activity
should be familiar to you if you've ever used an Internet search engine
to explore a topic you only vaguely understand. You often start with
terms you're not sure about, but as you see more accepted terms and
areas of knowledge unfold in your result set(s), you gain insight into
the "patterns" of thinking and solutions that exist. Soon, you are able
to enhance your own queries, eventually expanding your original lines
of thought.
When properly documented and cataloged, patterns provide a common roadmap, encourage engineers to investigate the problem space, and, more importantly, allow us to apply a set of proven solutions rather than only one particular solution. I have used a basic enhancement request to illustrate the impact of change to a pattern-driven solution for a system in maintenance mode. Following an iterative-incremental process model, projects face very similar situations during construction, and we can easily map the benefits of pattern-driven development to incremental improvements in the project.
The Rational Software Architect (RSA) provides capabilities to support a pattern-driven engineering process by starting with common design patterns (for example GoF), or by creating its own pattern catalog. Publishing a pattern catalog with RSA and sharing the library of patterns on an enterprise level increases adoption rate which results in more reliable and flexible IT design. The ability to react to and adapt to organizational change is a fundamental strategy for a SOA.
References
• Gamma, E., Johnson, R., Helm, R., and Vlissides, J.M. (1995). Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley.
• Larman, Craig. (2004). Applying UML and Patterns - An Introduction to Object-Oriented Analysis and Design and Iterative Development 3rd Edition. Prentice Hall.
• Alexander, C. (1979). A Timeless Way of Building. Oxford University Press.
• Cooper, J.W. (2001). Java Design Patterns -- A Tutorial. Addison-Wesley.
• Alpert,S., Brown, K., and Woolf, B. (1998). The Design Patterns - Smalltalk Companion. Addison-Wesley.
Published November 28, 2006 Reads 17,492
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jochen Krebs
Jochen (Joe) Krebs (http://www.jochenkrebs.com) is a Senior IT Specialist for the Rational Software Brand within the IBM Software Group. He is responsible for successful enablement of Rational products and services for clients in the financial sector. Prior to joining IBM Rational he worked as an Instructor and Senior Consultant with a focus on project management, requirements management, software engineering processes and object-oriented technologies using Smalltalk and Java. He holds his MSc in Computing for Commerce and Industry at the Open University.
![]() |
Costa Gino 12/05/06 06:50:07 PM EST | |||
Object-oriented software engineering (OOSE) without design patterns is like cooking without a recipe. haha...interesting analogy.... well then enterprise software engineering is challenged to solve unique issues... and there couldnt be real recipes in it anyway.... |
||||
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?




































