Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

design patterns in web applications  RSS feed

 
Yousef Salah
Greenhorn
Posts: 23
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,
i'm beginner in java ee technologies , and i think of the design patterns i learnt from head first design patterns how to be applied in java ee
i feel confused when thinking about that , excluding mvc  ofcourse
also would it be useful in frameworks like spring ?

any links and resources will be highly appreciated
thanks
 
Paul Clapham
Sheriff
Posts: 22471
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have the idea of using design patterns backwards. Yes, it's useful to understand the patterns. But the next step is not to go out and look for places to use them. That can result in bad and unreadable code if you just splash out design patterns willy-nilly. On the other hand you should carry on programming in the normal way, and when you find yourself coding something like, say, the Flyweight pattern you should pause and say "Oh, the Flyweight pattern applies here. Let me make sure I'm applying it in the right way."

For an analogy, think of doing improvements on your house. You don't go around looking for places to use a paintbrush. It's the other way around. Doing the improvements naturally suggests places where a paintbrush would be useful, and if you haven't ever used one before then this would be the time to review best practices for paintbrush usage.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other use case for design patterns is recognizing where they HAVE been used and thus being able to understand a system more easily.
Frameworks like spring et al normally employ several design patterns you could recognise.
They also help you "do the right thing" just by using the framework "as intended"

Extending Paul's metaphor, using a framework is similar to using a paint roller or spray painting instead of using a paintbrush. 
You get pretty much the same effect, with less effort on your part.
But you still sometimes need that paintbrush for the fine details!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!