Object-Oriented Programming- An Introduction
Lecture 1B
                 08/01/25
       Prof. Anita Agrawal
                                       2                    1/8/2025 7:09:01 PM
 Modern Programming Languages
 First   modern language- C
 High-Level   Statements were written in English
 Replaced    assembly code
 Faster,Efficient and more structured. Splits tasks into
  smaller ones.
 But however heavily dependent on procedure and
  syntax- hence huge complex programs, with clumsy code
                       Anita Agrawal   CS F213
                             3                           1/8/2025 7:09:01 PM
o Good for simple programs- But bigger the program, more
  lengthy and tougher to manage by programmers.
                                       Anita Agrawal   CS F213
                                              4           1/8/2025 7:09:01 PM
Procedural: More focus on functions
Object-Oriented: More focus Aon
                              simple real-world analogy
                                objects
                              Anita Agrawal   CS F213
                                           5                1/8/2025 7:09:01 PM
    Procedural Programming vs Object
    Oriented Programming
   The unit in procedural programming is function, and unit in object-
    oriented programming is class.
   Procedural programming concentrates on creating functions,
    while object-oriented programming starts from isolating the
    classes, and then looking for the methods inside them.
                           Anita Agrawal   CS F213
                                      6                1/8/2025 7:09:01 PM
  OOP why????
 Computer scientists have struggled for decades to design
  new languages and techniques for writing software.
 Procedural  languages existed but unfortunately, experience
  has shown that writing for large systems was virtually
  impossible.
 Small programs seemed to be no problem, but scaling to
  large systems with large programming teams could result in
  $100M projects that never worked and were thrown out.
                      Anita Agrawal   CS F213
                                    7                 1/8/2025 7:09:01 PM
 The only solution seemed to lie in writing small software
 units that could communicate via well-defined interfaces
 and protocols like computer chips.
 The units must be small enough that one developer can
 understand them entirely and most importantly the units
 must be protected from interference by other units so
 that programmers can code the units in isolation
 The Object-Oriented paradigm fits these guidelines as
 designers represent complete concepts or real world
 entities as objects with approved interfaces for use by
 other objects.
                    Anita Agrawal   CS F213
                                    8               1/8/2025 7:09:01 PM
 The first object-oriented language (called Simula), was
  designed in the 1960's, but object-oriented
  programming has only come into fashion in the 1990’s.
 Simula, short for "simulation language," was the first
  object-oriented programming language.
                    Anita Agrawal   CS F213
                                 9              1/8/2025 7:09:01 PM
OOP
 Object-Oriented Programming is a programming
       paradigm based on the concept of
            “objects” and “classes”
                 Anita Agrawal   CS F213
                                       10        1/8/2025 7:09:01 PM
Object Oriented Programming
Languages
Java, C++, C#, Ruby, etc.
                       Anita Agrawal   CS F213
                                         11         1/8/2025 7:09:01 PM
Object
   Is   a software bundle of related state and behavior.
   Software objects are often used to model the real-
    world objects that you find in everyday life.
                         Anita Agrawal   CS F213
                                        12              1/8/2025 7:09:01 PM
Class
    A    class is a blueprint or prototype from which
        objects are created.
    A    class models the state and behavior of the
        object.
         It represents the set of properties or methods that are
         common to all objects of one type.
                        Anita Agrawal   CS F213
                                           13             1/8/2025 7:09:01 PM
Object…..
 It is a basic unit of Object Oriented Programming and
  represents the real life entities.
 It consists of :
   State
   Behavior
   Identity
                           Anita Agrawal   CS F213
                                            14                      1/8/2025 7:09:01 PM
   State- It is represented by attributes of an object. It
    also reflects the properties of an object.
        These are the instance variables. Each object will have its
         unique set of instance variables.
        An object’s state is created by the values assigned to these
         instance variables
   Behaviour - It is represented by methods of an
    object. It also reflects the response of an object to
    other objects.
   Identity-It gives a unique name to an object and
    enables one object to interact with other objects.
                            Anita Agrawal   CS F213
                                        15        1/8/2025 7:09:01 PM
Method:
 A     class may contain many methods.
  Itis in methods that the logics are written, data is
   manipulated and all the actions are taken.
                        Anita Agrawal   CS F213
                       16          1/8/2025 7:09:01 PM
Class
members
            A Class
          Anita Agrawal -Dog
                         CS F213
                                17        1/8/2025 7:09:01 PM
An example of an Object- Dog
                Anita Agrawal   CS F213
                                         18               1/8/2025 7:09:01 PM
The 4 fundamental OOP Concepts
    1.   Data Abstraction
    2.   Encapsulation
    3.   Polymorphism (dynamic binding)
    4.   Inheritance (particular case of polymorphism )
                         Anita Agrawal   CS F213
                                              19                1/8/2025 7:09:01 PM
Data Abstraction
       It deals with hiding the details and showing the essential
        things to the user.
       In Java, abstraction is accomplished using Abstract classes
        and interfaces.
       An example of abstraction- A Banking application, where
        only required data fields are revealed to the user.
                              Anita Agrawal   CS F213
                           20                     1/8/2025 7:09:01 PM
Only necessary fields are available to the user
rest are hidden.
           Anita Agrawal   CS F213