Hacker News new | ask | show | jobs
by jrsala 1872 days ago
Pure functions, polymorphism, inheritance, composition, factory functions, classes... All of those are tools. They have benefits and drawbacks that are circumstantial (they depend on the language, the problem, the time pressure to ship, the skill level of the team, and many more other factors). Extremely successful codebases have been written using almost any combination of those tools. What those codebases have in common is that the people who wrote them understood their tools. So if I were you I would strive for understanding.

In that spirit, it's good that you question what experienced people tell you. What about asking your friend to explain why, at a fundamental level, their recommendation is good? "Always use classes and inheritance" as a hard-and-fast rule is not very helpful.

1 comments

This is a great answer. Life is about tradeoffs. Asked to tell the best way to do something, a good engineer pretty much always will answer "Well, it depends..." and list pros and cons of a tool.