Green Code

Green code is code that has been commented out. Its usually green because the popular development environments I use syntax highlight the comments in green. In my personal opinion having large chunks of commented out code is a violation of YAGNI. A much better approach than commenting out the code is just to remove it, if you are using  source control, which surely you must be? a record of it will be stored in version control. Doing this has two advantages, firstly the current source code has less clutter, and secondly the source code is kept historically in version control along side the code that it was meant to work with. Keeping the code commented out along side the current code is daft, unless you think that un-commenting out the code six months later it will still work, which in most cases it probably won’t.

Advertisement

One thought on “Green Code”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s