Software Design Patterns

  • Created by: wreje035
  • Created on: 14-10-18 21:09
Relationships represented by fields
UML diagram with unidirectional relationship - lives at pointing to address, means person has a field lives at : address
1 of 15
How does aggregation affect the code?
Aggregation affects the constructor arguments. The constructor must include the item if it is an aggregate.
2 of 15
What is a design pattern?
Term originaly from architecture. Describes a specific design problem and offers a solution.
3 of 15
What is a software design pattern?
Describe the escence of a problem and a commonly used technique for solving it. Named and well documented solutions to problems.
4 of 15
Categories of software design patterns:
Creational, Structural, Behavioural and others
5 of 15
Creational:
The singleton pattern. Ensures only one instance of a class is ever created. All objects that use an instance of that class use the same instance. Eg a logger. Also DAO
6 of 15
Structural
The Facade Pattern: Sometimes we need to create a single, unified interface to a set of underlying interfaces in a subsytem. Reduces complexity - facade provides a higher level interface.
7 of 15
Example of structural Facade pattern:
The projects DAO classes are facades, providing access to objects that handle data storage (collectons, databases).Hide complexity of JDBC connections/statements behind high level methods (get, save, delete).
8 of 15
Facade pattern
Two different UIs will use the same facade class - product admin module (swing based interface) and online shop module (web based interface).
9 of 15
Behavioural:
The observer pattern: Sometimes one object needs to be notified of changes in another object. An objects subject can have many observers. observers register with the subject, get notified when subject changes.
10 of 15
The observer pattern:
Observable class is extended by subject class - implement the observer interface.
11 of 15
Architectural:
Model View Controller pattern. MVC separates a system into three interconnected parts. Model=internal representation of info. View=how info is presented to users. Controller=provides ways to control and manipulate info. S
12 of 15
Benefits of MVC
Separates larger systems into smaller subsystems. Clear delineation makes code maintenance easier.
13 of 15
Why use design Patterns?
Capture expert knowledge that can be used by novice programmers. Can facilitate better communication between devs (common understanding).Can improve design documentaion.
14 of 15
What are anti patterns:
Identifying anti patterns is about providing constructive means for dealing with the frequent patterns of failure. Anti patterns are about refactoring. Improving the structure of the code without changing functionality and behaviour.
15 of 15

Other cards in this set

Card 2

Front

How does aggregation affect the code?

Back

Aggregation affects the constructor arguments. The constructor must include the item if it is an aggregate.

Card 3

Front

What is a design pattern?

Back

Preview of the front of card 3

Card 4

Front

What is a software design pattern?

Back

Preview of the front of card 4

Card 5

Front

Categories of software design patterns:

Back

Preview of the front of card 5
View more cards

Comments

No comments have yet been made

Similar ICT resources:

See all ICT resources »See all Software Design Patterns resources »