Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Information about Design Patterns used by Spring.

 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Craig,

I have read Spring in Action second edition. I loved it! But I was missing something called design patterns. Book explain each feature very well and in detail. But I was looking for the design patterns that spring developers have used to implement those features. Understanding the design behind each feature makes me more confident of using a feature without any doubt and makes me confident to explain the client who doesn't know spring but aware of design patterns. Can we see such things in third edition?
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only one i know Singleton, in spring config file defined beans are singleton by default.
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I wouldn't consider the design patterns under the covers of Spring as being "in Action" kind of topics. I don't disagree that they might be interesting reading material...just not the subject of an "in Action" kind of book.

If you're curious about the underlying design, I strongly encourage you to check the code out of SVN (or Git, depending on which piece of the Spring portfolio you're interested in) and read it. Yes...read the code. You'll learn a lot. And you'll also question a lot of decisions made. As you question those decisions, try to answer the "why" for yourself--I find trying to do that helps me understand the mindset of the developer who wrote it. If you get stuck, feel free to ask on the forums--I'm sure someone will be happy to help you.

But I wouldn't concern myself too much with the specific design pattern names--those are good, no doubt, for communicating the dsign. But the main thing is to understand why that pattern was chosen.

As for "singleton" which was mentioned: Be careful to not confuse a singleton bean with the singleton design pattern. The singleton design pattern (of which I've seen a handful of different approaches) is intended to ensure a single instance of any given type within an application. A singleton bean, on the other hand, only guarantees that Spring will not create another instance of the bean as you defined it. You are still able to create your own instances of it and even Spring might create more instances of it if you define another bean of the same type. In short, the singleton design pattern is a stronger concept than the singleton bean. (Even then, the singleton design pattern is not a strong enough concept to guarantee a unique instance universally--you could certainly create more instance in another JVM.)
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Craig! Would love to see some books on those topics as well
 
Hitesh Singh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I know is that Spring Framework & Design pattern is made by ROD Johnson. First he build Design pattern & based on that he made spring framework because spring framework has implemented many design pattern concepts like singleton,factory,prototype,Decorator etc.

prototype is for creating mutiple bean instance.
Decorator is for cross cutting functionality..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic