Académique Documents
Professionnel Documents
Culture Documents
Programming (OOP)
JAVADr Vish Kallimani
Road map
Programming languages
Software Engineering
OOP
JAVA
Objects and Class
Conventional Programming
Modular
programming
Bottom-up design
the approach is to start "at the bottom,"
with problems that you already know how
to solve
From there, you can work upwards towards
a solution to the overall problem
SOFTWARE ENGINEERING
PROGRAMS MUST BE DESIGNED.
The discipline calledsoftware engineeringis
concerned with the construction of correct, working,
well-written programs.
The software engineer tries to use accepted and
proven methods for analyzing the problem to be
solved and for designing a program to solve that
problem.
Modules that could support this kind of informationhiding became common in programming languages
in the early 1980s
Since then, a more advanced form of the same idea
has more or less taken over software engineering.
This approach is calledobject-oriented programming,
The central concept of object-oriented programming
is theobject, which is a kind of module containing
data and subroutines.
an object is a kind of self-sufficient entity that has an
internalstate(the data it contains) and that can
respond tomessages(calls to its subroutines).
9
In CRISP OOP :
To eliminate flaws of procedural approach.
Treats the data as a critical element & does not
allow it to flow freely around the system.
Allows to decompose a problem in to a no of
entities called objects and then build data and
functions ( Methods ) around these entities .
The combination of data and methods make up
an object.
11
(contd..)
Data structure are designed such that
they characterize the objects
Methods that operate on data of an
object are tied together in data structure.
Data is hidden and can not be accessed
by the external functions.
Objects may communicate with each
other through methods
12
Example:
Consider a drawing program that lets the user draw lines,
rectangles, ovals, polygons, and curves on the screen.
In the program, each visible object on the screen could be
represented by a software object in the program.
There would be five classes of objects in the program, one for
each type of visible object that can be drawn.
All the lines would belong to one class,
all the rectangles to another class, and so on.
14
15
In Crisp
Class: Collection of objects is called class. It is a logical entity.
Inheritance: When one object acquires all the properties and behaviours of parent
object
Polymorphism: When one task is performed by different ways.
In java, we use method overloading and method overriding to achieve
polymorphism.
Abstraction: Hiding internal details and showing functionality is known as
abstraction.
For example: phone call, we don't know the internal processing.
In java, we use abstract class and interface to achieve abstraction.
Encapsulation: Binding (or wrapping) code and data together into a single unit is
known as encapsulation.
For example: capsule, it is wrapped with different medicines.
16
Features of Java:
Benefits of OOP
Quality Products
Lower maintenance cost.
Through Inheritance
redundant code can be
eliminated
Improves security due to
data hiding
Multiple objects can
coexist without
interference.
Can be easily updated
from small to large
programs.
Compiled and
interpreted
Platform independent
Object Oriented
Robust and secure
Distributed
Simple and small
Multi threaded and
interactive
High Performance
Dynamic and
extensible
Internet (server side
and browser side,
Real time Java
Mobile communications
Applications :
Real time systems, Internet , Simulation and
17
JAVA
either
Stand alone
applications
or
Web Applets
(Internet)
Object
An Object may be a person, Place , Account ,user defined
data..
Objects have states and behaviors.
Each object contain code and data to manipulate
the data.
Objects can interact without knowing each others
code and data.
20
INSTANCE
An object that belongs to a class is said to be an
instance of that class.
The variables that the object contains are called
instance variables.
The subroutines that the object contains are called
instance methods.
21
Instance variables :
Instance variables are declared in a class, but
outside a method, constructor or any block.
When a space is allocated for an object in the heap
a slot for each instance variable value is created.
Instance variables are created when an object is
created with the use of the key word 'new' and
destroyed when the object is destroyed.
Instance variables can be declared in class level
before or after use.
Access modifiers can be given for instance
variables.
The instance variables are visible for all methods,
constructors and block in the class.
CLASS
its a specification or a pattern which we define
and every object we define will follow that pattern.
What does Java Class Consist
When we create class in java the first step is
keyword class and then name of the class or
identifier we can say.
Next is class body which starts with curly braces
{} and between this all things related with that
class means their property and method will come
here.
23
CLASS is:
The entire set of data and code of an object can be
made a user defined type using the concept called the
class.
A class
Object
as a Data Type
as a variable type
: Class
Objects
Fruit,
: Mango , Apple , Orange .
CLASS
Template is:
Class (name of the class) {
(Here define member of class)
}
26
CLASS..
Consider a simple class whose job is to group
together a few static member variables. For
example, the following class could be used to store
information about the person who is using the
program:
class UserData {
static String name;
static int age;
}
In Java, no variable can ever hold an object.
A variable can only hold a reference to an
object.
27
28
Summary
Conventional programming and their limitations. OOP concepts
THANK YOU
29