TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How To Write Unmaintainable Code

29 pointsby r4umover 11 years ago

7 comments

bcRIPsterover 11 years ago
from page... zOMG this is evil!<p>CODE THAT MASQUERADES AS COMMENTS AND VICE VERSA<p>Include sections of code that is commented out but at first glance does not appear to be.<p><pre><code> for ( j=0; j &lt; array_len; j +=8 ) { total += array[j+0]; total += array[j+1]; total += array[j+2]; &#x2F;* Main body of total += array[j+3]; * loop is unrolled total += array[j+4]; * for greater speed. total += array[j+5]; *&#x2F; total += array[j+6]; total += array[j+7]; } </code></pre> Without careful attention , would you notice that three lines of code are commented out?
评论 #6849797 未加载
评论 #6849879 未加载
评论 #6850018 未加载
评论 #6849791 未加载
lkrubnerover 11 years ago
I like this one:<p>Object oriented programming is a godsend for writing unmaintainable code. If you have a class with 10 properties (member&#x2F;method) in it, consider a base class with only one property and subclassing it 9 levels deep so that each descendant adds one property. By the time you get to the last descendant class, you&#x27;ll have all 10 properties. If possible, put each class declaration in a separate file. This has the added effect of bloating your INCLUDE or USES statements, and forces the maintainer to open that many more files in his or her editor. Make sure you create at least one instance of each subclass.
评论 #6850022 未加载
RyanZAGover 11 years ago
<p><pre><code> Underscore, a Friend Indeed Use _var and __var in identifiers. </code></pre> Even better when it&#x27;s sometimes __ and sometimes ___ - you can never tell which it is at a glance. (Python is great for this one!)
acheronover 11 years ago
A classic.<p>My favorite is &quot;Properly-written code never fails, so exceptions are actually unnecessary.&quot;
评论 #6850260 未加载
wrongc0ntinentover 11 years ago
This should be translated in a few languages I can think of.
interstitialover 11 years ago
I&#x27;m going to copy and paste this into any empty or default text README.md&#x27;s I find in projects I&#x27;m assigned to work on. Perhaps Github should also post it as the default README.md for any new project.
AsymetricComover 11 years ago
These are all great suggestions, because it&#x27;s very often (always) that management assumes they know what your software does given the output.