view the rest of the comments
Software Gore
Welcome to /c/SoftwareGore!
This is a community where you can poke fun at nasty software. This community is your go-to destination to look at the most cringe-worthy and facepalm-inducing moments of software gone wrong. Whether it's a user interface that defies all logic, a crash that leaves you in disbelief, silly bugs or glitches that make you go crazy, or an error message that feels like it was written by an unpaid intern, this is the place to see them all!
Remember to read the rules before you make a post or comment!
Community Rules - Click to expand
These rules are subject to change at any time with or without prior notice. (last updated: 7th December 2023 - Introduction of Rule 11 with one sub-rule prohibiting posting of AI content)
- This community is a part of the Lemmy.world instance. You must follow its Code of Conduct (https://mastodon.world/about).
- Please keep all discussions in English. This makes communication and moderation much easier.
- Only post content that's appropriate to this community. Inappropriate posts will be removed.
- NSFW content of any kind is not allowed in this community.
- Do not create duplicate posts or comments. Such duplicated content will be removed. This also includes spamming.
- Do not repost media that has already been posted in the last 30 days. Such reposts will be deleted. Non-original content and reposts from external websites are allowed.
- Absolutely no discussion regarding politics are allowed. There are plenty of other places to voice your opinions, but fights regarding your political opinion is the last thing needed in this community.
- Keep all discussions civil and lighthearted.
- Do not promote harmful activities.
- Don't be a bigot.
- Hate speech, harassment or discrimination based on one's race, ethnicity, gender, sexuality, religion, beliefs or any other identity is strictly disallowed. Everyone is welcome and encouraged to discuss in this community.
- The moderators retain the right to remove any post or comment and ban users/bots that do not necessarily violate these rules if deemed necessary.
- At last, use common sense. If you think you shouldn't say something to a person in real life, then don't say it here.
- Community specific rules:
- Posts that contain any AI-related content as the main focus (for example: AI “hallucinations”, repeated words or phrases, different than expected responses, etc.) will be removed. (polled)
You should also check out these awesome communities!
- Tech Support: For all your tech support needs! (partnered)
- Hardware Gore: Same as Software Gore, but for broken hardware.
- DiWHY - Questioning why some things exist...
- Perfect Fit: For things that perfectly and satisfyingly fit into each other!
First, I was exaggerating for humor, partly to make fun of the example and partly or make fun of programmers who would criticize even three lines of code out of context, because they like to feel smart. 😉
Even so, if I played "What's not to like about this code?" I would point out a few things to look at more closely.
Writable shared memory always draws my attention. It's not bad, but I tend to prefer to minimize it. A writable field in an object is often perfectly fine and sometimes it's a signal of a poorly-drawn boundary between methods.
Writing to a field, then immediately
return
ing falls into a similar category. Often this is perfectly fine, but sometimes it's a symptom of a misdrawn boundary between methods. I would prefer a function or method that calculates and returns the value, then separate code that assigns it to a field. That makes the calculation easier to inspect, such as with a test.Naming a boolean value for the "no" state always feels strange to me. I always prefer to name it for the "yes" state, so I would challenge the name
invalid
for that field.Having a boolean value to represent that a thing is valid tends to be a step in the direction of a little parser. Often, the design gets stuck at a spot where there is a boolean combined with another variable in such a way that the values of those variables is commented in some way. That design can almost always be improved by introducing a little parser that returns Maybe or Either or throws an exception. (https://blog.thecodewhisperer.com/permalink/a-guard-clause-is-maybe-a-tiny-parser)
Naming an argument with the prefix
arg
is usually either following an obsolete habit purely out of habit or a survival tactic for identifying arguments to loooooong functions. Sometimes we do this because we have to, but I would almost always prefer to split up the function to make this naming convention unhelpful and unnecessary.And it's very important to clarify that I raise these as areas of interest for further attention. They are at most risks. I can think of good reasons to do all these things, but I would tend to treat them as very temporary choices that I'd probably prefer to change sooner than later.
Was any of that helpful at all? Any further questions about it?
Yes this was a super interesting read as were most of the other replies. Thanks for sharing some info!
I glad it helped! Peace.