A question for OOP experts. - page 18

 

Avirtual function is a function template that is stored in a base class. It can only be implemented in descendant classes. Classes can also be virtual. The virtual classes that contain virtual functions are called "interfaces". Together they implement one of the main OOP mechanisms - polymorphism.

Only in practice, I don't understand where to put it...

 
Georgiy Merts:

Why should that be?

The global kernel and OOP are not mutually exclusive.

Just the elements in the windows should be encapsulated within the windows classes, not "Lying around for all to see". Just so no one can accidentally "get in the wrong place". Changing one variable and making a mistake about its location inside a huge global array is very easy, while it is much harder to query the right interface and then change the same variable in the right object and make a mistake.

Alas, they are mutually exclusive. A global kernel implies global visibility which removes the need for

(1)In encapsulation of code. Why, when everything is accessible from anywhere?

(2) Overloading of functions. Why when it's easier to do the work in one, making the results universally visible and accessible?

(3)Polymorphism. Why hide different implementations under one template, when one unit can do the work of those template variants? The amount of code would be less and the syntax would be many times simpler.

The whole point of OOP lies in the following:

1. Offloading of human memory. (It is badly offloaded. There is too much syntax).

2. Distribution of common work within a team (everyone knows a piece of code, hence there will be problems of building and debugging).

3. Code portability. (This is really a plus).

4. Marketing. Distribution and sale of development environments, libraries, through advertising of various gadgets.

 
Реter Konow:

Alas, exclusionary. A global kernel implies global visibility, which removes the need for

(1)In encapsulating code. Why, when everything is accessible from anywhere?

(2) Overloading of functions. Why when it's easier to do the work in one, making the results universally visible and accessible?

(3)Polymorphism. Why hide different implementations under one template, when one unit can do the work of those template variants? The amount of code would be less and the syntax would be many times simpler.

The whole point of OOP lies in the following:

1. Offloading of human memory. (It is badly offloaded. There is too much syntax).

2. Distribution of common work within a team (everyone knows a piece of code, hence there will be problems of building and debugging).

3. Code portability. (This is really a plus).

4. Marketing. Distribution and sale of development environments, libraries, through advertising of different gimmicks.

Who are you, and what do you want to prove? That OOP is bad and a bunch of stuff in one place is good? Is that all you've created this thread for? Or do you want to boost your ego by praising your super-memory? Sounds to me like your alter ego. Nothing more.
Then the thread loses its practical meaning - it can be titled "Look at me". It's useless.

Everything you are told you immediately question, not forgetting to add what you are like, and how you are doing, and how everything is good and better, and how the whole world is stupid, and other things inherent in an unlearned, burdened nihilism at its most beautiful manifestation of man.

 
Artyom Trishkin:

Who are you, and what do you want to prove? That OOP is bad and a bunch of stuff in one place is good? Is that all you've created this thread for? Or do you want to boost your ego by praising your super-memory? Sounds to me like your alter ego. Nothing more.
Then the thread loses its practical meaning - it can be titled "Look at me". It's useless.

Everything you are told you immediately question, not forgetting to add what you are like, and how you are doing, and how everything is good and better, and how the whole world is stupid, and other things inherent in an unlearned, burdened nihilism at its most beautiful manifestation of man .

You're doing it again, aren't you?)) I thought you'd stopped trolling my threads. You can't resist getting personal. I can't...)

When a person gets personal, it means that he has nothing to say on the matter. Apparently, the arguments are ironclad.
 

The argument for OOP is simple: people need it.

At this point, we can end the subject.

 
Реter Konow:

Alas, exclusionary. A global kernel implies global visibility, which removes the need for

(1)In encapsulating code. Why, when everything is accessible from anywhere?

(2) Overloading of functions. Why when it's easier to do the work in one, making the results universally visible and accessible?

(3)Polymorphism. Why hide different implementations under one template, when one unit can do the work of those template variants? The amount of code would be less and the syntax would be many times simpler.

The whole point of OOP lies in the following:

1. Offloading of human memory. (It is badly offloaded. There is too much syntax).

2. Distribution of common work within a team (everyone knows a piece of code, hence there will be problems of building and debugging).

3. Code portability. (This is really a plus).

4. Marketing. Distribution and sale of development environments, libraries, through advertising of various gimmicks.

So these are different things.

I have in any EA (in the same League) - there are objects with global scope.

But your kernel can be represented as a class which has a bunch of functions - getter setters, as a result it will be quite "OOP-like", but with global access. Although, of course, without main advantages of OOP - encapsulation, inheritance and polymorphism.

As to what OOP rests on - the first one should be completed not only by offloading of memory (and it offloads very well), but also by offloading of code support and modification. And besides, it is much easier to reuse developments which are in OOP-design than without it. By the way, "4 - marketing" is just a consequence of this very much easier use.

 
Artyom Trishkin:

Everything you're told, you immediately question, not forgetting to add how you are, and how everything is good and better, and how the whole world is an idiot, and other things inherent in an unlearned, burdened nihilist in its finest manifestation.

Artem, I envy Peter's memory...

Not to mention the fact that Peter did try and offer some real insights.

 

Informative, but not for the topic-starter's readingOOP patterns in metaphors

purely on the topic of content:What are anti-patterns?

 
Igor Makanu:

Informative, but not for the topic-starter's readingOOP patterns in metaphors

purely on the topic of content:What are anti-patterns?

The second article is more useful and, in my opinion, a must-read for everyone, no matter what style of programming they practice.
 
Реter Konow:

Avirtual function is a function template that is stored in a base class. It can only be implemented in descendant classes. Classes can also be virtual. The virtual classes that contain virtual functions are called "interfaces". Together they implement one of the main OOP mechanisms - polymorphism.

Only in practice, I don't understand where to put it...

virtual functions are those that can be overridden in a derived class. a template is different in any context.

A particular implementation may well be in a base class. or not (if the function is purely virtual)

Classes cannot be virtual, they can be abstract. there is virtual inheritance, but you don't need to bother with it at all.

the interface is roughly speaking, an abstract class with nothing but purely virtual functions.

virtual functions are only a part of polymorphism - dynamic polymorphism. overloading and templates are static.

You can do it everywhere, you just let it all slip through your flat table thinking.