Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OOP, class/objects overkill

Tags:

oop

What is a good gauge for knowing when a class is poorly designed or even necessary. In other words when to write a class and when no to.

like image 418
Babiker Avatar asked Nov 29 '22 20:11

Babiker


1 Answers

SOLID might help if a class is poorly designed, but it won't help answer a question like "Is object-oriented programming the best approach for this problem?"

People have done a lot of very good work in programming for mathematics and science before object-oriented programming came into vogue. If your problem falls into those categories, perhaps object-oriented programming isn't for you.

Objects are state and behavior together; they tend to map onto problem domain objects one-to-one. If that's not true for your problem, perhaps object-oriented programming isn't for you.

If you don't know an object-oriented language well, perhaps object-oriented programming isn't for you.

If your organization doesn't know and can't support object-oriented solutions, perhaps object-oriented programming isn't for you.

like image 161
duffymo Avatar answered Jan 21 '23 20:01

duffymo