there are two hard problems in computer science:

1. cache invalidation

2. naming things

3. off by 1 errors

Reply to this note

Please Login to reply.

Discussion

This is one of my go-to jokes. Not only is it funny but it carries a lot of lessons.

Cache invalidation is hard because you can't know what things in your cache will be important in the future, so the challenge is to come up with the best estimation for the most useless thing. Predicting the future is always a hard problem.

But that wasn't why I shared the joke. The reason for this post was hard thing #2: naming things.

Naming things is hard because good names only come from clear thinking. Coming up with a good name is only possible if you have a strong concept for what this thing is and what it does. Most of the time when coding you don't have a strong concept when you first create the thing. So you just pick a name that fits the context in your brain at the time. Then you start using that name elsewhere and the concept evolves to encompass new ideas and use cases. But the name is sticky. You already picked a bad one and started using it. Now it takes a lot more work to change the name so you put off renaming it. The longer you allow the bad name to persist the more it infects everyone's thinking who uses that name. Eventually the bad name becomes permanent and the extra processing it takes your brain to disentangle the bad name from the concept becomes a permanent feature of that thing.

A good software developer takes the time to understand the nature of the thing and picks an appropriate name. The shorter the better. This requires more planning, more thinking, more time. But it leads to better software. The name itself is actually not important. It is merely an indicator of the underlying thinking that goes into the software.

Pick good names for things.

Oh I forgot about number 3. This is not a hard problem at all but it makes for a great punchline!

Check Drupal cache concept for 1, 2 can’t be solved

there's two hard problems in computer science: we only have one joke and it's not funny.

Rust fixes 1st with ownership and 3rd with exhaustive conditions covering all possibilities. Unfortunately, the 2nd will stay problem while humans keep coding.