this post was submitted on 30 May 2024
393 points (94.6% liked)

Programmer Humor

32375 readers
1464 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 13 points 5 months ago (15 children)

Can someone please enlighten me on what makes inheritance, polymorphism, an operator overloading so bad? I use the all regularly, and have yet to experience the foot cannons I have heard so much about.

[–] [email protected] 6 points 5 months ago (2 children)

Operator overloading is adding complexity, making code subtly harder to read. The most important lesson for code is: It should primarily be written to be easy to read by humans because if code is not trash, it will be read way more often than written.

[–] [email protected] 7 points 5 months ago (1 children)

I would argue that there are very definitely cases where operator overloading can make code more clear: Specifically when you are working with some custom data type for which different mathematical operations are well defined.

[–] [email protected] 1 points 5 months ago

Yeah, that's a very useful exception.

load more comments (12 replies)