Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops. Juri is also a recognized Google Developer Expert in Web Technologies

Introducing #smellycode

2 min read

Couple of month ago, after posting some comments about bad code on Twitter, my ex-work-mate Peter (greets to Oz) asked me to show it s.t. others can view and learn from it. I really like the idea and so, why not to start and post ugly, smelly code on my blog and you on your blog as well. I'm sure you have something to share ;)

The Idea...

...is to have a similarly structured blog post with in the title "Smelly Code:". Once published, the post should then be published on Twitter too, with a link to it including a "#smellycode" hashtag s.t. others can follow such posts easily.
For this purpose you may employ Twitterfeed and set an appropriate filter which does the job for you.

The Rules

  • Do not blame others. The scope is to learn and improve your own coding skills. So don't include any names, don't be rude etc...the usual stuff ;)
  • The post should only contain real-world code, so it shouldn't include general hints, suggestions etc, but rather it should contain code you encountered during development or coded yourself. In order to not conflict with your company politics you may of course obfuscate things, change names etc or cut out irrelevant parts.
  • Do show code!!
  • For easy reading between different blogs, please conform to the post structure as shown below.
  • Please do use some syntax highlighter to improve code readability ;) . Prettyprint and SyntaxHighlighter are some popular ones.

The Structure

The blog post should more or less have the following structure.

Optional small intro sentence to your post

Original, smelly code
This section should contain the original, smelly source code, appropriately highlighting the problem.

Objections and Comments
Do explain why the code is considered to be smelly. What are the potential problems, negative side-effects? May it become a problem later, during maintenance? ...

Proposed Refactoring
Describe a possible refactoring in order to avoid the mentioned problems and include appropriate code.

In the next days I'll publish the first of these posts. Keep up on Twitter ;)
Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus