Basic pillars of java

 

BASIC PILLARS OF JAVA

 

š Procedure Oriented Programming (POP):

 In this programming approach many instructions are written to carry out the task. These instructions are grouped together to form functions. Emphasis is on the functions rather than data items.

š Characteristics of POP :

The characteristics of POP approach are as follows:-

1.      Emphasis on functions.

2.      Functions share global data.

3.      Data values can keep floating from one function to another.

4.      Use top to down approach programming.

š Drawbacks of POP :

The drawbacks of POP approach are as follows:- 

1.      It is not suitable to share complex problems.

2.      It is not applicable in real situations.

3.      As data values shares global data, we may require to make necessary changes in the function due to any change in data values.

š Object Oriented Programming (OOPs):

 OOPs is a modular approach, which allows data to be applied within stipulated program area. It also provides the reusability feature to develop productive logic, which means to give more emphasis on data.

 

š Characteristics of OOPs:

The characteristics of OOPs approach are as follows:-

1.      Emphasis on data items rather than functions.

2.      Use down to top approach programming.

3.      It makes complete program simpler by dividing it into number of objects.

4.      Objects can act as a bridge and float from one function to another function.

5.      We can easily modify the data without any change in function.

š Benefits of OOPs :

The benefits of OOPs approach are as follows:-

1.      We can extend the use of existing class through inheritance.

2.      Concept of data hiding promotes secure program.

3.      We can create multiple modules through objects.

4.      It is easy to maintain software complexity.

5.      Multiple instances of an object can be generated to co-exist without any interferences.

š Elements of OOPs:-

                                       

      @        OBJECTS : An object is a unique identity / entity which contains data and functions

                           (characteristics and behaviors) together in an OOPs language.

        Example: book, table, car, etc.

 

@       CLASSES : The class is a set of similar objects. Each object of a class possesses

                                  same attributes  and common behaviors defined within the same class.

 

Ø  ATTRIBUTES OF CLASS : It is a data value held by objects in a class.

Eg. class student

       ATTRIBUTES                    METHODS

Name                          

Class

Roll No.                                  Getdata()

DOB                                        Displaydata()

Blood Group

Address

Phone No.

 

                      Example : ‘Car’ is a class with its different models such as MARUTI, ZEN,

                                       INDICA, NANO, SANTRO which can be referred as objects with its

                                       particular characteristics and behaviors.

 

@         DATA ABSTRACTION : It refers to the act of representing essential features

                                            without including the background details.

 

                  Example :  You have a car and in order to drive it, we only know its external features

                                  such as steering, accelerator, clutch, brake and gears but we don’t know

                                   how it acts internally. In this way we know only essential features of car

                                   but don’t know the details of internal mechanism; this act of driving a car

                                   is known as abstraction.

 

       @   ENCAPSULATION : The system of wrapping up of data and function into a single

                                                  unit (class) is known as encapsulation.

 

Example : A TV set is operated by its remote control. All the functions of a TV set

                are by remote signals which are coming from remote control. The remote

                control of one TV set can’t be used for others TV set for various functions.

                Thus, a TV set’s activities are wrapped with remote signals of a specific

                remote control.

 

@      INHERITANCE : It is the process by which objects of one class can link and share

                               some common properties of objects from another class.

 

                  Example : ‘MENSURATION’ is a parent class with ‘Two Dimensional’ and ‘Three

                                    Dimensional’are child sharing some of the properties of its parent class.

 

      @      DYNAMIC BINDING : It is the process to link the function call with function

                                              signature at run time, i.e., during execution of a program.

 

     Example : Suppose we made a function ‘add()’ in a class addition. During runtime

                     add() function calls and the respective action will be performed this is called

                     dynamic binding.

 

@      POLYMORPHISM : It is the process of using a function for more than one

                                          purpose. It allows the use of different internal structure of the

                                          object by keeping the same external interface.

 

     Example :                                        

                                                    


In this example, Shape() will be used for different objects.

Comments