Unformatted text preview:

Information Systems Analysis and Design CSC340 XIX Class Design What is Class Design Types of Design Classes Class Specifications and Interfaces Components Sub Systems and Packages Cohesion and Coupling Designing Associations Integrity Constraints Referential Dependency and Domain Integrity 2003 Jaelson Castro and John Mylopoulos Class Design 1 Information Systems Analysis and Design CSC340 Class Design Within the context of architectural design class design Produces full definitions of classes associations algorithms and interfaces of operations Adds classes that will be useful during implementation Defines object interactions and object lifetimes in terms of interaction and state diagrams Optimises data structures and algorithms 2003 Jaelson Castro and John Mylopoulos Class Design 2 Information Systems Analysis and Design CSC340 Input Output for Class Design The input is assumed to consist of Use cases that describe the functional requirements for the new system also sequence and state activity diagrams that describe these use cases in more detail Class diagrams that describe the kinds of things the information system will be managing information about The outputs of class design are Class packages which describe the overall software architecture of the new system Supporting sequence state activity diagrams that give additional details about the design 2003 Jaelson Castro and John Mylopoulos Information Systems Analysis and Design Class Design 3 CSC340 Types of Design Classes Most classes defined during requirements analysis represent objects about which information will be stored in the system database During design we distinguish four types of classes Persistent database classes D correspond to application classes and describe what will be stored persistently in the system database Entity classes E represent in memory run time data structures for persistent database classes Boundary classes B specify interface functions Control classes C specify business logic functions 2003 Jaelson Castro and John Mylopoulos Class Design 4 Information Systems Analysis and Design CSC340 Class Specifications Attribute signature name type expression initial value property string Operation signature Operation name parameter list return type expression Object Visibility Public The feature is directly accessible by any class Private The feature may only be used by the class that includes it Protected The feature maybe used by either the class that includes it or by a subclass of that class 2003 Jaelson Castro and John Mylopoulos Class Design 5 Information Systems Analysis and Design An Example Database Class 2003 Jaelson Castro and John Mylopoulos CSC340 database Class Design 6 Information Systems Analysis and Design An Example Entity Class CSC340 entity Customer name String addr String listOfAccts List create Notes Customer objects are created by accessing the CustomerDB and BankAccounts part of the database to build a single Customer object which collects all account information about a customer 2003 Jaelson Castro and John Mylopoulos Class Design 7 Information Systems Analysis and Design An Example Control Class An Example Boundary Class 2003 Jaelson Castro and John Mylopoulos CSC340 control TransferAmount transfer acc1 acc2 amount Look at examples of view and control classes from the previous section Class Design 8 Information Systems Analysis and Design CSC340 Class Interfaces An interface is a group of externally visible public operations An interface is like a class but contains no internal structure has no attributes no associations and no implementation of its operations The realizes relationship indicates that the target class supports at least the operations listed in the interface 2003 Jaelson Castro and John Mylopoulos Information Systems Analysis and Design Class Design 9 CSC340 Class Interfaces 2003 Jaelson Castro and John Mylopoulos Class Design 10 Information Systems Analysis and Design CSC340 Class Design So a class design consists of a set of packages which contain classes and other packages and which represent components or sub systems The grouping of classes into packages may be done from several different points of view By architectural tier Boundary Control Entity Database By functional relationship MVC By authorship who designed what 2003 Jaelson Castro and John Mylopoulos Information Systems Analysis and Design Class Design 11 CSC340 Cohesion and Coupling Criteria for good sub system package design Coupling measures the degree of interconnectedness between design components sub systems packages The degree of coupling is reflected by the number of links a class has and by the degree of interaction the class has with other classes Low coupling is preferrable in a design for many good reasons e g easier to understand and modify the design Cohesion on the other hand measures the degree to which an element subsystem module or class contributes to a single purpose Of course we want a highly cohesive design 2003 Jaelson Castro and John Mylopoulos Class Design 12 Information Systems Analysis and Design CSC340 Minimizing Coupling Interaction coupling Measures the number of message types an object sends to other objects and the number of parameters passed with these message types Should be kept to a minimum in order to reduce the possibility of changes rippling through object interfaces Inheritance coupling Degree to which a subclass actually needs the features attributes or operations it inherits A subclass with unnecessary attributes or operations is more complex than it needs to be and instances of the subclass unnecessarily use up more memory 2003 Jaelson Castro and John Mylopoulos Class Design 13 Information Systems Analysis and Design CSC340 Maximizing Cohesion Operation cohesion Measure the degree to which an operation focuses on a single functional requirement Good design produces highly cohesive operations each of which deals with a single functional requirement Class cohesion Degree to which a class is focused on a single requirement Good operation cohesion but lousy class cohesion 2003 Jaelson Castro and John Mylopoulos Class Design 14 Information Systems Analysis and Design CSC340 Maximizing Cohesion Specialization Cohesion addresses the semantic cohesion of inheritance hierarchies Good cohesion Terrible cohesion 2003 Jaelson Castro and John Mylopoulos Class Design 15 Information Systems Analysis and Design CSC340 Liskov Substitution Principle In class hierarchies it


View Full Document

Toronto CSC 340 - Class Design

Documents in this Course
Scoping

Scoping

10 pages

Load more
Loading Unlocking...
Login

Join to view Class Design and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Class Design and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?