Buzzword Buster – Spaghetti Code

Definition:

You have Spaghetti code when the flow in your application becomes so complex and tangled it resembles a bowl of spaghetti where the different execution paths are twisted and intertwined it’s hard to make out where they start and end.

In software design, this is usually a danger associated with procedural programming or frequent, unstructured changes to a complex application.

image

Buzzword Buster – Macaroni Code

Definition:

You have Macaroni code when your application is chopped up into many little pieces and it’s difficult to see the big picture which may exist only in your (or someone else’s!) head.

In software design, you can often end up with Macaroni code when you overuse/misuse/abuse abstractions, and it’s one of the main dangers of using Inversion of Control.

image

Buzzword Buster – IoC

Definition:

Inversion of Control (IoC) refers to the inversion of the flow of control (the order in which individual statements, function calls, etc. are executed) in a software. You’ll often hear the term Hollywood principle being mentioned in the same breath as IoC, it simply states "Don’t call us, we’ll call you" which more or less sums up the principles of IoC.

Purpose:

In traditional software design, the flow of control is governed by a central piece of code which often have to address multiple concerns (logging, validation, etc.) and need to be aware of the implementation details of its dependencies. This creates a very tightly coupled application where changes in one component have a ripple effect throughout the rest of the application.

Following the principles of IoC can help you achieve:

  • decoupling of execution of a task from implementation (through the use of interfaces)
  • greater separation of concerns (each component only focuses on what it’s designed to do)
  • more flexibility (implementation can be easily changed without any side effects on other components)
  • more testable code (enables the use of stubs/mocks in place of concrete classes intended for production)

Advantages:

  • Simplifies the building of specific tasks.

Disadvantages:

  • Has the potential to make the flow of control in an application more complex, and therefore making it harder to follow.

Parting thoughts..

  • Misusing or abusing IoC can result in Macaroni code.
  • IoC is not a silver bullet for all your system engineering problems, and remember, "Don’t fix what’s not broken"
  • When adopting IoC, there is additional training needs for new joiners to the team.
  • Design systems for flexibility, which allows quick adaptation to changing environment/requirementsimage
  • Avoid complicating system design by trying to be future-proof upfront, you can’t predict the future! image

Further readings:

.NetRocks show 362 – James Kovac Inverts our Control!

Loosen Up – Tame Your Software Dependencies For More Flexible Apps (MSDN article by James Kovac)

Design Pattern – Inversion of Control and Dependency Injection (by Shivprasad Koirala)

Buzzword Buster – Forewords

For many of us, buzzwords and jargons have become part of everyday life, and us I.T (yet another former buzzword..) professionals never seem to shy away from the chance to invent new buzzwords/abbreviations to add to our ever-expanding vocabulary of technical terms used in I.T talks which confuses those not in the know to no end. Heck, I could be talking in Chinese for all they care unless they are vaguely aware of what these terms actually mean!

And it’s not a phenomenon associated only with the I.T industry either, think Finance and the terms ‘subprime’ and ‘credit crunch’ (and about 20 different names which all describe a bank..) comes to the fore..

In their defense, buzzwords aren’t just there to confuse outsiders (despite what others have told me in the past!) or to make us look smart, I believe they serve a useful purpose of encapsulating knowledge/experience and capturing essential but subtle details that only those working in the relevant fields care about (i.e. professionals!).

As Malcolm Gladwell said in one of the case studies  in Blink : The Power Of Thinking Without Thinking, all of us can tell whether a dish tastes good or not without being able to point our fingers on what makes it good, which is an ability that seems to reside only with the experts. Their uncanny ability stems from the fact that they, through years of experience and training, have built up a vocabulary which helps them identify, capture and convey the useful information from the overwhelming web of data that is our own sensation. Much like the way Software Engineers use terms like ‘object orientation’ and  ‘cross-cutting concerns’ to describe problems in software design, eh?

So, to tame this necessary evil and help me better understand them myself, I decided to write about the buzzwords frequently used in software development, make them easy to understand so others don’t have to struggle as I do!

Lancome Eye Cream does the job!