Академический Документы
Профессиональный Документы
Культура Документы
(3+4+5)
22/09/2019 4:51 PM
(Lecture 3) Lecture 5
Modeling.
Abstract Class vs Concrete Class.
Definition : Modeling is the simplification of reality.
Example : We make a model bridge before constructing a real bridge. Ø Abstract Class:
○ An incomplete Superclass that defines common parts.
"A model is the simplification of our perception of reality" ○ Not instantiated. (Cannot make objects or instances)
Ø Concrete Class:
Benefits of Modeling : ○ A complete Class.
Ø Understanding why what and how's of software. ○ Describes a concept completely.
Ø Communicating ^ our understanding. ○ Is intended to be instantiated.
Ø Detection of commonalities and differences.
Ø Detection of misunderstandings and miscommunications.
State of an Object
Object Oriented Modeling.
Ø Attach behavior and information that is Important to Objects. Ø State
Ø Associate relations between objects to describe the Structure and Organization ○ Definition : "State is a collection of associations (an object has with other objects) and its own
(static+dynamic) of a real situation. attributes.
○ "The state of an object encompasses all of the (usually static) properties of the object plus the
current (usually dynamic) values of each of these properties" - "Object-Oriented Analysis and
(Lecture 4)
Design" by G. Booch
Object.
Ø State Change
○ Definition : "A state change is the transition of an object from one state to another."
Definition: "Anything to which a concept applies, in our awareness."
Ø Event
○ An event is a note-worthy change in state [Rumbaugh]
Ø Object -> A structure that has identity and properties and behavior.
Ø Object -> It is an instance of a collective concept i.e. a class.
Object Oriented Application
Ø An object has operations and attributes. For example a particular human as an example can have
○ Operations:
Definition : "A collection of discrete objects, interacting with each other"
§ Work
Properties:-
§ Dance
Ø Objects have property and behavior (causing state transition)
§ Drive
Ø Interactions through message passing
§ Jump
Ø A sender object sends a request (message) to another object (reciever) to invoke a method of the
○ Attributes:
receiver object's)
§ Height
§ Eye color
§ Hair Color
§ Weight
○ Static :
§ Existing over a long time
§ Objects know about each others existence.
○ Dynamic:
§ Two objects communicate with each other.
§ Objects sending stimuli to each other
§ Stimuli are events, messages etc. •
What is OOAD?
Ø Analysis:
○ Understanding, finding and describing -> (Concepts in the problem domain)
Ø Basic Principles of OO Ø Design:
○ Abstraction ○ Understanding and defining -> (Software solution/objects) that represent the analysis concepts
§ Focus on the essentials and will eventually be implemented in code.
§ Omits Tremendous amounts of details Ø OOAD
§ Focus : What an object is and does, rather than the nitty details of how it does it. ○ Analysis is object-oriented and design is object oriented. A software development approach that
○ Encapsulation emphasizes a logical solution based on objects.
§ A.k.a. Information hiding. ○ Methodology -> (Notation + Process)
§ Objects Encapsulate:- Ø During OOA there is an emphasis on finding and describing the objects or concepts in the problem
□ Property (variables) domain.
□ Behavior (As a collection of Methods invoked by messages) ○ For example in a library management system, the objects can be Book, Library, Members,
□ State (as a collection of instance variables) librarian etc.
§ Behavior and information is represented or implemented internally. Ø During OOD there is an emphasis on defining software objects and how they collaborate to fulfill the
requirements.
○ For example, in the library system, a Book software object may have a title attribute and a
getChapter method.
Ø Example:
○
○ Inheritance
○ Polymorphism
Class.
Definition: "A collection of objects that share common properties, attributes, behaviors and semantics in
general." or "A collection of objects with the same data structure (attributes, state variables) and
behavior (function/operations) in the solution space.
Is it Any Good?
Inheritance:
Ø A system which is designed and modelled using an object oriented technology is:
Ø Specialization -> The act of defining one class as a refinement of another (Generalized) ○ Easy to understand
Ø Subclass -> A class defined in terms of a specialization of a superclass using inheritance. ○ Directly related to reality
Ø Superclass -> A class serving as a base for inheritance in a class hierarchy. ○ More Flexible and resilient to change
Ø Inheritance -> Automatic duplication of superclass attribute and behavior definitions in subclass. ○ Systems can be developed more rapidly and at a lower cost.
Iterative Development
Ø Why inheritance? Ø Building the entire project at once is complex and Error Prone.
○ Show similarities Ø Traditional Approach : Linear Water fall.
○ Reuse Common Descriptions Ø Limitations of water fall model??
○ Software Reuse
○ Easy modification
○ Avoiding Redundancy
Polymorphism.
Definition: The ability to hide many different implementations behind a single interface.