Monday 16 June 2014

Learn A Pattern A Week With Pie - Overview

As promised, we're gonna learn a new design pattern each week to make us better programmers, programmers who write clean and maintainable code. If any code was ever written by a good programmer, that code would probably not need to be commented.

To make the learning easier and full of fun, am gonna make my post very simple, byte-sized chunks which can easily be learnt, understood and memorised in the shortest possible time.

Today, I'll give you an overview of the various groups of design patterns out there and also learn about the GOF.

So What Is The GOF Thingy?

GOF (Gang Of Four) refers to a group of 4 authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides who in 1994 published a book titled "Design Patterns - Elements Of Reusable Software" which initiated the concept of design patterns in Software Development.

I just felt I should make mention of these reverend authors and pioneers of such an important subject in Software Development since no self-respecting book or text on this subject matter would be complete without making reference to the Gang Of Four.

Types Of Design Patterns

Per the book Design Patterns - Elements Of Reusable Software written by the GOF, there are 23 design patterns classified into 3 major categories: Creational, Behavioural & Structural Design Patterns.

In my subsequent posts we'll study each of these 23 design patterns identified and outlined by the GOF in their book.

Meanwhile, let's take a look at the criteria for grouping these 23 design patterns into any of the 3 categories.

NOTE : Java will be used for the code samples in all my post. It shouldn't be difficult converting those sample codes into other OOP languages!

CREATIONAL PATTERNS

Instead of using the "new" keyword in Java to instantiate new objects of classes, the creational design patterns provides ways of creating objects whiles hiding the logic for creating the objects. This gives more flexibility in deciding which object needs to be created for a given use case unlike using the "new" keyword.

BEHAVIOURAL PATTERNS

These patterns are concerned with how objects within our programs communicate across their interfaces.

STRUCTURAL PATTERNS

These patterns concern classes and objects compositions. In these patterns, inheritance is used to compose interfaces and define ways to compose objects  to obtain new functionalities.

Don't worry if all these seem too abstract and incomprehensible. Just hold on for a ride and things will be better once we start studying all the 23 patterns one-after-the-other.

May today kick yesterday's ass!

1 comment: