Full Stack JS developer with a good understanding of embedded devices. I'm a polyglot developer with huge appreciation of clean code and solid principles. Interests are web tech, cloud and embedded.
"Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged—the compiler knows the types anyway and can check those, and it only confuses the programmer" - Linus Torvalds
With modern tools and IDE's I really don't see this having to be a thing anymore. If you can just hover over or cursor to a variable and know its type. Then there is no need to add a type affix. Sadly I still do see this in the wild. Either due to an old code base or an old mindset and almost always when I do come across it there are at least a few dozen variable names that have since changed and have not been updated.
That beside, if you can't tell the semantic meaning of a variable by its name, and thereby deduce the like type(s) in use, you need better names anyway.
For example, what is the type of is_ready? How about like_count? average_temp? pending_requests? (If you guessed "boolean", "integer", "float", and "something akin to a queue", you're right!)
👋 Hey there, I am Waylon Walker
I am a Husband, Father of two beautiful children, Senior Python Developer currently working in the Data Engineering platform space. I am a continuous learner, and sha
Which reminds me of something I put in my upcoming Python book...
In other words, Python doesn’t care if it’s actually a robotic duck, or a moose in a duck costume; if it has the traits needed, the rest of the details are usually a moot point.
👋 Hey there, I am Waylon Walker
I am a Husband, Father of two beautiful children, Senior Python Developer currently working in the Data Engineering platform space. I am a continuous learner, and sha
I had no idea what Hungarian notation was. That is an amazing quote.
Just today I had vscode (pyright in particular) catch me with an edge case. I had a function that would return an iterable if there were values, but False if there were none. It caught me that I wasn't catching the False case.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged—the compiler knows the types anyway and can check those, and it only confuses the programmer" - Linus Torvalds
With modern tools and IDE's I really don't see this having to be a thing anymore. If you can just hover over or cursor to a variable and know its type. Then there is no need to add a type affix. Sadly I still do see this in the wild. Either due to an old code base or an old mindset and almost always when I do come across it there are at least a few dozen variable names that have since changed and have not been updated.
That beside, if you can't tell the semantic meaning of a variable by its name, and thereby deduce the like type(s) in use, you need better names anyway.
For example, what is the type of
is_ready
? How aboutlike_count
?average_temp
?pending_requests
? (If you guessed "boolean", "integer", "float", and "something akin to a queue", you're right!)Duck typing 🦆
Which reminds me of something I put in my upcoming Python book...
I had no idea what Hungarian notation was. That is an amazing quote.
Just today I had vscode (pyright in particular) catch me with an edge case. I had a function that would return an iterable if there were values, but
False
if there were none. It caught me that I wasn't catching theFalse
case.