1. OOSD Flashcards
OOAD
Object oriented analysis and development
A technical approach for analysing, designing an application, system, or a business by applying the object oriented paradigm and visual modelling throughout the development lifecycle for better communication product quality
Orthogonal view of software
Two approaches:
traditional approach
object oriented approach
traditional approach
Algorithms + data structures = programs
Software system is a set of mechanisms for performing certain actions on certain data
oosd methodology
- everything is an obj And each object is responsible for itself
- Object orientation systems are easier to adapt to changing requirements. Easier to maintain more robust and promote greater design and code reuse
diff b/w Traditional and oo approach
– in mam’s doc
object basics
obj:
Combination of data and logic that represents some real world entity
- Each object is instance of class
clses:
Specification of
-structures (instance variables)
-behaviour (methods)
-inheritance for objects
Classes are important mechanisms for classifying objects. A method or behaviour of an obj Defined by its class
Dynamic and static binding
dynamic binding-
Process of determining whic function to invoke and runtime
static binding
process of determining which function to invoke earlier itself
persistence
obj have lifetime.
Features of OOD:
-
Higher level of abstraction
Top down approach supports abstraction at functional level, whereas oo approach supports abstraction and object level so it encapsulates both data (attributes) And functions (methods) -
Seamless transition among different phases of software development
In trad app, s/w dev Requires different styles and methodologies for each step of the process -
Encouragement of good programming techniques
OO Systems carefully indicates The position between its interfaces(What class can do) and implementation of that interface(how class can do that) -
Promotion of reusability
Because their model directly out of real world problem domain
Object properties
Object Methods
Object Properties
State of an object represent property
eg: Object car has properties like cost colour model
Object methods
In object model object behaviour is described in methods or procedures
- Implements behaviour of object
- Capabilities of objects are determined by the methods defined for it
- Methods conceptually are equivalent to function definitions used in procedural languages
Messages
- Objects perform operations in response to messages
- Non specific function calls can respond to Message in different ways (different from subroutine call.)
- Methods are similar to functions procedures or subroutine in more traditional programming languages, such as Cobal, Basic, or C
Encapsulation or information hiding
- Principle of concealing internal data and procedures of an object and providing an interface to each object in such a way to reveal as little as possible about its inner working to the user.
- This means users can use the object by calling the objects methods, but cannot see inside of the object capsule
- Is the design goal of OO system
- Rather than Allowing an object access another objects data directly A message is sent to the target object requesting information
Inheritence
- Property of oo sys, that allows obj to be built from other obj
- Inheritance relationship between classes where one Class is the parent(base class or super class) of the another class(derived or child class)
dynamic inheritence
- Technique where inheritance relationships between classes can change at runtime, rather than being fixed at the compile time
- The change can be the relationship between parent and child classes, or flexibility to Add delete or change objects In parent or child at the runtime or even change the parent itself
Techniques to implement:
1. Delegation
Rather than class inheriting methods directly, it delegates the responsibility to another object that can change at the runtime
2. prototypes
Some languages like javascript use prototype based inheritance where objects can change their prototypes(parents) at runtime
3. composition
Rather than delegation, you can mimic dynamic inheritance behaviour
4. dynamic class modification
In some advanced scenarios languages like python allow modifying the base class of an object during runtime, thus changing the inheritance structure can be easy
multiple inh
Some OO systems permit a class to inherit its states (attributes) and behaviours from more than one super class or parent