šŸ˜“ I'm taking a break from February 1, 2024 until May 1, 2024, so I will be less active here and on social media.

Programming Discourse on Twitter

May 03, 2023

A lot of the programming discussions I see on Twitter eventually boil down to the simple question of whether to be explicit about your code, or not.

If you prefer to be explicit, then things like using the final keyword with PHP will make a lot of sense, even in places where you could reasonably omit it. (The idea being: ā€œThis keyword indicates that no subclass of this parent class should ever exist.ā€ This is a very explicit instruction or annotation.)

Iā€™m personally in the camp of being explicit about things (generally), but I can certainly acknowledge that this leads to an increase in verbosity, and sometimes ā€œbulkyā€ code.

For example: Swift as a programming language can be far more verbose than its predecessor (Obj-C) but is, as a result, much safer in various ways. At times, this definitely does impact the readability of the code. I find this difficult to navigate at times.

In the PHP world Iā€™ve been reading a bunch of interesting threads over the last few weeks with very opinionated folks saying all sorts of things about various language features. All reasonable, I assure you, yet consensus wonā€™t ever be reachedā€”because like most things in programming, the cardinal rule stands: ā€œit dependsā€.

Conversely, if you prefer to be implicit, then some language features may seem overkill, or youā€™ll only want to use them in very specific situations.

Certain features (i.e. auto-discovery in Laravel being an implicit feature, for example) that require you to be ā€œin the knowā€ can be nice because you donā€™t have to be explicit and you get some nice automatic behaviour. Super convenient!

This also means that in certain situations the automatic behaviour may be unexpected or unknown, and then this can lead to an undesirable performance impact, so thereā€™s definitely a balance to be struck here.

Regardless, none of this stuff is black or white, and there is much to be learned here, and different solutions to be applied to different projects.

I enjoy the discourse but sometimes I donā€™t like the tone of itā€¦ Itā€™s easy to get angry or to sound frustrated when your messages can only be 280 characters long.

Lately Iā€™ve been thinking about taking less time to read up on news here [on Twitter] just because of that. In a way, I think thatā€™s a bit of a shame.

Tagged as: Culture Programming PHP