Professional Documents
Culture Documents
•Object orientation
•Object Identity
•Generosity
•Importance of Modelling-Principles
•Architecture
Percentage of Projects That Fail
•The statistics for software project delivery show that only one
in three software projects are truly successful.
•The object-oriented approach focuses on objects that represent abstract or concrete things in the real
world.
•Objects are first defined by their character and their properties, which are represented by their internal
structure and their attributes (data). The behavior of these objects is described by methods (functions).
•Objects form a capsule, which combines the characteristics with behavior.
•Objects are intended to enable programmers to map a real problem and its proposed software solution on a
one-to-one basis.
•Object Oriented Programming
•Object Oriented programming (OOP) is a programming paradigm that relies on the
concept of classes and objects.
Simple
•Contains all the properties a car must have, color, brand and model.
We could then set the value of the properties defined in the class to
describe my car, without affecting other objects or the class template.
•We can then reuse this class to represent any number of cars.
•Our car class may have a method repaint that changes the colour attribute of our car.
This function is only helpful to objects of type car, so we declare it within the car class
thus making it a method.
•Each object can have unique values to the properties defined in the class.
Class car{
String model, color, brand;
String repaint(colorchange)
{
color=colorchange;
Return color;
}
Func {}
}
main()
{
Car obj()
obj.model=xyz;
obj.color=blue;
obj.brand=hyundai;
Car obj1;
obj1.model=xyz;
obj1.color=blue;
obj1.brand=hyundai;
Obj.repaint(red);
}
Uses of Object Orientation
➢ Classes
➢ Methods
➢ Attributes
➢ Objects
Classes
Classes are essentially user defined data types. Classes are where we create a
blueprint for the structure of methods and attributes. Individual objects are
instantiated, or created from this blueprint.
•Classes contain fields for attributes, and methods for behaviours and represent broad
categories, like car or dog that share attributes.
•These classes define what attributes an instance of this type will have, like color, but
not the value of those attributes for a specific object.
•Classes can also contain functions, called methods available only to objects of that
type. These functions are defined within the class and perform some action helpful to
that specific type of object.
Objects
The state of an object is defined by the data in the object’s attributes fields.
For example, a puppy and a dog might be treated differently at pet camp. The
birthday could define the state of an object, and allow the software to handle
dogs of different ages differently.
•Methods: Methods represent behaviors. Methods perform actions; methods might
return information about an object, or update an object’s data. The method’s code
is defined in the class definition.
When individual objects are instantiated, these objects can call the methods
defined in the class.
The state of an object is defined by the data in the object’s attributes fields.
Object Oriented Development
IT IS ALL ABOUT MODELING THE CONCEPTS
AND
▪ System Conception
▪ Analysis
▪ System Design : Design high level system architecture for the overall application
▪ Class Design: Designer adds details to analysis model as per system design strategy
• # class attribute
• # instance attribute
• self.name = name
•print("Blu is a {}".format(blu.__class__.species))
• Inheritance: child classes inherit data and behaviors from parent class.
• Abstraction: only exposing high level public methods for accessing an object.
•Specifically, consider that the final software system is the lowest level of abstraction.
All of the software's design details are present at this level. Information hiding allows
us to hide information unnecessary to a particular level of abstraction within the final
software system, allowing for software engineers to better understand, develop and
maintain the software.
•an abstraction relates to how an object and its behaviors are presented to the
user and encapsulation is a methodology that helps create that experience.
•Think about the interface of your mobile phone. Whether you use an Android
operating system or iOS, you don't interact directly with the code that allows
your phone to connect to the internet, send a text message or play a video
game. Instead, you interact with the code through a user interface that is
designed to streamline your experience and make it easy to access the
functions and methods you need to complete a task. In this case, the interface
is abstracted away from the actual implementation of the code.
•Inheritance
•Inheritance allows classes to inherit features of other classes.
•If basic attributes and behaviors are defined in a parent class, child classes can be
created extending the functionality of the parent class, and adding additional
attributes and behaviors.
•The benefits of inheritance are programs can create a generic parent class, and
then create more specific child classes as needed. This simplifies overall
programming, because instead of recreating the structure of the class multiple
times, child classes automatically gain access to functionalities within their
parent class.
•Types of Inheritance
✦Single Inheritance − A subclass derives from a single super-class.
✦Multilevel Inheritance − A subclass derives from a super-class which in turn is derived from another class
and so on.
✦Hierarchical Inheritance − A class has a number of subclasses each of which may have subsequent
subclasses, continuing for a number of levels, so as to form a tree structure.
✦Hybrid Inheritance − A combination of multiple and multilevel inheritance so as to form a lattice structure.
•Polymorphism
•Polymorphism means designing objects to share behaviors. Using inheritance,
objects can override shared parent behaviors, with specific child behaviors.
•With object identity, objects can contain or refer to other objects. Identity is a
property of an object that distinguishes the object from all other objects in the
application.
•An object retains its identity even if some or all of the values of variables or
definitions of methods change over time.
•Several forms of identity:
◦ value: A data value is used for identity (e.g., the primary key of a tuple in a
relational database).
◦ name: A user-supplied name is used for identity (e.g., file name in a file
system).
•The object identity of two objects of the same type is the same, if every change
to either object is also a change to the other object.
Modelling
•Model is a simplification of reality.
1. Activity diagrams
2. Interaction diagrams
• The structural and the behaviour elements of the system are there in this system.
✓The right models will simplify even the most wicked problem, offering insights
that couldn’t have been gained otherwise.
The wrong models will mislead us, causing to focus on irrelevant issues.
• Principle 2: Every model maybe expressed at different levels of abstraction.
• Example: An analyst or an end user will want to focus on issues of what while
a developer would like to address the issues of how.
•
• Principle 3: The best models are connected to reality.
•
• Principle 4: No single model is sufficient, a set of models is needed to solve any non-trivial system
• To understand the architecture of such a system, we need several complementary and interlocking
views:
A design view (capturing the vocabulary of the problem space and solution space).
An interaction view (showing interaction among parts of the system and between the system
and environment).
•In analysis phase, OO models are used to fill the gap between problem and
solution. It performs well in situation where systems are undergoing continuous
design, adaption, and maintenance. It identifies the objects in problem domain,
classifying them in terms of data and behavior.
•The OO model is beneficial in the following ways −
•Encapsulation
•Abstraction
•Relationships
•Inheritance
•Polymorphism
Elements of Object-Oriented System
Objects − An object is something that is exists within problem domain and can be
identified by data (attribute) or behavior. All tangible entities (student, patient) and some
intangible entities (bank account) are modeled as object.
Behavior − It specifies what the object can do. It defines the operation performed on
objects.
Class − A class encapsulates the data and its behavior. Objects with similar meaning
and purpose grouped together as class.
Methods − Methods determine the behavior of a class. They are nothing more than an
action that an object can perform.
Message − A message is a function or procedure call from one object to another. They
are information sent to objects to trigger methods. Essentially, a message is a function
or procedure call from one object to another.
Introduction to UML
•UML: Unified Modeling Language
• The UML uses mostly graphical notations to express the OO modeling and
design of software projects.
Visualizing: more than graphical symbols, each symbol in the UML notation is a
well-defined semantics.
In this manner, one developer can write a model in the UML, and another developer, or even another
tool, can interpret that model unambiguously
•Use graphical notation: more clearly than natural language and code.
▪ Class Diagram
▪ Sequence Diagram
▪ Collaboration Diagram
▪ State Diagram
Different VIEWS..
UML : Standard language for….
UML Conceptual Model
To understand the UML, you need to form a conceptual model of the language,
and this requires learning three major elements:
2. The rules that dictate how those building blocks may be put together
➢Relationships
➢Diagrams
Things in the UML : There are four kinds of things in the UML:
1. Structural things
2. Behavioral things
3. Grouping things
4. Annotational things
Structural Things
Structural things are the nouns of UML models.
These are the mostly static parts of a model, representing elements that are either
conceptual or physical.
In all, there are seven kinds of structural things:
1. Classes
2. Interfaces
3. Collaborations
4. Use cases
5. Active classes
6. Components
7. Nodes
CLASS
•An interface rarely stands alone. Rather, it is typically attached to the class or
component that realizes the interface.
Collaboration
• It is an Interaction
•It is a society of roles and other elements that work together to provide some
cooperative behavior that's bigger than the sum of all the elements.
•Graphically, an active class is rendered just like a class, but with heavy lines,
usually including its name, attributes, and operations
COMPONENT
1. Interaction
Package:-
• Structural things, behavioral things, and even other grouping things may be
placed in a package
•These are the comments you may apply to describe about any element in a
model.
Relationships in UML
There are four kinds of relationships in the UML:
Dependency
Association
Generalization
Realization
DEPENDENCY
-------------------------------------→
ASSOCIATION