• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Design Patterns and real life

 
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two questions for the authors of "HF Design Patterns":

(1) I might be stating the unpleasant but most of the Design Patterns discussion seems to be limited to theoretical, rote-learning questions asked mostly during job interviews and intricate boring discussion with textbook examples.

Does the HF book bring-in any insight on how a design pattern may actually be applied to a real-world project?

(2) Not many developers get the opportunity to be part of a project through the entire SDLC. For many people who are working on maintenance project, where the product is already there, the developer is usually involved only in bug-fixing or minor enhancements.

How can the Design Patterns be applied in such a scenario?
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Real world examples? The authors have discussed abt this in this thread
https://coderanch.com/t/99319/patterns/good-book-java-developer
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debashish Chakrabarty:

Does the HF book bring-in any insight on how a design pattern may actually be applied to a real-world project?



Check out Rod Johnson's Expert one on one book for a detailed explaination of what to use where & how.
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debashish Chakrabarty:
...but most of the Design Patterns discussion seems to be limited to theoretical, rote-learning questions asked mostly during job interviews and intricate boring discussion with textbook examples.



By definition, a design pattern is something that is discovered from existing code when experienced people find similarities in the way a particular problem is solved in different contexts. Hence, design patterns are as real as the code themselves.

The problem comes when people read a pattern and think that they have to apply as it is mentioned in the "class diagram" of the pattern. This point is something that Joshua Kerievsky mentions in his "Refactoring to Patterns" book also.

You should not take a DP literally. It is more of a guideline or a hint at solving a problem that you face. Almost always, you will come upon a slight variation of the problem defined in the pattern's statement. The skill/experience comes in looking under the variation, finding the pattern, and then massaging the problem so that you can solve it in a proven fashion.
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To some extent, I think that how much you utilize patterns will be impacted by your work environment. If people around you think about using patterns and talk about that, you're more likely to.

In many places, however, I see people that are rushing to meet deadlines and write horrible code to get something out the door. Could the code be written better and faster with the use of patterns? Probably. Will it take some time to learn to use patterns effectively. Yup. Are people willing to give up that time with a deadline looming. Not always. :roll:
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debashish Chakrabarty:
I have two questions for the authors of "HF Design Patterns":

(1) I might be stating the unpleasant but most of the Design Patterns discussion seems to be limited to theoretical, rote-learning questions asked mostly during job interviews and intricate boring discussion with textbook examples.

Does the HF book bring-in any insight on how a design pattern may actually be applied to a real-world project?



"DESIGN PATTERNS ARE SOLUTION TO REAL LIFE PROBLEMS" Its not something magical. You can apply one particualr pattern in particular scenario.



(2) Not many developers get the opportunity to be part of a project through the entire SDLC. For many people who are working on maintenance project, where the product is already there, the developer is usually involved only in bug-fixing or minor enhancements.

How can the Design Patterns be applied in such a scenario?




Refactoring to patterns. Change it as you find it. Maintainance is not only about bug fixes and minor enhancements. It also has its own fair part of performance tuning.

[ December 03, 2004: Message edited by: Udayan Patel ]
[ December 03, 2004: Message edited by: Udayan Patel ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Udayan Patel:
Refactoring to patterns. Change it as you find it. Maintainance is not only about bug fixes and minor enhancements. It also has its own fair part of performance tuning.



And about understanding existing code. As soon as you find yourself thinking "ah, this actually is a Decorator, why didn't he name it that way" - well, just rename it to make future maintenance easier.

Which makes me think - just being able to recognize a pattern will help you much to understand existing code if the developers were pattern-literate. (As a downside, it might also confuse you if they weren't and therefore the used names are misleading...)
 
author
Posts: 200
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We definitely made an effort to make the examples fun, but also applicable to real world situations. So while you might never actually program a gumball machine, hopefully you can see how this might translate to a copier machine, for instance.

To answer your second question, which is a very good question I think, even if you are involved only in the maintenance of a project, programs continue to evolve and new requirements come along all the time. A maintenance person might end up being the "expert" on the code after a while, especially after it's gone through a number of fixes and upgrades. Perhaps this maintenance person can see when the bug fixes that are requested are going to cause a problem, or perhaps are caused by a bad design. Having design patterns around to help to see where a program needs to be made more flexible to meet changing requirements is good for anyone. And eventually, this maintenance person might be asked their opinion of whether or not the program needs an entire overhaul to support a new requirement, or if they think a new requirement can be fit into the existing code. Knowing and understanding the design will help them greatly with this challege.

Elisabeth
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


most of the Design Patterns discussion seems to be limited to theoretical, rote-learning questions asked mostly during job interviews and intricate boring discussion with textbook examples


I did not feel that DP is limited to theoretical sense because it is really practical ideas. Even during the interviews, what the interviewers expect is how you apply DP to the system design, and what is the suitable patterns to be applied. If you can only speak out the name and description of the patterns without apply them correctly, it is meaningless still.

Nick
 
Debashish Chakrabarty
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Elisabeth Freeman:
A maintenance person might end up being the "expert" on the code after a while, especially after it's gone through a number of fixes and upgrades. Perhaps this maintenance person can see when the bug fixes that are requested are going to cause a problem, or perhaps are caused by a bad design.
Elisabeth


I agree with you. The reason I asked this question is, many of these maintenance projects do not either have any documentation at all or have insufficient documentation on the background or architecture of the application. How do you just get to know the patterns used just by looking at the 2-3000 odd files in the project folder?

Application designers may have followed a pattern to begin with, but when the same code passes through a dozen hands (I hope you concur that the maintenance projects usually see a lot of resource rotation problem) the pattern thing takes a back seat. You simply comment out old code, tuck-in yours, alter and add few queries, all this forgetting about the performance issues, the focus is simply on restoring/ensuring the expected functionality to meet the deadline. I agree a lot depends on the programmer himself but then it�s difficult to meditate sitting in the market-place
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is another take on "Design Patterns and Real Life" - as you may already know, the whole idea of Design Patterns in software was inspired by a series of books on Design Patterns in the physical world of landscapes and architecture by Christopher Alexander and co-authors.
If you have ever wondered why some buildings seem so clumsy and un-inviting while others are comfortable, these books explain it. A good one to start with is "The Timeless Way of Building" - it is expensive, so try the library.
Bill
 
Ranch Hand
Posts: 872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone have anything to say about the Christopher Alexander's design patterns and how his work as an architect compares software architecture.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gerald Davis:
Does anyone have anything to say about the Christopher Alexander's design patterns and how his work as an architect compares software architecture.



http://c2.com/cgi/wiki?ChristopherAlexander would be a good starting point on this topic.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first lecture I ever heard on Design Patterns started out by using several architectural examples from Alexander. I think the speaker was trying to convince us that there is some sort of universal truth to the idea that there are patterns that work well and patterns that don't work, and that as software designers we should pay attention to this.
Bill
 
Debashish Chakrabarty
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone for your answers. It seems I badly needed this book, alas I could not win it here
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic