Help me name my components
-
If you don't get over using "2", you will eventually have the same problem again, and you will forget which is the current one. ;)
OMG, you've just reminded me that Microsoft itself is very much guilty of that right in plain ol' Win32. I don't remember what component exactly--something to do with retrieving network configuration data--and they oh-so-wisely chose to append "2" at the end of some function names (and structs) to differentiate them from previous versions (you can't just remove functions from the standard Win32 set without breaking stuff). Someone remembers what I'm talking about, I'm sure, I can't be bothered to look it up right now. I'm pretty sure I also saw a "3"...proving your point. With names like that, nobody but the original author, who is intimately familiar with the underlying implementation, ever stands a chance of remembering which does what, and you constantly have to go back to documentation. Assuming it exists and is adequate enough to point out the differences. I absolutely believe in the saying that properly naming things *is*, indeed, one of the hardest computer science problems.
-
[Technology to the rescue](https://wheelofnames.com/)
cheers Chris Maunder
-
I clicked on the link because it would be a programming revelation YES I am still learning no revelations here keep moving I now know better humor is worth more than revelations made me laugh Caught Covid yesterday so needed a laugh Chris Maunder2
the dreaded 'vid. Salt water gargle and netflix. I hope it brushes you lightly.
cheers Chris Maunder
-
I'm working on a react project that has a component and related components named filter, filter group, etc. They need a complete overhaul and I was told to create a new set of components so that we can slowly implement the new one. Now I'm having the mental dilemma of figuring out what to name these new components. I flat out refuse "NewFilter" or "FilterNew" because you know it's going to have another iteration one day..."Filter2" seems blah. Does everyone else fret over naming things? What would you pick?
-
OMG, you've just reminded me that Microsoft itself is very much guilty of that right in plain ol' Win32. I don't remember what component exactly--something to do with retrieving network configuration data--and they oh-so-wisely chose to append "2" at the end of some function names (and structs) to differentiate them from previous versions (you can't just remove functions from the standard Win32 set without breaking stuff). Someone remembers what I'm talking about, I'm sure, I can't be bothered to look it up right now. I'm pretty sure I also saw a "3"...proving your point. With names like that, nobody but the original author, who is intimately familiar with the underlying implementation, ever stands a chance of remembering which does what, and you constantly have to go back to documentation. Assuming it exists and is adequate enough to point out the differences. I absolutely believe in the saying that properly naming things *is*, indeed, one of the hardest computer science problems.
-
Colander
-
Chris Nicolatos wrote:
in Lithuanian is filtras in Igbo it's nyo in Scots Gaelic it's criathradh now you have the benefit of learning new languages while you program
What is it they say again about writing software as if the next guy that has to maintain it is a psychopath who knows your home address? Yeah, that. I don't see this as being any better than using random 2-character variable names. Or complete gobbledygook. The smiley at the end of your post probably saved you. :-)
Having grown up using FORTRAN IV where there was a 6 character limit to variable names using only A-Z and 0-9, you had to be very inventive to avoid everything being A1, A2, A3, I, J, K etc
-
I'm working on a react project that has a component and related components named filter, filter group, etc. They need a complete overhaul and I was told to create a new set of components so that we can slowly implement the new one. Now I'm having the mental dilemma of figuring out what to name these new components. I flat out refuse "NewFilter" or "FilterNew" because you know it's going to have another iteration one day..."Filter2" seems blah. Does everyone else fret over naming things? What would you pick?
Does your programming language support namespaces? Then I‘d stay with Filter but put it in a different namespace. Then you would ‚only‘ need a name for the namespace. During a transition phase you must specify the namespace, if both types can be used in parallel.
-
Another choice is translate.google.com Put the component name on the left and go through various languages on the right, you have filter in Lithuanian is filtras in Igbo it's nyo in Scots Gaelic it's criathradh now you have the benefit of learning new languages while you program :)
Many moons ago I worked on a project in need of a file record manager. We didn't have the resources to build it from scratch, and searched for a library. As we would have to make adaptations, we needed open source solutions. We settled for one alternative recommended by several users - but it turned out to be useless to us: Every internal function, every variable, every comment was in French. None of us knew any French at all. We made a serious try to understand the workings of a few of the functions, but had to give up - it would be easier to write it from scratch ourselves (which had been ruled out for resource reasons). Even long before that, I have in my code followed two rules: Everything that only a programmer will see is in English (including off line documentation). Anything that will be seen by a user, including the most advanced users, is in the language of the user (including all the online or offline documentation a user will ever see) - i.e. it may appear in multiple languages, so the texts should be organized for simple translation, in separate modules/files. So I never use Norwegian variable names in my code, even if the all the users of the program are Norwegians.
Religious freedom is the freedom to say that two plus two make five.
-
InternetExplorer as a component: WebView. Edge as a component: WebView2. (This is an unresearched posting, but pretty close if wrong)
Jeez, I didn't even think about that one, and I've just spent quite a bit of time migrating over an old piece of code leveraging WebView to WebView2. At least in this case it's pretty clear WebView was built around IE, and WebView2 is the Edge version, and I just "naturally" think about it in those terms. There are components however where you just don't know unless you check the documentation.
-
Having grown up using FORTRAN IV where there was a 6 character limit to variable names using only A-Z and 0-9, you had to be very inventive to avoid everything being A1, A2, A3, I, J, K etc
-
I started off with Commodore 64 BASIC, where everything pretty much *was* A1, A2, A3, I, J, K. You couldn't *pay* me to go back to that sort of thing.
I started out with "Real Time Basic" on a Univac 1100 mainframe; it was the that way. String variables were A$ through Z$. "Real Time" because up until then (1975), Univac 1100 had run batch jobs only, submitted on punched cards. The Basic system was interactive (sort of...) through a Teletype with a 110 bps acoustic modem - Univac's first attempt at interactive time sharing. The machine did not make it through the acceptance test. Midway in the test period, it was discovered that Univac engineers had secretly doubled the amount of RAM to make it through the tests. The test was interrupted an a new test period started. It didn't go through that test round either, so the huge mainframe was returned to the manufacturer. Later, in my student days, the brightest kid in my class was caught coding a rather large homework problems using variable names I00 to Inn (for integers), F00 to Fnn (for floats) and so on. We told him, "Prof. R.C. is going to blow up completely when he sees that!" But this classmate of ours was calm: "That's only while I am working at the problem. Before I hand it in, I will replace I00 with NumberOfApplesPerCase and F01 with AverageWeightPerApple and so on, but I can't bother to write such variable names while I am still working on it!" Well, as I said, he was the brightest kid in the class. His brain had no problems associating I00 with the number of apples per case and F01 with the average weight per apple. He had no need for the mnemonic function of variable names.
Religious freedom is the freedom to say that two plus two make five.
-
Chris Nicolatos wrote:
in Lithuanian is filtras in Igbo it's nyo in Scots Gaelic it's criathradh now you have the benefit of learning new languages while you program
What is it they say again about writing software as if the next guy that has to maintain it is a psychopath who knows your home address? Yeah, that. I don't see this as being any better than using random 2-character variable names. Or complete gobbledygook. The smiley at the end of your post probably saved you. :-)
Reminds me of the first Pascal tutorial book I read, where all of the variable names were Aztec gods, kings and priests, as the author reckoned they were about as readable and memorable as most programmers variables, and wanted to make the point that badly chosen variable names can obfuscate the meaning of the code.
-
Reminds me of the first Pascal tutorial book I read, where all of the variable names were Aztec gods, kings and priests, as the author reckoned they were about as readable and memorable as most programmers variables, and wanted to make the point that badly chosen variable names can obfuscate the meaning of the code.
-
Reminds me of the first Pascal tutorial book I read, where all of the variable names were Aztec gods, kings and priests, as the author reckoned they were about as readable and memorable as most programmers variables, and wanted to make the point that badly chosen variable names can obfuscate the meaning of the code.
The textbook in my first university level course in discrete mathematics stated in the introduction: If all rouve traths are slooth, and we have a rouve trath, then we know that the trath is also slooth. We read the statement, grinned at the example, and nodded: Well, of course! I guess it is more important in discrete math to learn the theorems and lemmas as generics, not bound to specific familiar concepts. Like, you learn to multiply 5 by 2 making 10, not 5 apples times 2 dollars a piece making 10 dollars. Well, that is a nice application, to understand why it is useful to learn 5 times 2. But if you learn from it how to multiply apples by a unit price, so you know nothing about how to multiply 5 km/h by 2 hours, because what you have learnt doesn't include speeds and times, then the 'meaningful' example with apples and unit price didn't help you at all. You really should be able to learn a sorting algorithm, say, regardless of the kind of objects sorted. Or calculate an average. Or ... You should be able to calculate the average Āhuiatēteoh (*) value as well and as easily as the average AppleWeight value. So, I will to some degree defend the choice made by that book. Not unconditionally - it may go too far. E.g. I think Knuth made a grave mistake in assuming that it doesn't matter at all which programming language is used to show the implementation of an algorithm, so a fictional assembly language MIX is as good as any other language. But to a certain degree, we must be able to abstract the idea conveyed by a code snippet, above the level of variable names - especially when accompanies by a tutorial explanation. (*) The first entry in https://en.wikipedia.org/wiki/List\_of\_Aztec\_gods\_and\_supernatural\_beings
Religious freedom is the freedom to say that two plus two make five.
-
The textbook in my first university level course in discrete mathematics stated in the introduction: If all rouve traths are slooth, and we have a rouve trath, then we know that the trath is also slooth. We read the statement, grinned at the example, and nodded: Well, of course! I guess it is more important in discrete math to learn the theorems and lemmas as generics, not bound to specific familiar concepts. Like, you learn to multiply 5 by 2 making 10, not 5 apples times 2 dollars a piece making 10 dollars. Well, that is a nice application, to understand why it is useful to learn 5 times 2. But if you learn from it how to multiply apples by a unit price, so you know nothing about how to multiply 5 km/h by 2 hours, because what you have learnt doesn't include speeds and times, then the 'meaningful' example with apples and unit price didn't help you at all. You really should be able to learn a sorting algorithm, say, regardless of the kind of objects sorted. Or calculate an average. Or ... You should be able to calculate the average Āhuiatēteoh (*) value as well and as easily as the average AppleWeight value. So, I will to some degree defend the choice made by that book. Not unconditionally - it may go too far. E.g. I think Knuth made a grave mistake in assuming that it doesn't matter at all which programming language is used to show the implementation of an algorithm, so a fictional assembly language MIX is as good as any other language. But to a certain degree, we must be able to abstract the idea conveyed by a code snippet, above the level of variable names - especially when accompanies by a tutorial explanation. (*) The first entry in https://en.wikipedia.org/wiki/List\_of\_Aztec\_gods\_and\_supernatural\_beings
Religious freedom is the freedom to say that two plus two make five.
Yes, it's a balance between the abstract and the concrete.