ITFT - Oops


Published on


Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

ITFT - Oops

  1. 1. Fundamentals of OOP
  2. 2. Intro • Object-oriented programming (OOP) is a computer science term used to characterize a programming language that began development in the 1960’s
  3. 3. CONT…. • It consider the programming simulated to real world objects. • It help in programming approach in order to built robust user friendly and efficient software's and provide the efficient way to maintain real world software's.
  4. 4. CLASS • The first concept that you will need to learn is called a "class.“ • A class creates the attributes of a thing, and it will also define the processes that the thing can carry out. • For example, a class called "cats"
  5. 5. OBJECT An object can be defined as a specific instance of a class. As an example, while the class Cats will provide all the attributes that are found in all cats, the "object" named “HARLEY” is a specific cat. While it shares the same attributes which are found in all cats, it has fur with a unique color.
  6. 6. Example In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.
  7. 7. Object • An object stores its state in fields and exposes its behavior through methods. • Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication
  8. 8. CONT….. • By attributing state and providing methods for changing that state, the object remains in control of how the outside world is allowed to use it. • For example, if the bicycle only has 6 gears, a method to change gears could reject any value that is less than 1 or greater than 6.
  9. 9. INHERITANCE • As the name suggests, inheritance means to take something that is already made. • It is one of the most important feature of Object Oriented Programming. • It is the concept that is used for reusability purpose. Inheritance is the mechanism through which we can derived classes from other classes.
  10. 10. CONT…. • The derived class is called as child class or the subclass or we can say the extended class and the class from which we are deriving the subclass is called the base class or the parent class. • To derive a class in java the keyword extends is used.
  11. 11. INTERFACE • An interface is a collection of abstract methods. • A class implements an interface, thereby inheriting the abstract methods of the interface. • An interface is not a class. Writing an interface is similar to writing a class, but they are two different concepts.
  12. 12. CONT…. • A class describes the attributes and behaviors of an object. An interface contains behaviors that a class implements. • Unless the class that implements the interface is abstract, all the methods of the interface need to be defined in the class.
  13. 13. PACKAGES • A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. • Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time.
  14. 14. CONT… • Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality. • A package provides a unique namespace for the types it contains. • Classes in the same package can access each other's package- access members.
  15. 15. DATA ABSTRACTION • Data abstraction refers to, providing only essential information to the outside word and hiding their background details . • Data abstraction is a programming technique that relies on the separation of interface and implementation.
  16. 16. EXAMPLE…. Example of a TV which you can turn on and off, change the channel, adjust the volume, and add external components such as speakers, VCRs, and DVD players. BUT we do not know it's internal detail that is, you do not know how it receives signals over the air or through a cable, how it translates them, and finally displays them on the screen.
  17. 17. ENCAPSULATION It is an attribute of object design. It means that all of the object's data is contained and hidden in the object and access to it restricted to members of that class.
  18. 18. POLYMORPHISM • It refers to a programming language’s ability to process objects differently depending on their data type or class. • It is the ability to redefine methods for derived classes.
  19. 19. CONT… For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results. Polymorphism is considered to be a requirement of any true object-oriented programming language (OOPL).
  20. 20. DATA HIDING Data Hiding is an aspect of Object Oriented Programming (OOP) that allows developers to protect private data and hide implementation details. In this tutorial we examine basic data hiding techniques in Java.