This Overly Long Variable Name Could Have Been a Comment | Jonathan's Blog
squaresinger @ squaresinger @lemmy.world Posts 4Comments 593Joined 4 mo. ago
Tbh, creating new code just to shorten variable names is pretty bad practice. Don't do that.
Each line of code needs to be maintained, each line of code can contain bugs and reusing such a class in locations it wasn't actually made for can cause more harm than good.
And if you are adding external information (e.g. via a class) why not just add that information as inline documentation (aka comments) instead? Most IDEs can handle that so that if you hover over the variable/function name it will display the documentation. And pretty much all IDEs allow you to navigate to declaration with just one click, and there you find the necessary information.
You example only gets worse if you keep nesting these things, so for example if I have:
int sleepIntervalSeconds = 0;
Then I immediately know:
- It's an int (not a double)
- It's an interval used for sleeping
- It's in seconds
(Putting all that in a comment instead of the variable name is almost equally as visible via IDE)
Instead consider your proposal, which would read like this:
Intervals var.sleep = 0;
I used var as the variable name since you abstracted the informations "sleep", "interval" and "seconds" into other definitions.
So now I still know it's an interval used for sleeping, but both the real variable type and the information that it's in seconds is gone. I have to navigate to the Intervals class/type to figure that out.
IRL this often gets even worse, because Intervals probably doesn't even contain the fields directly, but instead inherits from a Time class, which then inherits from some other class, and then you might get to the actual definition of the field.
This is only amplified by using Mixins and other obfuscation goodness.
If you have two options, and one option creates extra code, extra classes and extra code paths without reducing the complexity of the code significantly, than that's the worse option.
Congratulations, you figured out to do comments the wrong way.
You also figured out how to use a bad, unclear variable name, so should we also stop naming variables with sensible words since it can be done wrong?
External documentation can also be done badly, so let's stop doing that too.
Or what's your point?
I totally get your point.
I think the rule of "cleared its own orbit" tried to be less arbitrary and failed horribly.
A size threshold is clearly more consistent, but it's purely arbitrary, while the "cleared its own orbit" rule at least has the appearence of not being totally arbitrary, even though it introduces just the problem you are describing.
The main issue here is that everything from a speck of dust to the massive black hole at the centre of the galaxis is pretty much the same thing on a large spectrum.
You can clearly say that some grains of dust are something entirely different than a supermassive black hole, but it's really hard to find solid cut-off points to categorize anything in between.
So we started with a handful of arbitrary examples for each category, which was easy when we only had these examples, but with more and more discoveries the gaps between these examples are filled and it becomes a spectrum, and then it becomes iffy what exactly fits into which category.
You are confusing science (the process of discovering understanding of reality) with truth (how the world "really" is).
"Real science" like you describe can almost by definition not exist. Science is costly, both in time and in money. People don't just spend lots of time and money just because. For that kind of investment you need some kind of motive, some reason. And as soon as you have that, you are into politics and emotions.
It does make sense though. The main motivator for politicians is power. That means, naturally political systems flow towards maximizing power for those in power, that's just the natural progression.
To change this, major political upheavals are necessary, so basically events where the whole old leadership is tossed out and the new leadership can try to setup something to stop the same thing from happening again.
WW2 was perfect for that. All those countries were in need of a completely new political system and thus they could be built better from the ground up.
The US never had any event like that (apart maybe from the civil war).
To change the system without such an event, two thirds of all relevant politicians would have to vote for changing the system that brought them to power. Not likely to happen.
Have you looked at the amendments? So far there have only been 27 of them over 236 years. Ten of them were created within a year of the constitution being created. They were basically Zero-Day-Patches, not actual amendments, and two amendments only exist to nullify each other (18 and 21) which leaves 15 amendments over 235 years (one of which was actually also created within the first year and only ratified 200 years later).
The last time an amendment was proposed was 54 years ago and the last one ratified was 33 years ago.
Not counting the Zero-Day-Patches, not a lot of these amendments actually change anything fundamental. Notable ones are 12 (governs the election of VP), 13-15 and 19 (civil rights), 17 (election of senators), 22 (president's term limit) and 25 (succession of the president).
Notably absent from the amendments is anything that changes the core political system or electoral system.
Compare that to other countries. In the time that the US constitution hat 15 minor amendments, France had a total of 15 complete constitution re-writes, not even counting amendments. 15 full new constitutions.
Germany had 69 constitutional amendments since 1949 (76 years, so almost one amendment per year, compared to the 1/16 amendments per year in the USA).
But by far the biggest issue is that a constitutional amendment cannot actually fix fundamental systemic issues. The people who have the power to change the constitution came to power within the current system, so if they fundamentally change how the system works (e.g. by repairing the electoral system in a way that more than two parties can be relevant), they are directly cutting into their own power, so of course they won't do that.
That's what you need major constitutional crises for (like e.g. Europe after WW2), so that the constitution can be re-written from scratch, fixing the issues that lead to the crisis.
But the US has been too big to fail for too long and thus there never was anything big enough to take down the US so that it needed to be restarted from scratch. The closest they came to was the civil war, but they didn't take the opportunity to actually overhaul the system. Probably because it was still too early and there wasn't much of a precedent of how to build a better democratic system.
But who knows, at the current rate it might be likely that the US is quite close to another chance to re-write the constitution.
Our independence was supposed to free the people of kings and tyrants. It’s been 249 years since 1776, we have undone what the Constitution authors fought for.
That's what happens if you stick with a quarter-millennium old prototype of a semi-democratic system.
The constitution was revolutionary and ground-breaking, a quarter millennium ago. But still running that old piece of toilet paper as the basis of a democratic system in 2025 is like driving a Ford Model T today and claiming that it still is the latest and greatest automobile ever created.
After thinking about this myself, I’m starting to feel the same way. Instead of being proud of the country, I’m feeling like I’m just another wallet that companies and the government are trying to suck all the money out of.
Always have been, always will be.
The cost of living is going up, the housing market is a nightmare
Don't worry, once they deported or killed all the Jews illegals the prices will surely come down.
pi == 3
That's what happens if you only have access to a handful of brain cells.
When do you need documentation? When you are down in the code or when you are sitting on the toilet browsing Confluence? If your goal is to make people read the documentation, then the documentation needs to be immediately there where you need it, not in some external thing like Confluence.
Same goes with if your goal is to make people update the documentation. That's much more likely to happen if the documentation is in a comment in the code than when you first have to go hunting to find the correct page in that steaming pile of mess that is confluence.
You still only got so much screen real estate, and having huge names means that your lines get very long at times, which makes everything really hard to read.