ObjectOriented Analysis and Design Advance class modelling Introduction
Object-Oriented Analysis and Design Advance class modelling Introduction to advance class modelling © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Advanced Object & Class Enumerations Concept • • Multiplicity • Scope • Visibility © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Enumeration • An enumeration is a data type that has finite set of values: <<enumeration>> week • For ex. Calendar week: Week Sunday Monday Tuesday ……. Saturday • Enumeration often occur and are important to users. – i. e. it display only the possible values or users are restricted to access only allowed values or data. • Do not use generalization to capture the values of an enumerated attributes © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • An enumeration list of values • Generalization Structuring the description of objects. – Ex. We are not introducing generalization for “Card” Class because most games do not differentiate the behavior of “Suit”. <<enumeration>> Suit Card suit: suit rank: rank © RKU 2014 Spades Clubs Hearts diamonds Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling UML notation • Top section: Write keyword enumeration in between “<<>>” above enumeration name. • Second section : List the enumeration values. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Multiplicity • Multiplicity is a constraint on the cardinality of a set. • Multiplicity for an attribute specifies the number of possible values for each representation of attributes. • Common specifications are – Mandatory single value [1] – An optional single value [0. . 1] – Many[*] • It specify whether an attribute is mandatory or optional • It indicates if an attribute is single valued or can be a collection. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • If not specified, it is assumed to be a mandatory single value[1] Person name: string[1] address: string[1. . *] birthdate: date[1] © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Scope • It indicates if a feature applies to an object or a class. • You should avoid attributes with class scope because they can lead inferior model. • It is better to model group explicitly and assign attributes to them. Person name © RKU 2014 Phone. Mail. Box 1 * max. Message. Count phone. Number password Phone. Message source 0. . 1 owner 1 * maximum. Duration max. Days. Retained {ordered} date. Recorded time. Recorded * priority Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Upper model is inferior because the maximum duration, maximum day retained and maximum message count have a single value for the entire phone mail system. • It is acceptable to use an attribute with class scope to hold the extent of a class ( Set of objects for a class) Mail. Category max. Message. Count maximum. Duration max. Days. Retained Person name © RKU 2014 Phone. Mail. Box 1 * phone. Number password * source 0. . 1 owner 1 Phone. Message * date. Recorded time. Recorded {ordered} priority * owner 1 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • It is also acceptable to define operations of class scope. • It is convenient to define class scoped operations to provide summary data. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Visibility • Visibility refers to the ability of a method to reference a feature from another class and has the possible values of – Public, – Protected – Private – Package • Public features: Any method freely access • Protected features: only methods of the containing class and its descendant via inheritance can access • Private features: only methods of the containing class can access. • Package features: Methods of classes defined in the same package as the target class can access. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • UML denotes visibility with a prefix. – Character “+” precedes public – Character “-” precedes private – Character “#” precedes protected – Character “~” precedes package • Several issues when choosing visibility – Comprehension • You must understand all public features to understand the capabilities of a class. • Others are merely an implementation convenience. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Extensibility – Many classes can depend on public methods, so it can be highly disruptive to change their signature. – Fewer classes depend on private, protected, and package methods, there is more latitude to change them. • Context – Private, protected and package methods may rely on preconditions or state information created by other methods in the class. – A private method may calculate incorrect results or cause the object to fail. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Association ends • A binary association has two ends, a ternary association has three ends and so forth. Few properties: • Association end name: – An association end may have meaningful name. – Names clarifies multiple references to a class and facilitate navigation • Multiplicity: – Can specify multiplicity for each association end. • Ordering: – Objects for a “many” association end are usually just a set. • Bags & Sequences: – Objects for a “many” association end also be a bag or sequence. • Qualification: – One or more qualifier attributes can disambiguate the objects for “many” association end © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Additional properties • Aggregation: – It may be an aggregate or constituent (element) part. – Only binary association can be a aggregation: • One association end must be an aggregate • Other must be a constituent • Changeability: – It specifies the update status of an association end. • Navigability – UML shows navigability with an arrowhead on the association end attached to the target class. – Arrowheads may be attached to zero, one or both ends of an association. • Visibility – Similar to attributes and operations, association ends may be public, protected, private or package. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling N-ary Associations Project * * * Language programmer Person • N-ary associations mean associations among three or more classes. – Ex. Programmers use computer languages on projects. • UML notation: – It is diamond with lines connecting to related classes. – If the association has a name, written in italics next to the diamond. Note: • Avoid n-ary associations – most of them can be decomposed into binary associations, with possible qualifiers and attributes. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • N-ary association can have a name for each end just like binary associations. • You can not traverse n-ary associations from one end to another as with binary associations. Professor * Semester © RKU 2014 Delivered. Course * * room. Number * Listed. Course Prepared By Jay Dave * Textbook
Object-Oriented Analysis and Design Advance class modelling • Ex. A professor teaches a listed course during a semester. The resulting delivered course has a room number and any number of textbooks. • Programming language can not express n-ary associations. • So you need to promote (support) n-ary associations to classes. • When you promote n-ary associations to a class, might change the meaning of a model. • An n-ary associations enforces that there is most one link for each combinations. – Ex. For each combinations of professor, semester and Listed. Course there is one Delivered. Course • So if you were implementing below fig. special application code would have to enforce the uniqueness of Professor + Semester + Listed. Course. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Professor 1 Semester 1 * * Delivered. Course room. Number * * 1 Listed. Course © RKU 2014 Prepared By Jay Dave * Textbook
Object-Oriented Analysis and Design Advance class modelling • UML has two forms of part-whole relationships: – Aggregation - A general form – Composition – More restrictive. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Definition: Aggregation – An aggregation as relating an assembly class to one constituent part class. – An assembly with many kinds of constituent parts corresponds to many aggregations. – For ex. • College consists of students, professor, courses etc. • Here college is assembly and the others are constituents. • Therefore, college to student is one aggregation, college to professor is another aggregation. – We define each individual pairing as an aggregation. – So that we can specify the multiplicity of each constituent part within the assembly. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Aggregation is an special form of binary associations. • Most important property of aggregation: – Transitivity • If A is part of B and B is part of C, then A is part of C. – Antisymmetric • If A is part of B, then B is not part of A. • Aggregate operations imply transitive closure and operate on both direct and indirect parts. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Aggregation v/s Association • Aggregation is not an independent concept, it is a special form of association. • If two objects are tightly bound by a part-whole relationship, it is an aggregation. • If two objects are usually considered as independent and have linked, it is association. To find whethere is a aggregation or not, some tests includes: – Use the phrase part of – Some operations on the Whole apply to its parts – Some attributes values circulate from whole to all or some parts. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling UML notation: • Like association, except a small diamond indicates the assembly end. • Decision to use aggregation is – Matter of Judgment – Arbitrary College Courses Professor © RKU 2014 Student Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Aggregation v/s Composition • Composition is a form of aggregation with two additional constraints. – A constituent part can belong to at most one assembly. – Once its assigned, it has coincident lifetime with the assembly. • Composition implies ownership of the parts by the whole. • Composition is convenient for programming – Ex. Deletion of assembly object triggers deletion of © RKU 2014 all constituent objects. Prepared By Jay Dave
UML notation: Object-Oriented Analysis and Design • Composition is a small solid diamond next to assembly Advance class modelling class. EX. A company consists of divisions, which in turn consists of departments. • A Company is indirectly a composition of departments. 1 Company * Division 1 * Department 1 Works. For * Person © RKU 2014 Prepared By Jay Dave
Propagation of operations Object-Oriented Analysis and Design Advance class modelling • Propagation is the automatic application of an operation to a network of objects. When the operation is applied to some starting object. • Ex. A persons owns multiple documents. • Copy operations propagate from document to paragraph to characters. • Copying a paragraph copies all the characters in it. • Operation does not propagate in the reverse direction: A paragraph can be copied without copying the whole document. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling UML notation: • Small arrow indicating the direction and operation name next to the affected association. Note: this notation is not part of the UML and is a special notation. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Abstract Classes • An abstract class is a class that has no direct instances but whose descendant classes have direct instances. • A Concrete class is a class that is instantiable; it can have direct instances. • Only concrete classes may be leaf classes in an inheritance tree. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Baker and candelstick. Maker are concrete classes because they have direct instances. Worker { note: listing of workers is incomplete} Baker Candlestick. Maker Concrete Class: it can have direct instances. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Full. Time. Employee and Part. Time. Employee are concrete classes because they can be directly instantiated. UML Notation: Abstract class name listed in italic font or may place keyword {abstract} below or after the name. l Abstract Class and Abstract operation: it has not direct instances. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • An abstract class can define signature for an operation without supplying corresponding method. • An abstract operation defines the signature of an operation for which each concrete subclass must provide its own implementation. • A concrete class may not contain abstract operations. UML Notation: • An abstract operation is designated by italics or the keyword {abstract}. Note: • Abstract nature of a class is always provisional, depending on the point of view or application. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Multiple Inheritance • It permits a class to have more than one superclass and to inherit features from all parents. • More complicated form of generalization than single inheritance. • Advantage is greater power in specifying classes and an increased opportunity for reuse. • Disadvantage is a loss of conceptual and implementation simplicity. • Multiple inheritance mean either the conceptual relationship between classes or the languages mechanism that implements that relationship. • Distinguish between – Generalization : conceptual relationship – Inheritance : Language mechanism. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Kinds of multiple Inheritance • Common form of multiple inheritance is from sets of disjoint classes. • Each subclasses inherits from one class in each set. Employee employement. Status Full. Time. Emp © RKU 2014 managerial. Status Part. Time. Emp Manager Full. Time. Individual. Contributor Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Here, Full. Time. Emp and Part. Time. Emp are disjoint; and Manager and Individual. Contributor are also disjoint classes. • We can also define additional combinations classes here like Full. Time. Manager, Part. Time. Contributor, Part. Time. Manager and Full. Time. Individual. Contributor. • Each generalization should cover a single aspect (A generalization set name). • Therefore, here class Employee has two aspect – Employment Status – Managerial Status © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • So, Full. Time. Individual. Contributor inherits Employee features along two paths via employment. Status and managerial. Status. • Conflicts among parallel definitions create ambiguities. • You should avoid such conflicts in models or explicitly resolve them. – For Ex. Full. Time. Emp and Individual. Contributor both have attribute called name. – Full. Time. Emp. name could refer as person’s full name and Individual. Contributor. name might refer as person’s title. • Solution is restating the attributes of classes. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Multiple inheritance can also occur with overlapping classes. Vehicle {overlapping, incomplete} land. Vehicle Car © RKU 2014 Amphibiousvehicle watervehicle boat Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Amphibious. Vehicle is both Land water vehicle. So there is a overlapping. • UML uses constraint to indicate an overlapping generalizations set; • Notation is a dotted line cutting across affected generalization with keyword in braces. © RKU 2014 Prepared By Jay Dave
Multiple Classification Object-Oriented Analysis and Design Advance class modelling Definition: – One instance happens to participant in two overlapping classes. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • UML permits multiple classification but most OO languages handle it poorly. • Fig. show that Person as an object composed of multiple University. Member object. • This workaround replaces inheritance with delegation. • This is not totally satisfactory, there is a loss of identity separates roles. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Workaround • Dealing with multiple inheritance is implementation issue but early restructuring of a model is often the easiest way to work around its absence. • Two approaches make use of delegation, which is an implementation mechanism by which object forwards an operation to another object for execution. • Restructuring technique – Delegation using composition of parts – Inherit the most important class and delegate the rest. – Nested generalization © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Delegation using composition of parts – You can recast superclass with multiple independent generalization as a composition in which each constituent part replaces a generalization. – Single object having a unique ID by a group of related objects that compose an extended object. – Inheritance of operations across the composition is not automatic. – Composite must capture operations and delegate to appropriate part. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Workaround for multiple inheritance - delegation l l You need not create various combination as explicit classes. All combinations of subclasses from the different generalizations are possible. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Inherit the most important class and delegate the rest. – Maintain identity and inheritance across the most important generalization. – Reduce the remaining generalization to composition and delegate their operations. © RKU 2014 Workaround for multiple inheritance – inheritance and delegation Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Nested Generalization: – Factor on one generalization first, then the other. – This approaches multiplies out all possible combinations. – This preserves inheritance but duplicates declarations and code and violates the spirit of OO programming. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • There are several issue when selecting the best workaround. – – – © RKU 2014 Superclass of equal importance Dominant superclass Few subclass Sequencing generalization sets Large quantities of code Identity Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Superclass of equal importance: – If a subclass has several superclasses it may be best to use delegation and preserves symmetry in the model. • Dominant superclass: – If one superclass clearly dominate and others are less important, preserve inheritance through this path. • Few subclasses: – If the number of combinations is small, consider nested generalization otherwise avoid. • Sequencing generalization sets. – In a case of generalization, factor on most important criterion first, then second most and so forth. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Large quantities of code: – Try to avoid nested generalization, in a case of duplicate large quantities of code. • Identity: – Consider the importance of maintaining strict identity. Only nested generalization preserves this. © RKU 2014 Prepared By Jay Dave
Metadata Object-Oriented Analysis and Design Advance class modelling Definition • Metadata is data that describes other data. – For ex. A class definition is metadata. • Models are inherently metadata, they describe things being modeled. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • A car model describes many physical cars and holds common data. • A car model is metadata relative to a physical car, which is data. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Constraints Definition • A constraint is Boolean condition involving model elements, such as objects, classes, attributes, links, associations and generalizations sets. • A constraint restricts the values that elements can assume. © RKU 2014 Prepared By Jay Dave
Constraints on objects Object-Oriented Analysis and Design Advance class modelling Ex-1. No employee’s salary can exceed the salary of the employee’s boss. ( a constraints between two things) Ex-2. No window can have an aspect ratio of less than 0. 8 or greater than 1. 5 ( a constraint between attributes). Ex-3. Priority of a job may not increase (a constraint on the same object) Employee. salary < boss. salary © RKU 2014 Priority never increase 0. 8< length/width<1. 5 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Constraints on Generalization Class models capture many constraints through their structure. – For ex. The semantics ofsets generalization imply certain structural constraints. • With single inheritance the subclasses are mutually exclusive • UML had few keywords for generalization sets. – Disjoint • The subclasses are mutually exclusive. Each object belongs exactly one of subclasses. – Overlapping • The subclasses can share some objects. An object may belongs to more than one subclass. – Complete: • The generalization lists all the possible subclasses. – Incomplete: • The generalization may be missing some subclasses. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Constraints on Links • Multiplicity is a constraint on cardinality set. • Multiplicity for an associations restricted the number of objects related to a given object. • Qualification also constraints an association. • A qualifier attribute does not merely describe the association but also significant in resolving the “many” objects. • An association class implies a constraint. • An association class has constraint that an ordinary class does not; it derives identity from instances of the related classes. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • There is no particular order on the objects of a “many” end for ordinary association. • But, constraint {ordered} indicates that elements of a “many” associations end have explicit order. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Use of constraints l l l Declaration lets you express a constraint’s intent, without supposing an implementation. That mean, convert constraints to procedural form before implementation. Practically, you can not enforces every constraint with model’s structure, but you should try to enforce the important ones. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling UML notation • Two alternative notations of constraints: – Delimit a constraint with braces or – place it in a “dog-eared” comment box. • You should try to position constraint near affected elements. • A dashed arrow can connect a constrained element to the element on which it depends. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OOAD Concept • The subject is not primarily about OOlanguage or coding. • This subject emphasize on initial stages of process development i. e. Requirement Gathering Planning etc. • Object-oriented analysis and design (OOAD) is a software engineering approach that models a system as a group of interacting objects. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OOAD Concept OOAD is divided into two parts as follows: • OOA (Object Oriented Analysis): – Definition : Object Oriented Analysis (OOA) is concerned with developing requirements and specifications • OOD (Object Oriented Design) – Definition: Object Oriented Design (OOD) is concerned with developing object-oriented models of a software/system to implement the requirements identified during OOA © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling What is an object? • What is an object? 1) any concept that represent a single thing 2) a representation of a specific entity in the real world 3) may be tangible (physical entity) or intangible Examples: In the case of LMS, software or system itself is intangible object and student and Library clerk act as tangible objects. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling What is Object-Orientation? • Organize software as a collection of discrete objects that incorporate both data structure and behavior. – Data structure data pattern or data style or formation of data – Behavior things that the object can do that are relevant to model • OO approach has 4 characteristics: – Identity – Classification – Inheritance – Polymorphism © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling • Identity Characteristics of Objects • Classification • Polymorphism • Inheritance © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects - Identity • Definition : Discrete (i. e. unique) & distinguishable entities called objects. Ex. A person is an object. His name is Identify Ex. Ram Note: • Objects are uniquely identifiable by name. • Each objects has its own inherent identity. • In other words, two objects are distinct even if an their attribute values (i. e. name and size) are identical. Ex. Twins are two distinct person by identity © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects - Classification • Definition: – Objects with the same data structure (attributes) & behavior ( operation) are grouped into a class. • In OO systems, class is a set of objects that share common structure and common behavior • Classes are important mechanisms for classifying objects. • Each class describes a possibly infinite set of individual objects. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects - Classification • Each objects is said to be instance of its class. • Objects has its own value for each attributes but shares the attributes names & operations. Example : Class Name : Circle Attributes : radius, center Operation : set. Center(), set. Radius() © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects - Inheritance • Definition: Sharing of attributes & operations (features) among classes based on hierarchical relationship. – A superclass has general information that subclass refine and elaborate. – Each subclass incorporates all the features of its superclass and adds its own features. – In other words, defining new classes from the existing one. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects - Inheritance Note: subclasses need not repeat the features of the superclass. Advantage: common features of several classes into a superclass can reduce repetition within design and programs. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects – Example of Inheritance is implied by is-a or kind-of relationship. class Person { String name; String age; void birthday () { age = age + 1; } } class Employee extends Person { double salary; void pay () {. . . } } Every Employee has a name, age, and birthday method as well as a salary and a pay method. © RKU 2014 Person Employee Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Characteristics of Objects – Polymorphism • Definition – Same operation may behave differently for different classes. – In simple words, “ One name multiple form” – Here operation mean – it’s a procedure or transformation that an object perform or is subject to. – For example , Class name is POLYGON – Attributes - vertices, border color, fill color. – Operations – Draw, erase, fill – An implementation of an operation by a specific class is called Method © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling What is OO Development? • OO Development refers to the software life cycle. i. e. Planning, Analysis, Design & Implementation Why OO Development? • In essence of OO development is the identification & organization of application concepts, rather than in a programming language. © RKU 2014 Prepared By Jay Dave 70
Object-Oriented Analysis and Design Advance class modelling OO Dev – Modeling Concept, Not implementation • Earlier, OO community focused on implementation part rather than analysis and design. • It focuses excessively on implementation mechanisms rather than the underlying thought process that support. • An OO development approach encourage software developers to work & thinks in terms of the application throughout software life cycle. © RKU 2014 Prepared By Jay Dave 71
Object-Oriented Analysis and Design Advance class modelling OO Dev – Modeling Concept, Not implementation • OO development is a conceptual process independent of a programming language until the final stage. • OO development is fundamentally a way of thinking & not a programming technique. • It can serve as a medium for specification, analysis, documentation & interfacing as well as for programming © RKU 2014 Prepared By Jay Dave 72
Object-Oriented Analysis and Design Advance class modelling OO Dev – Modeling Concept, Not implementation • OO Development & Graphical notation represents OO concept. • OO process consists of building a model of an application & then adding details to it during design. • Same notation is used from – Analysis Design Implementation. • So information is not lost or translated into the next stage [Reusability]. © RKU 2014 Prepared By Jay Dave 73
Object-Oriented Analysis and Design Advance class modelling OO Development Stages • • • System Conception Analysis System Design Class Design Implementation © RKU 2014 Prepared By Jay Dave 74
Object-Oriented Analysis and Design Advance class modelling System Conception • System Conception means origin of the system. • S/W development begins with - business analyst or users conceiving an application & formulating tentative requirement. © RKU 2014 Prepared By Jay Dave 75
Object-Oriented Analysis and Design Advance class modelling OO Development Stages • • • System Conception Analysis System Design Class Design Implementation © RKU 2014 Prepared By Jay Dave 76
Object-Oriented Analysis and Design Advance class modelling Task of Analyst • - - - © RKU 2014 Analysis Must work with the requester (client) to understand the problem, because problem statement are rarely complete or correct. To design the Analysis model which demonstrates what the desired system must do, not how it will be done. Analyst is not concerned about implementation decision. Prepared By Jay Dave 77
Object-Oriented Analysis and Design Advance class modelling Analysis model Domain model Description of real-world objects reflected Within the system Application model Description of the parts of application system itself that are visible to the user. Ex. Bank account is domain model. Application model includes Saving accounts, current account, demat account etc. © RKU 2014 Prepared By Jay Dave 78
Object-Oriented Analysis and Design Advance class modelling OO Development Stages • • • System Conception Analysis System Design Class Design Implementation 79 © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling System Design • Task of system designer - must decide what performance characteristics to optimize. - choose strategy to attack the problem. - making tentative resource allocation. • Ex. Designer might decide to change the window screen for fast & smooth working, even when windows are moved or erased. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OO Development Stages • • • System Conception Analysis System Design Class Design Implementation 81 © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Class Design • Task of class designer - add details to analysis model - They determine data structures & algorithm for each of the operation of window class. - They elaborate both domain & application objects using same OO concept & notation. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OO Development Stages • • • System Conception Analysis System Design Class Design Implementation 83 © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Implementation Task of Implementers : • Translates the classes & relationships developed during class design into particular programming language, database or hardware • During implementation, follow good software engineering practice so that traceability to the design is apparent (i. e. clear). © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Summary of OO Development • OO concepts apply throughout the System Development Life Cycle (SDLC) – i. e. Analysis design implementation • Use same classes from stage to stage without a change of notation. • Some classes are not part of analysis but are introduced during design or implementation. Ex. Data structure such trees, hash table & linked list are not visible to users at the time of analysis. – but designers introduce them to support particular algorithms. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Three Software Models Class Model Objects in the system and their relationship © RKU 2014 State model Life history of objects in the system Interaction model Interaction among objects Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Class model • Describe the static structure of the objects in a system & their relationship • It define the context for software development. • Class model contains class diagram to express it. • A class diagram is graph phase. • Nodes are classes. • Arcs are relationship among classes. Book classes Store Relationship © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling State Model • Describe aspect of an object that change over time. • State model specifies & implement control with state diagram • A state diagram is a graph whose • Nodes are state • Arcs are transitions between state caused by events State Diagram Event State 1 © RKU 2014 State 2 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Interaction model • How the objects in a system co-operate to achieve broader results. • Interaction model start with • Use case that are elaborate into with sequence and activity diagram. Sequence Diagram Use Cases Elaborate Activity Diagram © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling Interaction Model • Use cases: – Focus on functioning of system – Simple mean, what a system does for users • Sequence diagram – Shows the object that interact – Time sequence of their interactions • Activity diagram – Elaborate important processing steps. – Activity diagrams can be used to describe the business and operational step-by-step workflows of components in a system © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OO Modeling History • Grady Booch • James Rumbaugh • Ivar Jacobson Are the man behind Invention of OO Modeling Technique. • Object Modeling Technique (OMT) concept evolved in 1991. © RKU 2014 Prepared By Jay Dave 91
Object-Oriented Analysis and Design Advance class modelling OO modeling History • In 1994 James Rumbaugh joined Rational (now the part of IBM) in 1994 & began working with Grady Booch on UML Notations. • In 1995, Ivar Jacobson also joined Rational & added his concept to the unification work. © RKU 2014 Prepared By Jay Dave 92
Object-Oriented Analysis and Design Advance class modelling OO modeling History • In 1996 the Object Management Group issued a request for proposals for standard OO modeling notation. • Later Rational led the final proposal team, with Booch, Rumbaugh & Jacobson deeply involved. © RKU 2014 Prepared By Jay Dave 93
Object-Oriented Analysis and Design Advance class modelling OO modeling History © RKU 2014 Prepared By Jay Dave 94
Object-Oriented Analysis and Design Advance class modelling OO THEME • OO themes are not unique to OO systems, they are particularly well supported. – Abstraction – Encapsulation – Combining data and behavior – Sharing – Emphasis on the essence of an object – Synergy © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OO THEME • Abstraction: – Focus on essential aspects of an application while ignoring details. • i. e. focusing on what an object is and does, before deciding how to implement it. – Use of Abstraction: • Freedom to make decisions as long as possible by avoiding premature commitment to details. – Ability to abstract is probably the most important skill required for OO development. © RKU 2014 Prepared By Jay Dave
Object-Oriented Analysis and Design Advance class modelling OO THEME • Encapsulations ( Information Hiding): – It is separates the external ( accessible to objects) aspects of an objects from the internal ( hidden from other objects) implementation details. – It prevents portions of a program from becoming so interdependent that a small change has massive ripple effects. – For ex. You may want to change the objects to • Improve performance, Fix a bug, Consolidate code, Supporting © RKU 2014 Prepared By Jay Dave 97
Object-Oriented Analysis and Design Advance class modelling OO THEME • Encapsulation is not unique to OO language but ability to combine data structure & behavior in a single entity makes encapsulation cleaner & powerful. © RKU 2014 Prepared By Jay Dave 98
Object-Oriented Analysis and Design Advance class modelling OO THEME Combining data & Behavior • In non-OO code, to display the content of a window must distinguish the type of each figure, such as circle, polygon etc & call the appropriate procedure to display it. • In OO code, program invoke the “Draw” operations on each figure and each object implicitly decide which procedure to use, based on its class. • So caller of an operation need not consider how many implementation exist. © RKU 2014 Prepared By Jay Dave 99
Object-Oriented Analysis and Design Advance class modelling OO THEME • So, maintenance is easier, because the calling code need not be modified when a new class is added. • In an OO system, the data structure hierarchy matches the operation inheritance hierarchy. Data structure Hierarchy Is replaced by Class Hierarchy Procedure Hierarchy © RKU 2014 Prepared By Jay Dave 100
Object-Oriented Analysis and Design Advance class modelling Sharing OO THEME • OO technique promote sharing at different levels. • Sharing via inheritance is one of the main advantage of OO language. • OO development not only lets you share information within an application, but also offers the aspects of reusing designs & code on future projects. • OO provides the tools to build libraries ( or collection) of reusable component. © RKU 2014 Prepared By Jay Dave 101
Object-Oriented Analysis and Design Advance class modelling OO THEME Emphasis on the essence of an object: – In OO technology, focus is on what an objects is rather than how it is used. – Use of an object depend on the details of application and often change during development. – OO development greater emphasis on data structure & lesser emphasis on procedure structure. © RKU 2014 Prepared By Jay Dave 102
Object-Oriented Analysis and Design Advance class modelling Synergy : OO THEME • OO concepts can be used in isolation but together they complement each other synergistically. © RKU 2014 Prepared By Jay Dave 103
- Slides: 103