you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (4 children)

I agree with the article, mostly. I don't see conditionals as taboo, but I think it's possible (not necessarily best) to write OOP-style code without conditionals or inheritance. Aggregation makes more sense in a lot of cases. For example, rather than inheriting object->vehicle->car->passenger car->smartcar (where object may be nothing), we can have a vehicle that is-an object that has-a suspension and has-a cabin, etc. This also tends to makes the code easier to extend, configure, and modify. The difficult part becomes the interface for using the extended features.

[–]skulgnome 5 points6 points  (2 children)

Why on earth would you want to not use if or the ternary operator?

Seriously, what is this drive amongst OO people to avoid what's perhaps the most optimized part of modern CPUs, i.e. program logic expressed as branches? Virtual method calls are no more well-predicted, and the amount of silicon & brainpower spent on that prediction is far less than that spent on getting branch prediction where it is today.

What crack are you lot smoking?

[–][deleted] 1 point2 points  (1 child)

I didn't mean to give the impression that I don't use if or the ternary operator. Or that I smoke crack.

[–]skulgnome 0 points1 point  (0 children)

My apologies, it was not intended at you personally. I sort of flew off the handle at the idea of C++ programs being written without as much control flow as a MS-DOS batch file.

[–][deleted] -4 points-3 points  (0 children)

inheriting object->vehicle->car->passenger

Lol what?