Hacker News new | ask | show | jobs
by tharkun__ 1644 days ago
I read all of the comments here with much interest. Thanks for putting in this specific example.

I would love to have a chat with your architect. If you (or he) gave me a PR with

    foo(Timeout connection)
I would ask him to improve the naming. That thing is not a connection. In the places this variable will be used it makes no sense to use a connection. Take this example usage, potentially way down in the implementation of foo. Let's say an imaginary send function that takes the data and a timeout).

    send(data, connection)
If I read this code I will think that it takes data and a connection. But it doesn't. It takes data and a timeout. I have to know or look up the type of connection to understand what is happening.

Instead your original

    foo(Timeout connection_timeout)
Will make absolute perfect sense without knowing or having to look up the type. The following code can be read without having to stop and cross reference information. What you see is what you get. Less cognitive load, which is awesome. You put in thought to make awesome readable code once and every subsequent reader for all eternity can enjoy being able to just read and immediately understand what your code does and what everything is.

    send(data, connection_timeout)