Linked Questions
10 questions linked to/from Readability versus maintainability, special case of writing nested function calls
352 votes
19 answers
66k views
How would you know if you've written readable and easily maintainable code? [closed]
How would one know if the code one has created is easily readable, understandable, and maintainable? Of course from the author's point of view, the code is readable and maintainable, because the ...
105 votes
14 answers
13k views
At what point is brevity no longer a virtue?
A recent bug fix required me to go over code written by other team members, where I found this (it's C#): return (decimal)CostIn > 0 && CostOut > 0 ? (((decimal)CostOut - (decimal)...
50 votes
6 answers
13k views
Is a comment aligned with the element being commented a good practice?
I am a home, amateur developer for 25 years and I just had a bright idea regarding comments. Like all such novel bright ideas, someone has probably already done it and there is probably a consensus on ...
16 votes
5 answers
2k views
Is it possible to apply DRY without increasing coupling?
Assume we have a software module A that implements a function F. Another module B implements the same function as F'. There are a number of ways to get rid of the duplicate code: Let A use F' from B. ...
2 votes
5 answers
3k views
Declaring unnecessary variables for readability
I know some languages (C comes to mind) its best to declare as few variables as possible. In a language with memory management like C# is it better practice to continue with this philosophy or should ...
4 votes
5 answers
419 views
Using dedicated functions for opposites/inverse
I have a disagreement with one of my colleagues on whether or not functions should have inverse functions available. I would like to know when/if inverse functions should be used. For example, say we ...
3 votes
3 answers
4k views
Define "constants" at the global or function scope?
I often define variables that will never change, i.e. constants, at the top of a script/module. But recently I've been wondering if it makes sense to define them at the function scope level if they ...
3 votes
2 answers
420 views
Is there a name for this programming pattern? [closed]
A commmon pattern I've noticed in my Python code follows this simple structure: value = get_val_from_thing() value = mutate_that_val(value) I find myself first grabbing some specific value(s) from ...
1 vote
3 answers
509 views
Scala Option vs. conditional branches
If I'm writing Scala functions and have to check for nulls in situations where I can't avoid it (say, working with Spark UDFs and some legacy Java types), is it better to turn things into Option or to ...
1 vote
3 answers
316 views
To enforce column limits on long strings? [closed]
We're trying to update our style guide (using google's guide as a starting point) and I'm currently in the middle of a debate with my colleagues about column limits. I believe we're all in agreement ...