Recents in Beach

Object-Oriented Programming with python(OOP - Concept)

Introduction

Programming languages are emerging constantly, and so there are invented different
methodologies to easy the programming concept .Object-oriented programming is 
one such methodology(methods used in a particular area of study or activity) that has
become quite popular over past few years. 

This article talks about the features of Python programming language that makes it an
object-oriented programming language.


What is Object Oriented Programming(OOP)?

Object Oriented means "directed towards objects". In other words, it means functionally
directed towards modelling(representation of something) objects. OOP is one of the 
many techniques used for modelling complex systems by describing a collection of 
objects via their data and behavior.
The terms object-oriented analysis, object-oriented design, object-oriented analysis and  design, and object oriented programming. These are all highly related concepts under the general object-oriented umbrella.

Object Oriented Analysis(OOA) is the process of examining a problem, system or task
(that somebody wants to turn into an application) and identifying the objects and interactions 
between those objects. The analysis stage is all about what needs to be done.
 For example:
Website visitors need to be able to (italic represents actions/behaviour, bold represents objects):
review our history
Search Python in google search bar
browse, compare, and order products

Object-oriented design (OOD) is the process of converting such requirements into an
implementation specification. The designer must name the objects, define its behaviors, and formally specify which objects can activate specific behaviors on other objects. The design
stage is all about how things should be done.

Object-oriented programming (OOP) is the process of converting this perfectly defined design into a working program.Python, an Object Oriented programming (OOP), is a way of programming that focuseson using objects and classes to design and build applications. Major pillars of ObjectOriented Programming (OOP) are Inheritance, Polymorphism, Abstraction, ad Encapsulation.You will Learn about all this in this article.


Why to Choose ObjectOriented Programming?
Python was designed with an object-oriented approach. OOP offers the following
advantages:
  •  Provides a clear program structure, which makes it easy to map real world   problems and their solutions.
  •  Facilitates easy maintenance and modification of existing code.
  •  Enhances program modularity because each object exists independently and new features can be added easily without disturbing the existing ones.
  •  Presents a good framework for code libraries where supplied components can be easily adapted and modified by the programmer.
  • Imparts code reusability
Principles of Object Oriented Programming
In order for a programming language to be objectoriented, it should have a mechanism to enable working with classes and objects as well as the implementation and usage of the fundamental object-oriented principles and concepts namely:
 1. Inheritance,
 2. abstraction,
 3. encapsulation and
learn object oriented programming



Objects and classes

So, an object is a collection of data with associated behaviors. How do we differentiate
between types of objects?Apples and oranges are both objects but it is a common
adage(statement) that they cannot be compared.Apples and oranges aren't modeled very often in computer programming, but let's pretend.
To facilitate(easy an action) the example, we can assume that apples go in barrels and
oranges go in baskets
Now, we have four kinds of objects: apples, oranges, baskets, and barrels. In
object-oriented modeling, the term used for kind of object is class. So, in technical
terms, we now have four classes of objects.
What's the difference between an object and a class? Classes describe objects. They
are like blueprints for creating an object. You might have three oranges sitting on
the table in front of you. Each orange is a distinct object, but all three have the
attributes and behaviors associated with one class: the general class of oranges.

Specifying(describing) attributes and behaviors

In object-oriented programming, the term object loosely means a collection of data (attributes) with a set of methods(behavior) for accessing and manipulating those data.

We now have a grasp(understand) of some basic object-oriented terminology. Objects are
instances of classes that can be associated with each other. An object instance is a
specific object with its own set of data and behaviors; a specific orange on the table
in front of us is said to be an instance of the general class of oranges. That's simple
enough, but what are these data and behaviors that are associated with each object?

  • Data describes objects

Let's start with data. Data typically represents the individual characteristics of a
certain object. A class can define specific sets of characteristics that are shared by all
objects of that class. Any specific object can have different data values for the given
characteristics. For example, our three oranges on the table (if we haven't eaten any)
could each weigh a different amount. The orange class could then have a weight
attribute. All instances of the orange class have a weight attribute, but each orange
has a different value for this attribute. Attributes don't have to be unique, though; any
two oranges may weigh the same amount.
Data are action

Note : * denote all and 1 denote one item.


  • Behaviors are actions

Now Behaviors are actions that can occur on an object. The behaviors that can be performed on a specific class of objects are called methods. At the programming level, methods are like functions in structured programming, but they magically have access to all the data associated with this object. Like functions, methods can also accept parameters and return values Parameters to a method are a list of objects that need to be passed into the method that is being called (the objects that are passed in from the calling object are usually referred to as arguments). These objects are used by the method to perform whatever behavior or task it is meant to do. Returned values are the results of that task.

Each object in the system is a member of a certain class. These
classes specify what types of data the object can hold and what methods can be
invoked on it.

Object-oriented analysis and design is all about figuring out what those objects are
and how they should interact. The next section describes principles that can be used
to make those interactions as simple and intuitive as possible.



                                     Thank you

Post a Comment

0 Comments