Posts

Showing posts from May, 2018

Refactoring Factory Design Pattern with Lambdas

Image
Many existing object-oriented design patterns can be made redundant or written in a more concise way using lambda expressions. In this post, I would like to explain how to refactor Factory Design Pattern using  lambda expressions ?. This post may help in some situations like if we have implemented Factory Pattern in our projects using JDK 6 or 7. Now we want to use JDK 8 then we can refactor implementation of  Factory  Design  Pattern  using  lambda expressions  or we newly implement  Factory  Design  Pattern  using  lambda expressions  in our projects. Let's understand this refactoring technique with detail example. If you are new to Factory Pattern then there is a separate post for you:  Factory  Design  Pattern . If you want to revise or read the lambda expressions then visit  lambda expressions . As we know the  Factory  Design  Pattern  lets us create objects without exposing the instantiation logic to the client. For example, let�s say you�re working for a bank and they nee

Refactoring Chain of Responsibility Pattern with Lambdas

Image
Many existing object-oriented design patterns can be made redundant or written in a more concise way using lambda expressions. In this post, I would like to explain how to refactor  Chain of Responsibility Pattern  using  lambda expressions ?. This post may help in some situations like if we have implemented Observer Design Pattern in our projects using JDK 6 or 7. Now we want to use JDK 8 then we can refactor implementation of  Chain of Responsibility Pattern  using  lambda expressions  or we newly implement  Chain of Responsibility Pattern  using  lambda expressions  in our projects. Let's understand this refactoring technique with detail example. You can refer there is a separate post for  Chain of Responsibility Pattern . If you want to revise or read the lambda expressions then visit  lambda expressions . The chain of responsibility pattern is a common solution to create a chain of processing objects (such as a chain of operations). One processing object may do some work and p

Refactoring Observer Design Pattern with Lambdas

Image
Many existing object-oriented design patterns can be made redundant or written in a more concise way using lambda expressions. In this post, I would like to explain how to refactor Observer Design Pattern using lambda expressions ?. This post may help in some situations like if we have implemented Observer Design Pattern in our projects using JDK 6 or 7. Now we want to use JDK 8 then we can refactor implementation of  Observer Design Pattern  using  lambda expressions  or we newly implement  Observer Design Pattern  using  lambda expressions  in our projects. Let's understand this refactoring technique with detail example. You can refer there is a separate post for  Observer Design Pattern . If you want to revise or read the lambda expressions then visit:  lambda expressions The observer design pattern is a common solution when an object (called the subject) needs to automatically notify a list of other objects (called observers) when some event happens (for example, a state chang

Refactoring Strategy Design Pattern with Lambdas

Image
In this post, I would like to explain how to refactor Strategy Design Pattern using lambda expressions ?. This post may help in some situations like if we have implemented  Strategy Design Pattern  in our projects using JDK 6 or 7. Now we want to use JDK 8 then we can refactor implementation of  Strategy Design Pattern  using  lambda expressions  or we newly implement  Strategy Design Pattern  using  lambda expressions  in our projects. Let's understand this refactoring technique with detail example. If you want to revise or read the Strategy Design Pattern then visit:  Strategy Design Pattern . If you want to revise or read the lambda expressions then visit:  lambda expressions Strategy Design Pattern can be written in a more concise way of using lambda expressions. The  Strategy Design Pattern  states that it is a common solution for representing a family of algorithms and letting you choose among them at runtime. You can apply this pattern to a multitude of scenarios, such as v

Application Controller Pattern

Use an  Application Controller  to centralize retrieval and invocation of request-processing components, such as  commands  and  views . Let's discuss how Application Controller Design Pattern works with examples. This pattern is divided into a number of sections for simplicity like problem, forces, structure, solution, implementation etc. Table of Contents Problem Forces Solution Explanation Structure - Class Diagram, Sequence Diagram Participants and Responsibilities Implementation Consequences Applicability Real world examples References Read above topics on http://www.javaguides.net/2018/08/application-controller-design-pattern-in-java.html

Class Table Inheritance Pattern

Image
This pattern belongs to  Object-Relational Structural Patterns  Catalog and this Catalog belongs to  Patterns of Enterprise Application Architecture . Intent Represents an inheritance hierarchy of classes with one table for each class. Class Table Inheritance supports one database table per class in the inheritance structure. Explanation Please note in the diagram, each class have their own database table. Player class have its own players database table. Cricketer class have its own cricketers  database table. Footballer class have its own footballers database table. Bowler class has its own bowlers  database table. How It Works The straightforward thing about Class Table Inheritance is that it has one table per class in the domain model. The fields in the domain class map directly to fields in the corresponding tables. As with the other inheritance mappings the fundamental approach of Inheritance Mappers (302) applies. The biggest implementation issue with Class Table Inherita