Posts

Showing posts with the label Design Pattern

Factory Pattern from Head First Design Patterns

This post is available on: http://www.javaguides.net/2018/07/factory-pattern-from-head-first-design-patterns.html Hi, I am  Ramesh Fadatare  from India, a founder, author, designer and chief editor of a  website   JavaGuides , a technical blog dedicated to the Java/J2EE technologies.  If you like my articles/guides then connect with me directly on   Google Plus ,  Facebook ,  LinkedIn ,  GitHub , and  StackOverflow . Please comment if you have any suggestions or feedback about my articles would be appreciated. Happy learning and keep coding !!!.

Observer Pattern from Head First Design Patterns

In this post, we will learn simple Observer Pattern implementation with examples from Head First Design Patterns Book. Read more on: http://www.javaguides.net/2018/07/observer-pattern-from-head-first-design-patterns.html

Facade Pattern from Head First Design Patterns

This post is moved to: http://www.javaguides.net/2018/07/facade-pattern-from-head-first-design-patterns.html

Template Pattern from Head First Design Patterns

This post is moved to : http://www.javaguides.net/2018/07/template-pattern-from-head-first-design-patterns.html

Decorator Pattern from Head First Design Patterns

This post is moved to: http://www.javaguides.net/2018/07/decorator-pattern-from-head-first-design-patterns.html

Object Pool Design Pattern

Image
Intent When objects are expensive to create and they are needed only for short periods of time it is advantageous to utilize the Object Pool pattern. The Object Pool provides a cache for instantiated objects tracking which ones are in use and which are available. Object pool pattern is a software creational design pattern which is used in situations where the cost of initializing a class instance is very high. Basically, an Object pool is a container which contains some amount of objects. So, when an object is taken from the pool, it is not available in the pool until it is put back. Objects in the pool have a lifecycle: Creation, Validation and Destroy. Advantages It boosts the performance of the application significantly. It is most effective in a situation where the rate of initializing a class instance is high. It manages the connections and provides a way to reuse and share them. It can also provide the limit for the maximum number of objects that can be created. Applicability Use...

Design Patterns used in Hibernate Framework

Image
In this post, let's discuss a different kind of design patterns which are widely used in the Hibernate Framework. Design Patterns denote the best computer programming practices in the object-oriented software development. Hibernate framework has been built by using the following design pattern or standard practices. I list few known design patterns used in Hibernate Framework. Please mention in a comment, if you know any other design patterns used in Hibernate Framework. You can also read my post of  Design Patterns used in Spring Framework Domain Model Pattern The domain model is treated as POJO in Hibernate. The domain model is an object model of the domain that incorporates both behavior and data. Read more about Domain Model Pattern here https://stackoverflow.com/questions/41335249/domain-model-pattern-example Proxy Design Pattern Proxy Pattern for lazy loading - https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/performance.html Proxy Pattern provides a surrogate ...

Design Patterns used in Spring Framework

Image
In this post, let's discuss a different kind of design patterns which are widely used in the Spring Framework. Design Patterns denote the best computer programming practices in the object-oriented software development. Spring framework has been built by using the following design pattern or standard practices. I list few known design patterns used in Spring Framework. You may interested in  Design Patterns used in Hibernate Framework Proxy Design Pattern Proxy pattern is used heavily in AOP , and remoting . A good example of proxy design pattern is org.springframework.aop.framework.ProxyFactoryBean . This factory constructs AOP proxy based on Spring beans.  The proxy provides a surrogate or placeholder for another object to control access to it. Read more details about Proxy Design Pattern here  Proxy Design Pattern Singleton Design Pattern Singleton design pattern ensures that there will exist only the single instance of the object in the memory that could provide servic...

Null Object Design Pattern

Image
Intent In most object-oriented languages, such as Java or C#, references may be null. These references need to be checked to ensure they are not null before invoking any methods because methods typically cannot be invoked on null references. Instead of using a null reference to convey the absence of an object (for instance, a non-existent customer), one uses an object which implements the expected interface, but whose method body is empty. The advantage of this approach over a working default implementation is that a Null Object is very predictable and has no side effects: it does nothing. Structure Participants Client  requires a collaborator. AbstractObject  declares the interface for Client's collaborator. implements default behavior for the interface common to all classes, as appropriate. RealObject defines a concrete subclass of AbstractObject whose instances provide useful behavior that Client expects. NullObject provides an interface identical to AbstractObject's so t...