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.