4 ms·
This was weirdly condescending and content-free. I've been programming for 30 years, and getters/setters are both pointless and anti-productive. They hide (po
by smt88 2y ago
This was weirdly condescending and content-free.
I've been programming for 30 years, and getters/setters are both pointless and anti-productive.
They hide (potentially a lot of) code from people reading the program, which leads to a lot of "wtf" moments later.
Magic in general is bad, and it's the kind of "look how concise and clever I am" thinking that leads to unmaintainable software.
If setting a property isn't straightforward, make it private/protected and add explicit getter/setter methods. It's more work today and much less work later on.
- hparadiz 2y agoEvery php ORM disagrees. Nothing about it is magic
- smt88 2y agoPHP ORMs and ORMs in general are notoriously hard to maintain. I've written hundreds of thousands of lines of PHP, I'm speaking from experience.
- hparadiz 2y agoI maintain an ORM [ https://github.com/Divergence/framework/blob/release/src/Models/ActiveRecord.php https://github.com/Divergence/framework/blob/release/src/Mod... ] and have also maintained a job's fully custom ORM as well. 20 YOE in PHP. Also speaking from experience :)