5 ms·
Having rigorous code reviews that aim to raise the bar on readability is the best way imo. If a few people agree that something is readable then the odds are m
by thewarrior 5y ago
Having rigorous code reviews that aim to raise the bar on readability is the best way imo.
If a few people agree that something is readable then the odds are much better that code is maintainable.
- agentultra 5y agoYou have to be careful with readability in code review: you can't please everyone. There's nothing more demotivating than spending 8 hours on a problem, feeling good about your solution, and then having some "senior" developer come along and tell you to rewrite it "for readability." My best defence for this is to have a guiding philosophy or design guide beyond the usual linting rules and code formatting tools. It prevents unnecessary stylistic changes. A good guide will centre itself around the intersection of the IC's values and the requirements of the system. If you're working on a game engine you might value performance and tend to prefer vectorized code over branching code in order to exploit parallelism as much as possible in the pipeline. Whatever your team values the most is what should go in there and it should be as clear as can be so that people can reference it when giving suggestions in reviews.
- jsbg 5y ago> There's nothing more demotivating than spending 8 hours on a problem, feeling good about your solution, and then having some "senior" developer come along and tell you to rewrite it "for readability." While a senior engineer just asking you to rewrite it without further details is bad, it's good practice to follow the "make it work, make it right, (optional) make it fast" approach. The "make it right" part is where you make your code readable after you've ensured that it works and before you submit it for review. If you find later that you need to make it fast, it is expected that readability will have to be traded for performance.
- zebraflask 5y agoOr, for the contrarian view, you have a few people mutually reinforcing poor coding practices under the guise of whatever they view as readable and maintainable, which in my experience is equally likely.
- mateo411 5y agoEven if you don't agree with the coding practices, at least it enforces consistency throughout the code base. It might not be the consistency that you desire, but it much better than every author having their own style.
- zebraflask 5y agoI think this view assumes that consistency like that actually works. You can be consistently driving headlong off a cliff, right?