Can you please explain OOP in simple words? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Can you please explain OOP in simple words?

26th Jan 2017, 7:43 AM
Kumar
27 Answers
+ 31
Programming is of two types. 1) Procedure Oriented Programming (POP) 2) Object Oriented Programming (OOP) In POP, program is divided into functions. In OOP, program is divided into objects. In POP, data moves between functions. In OOP, data moves between objects. In POP, data is less secure. In OOP, data is more secure. So, OOP is preferred to POP.
26th Jan 2017, 2:36 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 11
OOP stands for Object Oriented Programming OOP is a Programming Style - in which multiple lines of code is wrapped into small small modules (classes, methods etc) OOP style makes program easily understandable and control the flow of data exchange Code written in OOP style with proper comments enhances readability, reusability, maintainability of code; that's why most of programmers like OOP style...! If U wanna learn OOP style, first clear some basic concepts like objects, classes, methods, inheritance
26th Jan 2017, 2:53 PM
codeDEcode
codeDEcode - avatar
26th Jan 2017, 2:46 PM
Filip
Filip - avatar
+ 9
Imagine an object, for example a ball, It has a name and other attributes like material ,cost or whatever, also they have behaviour like moving, bouncing... that are the methods. Also they came from a factory that has a constructor of balls to create new balls objects. I learned like this but with a car example 😝 In the future you will be able to abstract the concepts, but for starting I think you can imagine something like that
26th Jan 2017, 9:06 PM
C.E.
C.E. - avatar
+ 8
Old programmes ran code line by line, known as procedural, this was fine until more complex programs came to be, this meant code had to run and jump from one end to the next with anchors or lables for each piece of code, or function, so then OOP came to be, where you have your main code which calls other pieces of code as required, thus it doesn't have to read and process code its not using at that specific moment. If you make a sandwich you decide what you want on it, it doesn't have to be in a specific order, and if you dont want cheese, you dont put it on, its still available in the fridge, so "call" it when you need it.
26th Jan 2017, 5:42 PM
Andre van Rensburg
Andre van Rensburg - avatar
+ 7
object oriented programming is intended to bring programming closer to thinking about the real world.
26th Jan 2017, 5:40 PM
Kelvin Gathungu
Kelvin Gathungu - avatar
+ 5
OOP (Object Oriented Programming) is a simple way of describing how to navigate through the heirachy of a class. For example, putting music files in music folder and video file in videos folder, then putting both music and video folder in a media folder. If you decide to play a music file, you will have to navigate through the media folder to the music folder and to the music file u want to play. Thats the easiest analogy i can come up with
27th Jan 2017, 12:11 AM
rAsHtElL
rAsHtElL - avatar
+ 5
POP is like working with sculpting clay, you start from raw box-shaped clay and ends up with a sophisticated sculpture in a procedure. OOP is like playing with LEGOs, you assemble different objects together to build a house. You can use an object as much as you like, you can first build the roof and then walls. Gathering all needed objects without any order and put them together to build the result.
27th Jan 2017, 7:18 AM
Mohammad Mehrabi
Mohammad Mehrabi - avatar
+ 5
If to compare to a real world: Let's say you want to make a wooden table. The wooden table is the main method of your project. Now in order to make that table, you need Tools (Objects) like saw and hammer and nails etc. You need the saw to cut the wood, you need the hammer and the nails to put the cut wooden pieces together. Those can be tools you bought from the store (built in objects) or tools you made by yourself (objects writted by you). As in program, whatever you want to write, you need tools. In java for instance, you need the Scanner object if you want to take input from the user. you use the Formatter object if you want to write to a file etc, etc... Hope it helped understanding the concept.
27th Jan 2017, 7:52 AM
Shahar Levy
Shahar Levy - avatar
+ 3
An Object is a bit of code separated from the main code which has attributes (name, lastName, age, etc.) and methods (changeName, changeLName, changeAge, etc.), it's very useful for organizing and structuring your program in a more human-like-thinking way. Like in real life you have an Object (lets take a closet), a closet has attributes like "are the doors open?" (boolean doorOpen) and you have a method for closing and opening the doors "take the door and open/close it". You can do anything you want with your closet if you assign the attributes (size, weight, color, built year, etc)
26th Jan 2017, 4:41 PM
Daniel F.
Daniel F. - avatar
+ 3
a kind of programming that try to keep program close to the real world. example: suppose a car in real world. car can be a class in program. but car is just a definition and you can not use it unless you make an physical car from this definition. this physical car is the same as object in oop.
26th Jan 2017, 9:48 PM
Marjan Basiri
Marjan Basiri - avatar
+ 2
Thank you all for answering this question in much simpler way. Okay, so this is how I understood OOP: Let's say you own a car, which is obviously an object and one that you own. You don't have just any car. You have a particular car that was manufactured in a factory, maybe in California or in London or may be some place else. You car has a identification number that uniquely identifies your car. Here, your car is an instance of a car. Car is the name of the class from which this instance was created. So when new car is made, a new instance from the class of cars is created and each instance of car is referred to as an object.
27th Jan 2017, 7:48 AM
Kumar
+ 2
OOP is like when u have a banana in your pants and you show the shape of it in your pants... but people might think that is your ... . So its private or protected banana only for you to know. if you want to tell somebody about your banana, you make it public for everyone 😂😂😂
28th Jan 2017, 2:51 PM
Catalin Popinciuc
Catalin Popinciuc - avatar
+ 2
In simple words OOP means to map real time entity into a programming language. Everything around us are objects having characteristics and behaviour. OOP allows us to map such objects programmatically. Here the focus is not on functions but on the data security.
29th Jan 2017, 11:21 AM
pawan nadar
pawan nadar - avatar
+ 1
Object-oriented programming (OOP) is a programming language model organized around objects rather than actions; Objects are instances of classes, are used to interact with one another. But, The goals of object-oriented programming are: Increased understanding. Ease of maintenance. Ease of evolution.
27th Jan 2017, 5:05 PM
Jaydeep Katariya
+ 1
oop: just everything in oop is an object if it has data , a simple example can be facebook , each button and and all bars and etc... which has their own functions and attributes are objects
27th Jan 2017, 7:51 PM
Negin yousefi
+ 1
its like cookie template is class and cookies are object
28th Jan 2017, 3:08 PM
Rana Asif
Rana Asif - avatar
+ 1
oops provides data security in this week have class, inheritance, constructor, destructor, inline function,polymorphism public,private and protected variables and good bottom top approach
29th Jan 2017, 7:47 AM
Hardik Chaturvedi
Hardik Chaturvedi - avatar
+ 1
Try to imagine that a complex problem is splitted into individual elements called objects, that can handle some specific tasks in solving a complex problem. Like in a manufacture, they got some input and work on them.
29th Jan 2017, 12:06 PM
Csaba Koppány
Csaba Koppány - avatar
0
OOP concept is very simple where you have a Class of which you create an Object, usually OOP provides developer a functionality of 1) Abstraction i.e. hiding implementation showing only features , 2) Encapsulation i.e. wrapping of data or code into a single unit, 3) Polymorphism i.e. ability of an object to take many form, 4) Inheritance i.e. inheriting properties from one class to another class.
27th Jan 2017, 10:57 AM
Raghvendra Choudhary
Raghvendra Choudhary - avatar