Wille Faler is an experienced software developer, architect and agile coach with experience across a number of different industries as an independent consultant. Wille specializes in backend, integration, and Java technologies, but has more recently found a passion for Scala and text mining/analysis. Wille is a DZone MVB and is not an employee of DZone and has posted 39 posts at DZone. You can read more from them at their website. View Full User Profile

Most of the Code I Wrote >6 Months Ago Sucks

  • submit to reddit

The thing about learning a new programming language is that it is a humbling experience. You may have been an expert in another language after years of honing intricate knowledge of its behaviors and foibles. Yet when learning a new language, it counts for very little - at best you’ll have an experience to help you accelerate your learning of the new language, at worst it will be a chain and ball of bad habits holding you back in old, bad habits.

After 2-3 years of using Scala, I’d like to think I am approaching the level of becoming a competent Scala developer (though Dunning-Kruger is always a risk), but I know that there is undoubtedly a lot of depth that I have yet even scratched the surface of. I find myself taking spurts if improvement once about every 2-3 months, and find myself cringing at some of the code I wrote further back than that. Code that is older than 6 months I positively want to disown and deny any knowledge of (though it might be hard, as much of it is open source).

Going from an imperative style to more functional style, I’ve noticed the following changes in my own code over the last 6-9 months:

  • Code I thought was fairly “functional” 6 months ago in fact has a lot of very obvious imperative “smells” seen with my eyes today.
  • Though I knew mutability was bad, 9 months ago I still “cheated” occasionally as my mind had not yet shifted fully to solve all problems immutably.
  • I define fewer vals (and no vars) these days, preferring more concise composition of functions.
  • These days I find functions that return “Unit” smelly: returning Unit to me implies that a function is probably side-effecting.
  • A lot of code now boils down to simply manipulating Lists and Options with filter, folds, maps and flatMaps (see point 3. And maybe LISP got it right in the naming of the language).
  • 6 months ago I really didn’t get implicits. At all. Now I feel I’m starting to have a decent appreciations of where they fit and where they don’t.

These are a few of the things I have noticed in the evolution of my Scala code. I’m sure looking back in another 6 months, I will find a lot of bad smells in code I write today: I would be slightly concerned if that wasn’t the case, as it would imply I haven’t been learning enough.

To ensure I think my Scala code from today “stinks” in six months time, I will try to integrate more perspectives into my toolbox: though I’m unlikely to use any of them for production code, I will try to improve my Clojure skills, and perhaps learn me some Haskell, you know, for great good. Even if you only use a few of your tools, awareness of a wide variety of tools in your toolbox can only improve you as a programmer.

Published at DZone with permission of Wille Faler, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Sura Sos replied on Wed, 2012/07/18 - 7:02am

Programming involves life long learning. 

Your current programming might suck after a year when you move to a new language but

 It does not matter, here is a interesting quote - Your Coding Philosophies are Irrelevant


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.