Introduction to Java Design Patterns

LinkedIn
Hacker News

What are Design Patterns?

Design patterns are solutions to the common software problems. Design pattern tells how classes and objects are structured to solve certain problem. Design and design patterns are the concepts and are platform independent. There are many design patterns identified and available today. It is almost impossible for an individual to know about each and every design pattern present. However, a great developer should know the foundational design patterns known as GOF (Gang-Of-Four) If you understand GOF pattern clearly, than other patterns are derived by overlapping of two or more patterns.

Characteristics of a good design

While designing your application, you should be watchful of various software design characteristics. A great design would have all the characteristic. However, sometimes one pattern contradicts to other, so you have to make a hit a middle ground and choose one over other. Below are some of the characteristics for a good software design

i. Ease of maintenance

Software is always highly unstable. It is expected to undergo maintenance and changes in feature. The design should be self-explanatory and easy to understand for other programmers.

-Advertisement-

ii. Minimal complexity

Simplicity is the soul of efficiency(– Austin Freeman) .Design for simplicity. A complex design is often difficult to extend, maintain and understand. There are factors like many interconnections and relations, non-trivial algorithm, behaviors or rules, etc. causes the complexity in design.

iii. Loose coupling and extensibility

All components in your design should be loosely coupled to the maximum extend.  This will make the system modularized and each components can be tested separately before it is integrated to a whole larger system. You can change a piece of the system without affecting other pieces.  If there is a defect in one component in your software, then it won’t bug much to the other components. This can be done with the basic OO principles like encapsulation, information hiding and abstractions.

iv. Portability

How easy would it be to move the system to another environment.

v. Stratification and reusability

Design patterns encourage design reuse. Design softwares component, that can be easily used in other system or software.  For example, if you look at the android design (Image below), it provides multiple layers of abstractions. Each component is independent of other and provides great level of reusability.

vi. Standard techniques

Don’t hate things, because you don’t know or you don’t like them. Before  designing your software evaluate and use the industry suggested patterns that are appropriate for your requirements.

Related Articles

Join The Discussion

Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.