How can one ‘keep it simple’ in a complex system?

June 5, 2016 @ 8:56 pm Posted to .Net, Tech by Antony Koch

The often used phrase “Keep it simple, stupid,” abbreviated KISS, is solid advice in the field software development. We strive for simplicity, planning and refactoring continuously to ensure our code is extensible, reusable, and all those other words ending in ‘ble’ that apply. But what is simple? And how can things be kept simple in a complex system with several complex domains?

Simple is subjective. To some it means few moving parts, to others it means code that reads like a book, even if it’s repeated in several places. Disagreements can easily arise when deciding what simple means. Keeping an open mind is critical with regards to the definition of simplicity, because all sides can have valid arguments.

Complexity, like simplicity, is also subjective. Code can be composed in a complex way, however the component parts may be implemented simply. So can only simple things be over complicated?

There’s a saying: work smart, not hard, that applies to software development more deeply than in many other domains. Finding smart solutions usually means less code, fewer moving parts and a more concept-based approach.

To some developers a concept-based approach can be perplexing. Simplicity masquerading as complexity that remains obscure until scrutinised further. It can also, however, be over-engineered — six classes used where one might have sufficed until a later date.

Does this mean those developers who find smart solutions complex aren’t up to scratch, or should the codebase cater to the needs of the team and be legible to all? In my opinion, no. Smart trumps legibility every time, for the simple reason that legibility is subjective and based on the abilities of the reader. Some are baffled by lambdas and some aren’t. This doesn’t mean teams should avoid lambdas, it means teams should shift dead weight.

All of this begs the question: can something that seems complex always be reduced to something simple? In most cases, yes. A video I watched (which I will need to find later as the author escapes me) stated that in most cases he could walk into a company and reduce a code base by a factor of 80%. That is to say that a 100,000 line codebase could be reduced to roughly 20,000 lines of code.

Part of the reason this is, in my eyes, true, is because teams wilfully introduce technical debt, qualifying its introduction with ‘We’ll fix it if we need to later’. This is a flag to me that says “we know we aren’t doing it properly.” This is not counterintuitive to Ayende’s JFHCI — in fact it works with it: work smart, not hard. His example of hard coding is not an introduction of technical debt, it’s a forward thinking solution with minimal down payment now.

So how do we keep things simple in complex domains? Here’s a bulleted list of how it can be done:

Limit your abstractions

Don’t introduce a phony abstraction in order to make it mockable. If you see an IFoo with a single implementation Foo, you’re overcomplicating and you’re missing the point of interfaces in the first place. Code should be written to concepts as per Ayende’s limit your abstractions post.

Test outside in

Test your components using their public API. Don’t test the components internals because you’re then testing implementation. This allows two benefits:

  • Get the internals working correctly, quickly, with minimal fuss and with good test coverage
  • Once complete, it allows you to refactor into any concepts you may have uncovered along the way.

Work smart, not hard

Highly focussed components with specific jobs connected in a smart way. Some people might not understand them; it’s your job to enlighten them. If they still don’t understand it, cut them loose and hire someone who does. The inverse is true too, though — if everyone disagrees with your code it’s either wrong and you need to learn, or it’s right and you need to leave.

No comments (click to be first!)

Microsoft Band – A User’s Review

September 4, 2015 @ 6:42 am Posted to Tech by Antony Koch

I’ve decided to write a short review about the Microsoft Band, a product I feel I have had for long enough to draw meaningful conclusions against it.

I’ll start by saying I like the device. Anyone that buys something by Microsoft that has such an odd and ungainly shape ought to know what they’re getting themselves in for: it’s not perfect, it doesn’t fit perfect, but it has lots of features and once you get past the aesthetics it’s a quality bit of kit.

It can sometimes feel uncomfortable, but its adjustable strap makes up for that. It’s not that bad, though, and as with most things once you get used to it you don’t even know it’s there. People seem to have judged the device based on 4 hours of testing and I don’t feel that such a short length of time qualifies one to make broad statements about wearability. One criticism I would level at the device as hardware and not software is that the rim of the screen scratches extremely easily. Mine was ruined after a day of wearing the screen facing inwards, which reminded me to turn the screen to the top of my wrist as it goes, thus proving that it’s probably nigh on impossible to avoid scratching the thing. It’s a shame Microsoft didn’t foresee this and use the same type of glass across the whole screen instead of just the touch areas.

I have read plenty of reviews slamming the heart monitor, but I’ve found it to be accurate enough provided the strap is worn very tightly.

The GPS failed to work first time I tried to use it and I was close to sending it back before trying to lock it again while very stationary. This seemed to crack it and its accuracy seems on a par with my iPhone 6. Locking still takes 10-15 seconds though, however I don’t think that’s too long to wait for such a small device, and once locked I was up and running (literally). The device also supports ‘workouts’ and cycling, neither of which I’m particularly famous for.

The step counter is, well, a step counter. Not much more to be said about that really. It seems quite accurate so long as you’re not looking at the device while walking – it’s motion sensors can’t handle that, but I think that’s fair enough given the simplistic nature of the means by which the steps are gathered.

The device is certainly a gateway into realising just why wearable tech is so popular – having my wrist gently vibrate when my phone receives a notification – as well as providing the ability to read through most of them – has become extremely useful. The choice of whether I should pull out my phone or not allows me to stay engaged with people longer than I normally would. That doesn’t say too much about my manners, but I’m hopeful those around me now consider me to be strangely more present than I was previously.

The Microsoft Band also has a Ultra Violet (UV) screener, providing live results from a scan and advising just how long it’ll take to sunburn. I didn’t realise I needed this in my life until I had it, and it really is a worthwhile concept to have to hand with two young kids.

The final app worth a mention is the sleep monitor. Just before your head hits the pillow, switch on sleep mode and come morning you’ll have interesting statistics about time to fall asleep, length of sleep, the number of times you woke up and how much deep and light sleep you had. I’ve read that the ability of a wrist-based device to measure your deep sleep is non-existent, but it’s nonetheless interesting to find out information on a subject you tend to have none about, being asleep n’all.

The final piece of the puzzle is the software the Microsoft Band syncs with on your mobile phone or tablet. My phone of choice is an iPhone 6, and I’ve found no issues in pairing or syncing the device. The information displayed is of interest and when using GPS the bing maps have a nice little three coloured snail-to-cheetah legend advising you of your speed compared to your average at different times of your run.

In summary, I think the Microsoft Band is a great piece of equipment for £150. It offers lots more than other devices in the same price bracket, and you’ll get benefit from having your wrist tethered to your phone. Its phone agnosticism is one of its great selling points in my book.

No comments (click to be first!)