We have all heard that good variable names are important for creating readable programs — advice that will serve you well when you come back to your code two years later, or even twenty. Sometimes, when you are so deep in the zone and begin to question a variable name that you made three levels up the calling hierarchy, it can be helpful to take a step back and review your variable naming conventions. The wikipedia article on computer program naming conventions is a good starting point, where you can dig into the nitty gritty of Hungarian notation like bFlag
, case separated names like camelCase
, and so on. But sometimes you have to go meta, and need names to describe the names themselves.
For example, in everyday usage the terms parameter and argument are often used interchangeably. But strictly speaking, a parameter is a placeholder, the variables in a function declaration for example (see image above). An argument is the actual value itself, say the number 50.334 in the example.
We recommend that units of measure should always be clearly specified in your comments, perhaps even in the variable names if you’re mixing different systems in the same program. At Hackaday we prefer to use SI units, check out NIST SP 330 if you’re interested. But invariably, there are going to be exceptions for years to come. We like to deal with those at the edges during I/O if possible, thus keeping a consistent set of units in the core of the program.
What about the terms number and value? We like to think of a number as being a kind of value. For example, a function’s return value could be a number, say a velocity. Or it could return an enumeration or a boolean. Sometimes the perfect meta-name for something will collide with a reserved keyword in your programming language, names like string or data for example. In these cases you have to be creative and find suitable synonyms, perhaps text and payload.
Using consistent and precise language can be tedious, but it can be just as helpful as good commenting and variable naming practices. Do you have any examples where precise terminology such as this has been been helpful or perhaps tripped you up? If so, share in the comments section below.
The use of the royal “we” is cracking me up.
We can’t say about the author, but I often refer to myself as “we’. It aids the confusion when others go to assign blame :P
Nice thing about “we” is you never lose an argument.
When writing an expository scientific paper, such as a math paper, it’s appropriate to use inclusive pronouns. It’s intended to mimic standing at a whiteboard and including the reader, standing next to you, in the conversation. “Now when we rearrange the variables and integrate, we get…” and so on.
As an ex-avionics engineer for several decades, I’m well aware of importance of clarity in code. Lots of times I have to catch myself in writing comments and insert the units – for example the comment “command timeout” becomes “command timeout in seconds” and so on. All my function definitions have a boilerplate code block that says what the code does, what the arguments are (with examples), and what the return value is.
Hungarian notation is a plague. It was invented by a college grad to solve a particular problem, who was subsequently hired to a management position in Microsoft and had the power to impose his idea of “what’s best” on everything in the company. Of course, he never did a survey of “what’s best” comparing alternatives and arguments for and against…
“String”, “Text”, “Data”, and “Payload” are examples of BAD nouns to use as variable names, or even parts of variable names. “NameString” should be simply “Name”, this imposes less cognitive load on the reader. Those nouns are so imprecise as to lend no meaning to variable names. (Unless, of course you are dealing with those things generically, in which case just use the things as themselves.)
Use names that are targeted and precise. Instead of “LastChar”, use “PrevChar” or “FinalChar”, because “last” can have those two meanings. (Using “Char” generically in a function that deals with chars. If the char has some specific meaning, such as the digit of a number, then name it that: LastDigit, PrevDigit, and so on.)
The whole process is sort of like learning to write. First books are usually poorly written and difficult to get published, but your second book will be better and the third book will be even better than that.
Software clarity is like that. It takes awhile to get the knack of writing clear code. One learns by doing, and by observing others.
Actually your description of what happened with Hungarian in Microsoft is off the mark. The original intent was for the notation to describe the purpose of the variable (count, flag, index, row, column, timestamp, etc). That’s Apps Hungarian, and isn’t entirely awful. Then the OS team got hold of it and perverted it to indicate data type only, which is entirely redundant and pointless and horrible – that’s Systems Hungarian.
Of course, since the source code for the MS applications is proprietary, but the API for the OS is public, you can guess which version of the notation made it’s way into the wider world.
This isn’t quite correct either. Hungarian notation was invented by Charles Symoni when he worked at Xerox on the seminal GUI workstation, the Alto.
The Alto’s OS and kernel were written in BCPL which is a typeless language (the only type is the ‘word’ which is the natural length of the CPU’s architecture). His annotation for variables was intended to compensate for the lack of types.
When Symoni moved to Microsoft, the language they used was initially Pascal which is strongly typed, but they kept the conventions because Symoni was so influential.
Ps in my laziness I failed to check the spelling of Charles Simonyi. Apologies.
Back long ago when I was developing Windows 2.x applications and libraries, Hungarian notation was par for the course.
I didn’t particularly care for it one way or the other. I certainly didn’t mind it at the time, as owing to the need to be aware of what memory segment you were dealing with it was nice to know whether you had a short pointer, a long pointer, a string, a handle to a device context, etc etc or if none of those things just a regular variable.
Subsequently when we got to program for later versions of Windows it really became just became obsolete, and some time after that, ridiculed such as your comment points out.
BTW Simonyi had worked at PARC on the Alto software and was hardly just a college grad by the time Microsoft hired him.
Reading a science or math paper I would prefer the impersonal “Now when the variables are rearranged and integrated, the result is…”.
When reading a hackaday comments section: impersonal comments are preferred.
When I’m writing notes for myself, I often say we, because I figure I’m collaborating with the future me.
And by the way, it’s the “editorial”, not the “royal” “we”
Nor the tapeworm “we”, I presume?
If we’re including invertebrates, up to 70% of the population is supporting a colony of demodex mites, so “we” is about 70% likely to be correct in any instance.
You gots a mouse in your pocket, or are you The Queen? :-]
“At Hackaday we prefer to use SI units”
Hmmm.
(…Enters ” kph” into HaD search box :)
Indeed Don’t modern IDEs help with naming conventions?
I want to know what IDEs you’re using. Clearly they’re radically more advanced then any IDE I’ve ever used.
I anxiously await the time when HAD articles automatically convert sandpaper grits to their corresponding SI units.
Or wire gauge. Or PCB copper plating weight. (Or for that matter mass, instead of weight.) Or calorie, angstrom, minute, hour, day.
Or litre.
It would be cool when instead of a language option that some sites have (the flag at the top of the page) you could have a standards option to choose between imperial and metric. On the other hand, we have to guide those imperialistics out of the dark ages ;)
But think it through: if someone writes “I wanted the board to be about an inch square”, you get translations to “about 25.4mm square”. Which is ugly translation – the translation would need to be smart enough to say “about 25mm square” instead, keying on the word “about” and the fact that only one significant digit was specified. But even then it’s a problem, if the translation says “about 30mm square” on that basis, it may not accurately convey the meaning.
And THEN we have real problems with the example given, ounces of copper plating. The translator would need to be smart enough to know that “2 oz. copper PCB” does NOT mean “57 gram copper”, since in the metric world, copper plating thickness would be given in millimeters. And even more commonly, since pounds are an imperial measurement of force, should “pounds” be translated into “newtons”? The correct answer is “sometimes”, because if I’m saying how much something weighs 2000 pounds, I don’t mean 8900 Newtons; but when I say that a rope is rated for 2000 pounds, this SHOULD be translated to 8.9 kN. And of course there just isn’t any solution to what you’re supposed to say that the German camera takes a 1/4″-20 thread on its tripod socket, because a) obviously Germany did NOT go fully metric, and b) there is no metric thread that would fit that socket.
No, I’m afraid we really need to continue to ask that dimensions be given in metric, and live with the fact that we are stuck with our middle ages legacy.
I would also like to point out that the ONLY benefit of the metric system is that it is well standardized over the entire planet. The whole base 10 thing is rubbish, or we would have metric time. There really are cases where base 10 just doesn’t work.
“About 1 inch” is technically anything from 0.5 – 1.5 inches which is a precision of 12.7 mm. In other words, it should be 2 or 3 centimeters, otherwise you’re implying a precision of 0.1 mm which is falling into the same trap as translating 1 inch to 25.4 mm.
Also, rope and hoists in metric countries are specified by kilograms and tons, and you can use fractional notation for metric units any way you please. E.g. ½ kilo of sugar. You don’t have to write “500 grams”, or “500 milliliters” as some would insist because they’ve arbitrarily decided that everything has to be “multiples of a thousand” (looking at you Australia).
Common sense is permissible and advisable.
Au contraire. 25.4mm is not an ugly translation. Metric doesn’t care whether a measurement happens to be 24.9, 73.63, or 99.223. And the reason it doesn’t matter is that it is natively decimal.
Imperial on the other hand… encountering a fraction such as 2-63/64″ would and should make you ponder why was it not just rounded up to 3″. You might then say, use decimal inches, as you see on some engineering drawings and you get 2.984″, which sounds permissible.
So in that case, if you’re now resigned to using decimal inches why not just use metric and then you get the sane multipliers of milli-, deci-, kilo- and so on as part of the package.
Because you’re not allowed to use the prefixes in engineering drawings, even in metric. All the measurements in the drawing must be in the same magnitude, more so because you don’t actually write out the unit to avoid adding unnecessary clutter.
Example:
http://getdrawings.com/images/engineering-drawing-13.jpg
Fillmore: “Respect the classics man!”
foobar, foo, bar, baz, qux, quux, quuz, corge, grault, garply, waldo, plugh, xyzzy, thud, wibble, wobble, wubble, womble, flob, flub, eek, ook, fred, barney, wilma, betty.
;-)
That naming convention is marginally better then reading code from someone who has been damaged by a math degree.
iNum = ix + ix2 – k
iNum2 = iNum + c
(of cause there are a lot of skilled programmers with math degrees as well. but i am sure you have came across the type of code i am describing)
Come to think of it I think I lost marks in a Pascal module of a physics course when I labeled the variables, distance, time, acceleration, initvelocity, instead of sticking with the s=ut + 1/2 at^2 … comments something like “distance could mean anything, everyone knows the standard symbol s…” :-/
And i, ii, iii … for loops
Even the SI units vary, depending where you are.
In the USA, using the NIST, the unit of length is the “meter” :
https://www.nist.gov/pml/special-publication-330/sp-330-section-2#2.3.1
In other countries, the (original, French) spelling of “metre” is used:
https://www.npl.co.uk/si-units/metre
Wow, you are beyond fn anaaal.
I’m (me) afraid your “velocity example” isn’t. It’s a speed example. Please get your meta names right. 😉😀☺️
You are right to show us the lack of direction!
I smiled. Thanks, internet.
direction? you mean vector?
Vector? Ohh Yeahhh!
Use a strongly typed language and encapsulate the type of your parameters in actually defined types. Then you can name them about their actual purpose not just about type info. Your example is a good anti-example of what good naming looks like.
I was forced for six months once to use Hungarian notation for variable names. After a while you literally don’t even see the type, it just goes straight in to your head for free. Still don’t like it though.
This. Something like Boost.Units just makes life much easier.
And if you can’t choose a language that facilitates that you should just give up and call everything var1, var2… varN
and 12000 mAh ;-)
(not 12Ah) or color of my light bulb 3000K not 3M Kelvin
I use camelCase with increasing verbosity as code complexity increases, sometimes even calling out the Type in the varname, such as povHeadingStr, povHeadingAngle, where povHeadingStr (in Compass Division Notation, s/a SbSW, read as “South by Southwest” ) is converted to Angle
What’s ‘Angle’? I need the unit type as well! I work with a codebase where that’s still somewhat of an issue, we’ve got places where we have ‘speed’ as metres per second, cm per second, rotations per minute, encoder counts per second, etc., etc.
My company once hired a maverick ex-game programmer. He was infamous for random variable naming. The one that gained him notoriety was when he was stuck for a name, looked around the room without inspiration then noticed through the window that it was raining. ‘Raining’ was the name he used, and to this day no-one is sure what it conveyed.
As a result of his antics his code was all but impossible to maintain of course.
Choosing logical variable names can greatly help with understanding the code in the future. As well as properly commenting the code as well.
Something I wish more code examples/tutorials did more often…
Though, same story goes for function names, there is honestly little reason to compress all names to as few letters as possible. Even when documented it still makes the code less readable overall. One can make exceptions for more “common” shorthand. (Though, what is considered “common” will vary depending on who one asks. So please write a comment if more than yourself is expected to work on the code.)
Giving variables and functions random names is frankly nothing but obtuse.
One can make exceptions to control variables in shorter loops, where using “i”, “n”, “x”, etc are all fairly common and usually self explanatory, unless the loop gets longer and suddenly it becomes less obvious and gets a larger need of commenting. (where that line in the sand exactly is, who knows.)
But for code that is worked on by many people, or will need to be maintained, then it is usually a good idea to keep things clear and well documented.
And even quick simple codes to do some minor project can equally end up as a long term thing. After all: “There is nothing as permanent as a temporary fix.”
And for all those who thinks that adding an in line comment to make a title on a function is sufficient documentation, then please do also add a few more comments within the actual code in the function itself. A title only explains what something is, not how it does it, or what it expects. And worse case is when it doesn’t always do what the title states due to some bug…
… or because somebody modified the code and did not update the block comments (usually for lack of time — we need this fix TONIGHT!) so the operation is no longer as described.
I generally prefer inline comments for this reason.
Yes, proper in line commenting is an important part of making sure that code can be maintained.
And yes, quick fixes that doesn’t have time for commenting is a large potential for problems to creep in.
“usually for lack of time”
software developed like this (at the behest of stakeholders) has a limited shelf life anyway.
Perhaps I should have mentioned that it was embedded firmware and the factory would want it ASAP to continue production.
The risks of fast implementation were understood.
Obtuse is a nice way of putting it… it’s a horrible example of bad programming.
That’s why such hot shot programmers are so costly. Pushes maintenance costs through the roof, typically three times to four times, along with random bugs, and the delays of implementing enhancements and compliance issues. And that’s after their code has delayed development, testing & rollout.
I’m working on 180,000 lines of Java. I’ve found the IDE and the ability to refactor a name change to be essential to saving time and hugely aiding both development & maintenance. Rarely do I find including type valuable. But having a name the describes what something is and its purpose is essential.
As others state, comments rarely survive as accurate to the code. Not only in maintenance but during development. Including in-line comments. What I’ve found hugely useful is very meaningful names. What I’d have previously thought was crazy long. If one scans the code picking up only the names, with the occasional pause to read, the purpose of the code is quickly & easily obtained.
If I’m going back to code after two years, two months or two weeks, too many pauses, or the purpose is not clear, then the names are inadequate. And with an IDE, that is quickly corrected.
One interesting “trick”, is to have all variable names delimited by a space. Very ugly, but when reading code, the eye/brain picks up the names faster, with less effort & less stress, and understands the code faster and more accurate. After two years of doing that, I find that going through code typically takes 1/3 the time it used to, and doesn’t result in tense & stressed body. When re-encountering code that isn’t that way, I quickly edit it so, then I get to enjoy the quick, accurate and low-stress work. Then I actually enjoy tackling and refactoring a 1000, 2000 or 4000+ line class.
I wouldn’t have believed it, but code comes very close to self-documenting, only rarely requiring comments.
(trying to post after posting failed…)
That’s why such hot shot programmers are so costly. Pushes maintenance costs through the roof, typically three times to four times, along with random bugs, and the delays of implementing enhancements and compliance issues.
I’m working on 180,000 lines of Java. I’ve found the IDE and the ability to refactor a name change to be essential to saving time and hugely aiding both development & maintenance. Rarely do I find including type valuable. But having a name the describes what something is and its purpose is essential.
As others state, comments rarely survive as accurate to the code. Not only in maintenance but during development. Including in-line comments. What I’ve found hugely useful is very meaningful names. What I’d have previously thought was crazy long. If one scans the code picking up only the names, with the occasional pause to read, the purpose of the code is quickly & easily obtained.
If I’m going back to code after two years, two months or two weeks, too many pauses, or the purpose is not clear, then the names are inadequate. And with an IDE, that is quickly corrected.
One interesting “trick”, is to have all variable names delimited by a space. Very ugly, but when reading code, the eye/brain picks up the names faster, with less effort & less stress, and understands the code faster and more accurate. After two years of doing that, I find that going through code typically takes 1/3 the time it used to, and doesn’t result in tense & stressed body. When re-encountering code that isn’t that way, I quickly edit it so, then I get to enjoy the quick, accurate and low-stress work. Then I actually enjoy tackling and refactoring a 1000, 2000 or 4000+ line class.
Code comes very close to self-documenting, only rarely requiring comments.
I can concur with the previous post that code that is well written rarely requires comments.
Mosty, If comments are useful, they describe data structures and variables, not statements.
If you need comments to describe what each function is doing, it is a strong indicator that either function names and argument names are not well chosen, or that the function is generally doing too many things at once.
I can recommend this GitHub repository explaining how to write unmaintainable code: https://github.com/Droogans/unmaintainable-code If you avoid all these things, you are well on your way to writing good code.
I would go so far as to say that the main reason for including type in the name is to keep the original developer from making stupid mistakes. Once it gets to maintainers, I agree, not as useful.
(“Bad request”, trying to post again)
There’s a lot more to it. I’ve found Victor Rentea’s talks on Clean Code extremely valuable. On youtube and others.
One of his recommendations, is to avoid mountain code (I forget what he calls it), where there are so many levels of indentation it looks like a mountain range. So many of his other suggestions proved to be useful & valuable, so I took some mountain code and went extreme on splitting it up into smaller methods. Then smaller methods. With all of the added method calls, and in code that needs to be low latency, I’d expected a meaningful performance hit. Wrong. It ran faster. Code that used to give turnaround with 80% under 2 ms, 20 % under 3 ms with outliers up to 6 ms, now came in at 90 % under 1 ms, 10 % under 2 ms with outliers up to 3 ms. Best guess is that smaller chucks of code are more likely to have been retained in memory or optimized by the JVM? Unbelievably easier to read, refactor, enhance and test too. I then got the code improved to run slightly faster, with 99% under 1 ms, outliers still to 3 ms. All with clearer more concise code…
One thing with the enhancements in Java, is being able to refactor code to use the newer features. Like removing code that manages iteration, using code that does the iterations internally. Refactoring to new features usually runs faster too, and can be astoundingly more concise, hence more readable and less prone to bugs. Less cost, less stress, more reliable & robust, and a significantly quicker & reliable response to compliance issues.
The use of ‘we’ instead of ‘I’ in scientific papers reflects that both research and the write-up of research is almost always a team effort.
If you follow SI / NIST SP 330, then the pictured example is (mildly) wrong for “hour”.
As described in that document the symbol should be “h” not “hr”.
Please, countries that, like mine, use the metric system specify the speed of cars in km/h, not km/hr (or even worse kph). It hurts my eyes.
You write it like you say it. kph is like mph. Kilometers per hour, miles per hour.
Now milliliters is something you should be using anywhere. It’s a stupid word, ililliliiililili….
/should not be using/
The only reasonable argument I have ever heard against SI units is that volume scales go up in millions (e.g. Cubic millimetres to cubic metres to cubic kilometres). That must be why the litre was introduced.
The liter is exactly a cubic decimeter.
A milliliter is exactly a cubic centimeter.
A µL is exactly a cubic millimeter.
One can also measure cubic decameters and cubic hektometers. But rarely is this really needed in practice.
Now a lot of people don’t know that deci (1/10th), hekto (100) and deca (10) exist.
There is 4 prefixes between kilo and milli. (Not including the 5th “prefix” of not having a prefix.)
Though, there isn’t any real prefixes between milli and micro, and kilo and mega.
A decimetre is not SI. Unit multipliers should go up in thousands, which is why the ml is a synonym for the (deprecated) cc.
IanS:
Deci is an SI prefix.
https://en.wikipedia.org/wiki/Deci-
Just like hekto, deca and centi.
I am withdrawing from this discussion as I cannot prove my statement.
I don’t think there is any official deprecation of deci, centi, deca, or hecto, but more of a de facto consensus in engineering communities. The use of only powers of 1000 in engineering meshes well with the common use of commas in large numbers to separate into groups of three digits*, and I’m certainly happier for it – I avoid centimeters even though they are more of a “human scale” unit than millimeters, because while it is easy to make a factor of 10 error in calculation, i.e., misplacing the decimal point by one place, it is much harder not to notice an error that is a factor of 1000.
*Although the latest draft of the SI brochure, 9th edition, 2018, section 5.4.4 recommends using a space to separate groups of 3 digits instead of a period or comma. Something I did not know until looking this up!
Another argument for not using deci, centi, deca, or hecto, is that these are the only metric prefixes that are not integer powers of 1000, AND the same SI brochure prohibits compounding prefixes. That is, it is not proper metric to use units such as “decakilometers”. Therefore these units are really kind of orphans when it comes to practical applications, since they can only be used for numbers close to the order of magnitude of the basic unit.
Something I would like to point out to the metric police out there, is that neither “degrees” nor the symbol ‘°’ are recognized by SI; the metric unit of angle is the radian. Go try sticking to THAT in your everyday work. Furthermore, “percent” isnot allowed, although the ‘%’ symbol, defined as “per hundred” is. Yeah, go ahead, tell me just how consistent SI is.
Aaannd there’s the myth that “helpful” science teachers just made up to make it simple to teach. SI multipliers are designed to go 1, 10, 100, 1000, 1 000 000… (and reciprocals) exactly because it gives you a nice density of useful magnitudes for all sorts of things. Dropping the 10 and 100 out basically butchers the system.
Out of the countries that have adopted the metric system, the English speaking countries seem to get it wrong (on purpose?).
The reason it starts going up by thousands after one thousand is because you start to get so many zeroes that you lose track if you have a different name for every multiplication of 10.
For very large numbers, and for numbers at greatly different magnitudes, it’s easier and less error-prone to use the exponent notation, in which case you only use the base unit without any prefixes.
For everyday stuff, you can pick the right magnitude for what you’re dealing with and count with small numbers, like splitting or multiplying a cooking recipe, which is easier done in centi- and deciliters than in millililiters.
The liter was not introduced, it was in the original set of metric base units. It got depreciated when the definition of the meter changed, but it was retained as a “convenience unit”, like minutes and hours.
The liter didn’t get deprecated either.
When the meter changed from being a stick to being a distance traveled by light in vacuum in a specific amount of time. The definition of a liter stayed the same.
Ie, a liter is and always has been 1 cubic decimeter.
That the definition of the decimeter changed due to the standard setting the length of a meter changing doesn’t mean that all standards building on the meter gets “deprecated” that would be mighty unhelpful…
Alexander Wikström: The liter is not exactly deprecated, but the 9th ed. SI Brochure, Table 8 defines a litre as a “Non-SI unit accepted for use with SI units”. The SI unit of volume is the cubic meter.
I’ll admit, that I’m a sloppy programmer, just whatever I can get to work. But there is enough of a method to my madness, that it isn’t too much trouble to go back a tweak a little, even years later. Any major changes, would likely mean a mostly complete re-write anyway. The naming and comments, are just minimal notes to myself. It’s not really expected, that anybody else would be looking at my source code anyway, my dirty little secret code. I can see the need, if it’s something you intend to share, or other people will need to work on, but person projects, I don’t see much need in a lot of excessive typing, or documented (comments) . Then again, all of my programming, is for microcontrollers, and a project’s lifespan isn’t typically years. Once it works, and doing the intended job, there is little reason to ‘fix’ anything.
The worst program i’ve ever had to work on was originally wriiten by a Swiss company for a French bank. The variable names and comments were in French, German, Italian or English. I nearly quit my job…
The way you ended there we can assume you instead opted to learn French German and Italian, right.
Fake it, French is just English trying to sound bourgeois, German is just English trying to sound sehr alte and Italian is just Latin trying to sound putrido. ;-)
I prefer smoots/fortnight as my favored unit of measure for velocity. How come no one ever supports my wishes?
Come on, people! Talk about whining about something that doesn’t matter, at least not in this context! Seriously, do any of us really need to complain about the use of “kph”, when we ALL know EXACTLY what it means?!? Sheesh, people. Stop being so pedantic. This is Hackaday, not some piece of scientific literature. The folks that write these articles are mere humans after all.
Paraphrasing that old joke about going to a hockey game and an metric/imperial fight broke out.
I always heard it was more of a case of going to a fight and a hockey game broke out. 😁😂
HURRAY!
FYI, the Imp/Metric debate has been over.
There will, be vestiges, conveniences, and even common sense exceptions, for a very long time. Nothing wrong with that. Nobody is saying we have to cut the day into milliDays, etc. But most of the Metric system has units that are just as convenient to use as anything Imperial. Who seriously, without bias, can claim there is any reason to use a pound over a kilogram, a pint over liter?
Have a little self-respect as an individual and country. Being a stick-in-mud helps no one.
The WORLD IS METRIC. Get over it. It’s DONE.
The “Metric System” as a metric is OK. Not great, not scaled for humans, but OK. But it wold be nice if the names were open to change. The Imperial/ANSI metric has a couple big advantages, one being single syllable unit names that are impossible to confuse with each other. Whereas the French Metric has long unit names that all sound the same in a noisy environment.
If you were a scholar at the time the French system was introduces, it made perfect sense to Greek for the division that are smaller than the primary unit milli, micro, nano) and Latin for the divisions that are larger – deca, centi, killo. This must be more archaic than the Imperials unit names and today is pretty meaningless.
I would be up for name changes to single syllable audibly orthogonal words.
Using the units most prevalent in one’s country is hardly being a stick in the mud, it’s being practical. I’m not going to replace my car’s speedometer so it reads in kilometers when all the road signage is in miles. Everyone in this part of the world speaks in terms of feet, miles, degrees Fahrenheit, acres, etc. I would sound like a pedantic douchebag if I tried to convert them all to metric, wouldn’t I?
Of course, growing up as an American I was taught how to understand BOTH systems and even how to convert between them relatively easily. I feel bad for people in those parts of the world where such things are not taught, causing them to get angry for no reason when someone uses a unit of measure that they aren’t familiar with. Seems like the education system has failed them.
Get over it. The entire world is NOT metric. Just because it happens to be so in your neighborhood doesn’t give you the right to tell me how I must measure mine. ALL units of measure are arbitrary anyway, whether the foundation be a barlycorn, some guy’s height, or the speed of light. (it’s amazing to me how many times the kilogram has needed to be redefined. If that’s not arbitrary, I don’t know what is.)
There is a difference between arbitrary as just being so and arbitrary in the sense of being simply declared so. The point of the metric system is to be reproducible to the greatest possible precision, which is why all the other systems of measurement are pegged against the SI system even to define how much of what is what.
So if you’re using the second hand version anyways, why not use the real deal? The only good argument is the cultural inertia, where it would cost more to change things than what you would benefit out of it.
It’s like going to a shop in Sweden and trying to hand them dollars for a candy bar. The cost of making the currency exchange for the shop is greater than the value of the candy bar, so of course they will be angry at you.
The argument that they should be prepared to translate between metric and US customary units as casual is unreasonable, because by the same standard you should also know what a Swedish Mil is, or a Chinese Li, or a Finnish Kappa, or how big is the German Stahlpanzerrohrgewinde number 9.
If I ever travel to Sweden, I will not expect anyone there to use my language, my currency, my system of weights and measures, or anything of that sort.
Likewise, I expect that using US dollars will be perfectly acceptable here in the US. Trying to get me to change my system of weights and measures because YOU use a different one is no different than the hypothetical situation you describe. I am in the US, and I will happily continue to use the systems that I grew up with until such time as my country completely switches over to metric.
Actually, I will continue to use BOTH systems, and be just find doing so. Conversion in my head is actually pretty easy, because I was taught to do so when young.
But now you’ve switched the argument. You were complaining that the “education system has failed them” “in those parts of the world” where both systems are not taught.
I tend to find a lot of is based around “use case” especially here in the UK
A lot of old builders for example still use inches / feet for measuring lengths. The reason being is that it’s easier for them to estimate the distance and because it’s easier to divide 12 than it is to divide 10
So
12 / 2 = 6, 12 / 4 = 3, 12 / 3 = 4
10 / 2 = 5, 10 / 4 = 2.5, 10 / 3 = 3.33333
Historically calculators weren’t a thing in the past which is why base 12 was used as the old imperial system. For science or engineering applications typically you’re sat at a computer or desk so it’s more likely you’ll have access to cad software or a calculator.
For a builder or someone trying to do the math roughly in they’re head it’s much easier to use base 12 instead. Which is why tape measures here still have both imperial and metric measurements on.
I run into this failed argument all the time.
Real-world measurements are more like 87, or 57 and 3/8, or 59.72 or similar “whatever units”.
So, /2 = ? / 4 = ? /3 = ???
Base 10,12, 16, not much help. No reason not to go with what’s “Standard”.
Yes, that is Metric.
What about if we went to base 7 though so we could pretend pi = 3.1 and e = 2.5 ??
Uh, no. 12 being commensurate with 2, 3, 4 and 6 is definitely more useful than base 10 being commensurate with 2 and 5. The factor of 10 size difference in the French metric is just too big for convenient use. Look around you. The quart is the Imperial/ANSI equivalent of the Liter and nobody uses it except as a bulk measurement. They use 1/4 or 1/8th (pint, cup) for human activities or 2 or 4 Quarts as half gallon and gallon.
In the French system you have to use 250ml or 500ml. Really? I have to order 500 of something to get a drink of water? This is absurd. Take an objective look at it.
And consider that the power of 2 multiples and fraction are EXACT in binary whereas the 10’s don’t work worth a damn.
RE: ”
Comedicles —
Uh, no. 12 being commensurate with 2, 3, 4 and 6 is definitely more useful … ”
Amazing how “Imperialists” keep harping on this. Must be they are very giving sort of people, always needing to divide things up for sharing.
There is so much more to the difference between the two systems.
And seriously, do you think the rest of the world goes out asking four 350ml of wine, and 238mg of steak? The correct units for most are glass, bottle, large, box, sheet, and can.
To some of the other commenters, citing how the Metric system keeps changing:
It’s a Good thing. Better than being stuck in the past. The only updates to the Imperial System, are how convert to the Metric way.
Reply to “DainBramage”:
Re: “I’m not going to replace my car’s speedometer …. ”
OK. I don’t think there’s a speedometer police. Nobody cares.
Re: ” I would sound like a pedantic douchebag if I tried to convert them all to metric, wouldn’t I?”
No. It’s generally done as a gradual, national effort, with overlap of both systems.. So, it’s collective douchbagging, which feels much less targeted.
Re: “…I feel bad for people in those parts of the world where such things are not taught, …”
Why would they learn an archaic system that only 5% of the world uses? There’s more important things to learn. Maybe how to speak Romansh?
Re: “…ALL units of measure are arbitrary anyway, …”
My point EXACTLY. If what one calls a kilogram or pound is .88kg or 2.12345 pound, and you name it an orange, is irrelevant. So, why stubbornly be part of the 5% douche-club?
For one, if possible, just imagine how others feel about needing sets of tools in Imperial and Metric, for no reason. This is what makes you look like a douchebag.
RE: “it’s amazing to me how many times the kilogram has needed to be redefined. If that’s not arbitrary, I don’t know what is.)”
I think REFINED is a better word. Do you know how much the redefinitions have actually “changed” the mass? (I don’t, but would be surprised if it were anything significant). Redefinitions were likely implemented by need and measuring abitlity. SO? That does not make it arbitrary …
RE: “causing them to get angry for no reason when someone uses a unit of measure that they aren’t familiar with. ”
They don’t get angry. Just shake their head in sad amusement at human nature …
Damn right. That is why my desktop instruments, like O’scopes, range in 1 2 5 10 20 50 100 200…. oops.
The international abbreviation for kilometre par heure SI (or kilometer per hour not SI ) is km/h
“Because you’re not allowed to use the prefixes in engineering drawings”.
Depends on the type of engineering. I would hate a schematic with 10000000R written above a resistor or, even worse, 0.000000000001F written above a capacitor.
At least the SI units are pronounced nearly the same everywhere. Compare that with the width of the human thumb: US – inch, DE – zoll, FR – pouce, HR – palac, HU – hüvelyk, IT – pollice, SL – palec, RU – Дюйм, ES – pulgada, DA – tomme, CY – modfedd, etc. What a mess!
PL – cal
Best Practice: 1080p, 2k,4k 🤣
“a function’s return value could be a number, say a velocity”
Except that velocity is a vector, not a number. Did you mean speed? Velocity is the composite of both speed and direction.