INTRODUCTION TO OBJECT- ORIENTED PROGRAMMING (OOP)
1.1 Programming Techniques
OOP Techniques
Object-oriented programming is a method of programming based on a hierarchy of classes
Procedural Programming
Programming model which is derived from structured programming
OOA
Object-Oriented Approach
Java support OOA
Helps organize complex programs easily
Process of defining the problem in terms of real-world objects with which the system must interact
Clarifies and documents requirements of a system
OOD
Object-oriented Design
Defining the components,interfaces,objects,classes attributes and operations that will sastisfy the requirements
Implemtatation details generally includes
Restructuting the class data
Implementation of methods
Implementation of control
Implementation of associations
OOAD
Object-oriented analysis and design (OOAD)
combination of OOA and OOD
Applied throughout the development life cycle to foster better product quality and even encouraging stakeholder participation and communication
Advantage
Easy to understand
Easy to maintain
Provide reusability
Reduce the development time and cost
Improves the quality of the system due to program reuse
Disadvantages
all time it is not easy to determine all the necessary classes and objects required for a system
Most of our project development teams are familiar with traditional analysis and design
Without an explicit reuse procedure this methodology do not lead to successful reuse on a large scale
1.2 Object oriented concept & terminologies
Object,attribute,behaviour
Objects
An instance/specific example of a class
example:
If Cat is the class, then Betsy, Ladi, Patches, Jake, Radar, and Frosty are specific instances of the class found in my house
Attributes
Data value or state that describes an object and helps you to tell one object from another of the same class
Data values are called properties/member variable/member data but in UML,the proper term is attributes
Behavior
Operation/function that an object can perform
These might be called methods/member functions/even messages
Car object
A real world object and it has its own characteristics like colour of the car,size,model of the car,engine capacity and so on.
UML (Unified Modeling Language)
Graphical language designed to capture the artifacts of an OOAD process
Provides a comprehensive notation for communicating the requirements, behavior, architecture, and realization of an Object-Oriented design
Provides you with a way to create and document a model of a system
Structured Programming VS OOP
Structured programming
The importance is given to the sequence
Main component of a program is functions
Difficult to reuse the functions
OOP
The importance is given to data
Main component of a program is objects
Classes and objects can be reused easily
Features of OOP
Data Abstraction
Encapsulation
Inheritance
Polymorphism
Classes and object
Class
A class is a template or blueprint to create an object
Object
instance of a class