AlexLecture_UmlBasicClassModeling

AlexLecture_UmlBasicClassModeling - Motivation: Reasoning...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 UML - Basic Class Modeling Motivation: Reasoning about a design Goal: Be able to “reason about” a design i.e., understand designer’s intent Critique/improve the design Claim: Source code not best medium for communication and comprehension 2 Lots of redundancy and detail irrelevant for some program-understanding tasks Especially poor at depicting relationships among classes in OO programs To understand an OO design, one must be able to visualize these relationships Solution: Use abstract, visual representations - UML Unified Modeling Language (UML) Collection of notations representing software designs from three points of view: Class model describes the static structure of objects and relationships in a system Comprises object and class diagrams Provides new and very useful abstractions for reasoning State model describes the dynamic aspects of objects and the nature of control in a system 3 Interaction model describes how objects in a system cooperate to achieve broader results Generally need all three models to describe a system No single model says everything In this lecture, we focus on class model. Goal: Thinking in UML, Writing in C++. UML class diagram notations Boxes denote classes Each box comprises: Class name e.g., Employee List of data attributes e.g., first_name, last_name, etc List of operations Employee first_name : string last_name : string =“smith” hire_date : Date department : short Default value 4 e.g., print More compact than code and more amenable to depicting relationships among classes Only list attributes that have intrinsic meaning. Attributes of computer artifacts (such as pointers) should not be listed. City cityName : string population : unsigned Abstraction in class diagrams Class diagrams often elide details: Method associated with an operation Attributes and operations may be elided in the diagram to improve readability Even if they exist in the C++ code Employee ClassName 5 Employee first_name : string last_name : string hire_date : Date department : short attributeName1:dataType1=defaultValue1 attributeName2:dataType2=defaultValue2 operationName1(argumentList1):resultType1 operationName2(argumentList2):resultType2 optional optional Object (or instance) notation Notes Objectname : ClassName attribute1 = value1 ... 6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2009 for the course CSE 335 taught by Professor Kraemer during the Fall '08 term at Michigan State University.

Page1 / 6

AlexLecture_UmlBasicClassModeling - Motivation: Reasoning...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online