Makers Day 4
Test Driven Development — Feature tests and Unit tests. A Feature test is when you actually try to use the program i.e. using IRB. Therefore, before you have written any code, you try using the program as you would expect to as a user and it will flag up an error straight away stating that it doesn’t know what you’re talking about. The Unit test is then written into a spec file, and when this test passes you know you have written that patch of code correctly. To start with, once you have written the unit test, it will fail under rspec, as you have written no code for it. But then that error will assist you to write the simplest code possible to make the test pass. Then refactor your code. Then repeat for the next requirement of the program / user requirement.
More on feature and unit tests… The feature test is you running the program how you would, as a user, expect it to run, each step of the way. When it throws up an error or doesn’t expect it to work how you want it to, you then write a test, with aim being to produce the same error. That way, you know that the code you eventually write that passes the unit test, will also allow the program to behave how you wanted it to behave initially.
It also turns out that the poorly written user requirement from yesterday wasn’t actually poorly written at all, just poorly read… by me. I had a very effective pairing session today with Lee — we tried to figure out how to use instance variables and I was able to understand by simply following it through as slowly and as logically as possible. For instance, if this @ instance equals ‘this’, then where can I also use that @ to provide access to ‘this’.
Struggles and enjoyments at present.
At the moment I am struggling to read into subjects as much as I would like. People keep posting useful links onto the group, and I’m not finding the time to actually look at them. I think I will attempt to get in an hour of reading first thing in the morning just to satiate my curiosity and to relax me into the day, knowing that I’ve been able to at least look at what might have stressed me the day before. In the evenings, I’m enjoying watching walk through videos. It’s easy on the brain after working all day, and can be done whilst eating/cooking dinner or with my feet up and the TV on in the background.
This weekend I will take a look at the links posted earlier in the week regarding methods of tracking learning. At the moment I have this blog, but ideally I’d like to set up something on GitHub.
Now I’m going to read my book about a fantasy land where computers don’t exist! Goodnight.