Week 2

Week 2

So this week's mostly been about Ruby. All of the concepts from last week have been taken further, and the crazy knowledge train keeps thundering onwards. No real coherent thoughts (it's pretty hard to test drive a blog post. Maybe in a couple of weeks...), so this is basically just thoughts as I have them. We'll see how that goes...


In the command line, for git log, you can use a --colour flag as well as a --color flag. After years of CSS and background-color this makes me unspeakably happy.

The return <value> if <condition> turns out to be unbelievably useful. At the very least, it tends to be a better alternative than case statements or shorter if/elsif/else statements.

Blocks are really useful and we need to get use to them because we'll be dealing with them a lot. (Code Wars answers tend to be some block passed to each/map/inject/etc. I am beginning to get used to blocks). Also you can wrap them in Procs, but we'll get to that later.

There's a lot more to get to later (and it'll probably break us at some point).

break is return for loop statements. Kinda...

(0..n) is inclusive. (0...n) is not. I've already forgotten this. I'm always going to forget this. I'm really determined not to forget this.

Don't check for variable types. Assume everyone is thoroughly committed to the goal of making the most accessible language in the world, and that everything will mostly just work as it looks like it should. And, also, you know, write really readable code. We aren't JavaScript.

Assign stuff in parallel! It's fun!

Test driven development is really important. Also really effective. Like, slightly magic. On Wednesday, me, Jorja and... some visiting guy whose name I didn't catch (Rob, founder of the Academy says that remembering names can be a waste of mental bandwidth, so, you know, that's kind of an excuse... maybe...) were working on a Roman numeral convertor step by step, number by number. We had a mess of a solution, and he made us start again and build it up from the most basic answers. So we make it convert 1 into "I", 2 into "III" (and just those specific cases), and so on until we have solutions for the first 10 digits. And then suddenly we seem to have a solution for the other 3000 or so... It just... sort of... appeared... So basically I should really have remembered something about that guy because he was really helpful.

And roughly the same thing happened pairing with Peter. We traded tests and minimal answers to those tests (on a way of converting Roman numerals into numbers... my Roman numerals have gotten surprisingly good this week) over github (practicing forking and all that). So you write a small test and send it off, and soon get back a solution to that test with a new test for you to pass - which you do by adapting the previous solution that you didn't have much to do with. As a result, the overall solution just appears in the middle somewhere. Neither of you would have thought to write it at the start, or even anywhere in the middle. But it's so much better than any attempt to just write a solution on your own. Both combining disparate thought processes, and breaking a problem down into its smallest parts, you end up with far, far better code.

If that hadn't convinced me of the joys of pair programming, Sam Joseph and his reasonably convincing Eddie Izard impersonation would have.

I'm pretty sure that any attempt to introduce me to branching and forking code with git(hub) two weeks ago would have resulted in a pretty crushing failure (and a very crushed me), but after this volume of new concepts it would seem pretty churlish to have a problem with any more. So now I branch and fork things with git(hub). I even have a sticker to prove it.

The one thing Makers is very good at is reminding you how miserable it's about to make your life. The first couple of weeks' tests aren't too bad! The next few will kill you. Some of the previous cohort feel that having a break in the middle really helped them! We won't get that. We seem to be getting the hang of basic Ruby! Rails is a beast and will make you cry. Still happy, even if I'm slowly forgetting how to be a real human being on the sides, so I'm enjoying that for now. While the course still allows us joy.

Getting a sticker for passing a test is still amazing.

Code Wars is still soul destroying bliss. Especially now I'm on the actual leaderboard (and have a fake digital pseudo blue belt). I'm very aware I'm basically limping through kata (in comparison to the best solutions), but at solving the problems is always satisfying. As are the points.

I'm also getting used to waking up at the same time as the working world, which is a good thing. Still no real time outside of the course, but that's basically ok as stuff outside of the course tends not to be about coding and I seem to be all about coding now.

Though I may want to spend less time staring at this (lovely retina) screen...

Probably time to switch off for a little while.