Software Engineering I cs361 Announcements Writing Assignment 3 - - PowerPoint PPT Presentation

software engineering i cs361
SMART_READER_LITE
LIVE PREVIEW

Software Engineering I cs361 Announcements Writing Assignment 3 - - PowerPoint PPT Presentation

Software Engineering I cs361 Announcements Writing Assignment 3 http:// web.engr.oregonstate.edu/ ~hiltonm/classes/cs361/ WritingAssignments/ WritingAssignment3.pdf Class Diagrams Attribution Much of this material inspired by a


slide-1
SLIDE 1

Software Engineering I cs361

slide-2
SLIDE 2

Announcements

✖ Writing Assignment 3 ✖ http:// web.engr.oregonstate.edu/ ~hiltonm/classes/cs361/ WritingAssignments/ WritingAssignment3.pdf

slide-3
SLIDE 3

Class Diagrams

slide-4
SLIDE 4

Attribution Much of this material inspired by a great slides from Steve Easterbrook, available here: http://www.cs.toronto.edu/~sme/ CSC340F/slides/11-objects.pdf also some material taken from here: http://web.stanford.edu/class/cs193j/ LectureThree.pdf

slide-5
SLIDE 5

Object Terminology Review

Any entity which mirrors the existence of a real world entity is an Object. Examples:

slide-6
SLIDE 6

Object Terminology Review

Any entity which mirrors the existence of a real world entity is an Object. Examples: Person, Student, Car, Playing Card, etc.

slide-7
SLIDE 7

Object Terminology Review

Objects Contain:

  • attributes (variables)
  • functionality (methods)

Objects can have properties or be acted upon

slide-8
SLIDE 8

Object Terminology Review

A description of an Object is called a class Examples:

slide-9
SLIDE 9

Encapsulation

✖ Objects allow data and functionality to be bundled together. ✖ Additionally, access to the data may be restricted to some

  • f the objects components
slide-10
SLIDE 10

Inheritance

✖ Allows one Class to automatically “assume” the attributes of another class ✖ Defines an “is a” relationship for classes

slide-11
SLIDE 11

Polymorphism

✖ The ability to send the same message (call a method) to an Object, without knowing how the receiver (Object) will implement the message.

slide-12
SLIDE 12

Building an Object Oriented Model

Our model should: represent people, things and concepts show connections and interactions show enough detail to evaluate designs maintain value after design phase

slide-13
SLIDE 13

Object Oriented Analysis Background

  • Model the requirements in terms
  • f objects and services

Motivation

  • OO is (claimed to be) more

‘natural’

  • OO emphasizes importance of

well-defined interfaces between

  • bjects.
slide-14
SLIDE 14

Nearly Anything can be an object…

slide-15
SLIDE 15

Nearly Anything can be an object…

✖External Entities e.g.

people, devices, other systems.

✖Things e.g. reports,

displays, signals, etc

✖Occurrences or Events e.g. transfer of

resources, a control actions, etc

✖Roles people who interact

with the system

✖Organizational Unites e.g. division, group,

team, etc

✖Places e.g. manufacturing

floor, loading dock, game board, etc

✖Structures e.g. sensors,

computers, etc

slide-16
SLIDE 16

THINGS THAT SHOULD NOT BE AN OBJECT

✖Procedures: e.g. print, draw, deal, etc ✖Attributes: e.g. blue, 50Mb, etc

slide-17
SLIDE 17

Classes

A class describes a group of

  • bjects with:

similar properties (attributes) common behavior (operations) common relationships common meaning

slide-18
SLIDE 18

employee: has a name, employee#, department 
 an employee is hired, fired; an employee works in one or more projects

Example Class:

slide-19
SLIDE 19

:Employee

name employee# department

hire() fire() assignProject()

slide-20
SLIDE 20

:Employee

name employee# department

hire() fire() assignProject()

Name (mandatory) Attributes (optional) Operations (optional)

slide-21
SLIDE 21

How to find classes

✖ Look for nouns in user stories ✖ Review background information ✖ It’s better to start with too many and discard later

slide-22
SLIDE 22

Selecting Classes

Discard classes for concepts which:

  • Are beyond the scope of the

analysis

  • Refer to the system as a whole
  • Duplicate other classes
  • External entities should not

be included as classes

slide-23
SLIDE 23

Cold & Yourdon’s critera

  • Retained information: will the system

need to remember info about this class?

  • Needed Services: Do these objects

have identifiable operations that change values

  • Multiple Attributes: A single attribute

class may be an attribute

  • Common Attributes and Operations:

Does the class share attributes and

  • perations will all of its objects
slide-24
SLIDE 24

The instances of a class are called objects.

Jane Doe:Employee

name: Jane Doe employee#: 123-456 department: Software Dev

hire() fire() assignProject()

Objects vs Classes

slide-25
SLIDE 25

Associations

Objects do not exist in isolation UML supports:

  • Association
  • Aggregation and Composition
  • Generalization
  • Dependency
  • Realization
slide-26
SLIDE 26

Class associations

:Employee

name employee# department hire() fire() assignProject()

:Office

room #: # of desks: add_Employee() remove_Employee()

1 0..* Works in

slide-27
SLIDE 27

association Classes

:car

VIN Year Made Mileage …

:person

name address DriversLicenseNumber …

1 0..*

  • wns

:title

yearBought price initialMileage …

slide-28
SLIDE 28

Aggregation and Composition

✖Aggregation: This is the “Has-a” or “Whole/part” relationship ✖Composition implies ownership:

slide-29
SLIDE 29

Aggregation and Composition Example

:car :engine :person

1 1 1 0..1 driver Composition Aggregation

slide-30
SLIDE 30

Generalization

✖ Subclasses are more specific versions of superclasses ✖ Subclasses inherit attributes, associations, & operations from the superclass ✖Subclasses can override an inherited aspect ✖ Superclass are abstract if they have no instances

slide-31
SLIDE 31

Generalization

:student

name gpa

:undergrad

year major minor

:masters

m eng theis

:PhD

dissertation advisor

slide-32
SLIDE 32

http://agilemodeling.com/artifacts/classDiagram.htm

slide-33
SLIDE 33

http://www.uml-diagrams.org/class-diagrams-overview.html

slide-34
SLIDE 34

http://yuml.me/diagram/scruffy/class/samples

slide-35
SLIDE 35

:car

VIN Year Made Mileage …

:person

name address DriversLicenseNumber …

1

:title

yearBought price initialMileage …

:engine

0..1

  • wns

1

:SUV

isFourWheelDrive

:sedan

trunkSize

slide-36
SLIDE 36

Feedback

slide-37
SLIDE 37

Credits

Special thanks to all the people who made and released these awesome resources for free: ✖ Presentation template by SlidesCarnival ✖ Photographs by Unsplash