Page 129 - Computer science 868 Class 12
P. 129

•  It needs more memory to execute at a high speed. Thus, its execution is slower than the conventional encoding system.
                 •  It requires intensive testing.


                     4.3 COMPONENTS OF OBJECT-ORIENTED PROGRAMMING
                 The components or the building blocks of object-oriented programming include the following:
                 •  Objects
                 •  Classes
                 •  Methods
                 •  Instances

                 4.3.1 Objects
                 In Object-Oriented Programming (OOP), there is a concept of breaking each problem into small components. These
                 components are called Objects. It is an individual instance of a class for which storing place is allocated. They consist
                 of methods and properties to make a particular type of data useful.

                                                               Definition

                      An object is a unique entity that contains properties, methods and events together in an Object-Oriented Programming
                      language.



                 Thus, an object consists of:
                 •  A unique identity: Each object is different from the other even if two objects’ states are identical.
                 •  State/Properties/Attributes: This describes how the object looks like and the different properties it has.
                 •  Behaviour: The object does reflect the behaviour of the object.

                 For example, in a real-life situation, a vehicle is an object that has properties like colour, model, brand name, fuel type,
                 etc., and behaviours like, it runs. So, these properties and behaviours make an object (i.e., vehicle here). Similarly, in
                 computer world, while dealing with a program such as student’s examination system, the object is the student whose
                 marks are to be generated. This object has some characteristics and  behaviours which are illustrated below:

                                                          Software Object (Student)

                                    Characteristics (Data Members)             Behaviours (Methods)
                              1.  Name of the student                 1.  Calculating the total marks
                              2.  Class of the student                2.  Calculating the average marks
                              3.  Roll number
                              4.  Marks in Science

                              5.  Marks in English
                              6.  Marks in Computer

                 4.3.2 Classes
                 Classes in Java are non-primitive/user-defined data types that act as a blueprint for creating individual objects of the
                 same type.
                 In other words, a class is a set of instructions that build a specific type of object. As we can create objects using a
                 class, and hence a class may refer to as a  Factory of Objects. A class also includes the characteristics (attributes) and
                 behaviour (methods).



                                                                                                                       127
                                                                                                   Programming in Java  127
   124   125   126   127   128   129   130   131   132   133   134