Journal Articles

CVu Journal Vol 31, #4 - September 2019 + Process Topics
Browse in : All > Journals > CVu > 314 (8)
All > Topics > Process (83)
Any of these categories - All of these categories

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: A Case Against the Use of Code ‘Smells’

Author: Bob Schmidt

Date: 05 September 2019 17:23:45 +01:00 or Thu, 05 September 2019 17:23:45 +01:00

Summary: Simon Sebright asks if we’re using the term correctly.

Body: 

I recently saw a few tweets about deleting code. I am all for that, the first tweet was resounding the good feeling you have when you delete a lot and in this case replace it by a lot less, but that does not have to be the case, sometimes you just get rid of stuff that is not needed.

Anyway, a tweeted reply said something like, ‘I love the smell of deleted code’. Hmm, yes, I imagined summer meadows, mountain air, hoppy beer, and stuff like that.

But we are constantly confronted with the concept of ‘code smells’, a plural noun, not a sentence. So that implies that smells are a bad thing. I’d like to recapture the neutrality of the word smell. It means that our sense of smell can detect something, perhaps interpret it. It does not imply bad stuff. In English I would choose the word ‘stink’ for that. The farmer has been muck-spreading. It stinks. Sure it smells too, but so do my roses. They don’t stink.

So, let’s use ‘Bad code smells’ and ‘Good code smells’ to indicate what we mean. Or code ‘stenches’ for bad things (but what about good –fragrances???). Clean code smells like a spring morning, or lavender, or your shampoo. Bad code smells like dung, mould, the dungeon in a castle still used to house prisoners.

But, let’s conclude by conceding that all metaphors have their limits (otherwise they would not be metaphors). Interestingly, humans cannot imagine smells in the way that (most) can imagine a shape or a sound. I can certainly imagine good and bad code, so maybe we need to find another metaphor.

Simon Sebright Simon has been in Software and Solution development for over 20 years, with a focus on code quality and good practice.

Notes: 

More fields may be available via dynamicdata ..