0% found this document useful (0 votes)
50 views5 pages

Object Oriented Programming Class 12 EM

Object oriented programming organizes software around data or objects rather than functions and logic. The main building blocks are classes, which act as blueprints for objects, objects which are instances of classes, methods which describe object behaviors, and attributes which represent object state. The main principles are encapsulation, which hides implementation details, abstraction which hides unnecessary details, inheritance which allows code reuse, and polymorphism which allows objects to take on multiple forms. Popular object oriented languages include Java, Python, and C++.

Uploaded by

lakshyapatel49
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
50 views5 pages

Object Oriented Programming Class 12 EM

Object oriented programming organizes software around data or objects rather than functions and logic. The main building blocks are classes, which act as blueprints for objects, objects which are instances of classes, methods which describe object behaviors, and attributes which represent object state. The main principles are encapsulation, which hides implementation details, abstraction which hides unnecessary details, inheritance which allows code reuse, and polymorphism which allows objects to take on multiple forms. Popular object oriented languages include Java, Python, and C++.

Uploaded by

lakshyapatel49
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 5

Object oriented programming

Class-12

Object oriented programming-

Object-oriented programming (OOP) is a computer programming model


that organizes software design around data, or objects, rather than
functions and logic. An object can be defined as a data field that has
unique attributes and behavior.

structure of object-oriented programming


The structure, or building blocks, of object-oriented programming include
the following:

 Classes are user-defined data types that act as the blueprint for
individual objects, attributes and methods.

 Objects are instances of a class created with specifically defined data.


Objects can correspond to real-world objects or an abstract entity. When
class is defined initially, the description is the only object that is defined.

 Methods are functions that are defined inside a class that describe the
behaviors of an object. Each method contained in class definitions starts
with a reference to an instance object. Additionally, the subroutines
contained in an object are called instance methods. Programmers use
methods for reusability or keeping functionality encapsulated inside one
object at a time.

 Attributes are defined in the class template and represent the state of
an object. Objects will have data stored in the attributes field. Class
attributes belong to the class itself.
main principles of OOP
Object-oriented programming is based on the following principles:

 Encapsulation. This principle states that all important information is


contained inside an object and only select information is exposed. The
implementation and state of each object are privately held inside a
defined class. Other objects do not have access to this class or the
authority to make changes. They are only able to call a list of public
functions or methods. This characteristic of data hiding provides greater
program security and avoids unintended data corruption.

 Abstraction. Objects only reveal internal mechanisms that are relevant


for the use of other objects, hiding any unnecessary implementation
code. The derived class can have its functionality extended. This
concept can help developers more easily make additional changes or
additions over time.

 Inheritance. Classes can reuse code from other classes. Relationships


and subclasses between objects can be assigned, enabling developers
to reuse common logic while still maintaining a unique hierarchy. This
property of OOP forces a more thorough data analysis, reduces
development time and ensures a higher level of accuracy.

 Polymorphism. Objects are designed to share behaviors and they can


take on more than one form. The program will determine which meaning
or usage is necessary for each execution of that object from a parent
class, reducing the need to duplicate code. A child class is then created,
which extends the functionality of the parent class. Polymorphism allows
different types of objects to pass through the same interface.
examples of object-oriented programming languages
While Simula is credited as being the first object-oriented programming
language, many other programming languages are used with OOP
today. But some programming languages pair with OOP better than
others. For example

For example, popular pure OOP languages include:

 Ruby

 Scala

 JADE

 Emerald

Programming languages designed primarily for OOP include:

 Java

 Python

 C++

Other programming languages that pair with OOP include:

 Visual Basic .NET

 PHP

 JavaScript

Advantages of OOP-
Benefits of OOP include:

 Modularity. Encapsulation enables objects to be self-contained, making


troubleshooting and collaborative development easier.
 Reusability. Code can be reused through inheritance, meaning a team
does not have to write the same code multiple times.

 Productivity. Programmers can construct new programs quicker


through the use of multiple libraries and reusable code.

 Easily upgradable and scalable. Programmers can implement system


functionalities independently.

 Interface descriptions. Descriptions of external systems are simple,


due to message passing techniques that are used for objects
communication.

 Security. Using encapsulation and abstraction, complex code is hidden,


software maintenance is easier and internet protocols are protected.

 Flexibility. Polymorphism enables a single function to adapt to the class


it is placed in. Different objects can also pass through the same
interface.
Disadvantages of OOP ()
The object-oriented programming model has been criticized by developers
for multiple reasons. The largest concern is that OOP overemphasizes the
data component of software development and does not focus enough on
computation or algorithms. Additionally, OOP code may be more
complicated to write and take longer to compile.

Alternative methods to OOP include:

 Functional programming. This includes languages such as Erlang and


Scala, which are used for telecommunications and fault tolerant
systems.

 Structured or modular programming. This includes languages such


as PHP and C#.

 Imperative programming. This alternative to OOP focuses on function


rather than models and includes C++ and Java.
 Declarative programming. This programming method involves
statements on what the task or desired outcome is but not how to
achieve it. Languages include Prolog and Lisp.

 Logical programming. This method, which is based mostly in formal


logic and uses languages such as Prolog, contains a set of sentences
that express facts or rules about a problem domain. It focuses on tasks
that can benefit from rule-based logical queries.

You might also like