OOP vs procedural programming - page 19

 
Реter Konow:
I don't quite understand why switch is not suitable for this task. Well, if a person can't make a formula for single calculation of all parameters of trailing stop for a concrete situation and write 100 variants, swtch is the best solution...

Not suitable, because there is an optimal solution - OOP with polymorphism - the necessary object is created in the inite, and no ballast case and if. For 100 trailingings we should use if, so that the user is not limited by one variant, he may want to include 2 or 3 variants simultaneously. And 100 if is the end.

 
Alexey Volchanskiy:

He says it's so boring...

I replied, I'm all bored too, maybe you could hook me up with a fun friend?

- There's a transplant of psychologists, they come straight from the conference, I can do it ))))

Well, we agreed and I said, Sanya, let's play a trick on our friend.


Well, we worked on the "murky meow", Sanya called me and said: "Alexey, you are a civil pilot, aren't you?

I am, - yes, what's the problem?

- When we were sitting in the bar, I didn't drink, and the pilots did, now there was a fight, the plane was out of control.

I can't fly it, I'm just learning!

- Okay, let's go steer the course.

 
Dmitry Fedoseev:

Not suitable, because there is an optimal solution - OOP with polymorphism - the necessary object is created in the inite, and no ballast case. Also for 100 trailing variants we should use if, so that the user is not limited by one variant, he may want to include 2 or 3 variants simultaneously. And 100 if is the end.

If I understood correctly, each trailing stop is a separate function? You can put everything in one function...

If each trailing stop is a separate function, is it called depending on user's initial choices or specific situation?

 

If you use OOP polymorphism, an object method call is roughly identical to 10 if's in terms of cost. Therefore, if there are more than 10 variants of something, it is reasonable to use OOP.

 
Реter Konow:

If I understand correctly, each trailing function is a separate function? You can also put it all in one function...

If each trailing stop is a separate function, is it called depending on initial user's choice or specific situation?


Dump it. And how do you switch it on and off?

 
Dmitry Fedoseev:

Go away. How do you turn it on and off?

I'm just getting the big picture. Exactly how the user program is set up.

And so there are 100 separate functions with different trailings.

The question is, how is the selection of a particular trailing - by the user or programmatically?

 
Реter Konow:

I'm just drawing a general picture. Exactly how the user program is set up.

And so there are 100 individual functions with different trails.

The question is how is the selection of a particular trailing switch done - by the user or programmatically?


There are switches in the properties window.

 
СанСаныч Фоменко:

Has the productivity of reading the assignment increased too? Has the productivity of writing a test case gone up too? Has the productivity of writing software product manuals increased too? And the time required for trial operation has been reduced?

What do you know about modern development methodologies? About task and bug-tracking systems? About repositories? About unit-tests and test automation? About modern QA?

And the disassembly within the team due to inconsistencies between different authors?

Ancientness is almost completely eliminated by version control systems.

And the expulsion of all sorts of geniuses who write code no one understands?

Strict adherence to codestyle in a team greatly reduces the presence of unreadable code. The practice of code review practically eliminates it

Have you even sat next to serious developers?

Yes, I have a serious portfolio, I'm sure yours is not even close.
 

Комбинатор:

And banishing all sorts of geniuses who write code that no one understands?

A strict adherence to codestyle in the team greatly reduces the presence of unreadable code. The practice of code review practically eliminates it

Well, it's not so easy with this one. It might not be about style. Some tasks require looking at them from the other side for their optimal solution. And some can only sing about what they see; for them, of course, the code will be incomprehensible.
 
Alexey Volchanskiy:

In general, we worked on the muuu muuks, Sania comes to me and says: Alexey, you are a civilian pilot, right?

I am, - yes, what's the problem?

- When we were sitting in the bar, I didn't drink, and the pilots did, now there was a fight, the plane was out of control.

I can't fly it, I'm just learning!

- Okay, let's go steer the course.


Well, of course I didn't go to the pilots, I had a nervous break for 30 minutes ))

Sanya was doing a masterful job and he leaned towards me in such a sinister whisper: "Lech, the pilot-in-command is really out of it, why don't you go and give me a lift?

I return to my seat, the girl-psychologist is actively nervous.

We enter the turbulence zone, the plane shakes so much that my uterus almost fell out.)

and Sanya was there, saying, well, fuck it, the autopilot's down, Lech, all hope is on us! I was flying a bit on the simulator!

Anyway, somehow I offended the girl psychologist at the time. I'm ashamed to this day, honestly.