Page 101 - Cs_withBlue_J_C11_Flipbook
P. 101

Characteristics of OOP Languages
                 Some of the characteristics of object-oriented programming language are as follows:
                 •  It follows a bottom-up approach.
                 •  More emphasis is given on data rather than procedure.
                 •  Programs are divided into objects.
                 •  Data cannot be accessed by external functions.

                 •  Functions are the ways used by objects to communicate with each other.
                 •  The most important characteristic is that new data and functions can be added as and when required without
                   making severe changes to the program. This is because it uses the concept of reusability where coding is written
                   once and can be used multiple times using different objects.

                 Drawbacks of OOP Languages
                 Some of the drawbacks of object-oriented programming language are as follows:

                 •  Programming structure becomes complex and also time-consuming.
                 •  There is no way to handle garbage collection automatically.
                 •  A lot of planning goes behind OOP programming as designing OOP programs is tricky.
                 •  Classes tend to be over-generalised.
                 •  Object-oriented program needs more lines of coding than procedure-oriented program.
                 •  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.2 PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING LANGUAGES
                 Object-oriented programming languages depend on the following principles:



                                                          Principles of Object-Oriented
                                                            Programming Languages




                                               Encapsulation  Data    Abstraction  Inheritance  Polymorphism









                 These  principles  are  also  called  “The  Four  Pillars”  (see  image  above)  of  object-oriented  programming  languages.
                 Let us study them in detail.

                 4.2.1 Encapsulation
                 Encapsulation is one of the basic concepts in OOP languages. It is the procedure of
                 combining data and functions together. As the only way to access the data are the   Methods   Variables
                 member functions, it keeps both data and functions safe from outside misuse and
                 interference; and thus leading to the important OOP idea of data hiding.                 Class
                                                                                                  Concept of Encapsulation
                 A real-life example of encapsulation is a capsule. In general, a capsule is a small case
                 or container, especially round or cylindrical in shape which protects the drug inside it from getting contaminated with
                 the dust particles from outside. Similarly, methods and variables are enclosed within a unit called class.



                                                                                                                        99
                                                                     Introduction to Object-Oriented Programming Using Java   99
   96   97   98   99   100   101   102   103   104   105   106