5
brod
8y

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.

Comments
  • 9
    OOP 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.
  • 1
    @Lukas wow, that's a really concise and relatable description. Thanks Lukas.
  • 0
    In 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.
  • 1
    Directly 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
  • 0
    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*
  • 0
    All 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.
  • 0
    Long:

    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.
  • 0
    @ChappIO isn't that more a description of the "Single Responsibility Principle" from SOLID than a description of OOP?
  • 0
    @linux-colonel Yes but I feel that it is what captures the essence of OOP.
Add Comment