Why you should perform routine code cleanup

Lately I have been working on converting my CSS on the Triangle Land GitHub annex to SCSS, and as part of that conversion I am gradually going through my styles, looking for anything I no longer need, fixing any issues I find (and I have found many), and overall cleaning it up.

The other day, I was working on improving the blog post page (which a huge JSON feed from here on WordPress ๐Ÿ˜€ ), specifically the post metadata, when I noticed this class in my stylesheet.

.publish-info {
  font-size: 0.85em;
  text-shadow: 1px 1px 2px #000;
}

I had no remembrance of this particular class, and a quick search of project files found it was not being referenced. However, I could tell it belonged to the post metadata, so I quickly applied it using the Firefox developer tools inspector, and subsequently merged the text-shadow portion into the actual .post-meta class. Turns out, the small shadow helped improved readability, especially on mobile devices (these pictures do not quite capture the effect, but it works).

"Date published" text without shadow

“Date published” text without shadow

"Date published" text with shadow

“Date published” text with shadow

After a bit of research into when this class was added and last referenced (conducted right after drafting this post ๐Ÿ˜› ), it would appear the class was added on 3 April, 2014, and was used in a long-removed page layout. As far as I can tell, that layout is the only instance the .publish-info class was ever used, as from the initial implementation of the blog post feed code I have used the .post-info (now known as .post-meta) class to display the post metadata.

This means that since early April, for over 5 months, I have had an unreferenced class in my CSS that contained a helpful property that at one point was used but was quickly removed in a flurry of refactoring, making me forget it was even there.

That is why you should perform some form of cleanup on your code routinely. How often that should be is up to you, but it should be done. You never know what you will find!

By the way, this is the August edition of Adventures in Website Design && Development. I decided to make it a bit more real-world themed, not to mention the fact I forgot I had not done one at all this month! ๐Ÿ˜ฎ

-le717

Advertisements

One thought on “Why you should perform routine code cleanup

Triangular Reactions

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s