Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
23 views77 pages

Unit-1 Oom

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 77

Object Oriented

Modelling
Marks Distribution

 Mid Semester Exam: 25 Marks

 End Semester Exam: 50 Marks

 Teacher’s Assessment (Quiz/Presentation/Project): 25 Marks


Text Books

 Object-Oriented Modeling and Design with UML - Michael Blaha,


James Rumbaugh.

 Pattern-Oriented Software Architecture: A System of Patterns,


Volume 1 – Frank Buschmann, Regine Meunier, Hans Rohnert, Peter
Sommerlad, Michael Stal.

 Object-Oriented Analysis and Design with Applications - Grady


Booch et al.

 Object-Oriented Design with UML and JAVA - K. Barclay, J. Savage.

 Practical Object-Oriented Design with UML - Mark Priestley.


UNIT-I
Unit Structure

1.1 Introduction to Objects

1.2 Object state & behavior

1.3 Property (Object attribute)

1.4 Object oriented system development life cycle

1.5 Advantages of Object Oriented Methodology


Introduction to Objects

 We live in a world of objects.

 These objects exist in

• Nature,

• Man-made entities,

• Business,

• Products that we use.


Introduction to Objects Contd..

 Objects can be

• Created,

• Categorized,

• Described,

• Organized,

• Combined,

• Manipulated.
Introduction to Objects Contd..

 Objects are composite data types.

 An object provides for the storage of multiple data values in a


single unit.

 Each object is assigned a name which may then be used to


reference it.

 Each element in an object is referred to as a property.


Introduction to Objects Contd..
 Object properties can be seen as

• an unordered list of name value pairs contained within


the container object.

 Object comes in two categories:

• System-defined objects

• User-defined objects
Introduction to Objects Contd..

 There are system defined objects, which are predefined

• and come with the JavaScript parser or with the browser


running the parser.

 And there are user defined objects, which the programmer


creates.
Introduction to Objects Contd..

 Someone, somewhere, had to write the code to define the


integer data type as

• being a numeric value with no fractional component.

 Whenever, we declare an integer variable,

• we make use of this definition to create, or instantiate, an


integer.

 Fortunately for us, it all happens behind the scenes.


Introduction to Objects Contd..

 The point of object-based programming languages is that

• they give the user the ability to define their own data
types

❑ that can be specifically tailored to the needs of the


application.

 There are still system-defined data types and classes,

• So, we don't need to worry about defining commonly used


types of variables.
Introduction to Objects Contd..

 Since, objects are composite data types,

• they can contain more than one piece of data.

 In fact, the very point of the object is to bring together related


data elements into a logical grouping.

 This grouping can contain not only data values, but also rules
for processing those values.
Introduction to Objects Contd..

 While discussing object, a data element is called a property,

• whereas the rules the object contains for processing those


values are called methods.

 This makes objects very powerful because they can not only
store data,

• but they can store the instructions on what to do with that


data.
Introduction to Objects Contd..

There are two important concepts:

 Class

 Instance
Introduction to Objects
(Class)
Class:

 A definition, or description, of

• how the object is supposed to be created,

• what it contains,

• and how it work.


Introduction to Objects Contd..
(Class)
 Creating objects is a two-step process.

 First, we must define a class,

• then we use the class by declaring instances of that class


within the program.
Introduction to Objects Contd..
(Instance)
Instance:

 An instance of a class is an object.

 It is also known as a class object or class instance.

 The object instance is a composite data type created based on


the rules set forth in the class definition.
Introduction to Objects Contd..
(Instance)
 Before objects, all classes are hard coded into the parser

• and we can just make use of them while creating


instances of those classes.
Introduction to Objects Contd..
(Instance)
public class Student
{

 According to the sample given below

• we can say that the object, named objectStudent, has created


out of the Student class.

Student objectStudent = new Student( );


Object State & Behaviour

 Real-world objects share two characteristics:

• State

• Behavior
Object State & Behaviour Contd..
 Bicycles have state such as

• current gear,

• current pedal cadence,

• current speed

 and behavior

• changing gear,

• changing pedal cadence,

• applying brakes
Object State & Behaviour Contd..

State:

 Every object, at any given point of time would have to have a set
of attributes defining its State.

Behavior:

 Every object based on its state and identity will have particular
behavior.
Property (Object Attribute)

 Properties are variables contained in the class;

• every instance of the class has those properties.

 Properties should be set in the prototype property of the class

• so that inheritance works correctly.


Property (Object Attribute) Contd..

 Working with properties from within the class is done by the


keyword “this”.

 This is the same syntax used by C++ and Java.

 Inside the class the syntax “this.Property” is used to get or set


the property's value.
Property (Object Attribute) Contd..

 Accessing (reading or writing) a property outside of the class is


done
• using syntax: InstanceName.Property;
Property (Object Attribute)
(Methods)
Methods:

 Methods follow the same logic as properties;

• the difference is that they are functions and they are


defined as functions.

 Calling a method is similar to accessing a property,

• but we add () at the end of the method name, possibly


with arguments.
Property (Object Attribute)
(Messages)
Messages:

 An object-oriented program is a growing and shrinking


collection of objects that interact via messages.

 We can send the message to objects.

 The target decides how to implement or respond to a message


at run-time.
Property (Object Attribute) Contd..
(Messages)
 Objects can send and receive messages.

 Over its lifetime, the object has a state that varies.


Property (Object Attribute) Contd..
(Messages)
 A message is called a request or an event.

 The event contains

• name of the object,

• name of the operation,

• and maybe a group of parameters.


Property (Object Attribute) Contd..
(Messages)
 As a result of receiving a message, the object runs a script
(program)

• that may modify its state or send messages to other


objects.
Object Oriented System Development
(Overview)

 An object-oriented view has come into picture for creation of


computer software.

 An object-oriented approach to the development of software


was proposed in late 1960s.
Object Oriented System Development Contd..
(Overview)

 Object-Oriented development requires that object-oriented


techniques be used

• during the analysis,

• and implementation of the system.


Object Oriented System Development Contd..
(Overview)

 This methodology asks the analyst to determine

• what the objects of the system are,

• how they behave over time or in response to events,

• and what responsibilities & relationships an object has


to other objects.
Object Oriented System Development Contd..
(Overview)

 Object-oriented analysis has to look at

• all the objects in a system,

• their commonalties, difference,

• and how the system needs to manipulate the objects.


Object Oriented System Development
(Object Oriented Process)

Object Oriented Process:

 The Object Oriented Methodology of building systems takes the


objects as the basis.

 For this, At first the system to be developed is observed and


analyzed

• and the requirements are defined as in any other method


of system development.
Object Oriented System Development Contd..
(Object Oriented Process)

 Once this is done, objects in the required system are identified.

 For example, in case of a Banking System,

• a customer is an object,

• a chequebook is an object,

• and even an account is an object.


Object Oriented System Development Contd..
(Object Oriented Process)

 In simple terms, Object Modeling is based on identifying the


objects in a system and their inter-relationships.

 Once this is done, the coding of the system is done.

 Object Modeling is somewhat similar to the traditional


approach of system designing,

• in that it also follows a sequential process of system


designing but with a different approach.
Object Oriented System Development
Life Cycle
The basic steps of system development using Object Modeling
may be listed as following:

 System Analysis

 System Design

 Object Design

 Implementation
Object Oriented System Development
Life Cycle
(System Analysis)
System Analysis:

 As in any other system development model,

• system analysis is the first phase of development in case


of Object Modeling too.

 In this phase, the developer interacts with the user of the system

• to find out the user requirements,

• and analyse the system to understand the functioning.


Object Oriented System Development
Life Cycle Contd..
(System Analysis)
 Based on this system study, the analyst prepares a model of the
desired system.

 This model is purely based on what the system is required to do.

 At this stage, the implementation details are not taken care of.
Object Oriented System Development
Life Cycle Contd..
(System Analysis)

 Only the model of the system is prepared based on the idea that

• the system is made up of a set of interacting objects.

 The important elements of the system are emphasized.


Object Oriented System Development
Life Cycle
(System Design)
System Design:

 System Design is the next development stage

• where the overall architecture of the desired system is


decided.

 The system is organized as a set of sub systems interacting with


each other.
Object Oriented System Development
Life Cycle Contd..
(System Design)
 While designing the system as a set of interacting subsystems, the
analyst takes care of

• specifications as observed in system analysis,

• as well as what is required out of the new system by the


end user.
Object Oriented System Development
Life Cycle Contd..
(System Design)

 The basic philosophy of Object-Oriented method of system


analysis is to

• perceive the system as a set of interacting objects.

 A bigger system may also be seen as a set of interacting


smaller subsystems

❑ that in turn are composed of a set of interacting


objects.
Object Oriented System Development
Life Cycle Contd..
(System Design)

 While designing the system, the stress lies on the objects


comprising the system

• and not on the processes being carried out in the system


as in the case of traditional Waterfall Model

❑ where processes form the important part of the


system.
Object Oriented System Development
Life Cycle
(Object Design)
Object Design:

 In this phase, the Objects identified in the ‘system design phase’


are designed.

 Here, the data structures get defined.

 Also, the interrelationships between the objects are defined.


Object Oriented System Development
Life Cycle Contd..
(Object Design)
 Object Oriented Philosophy is very much similar to real world

❑ as the systems here are seen as a set of interacting


objects as in the real world.

 To implement this concept, the process-based structural


programming is not used;

• instead objects are created using data structures.


Object Oriented System Development
Life Cycle Contd..
(Object Design)
 Just as every programming language provides various data
types and various variables of that type can be created,

• similarly, in case of objects certain data types are


pre-defined.
Object Oriented System Development
Life Cycle Contd..
(Object Design)
 Following are the important aspects considered during object
design:

• Class

• Abstraction

• Inheritance
Object Oriented System Development
Life Cycle Contd..
(Object Design)
Class:

 It is a template where certain basic characteristics are defined.

 The class defines the basic attributes and operations of the


objects of that type.
Object Oriented System Development
Life Cycle Contd..
(Object Design)

 Defining a class does not create any object, but it only creates a
template.

 For objects to be actually created,

• instances of the class are created as per the requirement of


the case.
Object Oriented System Development
Life Cycle Contd..
(Object Design)
Abstraction:

 Classes are built on the basis of abstraction.

 The characteristics of concern to the system under observation


are picked up

• and the class definition is made.


Object Oriented System Development
Life Cycle Contd..
(Object Design)

 The attributes of no concern to the system are left out.

 This is known as abstraction.

 The abstraction of an object varies according to its application.


Object Oriented System Development
Life Cycle Contd..
(Object Design)

 For example, while defining a pen class for a stationary shop,

• the attributes of concern might be the pen color, ink


color, pen type etc.

 Whereas, a pen class for a manufacturing firm would be


containing the other dimensions of the pen

• like its diameter, its shape, and size, etc.


Object Oriented System Development
Life Cycle Contd..
(Object Design)
Inheritance:

 Inheritance is another important concept in this regard.

 This concept is used to apply the idea of reusability.

 A new type of class can be defined using a similar existing


class with a few new features.
Object Oriented System Development
Life Cycle Contd..
(Object Design)
 For instance, a class vehicle can be defined with the basic
functionality of any vehicle

• and a new class called ‘car’ can be derived out of it with a


few modifications.

 This would save the developers time and effort

• as the classes already existing are reused without much


change.
Object Oriented System Development
Life Cycle Contd..
(Object Design)
 In the Object Designing phase of the Development process,

• the designer decides onto the classes in the system.

 The designer also decides on

• whether the classes need to be created from scratch,

• or any existing classes can be used as it is,

• or new classes can be inherited from them.


Object Oriented System Development
Life Cycle
(Implementation)
Implementation:

 During this phase, the class objects and the interrelationships


of these classes are translated

• and actually coded using the programming language.

 The databases are made and the complete system is given a


functional shape.
Object Oriented System Development
Life Cycle Contd..
(Implementation)

 The complete object oriented methodology revolves around


the objects identified in the system.

 When observed closely, every object exhibits some state and


behavior.

 The objects recognize and respond to certain events.


Object Oriented System Development
Life Cycle Contd..
(Implementation)
 For example, considering a Window on the screen as an object,

• the size of the window gets changed when resize button of


the window is clicked.

 Here, the ‘clicking of the button’ is an event

• to which the window responds by changing its state from


the old size to the new size.
Object Oriented System Development
Life Cycle Contd..

 While developing systems based on this approach,

• the analyst makes use of certain models to analyze and


depict these objects.
Advantages of
Object Oriented Modelling
 As compared to the conventional system development
techniques,

• Object oriented modeling provides many benefits.

 Some of these benefits are:

• Reusability

• Inheritance

• Data hiding
Advantages of
Object Oriented Modelling
(Reusability)
Reusability:

 The classes once defined can easily be used by other


applications.

 This is achieved by defining classes and putting them into a


library of classes

• where all the classes are maintained for future use.


Advantages of
Object Oriented Modelling Contd..
(Reusability)
 Whenever a new class is needed

• the programmer looks into the library of classes

❑ and if it is available, it can be picked up directly


from there.
Advantages of
Object Oriented Modelling
(Inheritance)
Inheritance:

 The concept of inheritance helps the programmer use the


existing code,

• where making small additions to the existing classes


can quickly create new classes.
Advantages of
Object Oriented Modelling Contd..
(Inheritance)
 Programmer has to spend less time and effort and they can
concentrate on other aspects of the system

• due to the Inheritance feature of the methodology.


Advantages of
Object Oriented Modelling
(Data Hiding)
Data Hiding:

 Data hiding is a technique that allows the programmer to

• hide the internal functioning of the objects from the users


of the objects.

 Data hiding separates the internal functioning of the object


from the external functioning.
Advantages of
Object Oriented Modelling Contd..
(Data Hiding)

 Thus provides the user flexibility to change the external


behavior of the object

• making the programmer code safe against the changes


made by the user.
Advantages of
Object Oriented Modelling Contd..

 The systems designed using this approach are closer to the real
world

• as the real world functioning of the system is directly


mapped into the system designed using this approach.
Models in
Object Oriented Methodology
 The Object Oriented Methodology supports and uses three basic
models:

• Object Model

• Dynamic Model

• Functional Model
Models in Object Oriented Methodology
(Object Model)
Object Model:

 This model describes the objects in a system and their


inter-relationships.

 This model observes all the objects as static and does not
pay any attention to their dynamic nature.
Models in Object Oriented Methodology
(Dynamic Model)
Dynamic Model:

 This model depicts the dynamic aspects of the system.

 It portrays the changes occurring in the states of various


objects

• with the events that might occur in the system.


Models in Object Oriented Methodology
(Functional Model)
Functional Model:

 This model basically describes the data transformations of the


system.

 This describes the flow of data and the changes that occur to
the data throughout the system.
Models in Object Oriented Methodology
Contd..
 The Object Model is most important of all

• as it describes the basic element of the system i.e., the


objects.

 all the three models together describe the complete functional


system.
Advantages of
Object Oriented Methodology
 Object Oriented Methodology closely represents the problem
domain.

• Because of this, it is easier to produce and understand


designs.

 The objects in the system are immune to requirement changes.

• Therefore, allows changes more easily.


Advantages of
Object Oriented Methodology Contd..

 Object Oriented Methodology designs encourage more re-use.

 New applications can use the existing modules,

• thereby reduces the development cost.

 Object Oriented Methodology approach is more natural.

 It provides nice structures for thinking and abstracting which


leads to modular design.

You might also like