0% found this document useful (0 votes)
66 views54 pages

SOEN 344-3a - Design Patterns

This document discusses design patterns and introduces creational patterns. It begins by establishing ground rules for lectures and tutorials. It then provides an introduction to design patterns, discussing their types (creational, structural, behavioral), selection process, and learning process. Object-oriented approaches are contrasted with design patterns concepts. Finally, it introduces and explains the Factory Method and Abstract Factory creational patterns through examples and UML diagrams in 3+ pages.

Uploaded by

nizobell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views54 pages

SOEN 344-3a - Design Patterns

This document discusses design patterns and introduces creational patterns. It begins by establishing ground rules for lectures and tutorials. It then provides an introduction to design patterns, discussing their types (creational, structural, behavioral), selection process, and learning process. Object-oriented approaches are contrasted with design patterns concepts. Finally, it introduces and explains the Factory Method and Abstract Factory creational patterns through examples and UML diagrams in 3+ pages.

Uploaded by

nizobell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

SOEN 344

Software Architecture and


Design II
Design Patterns ( part I.a)

1
Ground Rules for lectures and
Tutorial
◼ Electronic devices, such as cellular phones, text/video
messaging devices and recording devices are strictly
prohibited.
◼ Laptops are accepted only for the course purpose.
◼ The usage of any of these materials during the class
will result in you being asked to immediately leave the
class.

2
Introduction to Design Patterns

3
4
5
6
7
8
Styles

9
10
Selecting Design Patterns
(23 Design Patterns)

11
Design Patterns Catalog

12
13
Design patterns Types
◼ Creational patterns are ones that create objects for you,
rather than having you instantiate objects directly. This
gives your program more flexibility in deciding which
objects need to be created for a given case.
◼ Structural patterns help you compose groups of objects
into larger structures, such as complex user interfaces or
accounting data.
◼ Behavioral patterns help you define the
communication between objects in your system and
how the flow is controlled in a complex program.

➢ We’ll be looking at all of these patterns in the next


few weeks.
14
Learning Process
◼ We have found learning Design patterns is a multiple step
process.
1. Acceptance
2. Recognition
3. Internalization
◼ First, you accept the premise that design patterns are
important in your work.
◼ Then, you recognize that you need to read about design patterns
in order to know when you might use them.
◼ Finally, you internalize the patterns in sufficient detail that you
know which ones might help you solve a given design problem.

15
Object Oriented Approaches vs
Design Patterns concepts
◼ The fundamental reason for using varies design patterns is
to keep classes separated and prevent them from having
to know too much about one another. There are a number
of strategies that OO programmers use to achieve this
separation, among them encapsulation and inheritance.
◼ Nearly all languages that have OO capabilities
support inheritance
◼ Design Patterns suggests that you always go for
➢ “Program to an interface and not to an implementation”.
➢ “Favor object composition over inheritance.”

16
17
18
simple decision making class that returns one of several
possible subclasses of an abstract base class depending on
the data that are provided.

provides an interface to create Abstract Factory


And return one of several families
of related objects.

19
20
21
22
23
24
25
26
27
28
Creational Patterns

◼ Factory Method
◼ Abstract Factory
◼ Builder
◼ Prototype
◼ Singleton

29
1. Factory Method

30
31
32
33
34
35
36
37
38
39
40
41
42
2. Abstract Factory

43
44
45
46
47
48
49
50
51
52
53
54

You might also like