• 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

Design Patterns Practical Implementation

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

I am new on subject of Design Patterns. I am currently using Head First Design Patterns. I just completed with observer pattern.
I was looking forward to know the best possible way to implement the patterns or we can start with a shopping cart application and
implement whatever i learn in design patterns. If anyone is willing to join, please let me know.

Best Regards,
NS
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I consider that approach an *Anti-Pattern* for applying patterns, actually. What you're doing amounts to saying something like "Ok, now I've learned how to use a hammer, let me go out and try to build a house." Good luck with that, right? You need more than just a hammer to build a house.

Patterns are things you should keep in your "toolbox" until such time that you recognize that you are facing a problem that has been solved before (the context). Recognizing the context, you sift through your toolbox and pull out the pattern that is best applied to the problem at hand. Otherwise, if you just start walking around with a pattern in hand, looking for a problem to "solve" with it, you'll be like a crazy guy on the construction site just aimlessly walking around and flailing a chainsaw: you're more liable to cause damage and/or hurt someone than you are likely to help build anything.

A better approach would be to go breadth-first and become familiar with a number of patterns, paying particular attention not to the details of their implementations but to the *context* in which each can be applied. Then work on a project, without any preconceived notions of using patterns at all, and try to recognize the kinds of problems that you can solve with a proper application of an appropriate pattern.
 
Bartender
Posts: 1205
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:I consider that approach an *Anti-Pattern* for applying patterns, actually. What you're doing amounts to saying something like "Ok, now I've learned how to use a hammer, let me go out and try to build a house." Good luck with that, right? You need more than just a hammer to build a house.



I disagree. I think Nik's approach is analogous to having a hammer and trying to find a few small pieces of wood to nail together in the shape of a doll house.

Patterns are things you should keep in your "toolbox" until such time that you recognize that you are facing a problem that has been solved before (the context).



Patterns are things you keep in your toolbox once you know how to use them. Until then, there is some benefit to getting to them in a controlled environment. By trying various patterns out on toy applications, one gets an intuitive feel for the pros and cons of each pattern, as opposed to just the "Applicability" (or whatever) paragraph memorized by rote from the book.

A better approach would be to go breadth-first and become familiar with a number of patterns, paying particular attention not to the details of their implementations but to the *context* in which each can be applied. Then work on a project, without any preconceived notions of using patterns at all, and try to recognize the kinds of problems that you can solve with a proper application of an appropriate pattern.



I would suggest that approach after one has had a chance to get to know each one.

Bigger picture...
Our two approaches are probably just reflective of our individual learning styles. Some people can get a good feel for things such as design patterns, including when each one is applicable, just from reading a book. For others, a lot of the information in the books just leaks out unless/until we have a concrete experience to which to attach the information. My suggestions may well not work for you, Junilu, and it's possible that neither of our approaches will work for Nik. At least now Nik has two possible approaches, both of which seem reasonable.
 
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Design patterns are meant to solve specific problems. So you should be thinking "I'm gonna solve my design problems using patterns" and not "I'm create a design using design patterns".

So go ahead and create your initial design for the shopping cart application.

Personally it helps when i create my designs on paper first and think about them a little bit before i start the coding.
When you run into specific problems, you can always look at the patterns to find a solution.

It's of course meaningful to get an overview of the different patterns and specially what problems they solve.

There are a number of great resources on the web:

1. Nice overview of a number of patterns SourceMaking
2. Specific patterns for J2EE Core J2EE pattrns
3. Java design patterns video course on udemy Java Design Patterns

Hopes this info gives you a good head start. If you have a design you may contact me and i'll give you a review.

 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic