Linked Questions
141 questions linked to/from How would you know if you've written readable and easily maintainable code?
85
votes
10
answers
20k
views
When to use / not use syntactic sugar
Currently I am working on a school project written in C#. Some teammates just started in C# and some are already familiar with C#. Today I had a discussion on whether to use syntactic sugar like this ...
52
votes
18
answers
46k
views
What is proven as a good maximum length of a function? [closed]
Does function length affect the productivity of a programmer? If so, what is a good maximum number of lines to avoid productivity loss?
Since this is a highly opinionated topic please back up the ...
6
votes
2
answers
286
views
What time horizon and level of abstraction is the right for the maintainable and evolvable software? [closed]
From time to time I feel exhausted in my software development efforts because I am pressed to think and develop in very specific and very short term manner. One client here and now requires one ...
7
votes
2
answers
2k
views
Why should imports be made at the beginning
Why is it considered good style to do all imports in a python application at the beginning, even if what is imported is used only once?
I have been programming only shorter pieces of software for a ...
1
vote
1
answer
210
views
Should I use an `elif` or an `if` for the second of two consecutive assertions?
Here's an example of my question in python. Notice there's only a very subtle difference: changing an if to an elif. There's no difference in behavior; if the first if statement is executed, the ...
63
votes
10
answers
12k
views
Readability versus maintainability, special case of writing nested function calls
My coding style for nested function calls is the following:
var result_h1 = H1(b1);
var result_h2 = H2(b2);
var result_g1 = G1(result_h1, result_h2);
var result_g2 = G2(c1);
var a = F(result_g1, ...
2
votes
1
answer
384
views
Module with various classes in addition to helper functions defined outside of a class
I have a data science codebase that contains several classes. Several of the methods in the classes rely upon various helper functions. These functions will just precede the class definitions in my ...
2
votes
3
answers
2k
views
Best practices for maintainable Graphviz / PlantUML code
I've been using Graphviz a little and just found out about PlantUML which is quite similar.
I make diagrams but later the processes or systems depicted by the diagrams might change so I need to make ...
-2
votes
1
answer
63
views
Initialize some values from an array, write more elegant or efficient
I have tried this piece of code:
String[] latitudesArray = latitudes.split(",");
String[] longitudesArray = longitudes.split(",");
Double startLat = ...
83
votes
6
answers
68k
views
At what point/range is a code file too big?
I'm finding lots of 2-3k line files, and it doesn't really feel like they should be that big.
What is a good criteria to objectively call a source code file "too big"?, is there such thing as a ...
18
votes
7
answers
7k
views
Should one prefer a generic version of a function, even if it's not re-used (yet)?
YAGNI might tell us, that in the below implementation the generic version is not needed, as long as the function is only used once.
But to me personally, it seems, the generic version is more readable ...
75
votes
17
answers
7k
views
What hurts maintainability? [duplicate]
For someone who doesn't have much real world experience yet, the notion of maintainable code is a bit vague, even though it follows from typical good practice rules. Intuitively I can tell that code ...
39
votes
8
answers
12k
views
Literate programming vs reasonably documenting your code
In a project that aspires from the onset to be maintainable across a revolving team of developers, what difference would it make to use literate programming against thorough commenting guidelines?
The ...
1
vote
1
answer
392
views
Cyclomatic complexity vs repeated code
we've a python function that can be achieved in 2 ways
1st method
def complexity_1(x, y):
if 2 == x and 3 == y:
a=3
b=4
c = a + b
elif 2 == x and not 3 == y:
a =...
12
votes
3
answers
24k
views
Is it really correct to declare all instance attributes in __init__
According to Pycharm (and thus assume according by PEP) i should state all instance attributes directly inside __init__. In my case it does not seem suitable to me. I have something like:
class ...