It feels like I’m only just getting the hang of things, but I’m already 2 weeks into the course. Nooooo!
I had my first code review at Makers on Tuesday, reflecting on last week’s weekend challenge (create an airport program to control incoming and outgoing flights). I wish I had attempted the challenge without reading the submission guide first. I probably would have made loads of unexpected mistakes and code smells (that’s a thing, lolol), but at least I’d be able to see where I was going wrong and learn never to make the same mistakes. My pair clearly hadn’t seen it and really tested the boundaries with some alien ‘null object pattern’ stuff.
The workshops this week have mostly been looking at design patterns: abstract vs concrete, delegating responsibilities, and composition over inheritance. Duck typing is something else that came up this week — as a weakly-typed language, Ruby only cares about what an object responds to, not how it looks. If an object can quack and can swim, it can be considered a duck!
Delegating responsibilities to other classes absolutely makes sense, yet I struggled actually implementing it during this week’s weekend challenge (create a takeaway/restaurant program to take orders) because I wasn’t really sure how to write meaningful tests.
I’m still unsure of how I go about testing
add_to_basket without it being a vacuous test that only checks for a response, and without it relying on
update_basket working correctly.
The rest of the week has been a blur. I definitely can’t keep up with this blogging business, so this entry is going to be short and sweet (like me, ha). So much stuff is crammed into each day, so unless I note down what’s happened on that same day, I’ve already forgotten what I’ve accomplished by the next morning. I know it’s a lot though!