Tuesday, April 28, 2020

Java chapter-2


Object oriented programming.


A large application consists of components objects, which interact with each other. These components can be used to develop various applications. This is referred to as the object oriented approach to develop an application.
Ravi, a programmer develops a code to calculate the employees’ salaries by using object oriented language. This code is reused for all employees at all levels. Re usability of code enables Ravi to use the same code for employees at all levels.
Advantages of object oriented programming.
1.    Real world programming.
In OOP, you create a basic structure of a program and keep extending the functionality of the program as per the requirements. The object oriented approach models the real world more accurately than the conventional, procedural approach.
2.    Reusability of code
In the object-oriented approach, you build classes, which can be used by several applications.
3.    Modularity of code.
Another advantage of object oriented programming is its modularity. It means that an object can be maintained independently of other objects. All these objects are independent of each other and maintained separately. You can make modification in one application without affecting the functionality of other objects.
4.    Resilience to change.
Object oriented programming also enables you to evolve various versions of software. When a change is suggested, the old system need not be completely abandoned and re-built from scratch.
5.    Information hiding
Objects provide the benefit of information hiding. Only a limited access to information is provided to the user. Information hiding enables data security in a program. An end user is given an access to the information only to the data that is required to run an application and not to the internal working of the application.

Class and objects.
A class defines structure and behavior of an object or set of objects.
Objects are the basic building block of object oriented programming. The concept of object oriented methodology is based on objects. You create independent entities that can be reused across various programs. Objects have the following characteristics:
State: The state of an object is indicated by set of attributes and the values of these attributes. For example you design an online shopping site for books, each book, which is an object in the program, has its size, number of pages, type of binding, and its shipping details.
Behavior: The behavior of an object refers to a change of its state over a period of time. For example, in the online shopping site, when you place an order for a book, the status of book might change from available to sold out. The changed status of the book its behavior.
Identity: Each objects has a unique identity, just as each person has a unique Identity. For example all the books may have same title, author, price etc but have a unique book id.

Thank you.

Muthu karthikeyan, Madurai
Contact: 91 96293 29142.
Visit my you tube channel: programming Digest.





No comments:

Post a Comment