💾 Archived View for freeshell.de › gemlog › 2022-05-24_Code_smells.gmi captured on 2023-11-04 at 11:31:53. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
When you have to maintain other people's code, little things can give you a bad feeling. They aren't disasters, but they don't give you confidence in your predecessors.
Looking for the table of Things. I was expecting a database called SensibleName, and there it was. Luckily a colleague told me to ignore that and look in SensibleName_Acronym2.
Never mind. I scan down the list of tables for the Thing table. It's OpenThing2.
You could argue that "Open" is a smell because it's a status of Thing, and there are other StatusThing tables, but the fields on other StatusThing tables differ, so I'll let that go.
You can't ignore a checked exception¹ but you can do this:
catch(Whatever w){ ; }
Presumably the original dev was annoyed at having to use try/catch, so they just swallowed the exception they didn't want to deal with. Then I'll bet that they got a warning for an empty catch block, so they put an empty statement in to make the warning go away.
The same code base also had catch blocks like this:
catch(Whatever w){ log("Got an exception"); }
It's saying "Something went wrong, but I'm not telling you what." If it's important, log some details (at least). If it's not important, why log a teaser? What it actually does is really the same as the previous example, but more annoying.
¹ Some people think that checked exceptions are a language smell, but language isn't a choice available in code maintenance.