this post was submitted on 30 May 2024
388 points (94.3% liked)

Programmer Humor

32710 readers
102 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
[–] olafurp 10 points 7 months ago (1 children)

Using classes is nice tbh. Using inheritance usually isn't. Inheriting from inherited class should be forbidden.

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

Inheriting from inherited class should be forbidden.

so an interface with state?

[–] olafurp 1 points 7 months ago

Those are nice. Services that manage data are an example. Having the class also declare how to interact with the data is nice.

My most OOP pattern I like using is implementing an interface with an abstract class for "standard" implementation. Then implement abstract methods for a concrete thing.