Well all too fast another week of work experience at Two Red Kites has wrapped up, and what a week it has been. I’m starting to feel really confident with the ‘rubyist’ way of doing things, especially when it comes to creating and using classes.
As with last week the days went so quickly, but managed to fit in so much! We started by reviewing our work from last week, and had a look at the code we each wrote for ‘homework’ – creating a new method to test the age of an instance of our Human class. This quickly led us onto a few new topics including edge cases (strange situations you might not have thought of that can muck up your code) and conditional assignment (one of the ways you can deal with certain edge cases, and one way of setting a default value for a variable). Conditional assignment led us onto the concept of binary, and how that ties in with the logical operators &&, ||, ! and ^ (and, or, not, and the exclusive or) and the concepts of true and false. Being ‘truthy’ or ‘falsey’ isn’t as straightfoward as it might seem, but Ruby definitely seems to have the simplest way of dealing with the concept.
We looked further into Class methods vs Instance methods, and then also different types of variables that can be accessed only in certain conditions. We started looking at class inheritance and class relationships, both of which we will now understand more thoroughly once we start working in Rails and having a lot of this done automatically.
This week has taken us further into our use of TDD and RSPEC, and we are getting more familiar with understanding errors and failure messages, as well as looking at new ways of writing tests and how to ensure separation of concerns in our tests by using mocks where necessary.
We looked at some of the many ways you can write hashes and found out how a symbol differs from a string and where they can be useful. Add to this a few team meetings, a team lunch, and finishing up working through Learn to Program by Chris Pine – all in all, it was a jam-packed two days!
Since finishing up the week I’ve written my own classes to practice inheritance and class relationships, as well as redoing the ‘fizzbuzz’ challenge as a class and practicing my RSPEC test writing skills. I’ve also made the change from using Atom as my text editor to using RubyMine as my IDE. I’m totally sold on RubyMine, it makes everything from simple text editing to Git and testing as simple as a few keystrokes.
As always, looking forward to the next week of work experience and more challenges! Thanks again to 2RK for this incredible opportunity!!