What stands out to me in favour of classes is that you know exactly what you modify or are you able to tell me without reading the documentation what p[0] means?
The initial problem you mentioned regarding the polution and especially with this example:
is naturally solved by classes. They do different things even if they are named the same. Otherwise you could throw in an object and check which properties are defined and act accordingly when the functionallity stays the same e.g.
My biggest issue with classes these days is actually that you have to instantiate them to use methods after you get the value from the db. So I am a bit biased by my particular use case.
You could do all this with static methods but an object works just as well and is shorter and clearly cannot be instantiated.
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 don't get your point at all.
This
is basically this
What stands out to me in favour of classes is that you know exactly what you modify or are you able to tell me without reading the documentation what
p[0]
means?The initial problem you mentioned regarding the polution and especially with this example:
is naturally solved by classes. They do different things even if they are named the same. Otherwise you could throw in an object and check which properties are defined and act accordingly when the functionallity stays the same e.g.
My biggest issue with classes these days is actually that you have to instantiate them to use methods after you get the value from the db. So I am a bit biased by my particular use case.
You could do all this with static methods but an object works just as well and is shorter and clearly cannot be instantiated.