New answers tagged

0

A codebase with a consistent formatting style is a more readable codebase, because it takes less time and less mental effort to read constructs that look like what you're used to. Readability is important: even code with a short life cycle is read more often than it's written. That argument doesn't become invalid if the codebase is split into a large number ...


3

As soon as the code is read more than it's written, it doesn't matter if you're writing a microservice or not: bad code is bad code. Formatting is important, because: Consistent formatting decreases the time wasted understanding code. Whenever it's your colleague reading your code when you're on vacation, or you yourself six months after writing the code. ...


1

Does it really matter how the code is formatted as long as the formatting is adequate? Code formatting is still important to quickly grasp what a particular method/function/block is doing. Perhaps even more so now that a problem may need to be analyzed across several microservices. the necessity of unified format enforcement. Well, nobody expects Python ...


0

Neither choice is “best practice” or not; there is very little difference. In your case the function names are very clear, so you are fine using “text” as the variable names. If it wasn’t obvious what the effect of the functions is, you would use the variable names to document it.


-1

If I find myself in this position it is usually because I have neglected a Clean Code guideline. If the variable can be reused, do you have two functions in one? Do you have repeated code? 99% of the time you will be able to refector your code into multiple functions or a function that can be called multiple times...and achieve the same thing more readably ...


8

The only real rule with variable names is that it should always be obvious what they refer to. Reusing a variable name can cause issues in some situations if the reassignment fundamentally changes what the variable is representing, but in your case that isn't happening. Compare what you wrote to what this might look if instead of applying a string to a ...


1

I was wondering if there are any best practices, conventions or guides to writing maintainable code in Graphviz and/or PlantUML. What approaches you have, and if you can share tips from your experiences. I don't think there's any. You can follow the best practices suggested by PlantUML or Graphviz, but the ultimate test is often showing up the result to ...


Top 50 recent answers are included