Meaning of "the code acting on the data" and "the data controlling access to the code"



  • This is a purely theoretical question about programming.

    I would like to know through an example simple (response with complement of figures, drawings, etc.), the meaning of two sentences for two types of programming languages:

    • structured: "the code acting on the data"
    • object-oriented: "the data controlling access to the code"


  • Not everyone agrees with that, but it's just a way of thinking that makes little difference in the end.

    I don't know where you saw that comparison, but she's already getting wrong. https://pt.stackoverflow.com/q/211768/101 . And https://pt.stackoverflow.com/q/104340/101 . So it doesn't make much sense to try to counter these two ideas.

    The same goes for https://pt.stackoverflow.com/q/127121/101 , which makes a little more sense to contrapose, but not much. It makes no sense to choose one or another, they are complementary. A https://pt.stackoverflow.com/q/88546/101 is a https://pt.stackoverflow.com/q/141624/101 (in fact some people consider that orientation is even paradigm).

    The "opposition" of the orientation the object is the https://pt.stackoverflow.com/q/195069/101 .

    It is now seen that much is said about the subject without much knowledge of what it is really about. Much less makes sense to separate language in https://pt.stackoverflow.com/q/122430/101 or object-oriented. This is simply a wrong concept.

    Almost every time the code of people is imperative and with some use of orientation to the object.

    What you're probably wanting to say with these phrases is that the purest imperative code you call actions that will act on data and the object-oriented code you take the data and call an action upon it.

    Imperative procedural:

    substring("abc", 3, 1)
    

    Object-oriented:

    "abc".substring(3, 1)
    

    https://github.com/maniero/SOpt/blob/master/Portugol/OOSyntax.ptg .

    So it turns out to be just who is invoked first, the behavior, or the state. Then in the first code substring() will act on the text "abc" (procedurally acts on the object), while in the second you have the text "abc" controlling access to code substring() (the object calls the procedure).

    Outside help an IDE fragment more easily what you can do with the data, it changes very little and it comes to be silly to fight more for one or another style. The orientation of the object has some advantages, as well as has disadvantages also, in other parts.

    This ease comes to be even worse because many people think that the fact that it is easy to find the methods that the object can perform does not require you to study the documentation, and it ends up making much worse codes. Worse, by wanting to do what's fashionable anyway she ends up doing what she doesn't understand.

    It can be useful:

    • https://pt.stackoverflow.com/q/13372/101
    • https://pt.stackoverflow.com/q/104340/101
    • https://pt.stackoverflow.com/q/215679/101
    • https://pt.stackoverflow.com/q/108047/101



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2