DOC PREVIEW
Toronto CSC 340 - Class Design

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 1XXIII. Class DesignXXIII. Class DesignWhat is Class Design?Types of Design ClassesClass Specifications and InterfacesComponents, Sub-Systems and PackagesCohesion and CouplingDesigning AssociationsIntegrity ConstraintsReferential, Dependency and Domain Integrity© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 2Class DesignClass Design Within the context of architectural design, classdesign: Produces full definitions of classes, associations,algorithms and interfaces of operations; Adds classes that will be useful duringimplementation; Defines object interactions and object lifetimes interms of interaction and state diagrams; Optimises data structures and algorithms.© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 3Input/Output for Class DesignInput/Output for Class Design The input is assumed to consist of: Use cases that describe functional requirements;also sequence, state/activity diagrams thatdescribe the use cases in more detail; Class diagrams that describe the kinds of thingsthe information system will be managinginformation about. The outputs of class design are: Class packages which describe the overallsoftware architecture of the new system; Supporting sequence, state/activity diagrams thatgive additional details about the design.© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 4Types of Design ClassesTypes of Design Classes Most classes defined during requirements analysisrepresent objects about which information will bestored in the system database. Assuming a 4-tier layered architecture, we distinguishfour types of classes:Persistent database classes (D), correspond toapplication classes and describe what will bestored persistently in the system database;Entity classes (E) represent in-memory, run-timedata structures for persistent database classes;Boundary classes (B) specify interface functions;Control classes (C) specify business logicfunctions.© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 5Class SpecificationsClass Specifications Attribute signaturename: `:´ type-expr `=´ init-value `{property-string}´ Operation signature Operation name: `(´ param-list ´)´ `:´ return-type-expr Object Visibility + Public -- feature directly accessible by any class; - Private -- feature may only be used by the classthat includes it; # Protected -- feature maybe used by either theclass that includes it or by a subclass of that class;© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 6AnAnExampleExampleDatabaseDatabaseClassClass<<database>>© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 7AnAnExampleExampleEntityEntityClassClass <<entity>> Customername:Stringaddr: StringlistOfAccts:Listcreate()Notes: Customer objects are created by accessing theCustomerDB and BankAccounts part of the database tobuild a single Customer object which collects allaccount information about a customer.© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 8AnAnExampleExampleControlControlClassClass <<control>>TransferAmounttransfer(acc1, acc2, amount)AnAnExampleExampleBoundaryBoundaryClassClassLook at examples of view andcontrol classes from the previoussection.© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 9Class InterfacesClass Interfaces An interfaceinterface is a group of externally visible (public)operations. An interface is like a class, but contains no internalstructure, has no attributes, no associations and noimplementation of its operations. The realizes realizes relationship indicates that the targetclass supports at least the operations listed in theinterface© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 10ClassClassInterfacesInterfaces© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 11Class DesignClass Design So, a class design consists of a set of packageswhich contain classes and other packages, and whichrepresent components or sub-systems. The grouping of classes into packages may be donefrom several different points of view: By architectural tier -- Boundary, Control, Entity,Database; By functional relationship -- MVC; By authorship -- who designed what; …© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 12Cohesion and CouplingCohesion and CouplingCriteria for good sub-system/package design:Coupling measures the degree ofinterconnectedness between designclasses/components/sub-systems/packages. The degree of coupling is reflected by the number oflinks a class has, and by the degree of interaction theclass has with other classes. Low coupling is preferrable in a design for many goodreasons, e.g., easier to understand and modify thedesign.Cohesion, on the other hand, measures the degreeto which an element (class/component/sub-system/package) contributes to a single purpose. Of course, we want a highly cohesive design.© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 13 Interaction coupling Measures number of message typesand the number of parameterspassed with these message types; Should be kept to a minimum inorder to reduce the possibility ofchanges rippling through interfaces; Inheritance coupling Degree to which a subclass actuallyneeds the features it inherits; A subclass with unnecessaryattributes or operations is morecomplex than it needs to be.Minimizing CouplingMinimizing Coupling© 2004 Jaelson Castro and John MylopoulosCSC340Information Systems Analysis and DesignClass Design -- 14 Operation cohesion Measures degree to which anoperation focuses on a singlefunctional requirement. Good design produces highlycohesive operations, each ofwhich deals with a singlefunctional requirement. Class cohesion Degree to which a class isfocused on a


View Full Document

Toronto CSC 340 - Class Design

Documents in this Course
Scoping

Scoping

10 pages

Load more
Download Class Design
Our administrator received your request to download this document. We will send you the file to your email shortly.
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 2 2 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?