Docsity

Earlier Patterns-Patterns in Software Engineering-Lecture 1 Slides-Computer Engineering, Slides of Software Engineering

Partial preview of the text

Download Earlier Patterns-Patterns in Software Engineering-Lecture 1 Slides-Computer Engineering and more Slides Software Engineering in PDF only on Docsity!

Patterns inSoftware EngineeringSoftware Engineering Lecturer: Raman RamsinLecturer:

Raman Ramsin

L^

t^

Lecture 1 Earlier Patterns

1

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Software Patterns ย„ Software Patterns support reuse of software architecture

pp

and design.

^

Patterns capture the static and dynamic structures and

^

Patterns capture the static and dynamic structures andcollaborations of successful solutions to problems that arisewhen building applications in a particular domain.

ย„^

Patterns represent solutions to problems that arise whendeveloping software within a particular contextdeveloping software within a particular context.

^

i.e., โ€œPattern == problem/solution pair in a contextโ€

2

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Software Design Patterns ย„ โ€œA

design pattern names, abstracts, and identifies the

key aspects of a common design structure that make ituseful for creating a reusable object-oriented design.โ€

ย„^

Design Patterns capture the static and dynamic structureand collaboration among key participants in softwaredesigns.

^

They are particularly useful for articulating how and why toresolve non-functional forcesresolve non-functional forces.

^

Patterns facilitate reuse of successful software architecturesand designs.

4

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Coad's OO Patterns ย„ Seven basic Patterns:

1.^

Item Description 2

Time Association

2.^

Time Association

3.^

Event Logging

4.^

Roles Played

5.^

State over a Collection

6.^

Behavior over a Collection 7

Broadcast

5

Sharif University of Technology

7.^

Broadcast

Patterns in Software Engineering โ€“ Lecture 1 Item Description

7

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Pattern 2: Time Association ย„ If one needs to express attributes or services regarding anassociation between two objects, then an object from "time

j^

,^

j

association" is needed. ย„^ A "time association" object often sends messages to itsparticipating objects to get values or get a sub-calculationparticipating objects to get values or get a sub calculationdone on its behalf. ย„^

Note that the association connection:^

captures the association for future queries about these objects. captures (for the sender) "to whom to send a message." ย„^ Use this pattern whenever the system is responsible to knowan association between two or more objects and to know ordo something about that association

8

Sharif University of Technology

do

something about that association.

Patterns in Software Engineering โ€“ Lecture 1 Pattern 3: Event Logging ย„ A "device" object monitors an external device; the object

^

is responsible for detecting that an event has occurred;

^

is responsible for detecting that an event has occurred;

^

is responsible for initiating a response to the event. P^

t^

f th

b^

t^

l^

th^

t'^

h^

thi

ย„^ Part of the response may be to log the event's occurrence; when thisis the case, a "device" object sends the message "create" to the"event remembered" class to create an object with historical values. ย„^ A "device" object may know about some number of "eventremembered" objects; an "event remembered" object must knowabout a corresponding "device" object. ย„^ Use whenever an event is detected, and you need to log itsoccurrence to support after-the-fact analysis or to meet legaleq i ements

10

Sharif University of Technology

requirements.

Patterns in Software Engineering โ€“ Lecture 1 Event Logging

11

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Roles Played

13

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Pattern 5: State over a Collection ย„ A "collection" object knows its state; this state applies to thecollection and may also apply to its parts, and each "member"

y^

pp y

p^

object has its own state, too. ย„^ Use this pattern whenever there is whole-part in a businessdomain or implementation domain, and one or more attributesapply to the whole (the collection)apply to the whole (the collection).

14

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Pattern 6: Behavior over a Collection ย„ A "collection" object has behavior that applies across an entire

j^

pp

collection of its "member" objects. ย„^ Each "member" object performs actions, knowing (by means

j^

p^

,^

g ( y

of its attributes) how to perform, without needed coordinationwith other "member" objects. ย„^ Use this pattern whenever there is whole-part in a domain,and a behavior (i.e., one or more services) applies across thewhole collection. ย„^ Caution: make the member objects do as much as they canwith what they know; only put behavior that really appliesacross the collection up in the "collection" object.

16

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Behavior over a Collection

17

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Broadcast

19

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 1 Coad Patterns: Example Model

20

Sharif University of Technology