DEV Community

Discussion on: Please don't write a class

Collapse
 
pwaivers profile image
Patrick Waivers

I disagree with this wholeheartedly. Classes are generally a GREAT way to separate logic into discrete pieces. When I go back to old code, I usually am very happy when the single thing I want to change is isolated in a class. For example: Logger, FileNameCreater, TradeQuoteMerger, etc. Creating a class even for very small operations makes testing, refactoring, and reading easier (given you name it well).

I think your statement would better as "Do not make an abstract/super class for every class". Dog does not need Mammal, but Dog is a GREAT class to create.