Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Lukas18698yOOP is an attempt to project the real conceptual world on code. Procedural programming, on the other hand, is just a sequence of instructions. OOP is a network of objects working together to do a task.This way, an object can easily be replaced with another with a different functionality. This keeps maintenance costs in the long run low and greatly improves the readability.
-
fyroc58608yIn a simple form of saying it. OOP is a collection of objects for an entity that allows you to easily manipulate its data and relationships.
-
Pointer32388yDirectly from my Functional Programming Course:
OOP it's a paradigm based on the Imperative one. Imperative because you have to tell "how to do it", where in Declarative, you tell "what to do".
OOP relies on abstraction of the real world, taking objects, attributes, behaviour and interaction, into classes, methods, interfaces and variables/constants -
True OOP was invented with Smalltalk which took the ideas behind Simula and ran with them.
Smalltalk was all about riffing on the idea of a computer itself. Each object was a tiny machine that responded to messages and communicated in the same way.
C++ on the other hand missed these insights and went back to Simula. *sigh* -
ChappIO46938yAll the long explanations come back to one very simple theme: RESPONSIBILITY
TLDR:
An object does what is it RESPONSIBLE for.
An object expects other objects to do what they are RESPONSIBLE for.
Good software has clear RESPONSIBLE. -
ChappIO46938yLong:
I can make an xml database implementation in a single class and say it is responsible for the xml database.
This is not a clear responsibility so it is a sign of bad design.
Alternative:
I can make an XMLSerialization class that is responsible for serializing objects to xml.
I can make a FilePersistence class that is responsible for saving data to files.
I can make a XMLDatabase class that is responsible for the high level operations of my xml database system. -
@ChappIO isn't that more a description of the "Single Responsibility Principle" from SOLID than a description of OOP?
Related Rants
Question: can I describe OOP as "not in a loop, doesn't use interrupts" ?
I don't know much outside of OOP so describing it is like describing life, hard.
undefined
question
oop