this post was submitted on 10 Sep 2025
572 points (98.1% liked)
Programmer Humor
26772 readers
1277 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Ah, yeah, very familiar with that article. ๐
It's definitely part of the reason why I like these really narrow types. But the other big reason is that your internal APIs start to look like this:
It just makes it almost impossible to pass the wrong value into a parameter. You don't need to wonder, whether you should pass your
port
variable into a parameter calledbind_port
, if you introduced separate typesBindPort
andRemotePort
for them.Of course, this is a somewhat extreme example. It's up to you to decide, whether you're likely to encounter multiple values of the same type and whether it's therefore helpful to make it impossible to confuse them.
oooor you could just stuff it all in the square hole ๐
But seriously, I like the approach. I tend to go overboard with my type definitions sometimes, because I feel like it saves me some thinking down the line, and conversely get frustrated when the tools for it are limited.
My first foray into the world of programming was a python book for kids. Among other things, it featured an example for multi-line strings that contained the line "Explicit is better than implicit". Aside from the irony of quoting that in the context of python (I believe it was written for 2.4 or 2.5, before explicit typing was even supported), it stuck with me.