際際滷

際際滷Share a Scribd company logo
Md. Al-Imran
Lecturer
Department of Computer Science & Engineering
Dhaka International University
Bangladesh

 Define OOP
 OOP Vs. Structured Programming
 Main principle of OOP
 Encapsulation
 Abstraction
 Inheritance
 Polymorphism
 Overview
Contents
 Object-oriented programming is a method of
implementation in which programs are organized as
cooperative collections of objects, each of which
represents an instance of some class, and whose classes
are all members of one or more hierarchy of classes united
via inheritance relationships.
What is OOP ?

Structure Programming Object Oriented Programming
Top to Bottom Design Object focused design
Structure determines execution flow Conversion determines execution flow.
Moderately complex program Very Complex Program
Less data security More security
Less flexible More flexible
Less reusability More reusability
Less abstraction More abstraction
Structure Programming Vs. OOP

Reusability
Platform Independent
Security
Client/Sever Application
Graphical User Interface
Design Pattern
Portability (WORA)
Why Java?

 Write Ones Run Anywhere
WORA

 Fundamental Principles of Object Oriented Programming:
1. Encapsulation.
2. Abstraction.
3. Inheritance.
4. Polymorphism.
Main principle of OOP

 Encapsulation is the mechanism that binds together
code and the data it manipulates, and keeps both
safe from outside interference and misuse.
Encapsulation

i. Protection
ii. Consistency
iii. Allows change
Advantages of Encapsulation
 abstraction is a process of hiding the implementation
details from the user, only the functionality will be
provided to the user. In other words, the user will have the
information on what the object does instead of how it
does.
 In Java, abstraction is achieved using Abstract classes and
interfaces.
Abstraction

 An abstract class is a class that is declared with abstract keyword.
 An abstract method is a method that is declared without an
implementation.
 An abstract class may or may not have all abstract methods. Some
of them can be concrete methods.
 A method defined abstract must always be redefined in the subclass,
 Any class that contains one or more abstract methods must also be
declared with abstract keyword.
 There can be no object of an abstract class. That is, an abstract class
can not be directly instantiated with the new operator.
Abstract Class Vs. Abstract
Method

 Inheritance is the process by which one object acquires the properties
of another object.
 A class that is derived from another class is called a subclass(also a
derived class, extended class, or child class).
 The class from which the subclass is derived is called a super class
(also a base class or a parent class).
Inheritance

 The sub-class inherits the base class data members and member
functions.
 A sub-class has all data members of its base-class plus its own.
 A sub-class has all member functions of its base class (with changes)
plus its own.
Contd

Inheritance has a lot of benefits
 Extensibility
 Reusability
 Provides abstraction
 Eliminates redundant code
 Use inheritance for building a relationships
E.g. dog is--a animal (dogs are kind of animals)
Benefits of Inheritance
 Polymorphisms comes from Greek word that means 'many forms'.
 More precisely Polymorphisms means the ability to request that
the same methods be performed by a wide range of different types
of things.
Polymorphism

 It is achieved by using many different techniques named
method overloading and method overriding.
Contd

 Discuss about OOP.
 Differentiate Structure Programming and OOP.
 Main principles of OOP.
 Encapsulation.
 Abstraction.
 Inheritance.
 Polymorphism.
Overview
OOP Introduction with java programming language

More Related Content

OOP Introduction with java programming language

  • 1. Md. Al-Imran Lecturer Department of Computer Science & Engineering Dhaka International University Bangladesh
  • 2. Define OOP OOP Vs. Structured Programming Main principle of OOP Encapsulation Abstraction Inheritance Polymorphism Overview Contents
  • 3. Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships. What is OOP ?
  • 4. Structure Programming Object Oriented Programming Top to Bottom Design Object focused design Structure determines execution flow Conversion determines execution flow. Moderately complex program Very Complex Program Less data security More security Less flexible More flexible Less reusability More reusability Less abstraction More abstraction Structure Programming Vs. OOP
  • 5. Reusability Platform Independent Security Client/Sever Application Graphical User Interface Design Pattern Portability (WORA) Why Java?
  • 6. Write Ones Run Anywhere WORA
  • 7. Fundamental Principles of Object Oriented Programming: 1. Encapsulation. 2. Abstraction. 3. Inheritance. 4. Polymorphism. Main principle of OOP
  • 8. Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. Encapsulation
  • 9. i. Protection ii. Consistency iii. Allows change Advantages of Encapsulation
  • 10. abstraction is a process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words, the user will have the information on what the object does instead of how it does. In Java, abstraction is achieved using Abstract classes and interfaces. Abstraction
  • 11. An abstract class is a class that is declared with abstract keyword. An abstract method is a method that is declared without an implementation. An abstract class may or may not have all abstract methods. Some of them can be concrete methods. A method defined abstract must always be redefined in the subclass, Any class that contains one or more abstract methods must also be declared with abstract keyword. There can be no object of an abstract class. That is, an abstract class can not be directly instantiated with the new operator. Abstract Class Vs. Abstract Method
  • 12. Inheritance is the process by which one object acquires the properties of another object. A class that is derived from another class is called a subclass(also a derived class, extended class, or child class). The class from which the subclass is derived is called a super class (also a base class or a parent class). Inheritance
  • 13. The sub-class inherits the base class data members and member functions. A sub-class has all data members of its base-class plus its own. A sub-class has all member functions of its base class (with changes) plus its own. Contd
  • 14. Inheritance has a lot of benefits Extensibility Reusability Provides abstraction Eliminates redundant code Use inheritance for building a relationships E.g. dog is--a animal (dogs are kind of animals) Benefits of Inheritance
  • 15. Polymorphisms comes from Greek word that means 'many forms'. More precisely Polymorphisms means the ability to request that the same methods be performed by a wide range of different types of things. Polymorphism
  • 16. It is achieved by using many different techniques named method overloading and method overriding. Contd
  • 17. Discuss about OOP. Differentiate Structure Programming and OOP. Main principles of OOP. Encapsulation. Abstraction. Inheritance. Polymorphism. Overview