Architecture Patterns to Code Design Patterns

Design Pattern

Design Pattern doesn’t just mean OOPS Design Patterns. Design Patterns can refer to Architecture Patterns, Software Patterns, Programming Patterns and Code Patterns. Let’s understand more about them.

What is design pattern?

Here are few definitions or explanations,

  • In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design [Wikipedia]
  • Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects. [dofactory.com]

When you search for “Design Patterns”, you will find most of the resources related to Object-Oriented Design Patterns.

Why? It is because the most used programming languages such as Java & .NET are object oriented. So, many people thinks design patterns means object-oriented design patterns but it’s not.

Then, what all are included in design patterns? To understand this, first we have to understand,

What is design?

Here are few definitions from google search results.

  • A plan or drawing produced to show the look and function or workings of a building, garment, or other object before it is made.
  • An outline, sketch, or plan, as of the form and structure of a work of art, an edifice, or a machine to be executed or constructed.
  • A design is a plan or specification for the construction of an object or system or for the implementation of an activity or process, or the result of that plan or specification in the form of a prototype, product or process. The verb to design expresses the process of developing a design. [Wikipedia]

Then,

What is pattern?

  • A repeated decorative design.
  • A pattern is a regularity in the world, in human-made design, or in abstract ideas. As such, the elements of a pattern repeat in a predictable manner. A geometric pattern is a kind of pattern formed of geometric shapes and typically repeated like a wallpaper design. Any of the senses may directly observe patterns. [Wikipedia]

So, the design pattern is a generic term, which can be applied anywhere to establish a common language to refer a repeatable solution to commonly occurring problem.

Now, what does it mean to us as software professional? What are the different types of design patterns?

Categories of Design Patterns

Here is a small list,

  1. Architecture Patterns
  2. Software Patterns
  3. Programming Patterns
  4. Code Patterns

Let’s talk briefly about each of them.

Architecture Patterns are solution to architecture level problem. “Architecture Level” means the problem is related to a system/sub-system, which has the impact across modules and components.

Here are few examples,

  • SOA is a pattern to address software architecture problem to divide a system into loosely coupled, interoperable components in a service-consumer setup.
  • N-Tier Architecture Pattern is another example, where application is divided into physically separated tiers to manage them independently.

Software Patterns are solution to a problem within an architecture style or pattern, which is related to a component or element within software architecture.

Here are few examples of such patterns,

  • [Messaging Component] Publish/Subscribe is a pattern to where message producer produce messages and interested consumer subscribes to the messages based on predefined categories.
  • [Authentication Component] Brokered Authentication – An authentication broker with a centralized identity store assumes the responsibility for authenticating the consumer and issuing a token that the consumer can use to access the service. [Arcitura]

Programming Patterns are patterns, which provides solution to a programming problem. If the programming problem is in Object-Oriented Programming Language then it will be Object-Oriented Programming Pattern. Below are 3 such patterns from dofactory.com,

  • Singleton – A class of which only a single instance can exist.
  • Proxy – An object representing another object.
  • Strategy – Encapsulates an algorithm inside a class.

Code Patterns are solution to code level problem.

Below are 2 such pattern for object oriented code.

  • Exception Handling Patterns such as try…catch.
  • Guard Condition or Guard Clause

So the design patterns are not just object oriented design patterns. it has wide meaning and application across software development discipline. The patterns can also be related to deployment and configuration of software and hardware components.

Thank you and Happy Reading !!!

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: