Skip to content

Apologies for the appearance of the site. I'm designing in public!

MNMLSM: Simplify, simplify some more, then start simplifying

MNMLSM: Simplify, simplify some more, then start simplifying

Published on Wednesday, 5 August 2015.
At 564 words, this article should take about 3 minutes to read.
This article is more than 7 years old.

Minimalism is an interesting thing – far from meaning as stark as possible, minimalism is the idea of removing anything unnecessary for base level functionality. Imagine a human face. Now remove all of the details you can until it still resembles a human face. If, for example, you took the eyes out and it looks wrong, stick them back in. Once you’ve finished you have minimalism. Buildings, paintings, web design can all implement (and benefit from) minimalism. So can code.

When I started coding for a living I had no idea about loops. The last year of solidly building WordPress sites has taught me a lot. I still start my code the same way I used to code though. I write everything out longhand, then work out the commonalities and parse them as variables, arrays, and loops. Then I start cutting out the duplicated code. Once I have this, I can start working out what I can cut from where to make my code as small and as simple as possible.

Who wants a DRY KISS*?

Every single developer! The reuse of code improves performance, makes updating easier – especially if the project gets passed to someone else when you’re inevitably hit by that bus that everyone goes on about, and benefits consistency across the design.

“Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.”

Everyone knows that deadlines get in the way of perfection and sometimes it’s necessary to chuck something in that works rather than delay everything to produce code that will make other developers moist. This is where Technical Debt comes in. Set aside some time after deployment to tidy up your code. Think of it like throwing all of the stuff from your floor into a wardrobe when your mum visits. Your flat will pass muster for the duration of her visit but, if you don’t go and sort that wardrobe out once she’s gone, you’ll be in for a world of pain later on!

There are unimaginable horrors lurking behind those wardrobe doors!

It’s like CSS classes; you wouldn’t apply identical styles to two elements when you could assign the same class to them and only write one bit of CSS, so why do it with your PHP or JavaScript? I start by breaking a build down into independent functions. Then breaking those independent functions down into independent pieces of functionality. This allows me to reuse a function again and again. For example, on one site I built recently, we needed a Netflix-style ‘bookshelf’ that scrolled sideways. This had to start on click of a button or swipe on a touch-screen. It also had to work on several ‘shelves’ independently of each other. By separating the function that made the shelf slide, I could call that one function on each shelf for each method of initiation. This made this one function simple to adjust, easy to replace if a better solution presented itself, and extensible for use on infinite shelves.

Code, like Dr Evil, is better when’s it’s Mini Me

Andy Hunt and Dave Thomas originally intended their principle for use in software engineering but it is sound practice for almost all aspects of development. Keeping your code clean, reusable, and – above all – simple, makes for better code and, by extension, better websites.

* Don’t Repeat Yourself and Keep It Simple Stupid



In almost all cases, the comments section is a vile cesspool of Reply Guys, racists, and bots.

I don't want to have to deal with that kind of hell so I don't have a comments section.

If you want to continue the conversation, you can always hit me up on Mastodon (which is not a vile cesspool of Reply Guys, racists, and bots).

onward-journeys module