I can absolutely understand the author. In my career i saw a lot of oop code like:
report = ReportBuilder(a, b, c)
report.do_something()
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?
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I can absolutely understand the author. In my career i saw a lot of oop code like:
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?
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.