We all write a lot of models and entities, specially when we are working with frameworks like Symfony.
But, when you code them, you have to make a choice for the properties. Should they be public, protected or private ?
Symfony made a choice: private.
Laravel chose public.
My coworkers, inside our Symfony projects code them either protected or private, with a bunch of accessors.
I prefer the Laravel's way, and always code them with a public visibility.
I made that choice because most of the time (like 99% of the time), accessors are useless, they don't transform the data. I prefer access them with
object->property instead of
And you, what visibility is your default choice, and why ?
Is programming an art?
Néstor Llop Guerra -
Looking for C# Open Source Projects for a 1st Time Contributor
Nick Taylor (he/him) -
When starting a new project, when wouldn't you want to build in a cloud?
Dakota Lewallen -
Introducing our first original podcast: DevDiscuss
Jess Lee (she/her) -