1 Introduction to Classes. 2 Terms and Concepts A class is... –The most important building block of any object- oriented system. –A description of a set.

Slides:



Advertisements
Similar presentations
Database Systems: Design, Implementation, and Management Tenth Edition
Advertisements

Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
2008/03/25 Unified Modeling Lanauage 1 Introduction to Unified Modeling Language (UML) – Part One Ku-Yaw Chang Assistant Professor.
Object-Oriented Analysis and Design
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Chapter 14 (Web): Object-Oriented Data Modeling
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
Class Diagram & Object Diagram
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
Classes Chapter 4. Terms and Concepts A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Chapter 14: Object-Oriented Data Modeling
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
UML Diagrams Computer Science I.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Unified Modeling Language User Guide Section 2—Basic Structural Modeling Chapter 4—Classes.
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
Lawrence ChungCS6359.0T1: Module 41 Module 4: Relationships.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
Presented by: CHAN LAI SAN ( ) REBAH DAW SARREB ( ) FIDA AL-OBAISI ( ) 08 April 2008 (Tuesday 6pm – 7:30pm)
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML
Structural Modeling. Objectives O Understand the rules and style guidelines for creating CRC cards, class diagrams, and object diagrams. O Understand.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
1 © Prentice Hall, 2002 Chapter 14: Object-Oriented Data Modeling Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.
Chapter 16 Applying UML and Patterns Craig Larman
1 Class Diagrams: The Essentials. 2 Terms and Concepts A class is... The most important building block of any object-oriented system. A description of.
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
Modeling system requirements. Purpose of Models Models help an analyst clarify and refine a design. Models help simplify the complexity of information.
Lecture 6: Structural Modeling
Fundamentals of Computer Science The Object-Oriented Paradigm and UML.
Structural Modeling Chapter 7. Key Ideas A structural or conceptual model describes the structure of the data that supports the business processes in.
1 Structural Modeling Chapter 7. 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business processes.
Design Jon Walker. More UML ● What is UML again?
Class Diagram Classes are the most important building block of any object-oriented system. A class is a description of a set of objects that share the.
Design Model Lecture p6 T120B pavasario sem.
Repetition af Domæne model. Artifact influence emphasizing the Domain Model.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Object Oriented Analysis and Design Class and Object Diagrams.
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
UML Part 1: Class Diagrams. Introduction UML stands for Unified Modeling Language. It represents a unification of the concepts and notations presented.
Structural Modeling. Introduction A Structural model is a formal way of representating the objects that are used and created by a business system One.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Chapter 3: Introducing the UML
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
DBS201: Data Modeling. Agenda Data Modeling Types of Models Entity Relationship Model.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Use Cases. 2 A use case... –Specifies the behavior of a system or some subset of a system. –Is a system-level function. –Does not indicative how the specified.
Structural Modeling.
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Class Diagrams.
Analysis and Design with UML: Discovering Classes and Relationships
Analysis and Design with UML: Discovering Classes and Relationships
Analysis and Design with UML: Discovering Classes and Relationships
Use Cases.
Understand and Use Object Oriented Methods
Software Design Lecture : 15.
Analysis and Design with UML: Classes and Relationships
Chapter 22 Object-Oriented Systems Analysis and Design and UML
The Object Paradigm Classes – Templates for creating objects
ITEC324 Principle of CS III
From Class Diagram to Contract Diagram
Presentation transcript:

1 Introduction to Classes

2 Terms and Concepts A class is... –The most important building block of any object- oriented system. –A description of a set of objects that share the same attributes and behaviors. –A blueprint for creating an object. –An abstraction (simplification) of reality. –A representation of a software thing, a hardware thing, or even a conceptual thing. –Graphically represented as a rectangle.

3 Terms and Concepts All classes have … –Names - Used to distinguish one class from another. A class must have a name. –Attributes - Member data. –Operations (behaviors) - Member functions. –Stereotypes - Documentation used to categorized class members. –Responsibilities - Documents the purpose of the class. Attributes and operations are the most important features of a class definition. A class usually collaborate with other classes.

4 Terms and Concepts Class names are … –Extracted from the problem domain (statement). –Nouns or noun phrases. –Concise and descriptive. Class attributes are … –Usually nouns or noun phrases. –Extracted or inferred from the problem statement. –Used to represent properties of the enclosing class. –Determine the state of an object.

5 Terms and Concepts Class operations (behaviors) are … –Verbs or verb phrases. –Inferred from the problem statement. –Provide a requested service. Class responsibility… –Is a contract or obligation of a class to the users of the class. –Maps directly to the Responsibility field of a CRC card. CRC - Class Responsibility Collaboration

6 Class Artifact

7 Common Modeling Techniques Identify the classes that are to be included in the design. –Formulate a problem statement. –Focus on the nouns in the problem statement. –Use CRC (Class, Responsibility, Collaboration) cards or use-cases to isolate each class.

8 Common Modeling Techniques Determine the responsibilities of each class. –Even out the work load between classes. A class with too much responsibility should be broken up into multiple classes. A class with too little responsibility should be absorbed into another class. –Group together classes that work toward a common goal. Packages (directories) may be used to group related classes into a higher level of abstraction. Packages may contain other packages.

9 Common Modeling Techniques Classes should exhibit high cohesion and low coupling. –A class should have a single well-defined purpose. This promotes software reusability –A class should interact with a limited number of other classes. This simplifies modifications to the program.

10 Common Modeling Techniques Feel free to model abstract (non-software) things (such as people) that are outside of the system boundaries. Occasionally built-in data types (int, float, char, etc.) are modeled as classes, although this is rare.

11 Class Relationships

12 Terms and Concepts

13 Terms and Concepts A dependency is... –A type of relationship that can exist between two classes. –An indication that one class ‘uses’ another class. –If the ‘used’ class changes it can have an impact on the ‘using’ class. –Graphically represented as a dashed line with an open arrowhead on one end. –Rarely labeled. The ‘used’ class is frequently an argument to one of the member functions of the ‘using’ class. The “used” class has no knowledge of the “using” class.

14 Terms and Concepts

15 Terms and Concepts A generalization is … –A type of relationship that can exist between two classes. One of the classes is the base (or parent) class; the other class is the derived (or child) class. –Used to show a ‘kind-of’ relationship. –Another name for inheritance. –All OO programming languages support single inheritance; some (C++) also support multiple inheritance. –Graphically represented by a solid line with an open triangular arrowhead on the base class end. The parent class has no knowledge of the child class.

16 Terms and Concepts

17 Terms and Concepts An association is … –A type of relationship that can exist between one or more classes. –Used to show a ‘knows-a’ relationship. –Either unidirectional or bi-directional. –Graphically represented by a solid line which may optionally be labeled and have a name direction indicator. –A peer relationship. Association names are verbs or verb phrases. The same class can be on both ends of a binary association.

18 Terms and Concepts Associations may optionally have role names and multiplicity symbols on either end of the association line (next to the class icon). Role –The face that a class on one end of an association presents to the class on the other end of the association. –A class can participate in many associations and thus have multiple (different) roles. –Role names are nouns. –Role names are usually used in place of association names.

19 Terms and Concepts Multiplicity –Indicates how many object may be connected across an instance of an association. Aggregation is … –A relationship between two classes. –A form of association. –Used to show a ‘has-a’ or a ‘whole-part’ relationship. –Graphically represented as a solid line with an open diamond on the ‘whole’ end. Aggregations and associations are implemented in exactly the same way. The difference is entirely conceptual.

20 Terms and Concepts

21 Terms and Concepts Composition is … –A relationship between two classes. –A strong form of association. –Used to show a ‘contains-a’ or a ‘whole-part’ relationship. –Graphically represented as a solid line with a solid diamond on the ‘whole’ end. Composition relationships and associations are not implemented in exactly the same way. If the ‘whole’ object is destroyed, the part object will also be destroyed. –The whole and part have concurrent lifetimes.

22 Terms and Concepts

23 Common Modeling Techniques Modeling inheritance –Make it a priority to look for possible inheritance relationships. This will reduce code redundancy. Use the “ClassA ‘is-a-kind-of’ ClassB” test. –Do not model relationships using multiple inheritance unless the implementation language supports multiple inheritance. This will save programmers having to develop messy work-arounds. –Look for classes that have similar attributes and behaviors and then factor those attributes and behaviors into a common base class.

24 Common Modeling Techniques Modeling dependency, association, aggregation and composition relationships. –It is not always easy to determine which is the best relationship to use. It all has to do with your perspective of the problem domain. –There is not always one best solution. –Personal experience is your most valuable modeling tool. –CRC cards are helpful.