File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Agile and Other Processes and the fly likes How do I keep our patterns alive and clean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "How do I keep our patterns alive and clean" Watch "How do I keep our patterns alive and clean" New topic
Author

How do I keep our patterns alive and clean

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2499
    
    8

We have difficulties to keep our "patterns based code" clean.
We started of well, applying the patterns we selected in our code.
But after some iterations, overhauls, hand-overs and change of implementation partners, things blurred.
Looking for advise on how to properly manage a pattern catalog and the code based upon them, and how to take care that our codebase keeps adhering to our patterns.


OCUP UML fundamental and ITIL foundation
youtube channel
Victor Sosa
Greenhorn

Joined: Aug 26, 2008
Posts: 20

Yeah! same problem here. Hope Celso and Lee can answer this practical question


"Software development has been, is, and will remain fundamentally hard"
- Grady Booch
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hello,

I have faced similar issue on the projects I have been working on. Something I realized is "A stitch in time saves nine". This applies to most situations and the sooner the project is re-factored, so much easier things become. With each "iterations, overhauls, hand-overs and change of implementation partners" the more "blurred" things are going to get. In the end you have one humongous project/code-base that is harder to upgrade, maintain ...... I agree re-factoring is going to take a good amount of time but with each passing moment the process is not going to get any easier and on the contrary it will get all the more harder and harder. Weigh all aspects like how long is the project going to be around for, what technologies may it move on to, is the development phase over etc.

Cheers,
Raj.
Lee Ackerman
Author
Greenhorn

Joined: Nov 14, 2010
Posts: 25
Hi Jan - good question.

A first step is to recognize that there's an issue. And it sounds like you've identified a couple of issues:
1. How do I ensure that my pattern catalog is up to date?
2. How do I keep my code base in synch with my patterns? (While recognizing that both the code and the patterns can change)

For the first, we can think about how we manage the pattern catalog. Is there a review process in place for the pattern? Is there a centralized place that patterns are stored? How are updates to the patterns managed? How is information about updates communicated to the organization? As we make plans for maintaining or updating software that uses patterns, are we accounting for effort associated with updating code associated with the pattern?

For the second issue, a good place to start is to think about the role that automation can play. We can look to use automation in the form of a pattern implementation to generate a solution based on a pattern. In such cases, if the pattern is updated, we can reapply the pattern and synchronize. In cases, where someone has modified the code and deviated from the pattern, we have the option of reapplying the pattern and bringing the solution back into alignment with the pattern. However, the situation may be more complex and we need to first determine whether the pattern needs to be updated, the solution needs to be brought back into alignment, or if the two will remain different and we need to decide if we have a new pattern or a unique and isolated solution.

Another role for automation is pattern detection. Some development environments have the capability to analyze and code base and can recognize the application of a pattern. We can use these capabilities to see and confirm that patterns have been applied and then confirm adherence to the pattern definition.

Moving beyond automation, we can look to traditional approaches such as design and code reviews to further assist us in catching solutions that drift from patterns.

Lee.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2499
    
    8

Wow, thank you.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

I don't understand. Why would a pattern once implemented in the code go bad. Can you give examples ?


Groovy
Lee Ackerman
Author
Greenhorn

Joined: Nov 14, 2010
Posts: 25
Our solutions and associated code are not static over time. The initial release of the solution may indeed be true to the pattern. However, software often lives much longer than expected, and is updated many times over that lifespan. At any point in time, there are a few reasons as to why there is a divergence between a pattern and how that pattern is represented in a solution:

1. The pattern was not applied correctly.
2. The pattern was applied correctly, but was "enhanced"
3. The solution itself evolves over time, addressing defects, changes in requirements, etc. The updates in the code have led to changes in the solution.

Lee.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I keep our patterns alive and clean