Web API Tutorials Part 3 : Translation Abstraction

There’s a famous quote in the world of Software Development:

“We can solve any problem by introducing an extra level of indirection.”

In my experience, this is almost certainly correct, this post will see us adding in an additional layer of Abstraction to allow us to simplify our Controller(s) and manage our Dependencies in a more straightforward manner.

Outcome

Last post saw us implement our Translation PCL into our Web API using Dependency Injection.  The problem is that our ITranslator Interface only handles a single Translator Implementation, such that when we inject from our Container we can’t currently translate more than one direction.  We’ll look into the why’s shortly, but by the end of the post we will have created :

  • ITranslatorService Interface;
  • TranslatorService Implementation and Unit Tests.

Continue reading “Web API Tutorials Part 3 : Translation Abstraction”

Development Team Leadership First Steps : Part 12

Bugs

Despite what your boss might like to think, Bugs are a fact of Software.  There’s a number of things you can do to minimise the occurrence, the severity and the impact bugs might have, mostly centring around having a reliable set of Unit Tests.  Regardless of your best efforts, they will still find a way through the net, it’s how you handle them that matters.

Be Honest

My first piece of advice would be to be honest about them, and the root cause, however embarrassing to you or your team it might be.  It’ll be too late to cover it up, so don’t waste your time thinking of excuses.  Get to the root cause and come up with a plan to resolve it.  If it’s a major problem in Production it’ll be on your shoulders to come up with a strategy to expedite a resolution. Continue reading “Development Team Leadership First Steps : Part 12”

Morse Coder Part 5 : Unit Testing with the Microsoft Unit Test Framework

How do we know that our Morse Code Translation Logic is working correctly? This is where Unit Tests prove to be a valuable tool to have in our toolkit. There are a number of Test Frameworks available, NUnit, XUnit, etc. Given that we’re using PCLs targeting Universal Apps, our choices are limited slightly at this stage, so for simplicity and speed of getting up and running we can use the Libraries and Test projects bundled with Visual Studio. There’s masses of documentation and blog posts around Unit Testing and Test Driven Development (TDD) so I won’t go into the why’s here, but if you’re new to the concept I would recommend you read The Three Rules of TDD by Robert C Martin (Uncle Bob).

(If we were following strict TDD, these tests would have been written before we created the translators, but we’ll look past that for now!)

Continue reading “Morse Coder Part 5 : Unit Testing with the Microsoft Unit Test Framework”