13 Jul 2015

I like to do apps. As a newbie TDD developer, I've made my apps with tests but not driven by tests. I want to change that. I'm learning to be a Craftsman, so TDD is an essential technique to know. It's your main tool. At Codurance it's unthinkable that you could code without doing TDD. That's one of the things that you learn in our apprenticeship program: to be able to do TDD without thinking about it and feel as if it's natural: as you breath to survive you do TDD to code.

So today I feel pretty much confident that I'm able to do TDD (at least in C#), and so I've come back to my apps and I've decided to change them to apply all the good practices that I've learned in my first month at Codurance.

Oh God! What have I done! It's amazing how you go back now, look at your code and think: What that hell was I doing? How could I write such code? I really just wanted to delete everything and start again... Well, we all know that that is not really possible when you have an app published and selling and you have users that send you requests for new features...

So what could I do? I thought it would be a good idea to refactor all my code, and at least make it a little bit cleaner, with unit tests everywhere rather than just in the main features (Oh God! I know!!!! It's horrible...) All the horrible things that they say to you that you will find in the real world when you finish the apprenticeship have come true when looking to at own code, so frustating!!!! So to be proficient in doing refactoring in iOS, I must be able to do TDD correctly, this means not even thinking about it when I code in Objective-C. That was not the stage that I was at... So, what can I do?

I decided to start were I started at Codurance: to do katas, one after another, get the logic of the language, solve small problems first, and then go to bigger katas where you can apply your OOP knowledge. I've googled for katas in Objective-C and I've got a lot of links: I was thrilled! iOS developers are sharing their katas. Then I followed the links... Most of then send me to a "This webpage is not available" page. Even the Objective-C version of String calculator by Roy Osherove is going to the same page... And then I found a screencast that is using iOS 5.5? We are already in beta for 9!!!

Well I can just conclude that iOS developers don't share their code! So let's change that. Since we talked about the String Calculator, let's start with this kata and see what we can do with it. I'll do the beginner version. Here's my attempt, found at Github.

Get content like this straight to your inbox!

Software es nuestra pasión.

Somos Software Craftspeople. Construimos software bien elaborado para nuestros clientes, ayudamos a los/as desarrolladores/as a mejorar en su oficio a través de la formación, la orientación y la tutoría. Ayudamos a las empresas a mejorar en la distribución de software.

Contacto

3 Sutton Lane, planta 3
Londres, EC1M 5PU

Teléfono: +44 207 4902967

2 Mount Street
Manchester, M2 5WQ

Teléfono: +44 161 302 6795

Carrer de Pallars 99, planta 4, sala 41
Barcelona, 08018

Teléfono: +34 937 82 28 82

Correo electrónico: hello@codurance.es