DRCClass Guidelines modelling Introduction to OOAD OOAD Topics
- Slides: 83
DRCClass Guidelines modelling Introduction to OOAD
OOAD Topics to be covered • OOAD Concept – OOA (Object Oriented Analysis) – OOD (Object Oriented Design) • • • What is object? What is Object-Orientation? Characteristics of Objects What is OO Development? OO Theme
OOAD CONCEPTS • OOAD Concept • The subject is not primarily about OO-language 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.
Object • OOAD Concept • 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.
Object • 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
OOAD • 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.
OOAD • 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()
OOAD • 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.
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.
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
Topics to be covered • Introduction • Object and class concepts – – – Objects Classes Class diagrams Values and Attributes Operation and Methods • Link and Association concepts – Link and Association – Multiplicity – Association End name
Topics to be covered – Bags & Sequence – Ordering – Association Classes – Qualified Associations • Generalization and Inheritance – Definition – Use of generalization – Overriding Features
Introduction • A class model captures – Objects – Relationship between the objects – Attributes and operations for each class of object. • Class model focuses on building a system around objects rather than functionality.
Object and class concept • Purpose of Class Modeling is to describe the objects. • Definition: An objects is a concept, abstraction or thing with identify that has meaning. • Often appear as a specific noun or specific references with users. • Some objects have real world counterpart. – Ex. Person name or thing or company
Object and class concept • Others are conceptual entities. – Ex. Simulation run 1234 or formula to solve problem • Still others are for implementations. – Ex. Variable a, b, temp etc. • Object choice depend on judgment and nature of a problem • All objects have identity and are distinguishable. – Ex. Two apple with same color and shape are still individual.
Object and class concept • An object is an instance – or occurrence – of a class. • A class describes a group of object with – Same properties (Attributes) – Behavior ( operations) – Kinds of operations (relationship with objects) – Semantics (useful meaning) • Classes often appear as common nouns and nouns phrases in problem descriptions
• Most objects derive their individually from differences in their attributes values & specific relationship to other objects. • Choices of classes depend on – Nature – Scope – Judgment • So in the context of OOAD, we define class as follows: – A class is a set of objects that share a • Common Structure • Common Behavior • Common Semantics
• If objects are focus on modeling, then why bother with classes? • Benefit is to define class is – Common definition are stored once per class instead of per objects – Operations written for each class, can be reuse number of times
Object and Class Concept : Class diagram • Static modeling comprises of two structure Models Class diagram • Provide graphic notation for modeling classes and their relationship. Useful for Object Diagram • It shows individual objects and their relationship. Useful for • Abstract Modeling • Documenting Use Cases • Designing actual • Discussing examples.
Object and Class Concept : Class diagram • Note: A class diagram corresponding to an infinite set of object diagram.
Object and Class Concept : Class diagram Person : Person Raj: Person Class UML Notation: • For a class: Objects – Center the name in the box and capitalize the first letter. – Use singular nouns for the names of classes. • For an Object: – A box with an object name followed by colon and the class name – Object and class name both underlined
Object and Class Concept : Values and Attributes • An attribute is a named property of a class that describes a value held by each objects. • A value is piece of data. • You can find attributes by looking for adjectives or by range of values. – Ex. Person is one object. – Name, birthdate and weight can be attributes • Each attribute has value for each objects. – Ex. Attribute Name has value “Ravi”.
Object and Class Concept : Values and Attributes • Different object may have same or different values. – i. e. Two different person can have same name or different also. • Each attribute name is unique within a class. • Like, class Student and class Faculty may each have attribute called “Name”
Object and Class Concept : Values and Attributes Person Ravi: person Jay: person name: string birthdate: date Class with attributes name: “Ravi” birthdate: 1 st Oct. 1984 name: “Jay” birthdate: 8 th Oct. 1984 Objects with attributes UML Notation • Attribute list in the second compartment of class box. • Optional details, type and default value, followed by each attributes. • “Colon(: )” Type and “Equal(=)” default value. • Attribute should be left align – Lowercase letter for first letter.
Object and Class Concept : Values and Attributes
Object and Class Concept : Values and Attributes Identifier Internal Identifier • These identifier are implicit in a class model – mean you need not and should not list them. • i. e. have no application meaning. • Ex. person_id External Identifier These identifier are explicit in a class model – mean you need and should list them explicitly in class. i. e. have meaning in the real world. Ex. Telephone_no, license plate number.
Object and Class Concept : Operations and Method • Operations: – It is a function or procedure that may be applied to or by objects in a class. – Ex. For class window can have operations like • • Open Close Hide (minimize) Redisplay (maximize) – All object in a class share the same operations & may apply to other classes such an operation is polymorphism
Object and Class Concept : Operations and Method • Method: – A method is implementation of an operation for a class. – For ex. Class “File” may have operation called “Print” – You could implement different methods to print ASCII files, Print binary files etc. – All methods Logically doing the same task – “Printing a file” Operations Methods Print ASCII Print Generic Binary Print Different code for each methods
Object and Class Concept : Operations and Method • When an operation has methods on several classes, it is important that all methods have same signature. – i. e. the number and types of arguments and the type of result value. • For ex. for small circle and big circle, “Draw” method should have same kind of argument. Draw should not have radius as argument for one method & “Center” for another.
Object and Class Concept : Operations and Method UML Notation: • Operations in third compartment of class box. • Operation name in regular face, left align and use lowercase letter for first letter. • Optional details, argument list and result type, may follow each operation name. • Parenthesis enclose an argument list; comma Person separates the arguments. name • A colon precedes the result type change. Job() change. Address(
Object and Class Concept : Operations and Method • Here Geometric. Object has 3 operations. Move has argument delta, which type Geometric. Object of vector. color • Similarly, select has one position argument p, type of point and returns a boolean. move(delta: vector) select(p: point): boolean • Rotate has angle argument, rotate(in angle : float = 0. 0) which is input type of float with default value of 0. 0
Summary of Notation for Classes • Box represent class and may have many as three compartments. 1. Class Name 2. Attribute list 3. Operation list • Optional details – Type and default value for attribute – Argument list & result type for operations. • In operations, each argument may have directions, name, type and default value.
Summary of Notation for Classes • Direction mean input(in), output(out) or input argument that can be modified (inout). Syntax: direction argument. Name: type= defalut value • A colon precedes the type. An equal sign precedes the default value. • Attribute and operation compartments of class boxes are optional.
Link and Association • Link & Association are the means for establishing relationship among objects & classes. • • Links and associations Multiplicity Association end name Ordering Bags & Sequences Association classes Qualified associations
Link and Association Concept: Link and Association • A Link is a physical or conceptual connection among objects. – For ex. Ram (object) own a Maruti Car (another object) • Most links relate two objects, but some links relate three or more objects. • A link is an instance of an association • An association is a description of a group of links. – For ex. A person own a car • An association describes a set of potential links in the same that a class describes a set of potential objects.
Link and Association Concept: Link and Association • Link and association often appears as verbs (content) in problem statements. Person name * owns. Stock Company * name Class diagram • In the class diagram, a person may own stocks in more companies; a company may have many person owning its stock.
Link and Association Concept: Link and Association xyz: Person name= “xyz” abc: Person GE: Car name=“GE” name= “abc” mno: Person name= “mno” pqr: Person name= “pqr” Ravi: Person name= “Ravi” IBM: Car name=“IBM” Object diagram
Link and Association Concept: Link and Association • In object diagram, represent some examples. • xyz, abc, mno own stock in GE company; while mno and pqr own stock in the IBM company. But Ravi does not own stock in any company and thus has no link. • Asterisk(*) indicate multiplicity (number of instance of one class) symbol.
Link and Association Concept: Link and Association UML Notation • Link is a line between objects. If the link has a name, it is underlined. • An association connects related classes and is also denoted by line • Link and associations names in italics • Arrange classes in an association to read from left to right, if possible. • The association name is optional, if the model is unambiguous. • It happened when model has multiple association among the classes.
Link and Association Concept: Link and Association • Associations has inherently bidirectional. Usually binary association reads in particular direction. • Binary association can be read in either direction : forward or inverse. • For ex. Worksfor connects a person to a company. The inverse of Worksfor could be Employs. So it connects company to a person. • Only the names that establish a direction. – i. e. name only give idea about from which side we should read.
Link and Association Concept: Link and Association • Developers often implement association in programming languages as references from one object to another. • A reference is an attribute in one object that refers to another objects. • Reference cover up the fact, that the link is not part of object itself. – Ex. A company is not part of a person, and a person is not part of a company. • Modeling treats associations as bidirectional, you do not have to implement them in both directions.
Link and Association Concept: Multiplicity • Multiplicity specifies the number of instances of one class that may relate to a single instance of an associated class. • Simple mean, Shows how many objects of one class can be associated with one object of another class. • Multiplicity mean “one” or “more” (possibly infinite). • UML diagrams explicitly list multiplicity at the ends of associations lines.
Link and Association Concept: Multiplicity Exactly one 1 Many * Zero or more (unlimited) (0. . *) One or more 1. . * Zero or one (optional association) 0. . 1 Specified range 2. . 4 Multiple, disjoint ranges 2, 4. . 6, 8
Link and Association Concept: Multiplicity • One to One: One country is associated with one capital city. • One to many: One Server is associated with many client.
Link and Association Concept: Multiplicity • Many to many: • One to one or many
Link and Association Concept: Multiplicity • Multiplicity is a constraint on the size of collection; • For each association there is at most one link between a given pair of objects. • If you want two links between the same objects, you must have twoa. Link associations. A * * an. Association * another. Association Class diagram * B * an. A: A * another. Link Object diagram * * a. B: B
Link and Association Concept: Multiplicity • Multiplicity depends on assumptions and how you define the boundaries of a problem. • So first determine classes and associations, then decide on multiplicity. • If you omit multiplicity notation from a diagram, multiplicity is considered to be unspecified. which often turns into assumptions. – Ex. Worksfor association between person and company one to many or many to many? It is depend on the context
Link and Assocation Concept: Multiplicity • Multiplicity distinction between “one” and “many”. – Ex. Person can not accommodate multiple phone number. – Ex. Student can have many subjects.
Link and Association Concept: Association End name • Role is placed at the end of an association where it connects to a class. • Each role has multiplicity, which indicates how many objects participate in a given association relationship. • Multiplicity implicitly referred to the end of associations. Every association has two ends. – For Ex. “One” to “Many” association. • You can not only assign multiplicity to an association end but you can also assign name as well 49
Link and Association Concept: Association End name • These names are especially convenient for reading purpose. • Ex. A person is an employee with respect to a company. • A company is an employer with respect to a person. • Use of association end names is optional; but it is easier and less confusing to assign association end names instead of association names 50
Link and Association Concept: Association End name employee Person employer works. For * 0. . 1 Company • Whenever there is more than one association between a pair of distinct classes, it is preferably to specify association end names. owner 1 User * Directory * authorized. For * 51
Link and Association Concept: Association End name • Ex. – Each directory has exactly one user owner – Many users are authorized to use directory. • Association end names helps when unify multiple references to the same class. • The main advantage is not to introduce separate class for each reference. 52
Link and Association Concept: Ordering • Ordering is inherent part of the associations. • You can indicate ordered set of objects by writing “{ordered}” at associations ends. • Many association end have explicit order. E. g. Window have an explicit order, so only top most window is visible at any point on the screen. 53
Link and Association Concept: Ordering visible. On 54
Link and Association Concept: Bags & Sequence • A bag is collection of elements with duplicate allowed. • A sequence is an ordered collection of element with duplicate allowed. • If you specify bag or sequence in associations, then there can be a multiple links for a pair of objects. • If you omit these notations, then association has at most one link. 55
Link and Association Concept: Bags & Sequence • An Itinerary is a sequence of airports & the same airport can be visited more than once. 56
Link and Association Concept: Bags & Sequence • Like the {ordered} indication, {bag} and {sequence} are permitted only for binary associations. • binary associations means relationship between exactly two classes. • If we specify {bag} or {sequence}, then there can be multiple link for a pair of objects. 57
{ordered} {sequence {bag} } Multiple Link Duplicatio n Disordere d sequence 58
Link and Association Concept: Association Class • Like a class, an association class can have attributes & operation & also participates in associations. • We can find association classes by looking for adverbs (modifies something other than noun) in a problem statement or by fetching known values. • Simple mean, if association name indicate or have multiple attribute relevant to context then we can derive it as association class
Link and Association Concept: Association Class • Before deriving association class File Accessible * * User • After deriving Association class File * * Accessible. By access. Permission A. Txt B. Doc read-write XYZ ABC User
Link and Association Concept: Association Class • UML notation – Association class is box attached to the association by dashed line • Note: – access. Permission is a joint property of file & user and can not be attached to either file or user. – Do not fold attributes of an association into a class because multiplicity of associations might change. • Attributes of an association classes belong to common link & cannot be described to either object.
Link and Association Concept: Association Class Prefer Person form name address Person name address salary job. Title * Company 0. . 1 * Works. For Salary job. Title works. For 0. . 1 name address Company name address Not prefer form
Link and Association Concept: Association Class • Ex. – an association class participating in an association User * * Workstation Authorization Priority Privileges start. Session * 1 Workstation home. Directory • Association class participating in an association – Users may be authorized to many workstation – Each authorization carries priority & privileges
Link and Association Concept: Association Class • Association class has only one occurrences for each pairing of person and company. • In contrast, there can be any number of occurrences of a purchase for each person & company. Person name Company name Owns. Stock Association class quantity Person 1 name * Purchase * quantity date cost 1 Company name Ordinary Class
Link and Association Concept: Qualified Association • The qualifier is an attribute of the association between two classes. • Consider the following class diagram. 1 University * Student id: Integer name: String University s 1: Student id = 3456 name = "Mary" s 2: Student id = 3456 name = "Mary" • We expect each student to be uniquely identified by an identification number (i. e. id).
Link and Association Concept: Qualified Association • If we want to state (in the class model) that the attribute id has to be unique across all student objects then we could use qualified association between university and student. University 1 id: Integer 0. . 1 Student id: Integer name: String
Link and Association Concept: Qualified Association UML notation • The notation of qualifier is a small box on the end of association line near the source class. • The qualifier box may grow out of any side (top, bottom, left, right). • Source class + Qualifier = Target class
Link and Association Concept: Qualified Association • More example: 1 * Bank Account account. Numbe r 1 Bank account. Numbe r 0. . 1 Account
Link and Association Concept: Qualified Association • Most common use of qualifier is an association with one to many or many to many functionality. • Bank server multiple accounts. • An account belong to single bank. • An account number specifies a unique account. • Here bank & account are classes & account number is an qualifier.
Link and Association Concept: Qualified Association • Qualification reduces the effective multiplicity of this association from one-to-many to one-to-one. • Both qualified & unqualified models are acceptable but Qualified adds more information. • Adds multiplicity constraint.
Generalization • Definition – Generalization is the relationship between a class (i. e. superclass) and one or more variations of the class (i. e. subclasses). – Simple mean, A inherit relationship between a more general and a more specific element.
Generalization • The superclass holds common attributes, operations and associations • A sub-class inherits from its super-class – Attributes, Operations and Relationships • A sub-class may – Add attributes, operations and add relationships • It is sometimes called “is-a” or “kind-of” relationship.
Generalization • Organizes classes into hierarchy, there can be multiple level of generalization. • Each subclass has single immediate super class. Advertising { Note: Advertising is incomplete} Hoarding Advertising Newspaper Advertising Video Advertising Press Advertising Magazine Advertising
Generalization UML notation • A large hollow arrowhead denotes generalization. The arrowhead points to the superclass. • Directly connect the superclass to each subclass, but normally prefer to group subclasses as a tree. • Draw superclass on top and subclasses on the bottom, if possible. • The curly braces denotes a UML comment.
Generalization • A Generalization set name is an enumerated attribute that indicates which aspect of an object is being abstracted by particular generalization. • In fig. dimensionality is a generalization set name. • The generalization set name is optional. Figure dimensionality Zero. Dimension One. Dimensional Two. Dimensional
Generalization • Notes: – Do not nest subclasses too deeply. – i. e. an inheritance hierarchy that is two or three levels deep is certainly acceptable; ten levels deeps is probably excessive;
Use of Generalization • Mainly 3 purposes 1. Support for polymorphism • Polymorphism increase software or system flexibility. • When adding new subclass, it automatically inherit superclass behavior. • Furthermore, newly subclass does not disrupt existing code. 2. To structure the description of objects. • When you use generalization, you are making a conceptual statement.
Use of Generalization • You are forming a taxonomy (i. e. classification) and organizing objects on the basis of their similarities and differences. • Which indicate each class individually and in isolation from other classes. 3. To enable reuse of code. • Reuse is more productive than repeatedly writing code from scratch. • You can inherit code within your application as well as from past work (such as class library).
Use of Generalization Terms Generalization, Specialization and Inheritance. – Generalization derives from fact that the superclass generalizes the subclasses. • Top to Down description – Specialization refers to the fact that the subclasses refine or specialize the superclass. • Bottom to Up description – Inheritance is the mechanism for sharing attributes, operations and association via the generalization/specialization relationship.
Overriding Features • A subclass may override a superclass feature by defining a feature with same name. • The overriding feature ( subclass features) refines and replaces the overridden features (superclass features). • Several reasons to override: – To specify behavior that depends on the subclass. – To tighten the specification of a feature. – To Improve performance.
Overriding Features • We may override methods & default behavior values of attribute. • Never override signature, or form of a feature. • Override should preserve - attribute type - number & type of arguments to an operation and - finally operation return type - operation semantics
Overriding Features • Overriding will increase performance • It enable reusability • Makes advantage of specific information but does not change the operation semantics.
THANK YOU
- Ooad
- Abstract class vs concrete class
- Katie holmes
- Unified process in ooad
- Object oriented system development life cycle
- Orthogonal views of software in ooad
- Object analysis classification in ooad
- Contoh ooad
- Data abstraction and problem solving with java
- Nested state diagram
- Sad vs ooad
- Perbedaan ssad dan ooad
- Actor in ooad
- Multiplicity in ooad
- Domain model in ooad
- Functional modeling in ooad
- What is technological modelling
- Energy based model
- Java modelling tools
- Molecular modelling laboratory
- Modelling madness what's new
- Modelling rich interaction
- Lbo case study
- Advantages of solid geometric models
- Homology modelling steps
- Hair modelling
- Edlc phases in embedded system
- Homology modelling steps
- Exercise 4
- Rotational mechanical system example
- Modeling rich interaction in hci
- Unit 5 data modelling assignment 2
- Tools of structured analysis
- Algorithmic cost modelling
- Class responsibility collaborator modelling
- State modelling
- Contoh object oriented model
- Multijet modeling
- An introduction to model-based cognitive neuroscience
- Cognitive modelling
- Types of financial modelling techniques
- Menurut anda apa tujuan dari dimensional modelling
- Data modelling techniques in business intelligence
- Malatesta's modelling e.g. by mother
- Cognitive modelling
- Modelling relationships and trends in data
- Ipd ppt
- Threat modelling web application
- 150000/175
- Modelling
- Define the relationship chapter 16
- Unified modelling language
- Disease modelling
- Modelling software
- Crc model
- Marco arpagaus
- Consequences of heteroscedasticity
- What is solid modelling
- Qra software
- Unit 42 spreadsheet modelling
- Matlab biological modelling
- Modelling
- Mom modelling
- Modelling task
- Modelling
- Modelling
- Problem solving and modelling task
- Finshiksha financial modelling
- Uml overview
- Chloe ashford
- Parametric surface modeling
- Modelling cost of delay
- Power platform data modelling
- Vibration engineering
- Data modeling concepts
- Unit 42 spreadsheet modelling
- Saturation height modelling
- Microgeny
- Climate based daylight modelling
- Mlpowsim
- Sheath plasma
- Body paragraph structure
- Magazine article sample for students
- Grade 9 writing examples