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!

Familiarity Bias is Holding You Back: It’s Time to Embrace Arrow Functions

I don’t think that less lines of code automatically means code is more readable, but I’m a big fan of ES6′ arrow functions. In this article Eric Elliott dives deep into them.

I also supect that your team would become significantly more productive if you learned to embrace and favor more of the concise syntax available in ES6.
While it’s true that sometimes things are easier to understand if they’re made explicit, it’s also true that as a general rule, less code is better.
If less code can accomplish the same thing and communicate more, without sacrificing any meaning, it’s objectively better.

https://medium.com/javascript-scene/familiarity-bias-is-holding-you-back-its-time-to-embrace-arrow-functions-3d37e1a9bb75

Let’s hope we’ll soon have array functions in PHP too.

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. He loves waffles and butterflies.
  • I agree – this is one case where readability is not sacrificed by shorter syntax.

    However – “less code is better”? Are you shitting me, Eric Elliott? That refers to less *lines* of code, less abstract classes, less duplication. Not less characters to write a function.