M
M
Mikhail2018-02-08 00:49:49
OOP
Mikhail, 2018-02-08 00:49:49

OOP in C# from Alan Kay's point of view?

It is often said that modern OOP is not OOP as the founding fathers intended it to be. I looked at the basic principles of OOP from the point of view of Alan Kay and I can not understand what he wanted. I will give specific examples:
1) Everything is an object
Nu. In C#, everything seems to be the same. Even if you execute: , then you can then call the method , although it seems to be just a number. 2) Calculations are carried out by interaction (data exchange) between objects, in which one object requires another object to perform some action. Objects communicate by sending and receiving messages. The message is a request to perform an action, complete with a set of arguments that may be needed when performing the Yes action. This is not.int a= 1ToString()

3) Each object has an independent memory, which consists of other objects
. I don’t understand what it is about at all
4) Each object is a representative of a class that expresses the general properties of objects (such as integers or lists)
It is. If you create two objects of a class, then the same methods will be available to them.
5) The behavior (functionality) of the object is specified in the class. Thus, all objects that are instances of the same class can perform the same
Stop actions. Isn't that what I wrote in point 4?
6)The classes are organized into a single tree structure with a common root, called the inheritance hierarchy. The memory and behavior associated with instances of a particular class are automatically available to any class lower in the hierarchical tree
. This is generally insane. If I have a Dog class that describes a dog, what mythical single generic class should it inherit from?
Sorry for the blurry text

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav Makarov, 2018-02-08
@mak_ufo

I looked at the basic principles of OOP from the point of view of Alan Kay and I can not understand what he wanted.

Not surprising. Initially, OOP was primarily an idea and did not have a formal description, such as relational algebra for RDBs. What does not have a formal description can be interpreted and understood differently, or not understood at all.
You are wrong. There is an analogue of "messages" - these are methods of objects. Calling a method is analogous to sending a message. You just aren't used to looking at it that way. For example, in Objective C, in which Smoltok-style OOP, they say so directly . In Simula-like OOP languages, methods are not called messages because unlike the Smalltalk style, the choice of code to invoke (method/message handling) is done by the compiler, not by the object itself.
Perhaps here we are talking about encapsulation.
No. In paragraph 4, the very concept of classification is introduced - that among an unordered set of possible objects, you select subsets of objects that are "similar" to each other. There is no question here yet about whether they will have general methods or something else specific. It's about the very idea of ​​separating objects into sets according to some criteria. In paragraph 5, the conclusion is already made that if we have already identified a certain subset of objects, then it’s a sin not to use this and set the same behavior for the entire subset at once (roughly described, but somehow it is).
System.Object . Yes, you have already inherited from him, directly or through other ancestors. From the runtime's point of view, not everything you operate on is an object, such as primitive values. However, from the point of view of the language, one can say that int "is an object" because an int value can be cast to type object. On my own behalf, I will say that the expediency of the concept "everything is an object" is very doubtful for a number of reasons.

P
Peter, 2018-02-08
@Morpheus_God

About the sixth point. In C#, all classes inherit from System.Object by default. And your Dog class inherits from it by default.

K
Konstantin Borovik, 2018-02-08
@PushMeNow

It seems to me that it is simply pointless to breed holivars about whether the current OOP is true or not, because:
1. The current type of OOP is working.
2. The OOP that the "founding fathers" conceived was nothing more than a sketch, a sketch. Then this sketch was polished for many more years.
3. The principles of OOP have changed for a reason (if they have changed at all): it means it was necessary, it means they found a more profitable / adequate solution.
As for c#. It was originally conceived as an OOP language, and coding in it without this knowledge is, to put it mildly, difficult. It contains all three basic principles of OOP, and these principles just summarize all the points that were proposed above. Yes, and c# has a corny main parent class called Object, it (c#) is simply built on classes from the ground up. Therefore, argue, do not argue anyway, we will come to one result: what we have is what we use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question