Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

What about “final” and “private”?

There was much discussion on Twitter about the concepts of using “final” and “private” in objects, and what exactly the best practices are. The conversation seemed to boil down to three distinct questions:

  • Should an object be open for extension, and expose its internals for that purpose?
  • Does exposure of those internals create a de facto contract with children for their behavior?
  • Should software only be used as intended by its designers, or should it be modified, extended and changed by the end user to fit certain, specific goals?


Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band.