re: OOP Overkill VIEW POST


I can absolutely understand the author. In my career i saw a lot of oop code like:

report = ReportBuilder(a, b, c)
result = report.get_results()

To me this is using OOP without using the brain. If it behaves like a function .. maybe it is a function. Besides this most of the implementations deserves a rant because this pattern guides the dev to initialize/load everything into memory!

My main question is the same as well. Why coders sometime choose the more complicated way?

  • Do they don't know/see the easier way (because of experience)?
  • Do they get enforces indirectly by (company/project) policies?
  • Do i am just wrong?

This really depends on what's inside ReportBuilder. Maybe it's a class that has to collect tons of data and do complex analysis.

In that case, it's super easy that you can use all that functionality in just 3 lines of code.

Also, don't forget that you are already using built-in classes every day! From using arrays to typing console.log(), all that functionality has to be programmed somewhere, and that's mostly in a class file.

Code of Conduct Report abuse