0% found this document useful (0 votes)
40 views

Software Design Patterns I

This is a slide I made for design patterns for a company training. The slide utiilizes Java as its native programming language. Use it at your displosal.

Uploaded by

benackerman
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Software Design Patterns I

This is a slide I made for design patterns for a company training. The slide utiilizes Java as its native programming language. Use it at your displosal.

Uploaded by

benackerman
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Lesson VII: Design Patterns

Introduction to Design Patterns, Creational Design Pattern

Introduction
Designing object-oriented software is hard, and designing one to standards is ever harder. Designs should be granular enough for the problem and general enough to handle future problems. Design can never be correct the first time.

What are Design Patterns?


Normally when people have solved problems before, they use the same solution to solve other problems that have the same nature. Of course we cant communicate our experiences with other people in this way. The purpose of design patterns is to communicate these experiences with other people so that they can easily solve problems as well.

What do Design Patterns do?


They give you a design framework to work on so you can make decisions faster. They let you be aware of what solutions have worked before, and what dont work at all.

In other words, it lets you get things right faster.

Design Patterns
"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice - Christopher Alexander

Design Patterns
Although Alexander was talking about design solutions or patterns for towns and buildings, the same principles are applied to out software and any kind of problem. There are four key parts of a design pattern namely pattern name, problem, solution, and consequences.

Pattern Name
Naming conventions for patterns allow us to easily communicate these solutions with our colleagues. It becomes easier to refer to them in documentation and it allows us to design them in a higher level of abstraction.

Problem
The problem describes the reason why we have the design solution in the first place. The problem also includes the unique context that its in.

Solution
The solution describes the different aspects of the design pattern including the elements and their relationships, interactions, responsibilities and collaborations. The only thing that a solution does not describe is the concrete, specific implementation of it. Instead it serves as a template showing you how to solve it.

Consequences
These are obviously trade-offs of applying the design and are often critical when we want to evaluate design decision that were made along the way. They are very important when we want to evaluate other alternatives, and understanding the cost and benefits of a certain pattern implementation.

Design Patterns in our Context

They are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.

Kinds of Design Patterns


There are about 27 design patterns that we can use and all of them are grouped depending on the purpose of their design and their granularity. The grouping of these patterns are the following:
Creational Design Pattern Structural Design Pattern Behavioural Design Pattern

Design Patterns and Their Groupings

A Brief Overview of Patterns


Creational
They are concerned with creating objects.

Structural
They are concerned with the composition of objects

Behavioural
They are concerned with the way objects and classes interact and distribute responsibility.

Creational Design Pattern


Creational Design patterns abstract the system from the way its objects are being created. The help make the system independent from the way objects are represented, created and composed. A class creational pattern utilizes inheritance to vary the class being instantiated. An object creational pattern will delegate instantiation to another object.

Creational Design Pattern


The pattern becomes more important when the system becomes more dependent on object creation than class inheritance. This happens when hardcoding behaviours become less important than complex behaviours that can only be used through objects.

You might also like