3 ms·
> Consider this real world example: a_crszkvc30LastNameCol. > It took a team of maintenance engineers nearly 3 days to figure out that this whopper variable na
by newsbinator 8y ago
> Consider this real world example: a_crszkvc30LastNameCol.
> It took a team of maintenance engineers nearly 3 days to figure out that this whopper variable name described a const, reference, function argument that was holding information from a database column of type Varchar[30] named "LastName" which was part of the table's primary key.
- vntok 8y agoThat's insane, what could those 3 engineers possibly be doing for 3 days? - const, reference and function argument should be pretty obvious from the code context - LastNameCol seems like self-describing... of course you would have to know that you're debugging an application that talks to databases, but eh
- marcinzm 8y agoMost likely tracking down what originally populated the variable and how it's used. I'm assuming the code base was large and spaghetti like. I'd say it's somewhat akin to proving a negative. Sure you get that it's a const, reference and function argument which likely refers to the Last Name Column. However is that all it is? Or is there more meaning in the name? Meaning that could be crucial to understanding how the application functions? Does one of the characters mean function reference or does it refer to something else? Apparently not in this case but how can you know without investigating?
- wild_preference 8y agoSpending time to understand the author’s intent of some code is one of the hardest parts of reading code. It’s like when you find a nil-guard in a function. You can’t truly refactor it until you know whether it was added defensively just-in-case or whether nils can still exist in the system at the function’s callsite, calling for further upstream examination. There’s a certain hell in trying to follow a code base where every function is infected with ‘if (!arg) return’.
- AgentME 8y agoAfter dealing with code absolutely plagued with that pattern, languages with non-nullable types are amazing (Flow, Typescript in strict mode, Kotlin, Rust, ...) and I don't think I'm ever going to voluntarily switch away from them now.
- ppeetteerr 8y agoc30 appears to identify the size of the column. If you put structure in your variable name, your PR is not going through. ;)