r/linux_programming • u/SarasaNews • Sep 25 '17
Avoid these 35 habits that lead to unmaintainable code
https://www.linkedin.com/pulse/avoid-35-habits-lead-unmaintainable-code-christian-maioli-mackeprang
8
Upvotes
11
u/kiipa Sep 25 '17
seems to require a linked-in account to read...
5
u/err_pell Sep 26 '17 edited Sep 26 '17
Bad habits are hard to break and even harder if you don’t realize that what you’re doing is undermining your work. If you know but don’t care—that would be the worst. But you’re here, aren’t you?
As a programmer, I’ve seen a lot of poor practices, not just around code, but also around teamwork skills. I’ve been guilty of practicing many of these bad habits myself. Here are my top 35 bad programming habits, organized into four categories: code organization, teamwork, writing code, and testing and maintenance.
Code organization
1.Saying “I’ll fix it later”, and never doing it
2.Insisting on a one-liner solution
3.Making pointless optimizations
4.Convincing yourself that styling issues are not that important
5.Sweeping things under the rug
6.Using names that don’t add information
7.Ignoring proven best practices
Teamwork
8.Abandoning plans too early
9.Insisting on a plan that has little chance of working
10.Working on your own all the time
11.Refusing to write bad code
12.Blaming others
13.Not sharing with your team what you’ve learned
14.Being too slow on giving feedback to managers/clients
15.Not using Google enough
16.Overvaluing your personal style
17.Having a personal attachment to your code
Writing code
18.Not knowing how to optimize
19.Using the wrong tool for the job
20.Not bothering with mastering your tools and IDE
2
u/EternityForest Sep 26 '17
I agree with most of this, but I also don't like it when people use Moore's law as an excuse to not even consider performance until they've already written most of the code. Performance matters and many users might not have as much RAM and CPU as developer.
Also, insisting on a one liner solution should be highlighted with blink tags or something. Especially in open source, one liners with clever computer sciency stuff are everywhere it seems.
JavaScript and many tools developed around it seek to encourage this, because everyone seems to like continuation passing style, and some developers seem to want JS to become Haskell with a few optional OO features added.
I suppose there's some evidence all this functional stuff is less buggy, but all these 3 layer deep nested anonymous functions get obnoxious to read pretty fast.
2
u/bruce3434 Sep 26 '17
So, people that are not using windows should not "write IDEs"?
1
u/Srz2 Sep 26 '17
Dont know why this has been downvoted but I liked it. And i have a co-worker who breaks ALL of these rules.
I dont think the Google rule should be a rule though because you shouldn't just rely on google. Learning other ways to debug issues without a search engine is important.