In a code review that I did today, I left a final note to the author of some new piece of code:
Sorry for nitpicking on code naming. The approaches you take are good, but naming is hard (but important!):
There are only two hard things in Computer Science: cache invalidation and naming things.
(see here a list of variations on these two hard problem ‘jokes’ in Computer Science)
I enjoy the ruby programming language because you can get a long way by just assuming things. A collection implements each
, every object has nil?, in rails, I can get the relationship of a record and use scopes to filter the relationships as defined in the class of that related record. If it ands with a questionmark, it returns a boolean(y). Anyway.
So while they might say: “never assume things”, and sure, a lot of things are chaos, but ideally not our code base :) I prefer to work from assuming things, and if it doesn’t match to my assumption choose:
… and/or maybe, I am just wrong and I should level up my understanding of things. We all have our internal models of how things work, sometimes they are wrong and these internal models need some adjustments, but ideally the API that we create guides us.
Enjoyed this? Follow me on Mastodon or add the RSS, euh ATOM feed to your feed reader.
Dit artikel van murblog van Maarten Brouwers (murb) is in licentie gegeven volgens een Creative Commons Naamsvermelding 3.0 Nederland licentie .