Thursday, July 23, 2015

If It Looks Like A Duck....

See that ^ .

Yeah, that duck up there typing. It's not some abstract visual metaphor for how I'm getting on with the Makers Academy Ronin course, rather a term we've been asked to look into.

What is 'Duck Typing'?

Well someone who knows what they're talking about might respond that in computer programming with object-oriented programming languages, duck typing is a layer of programming language and design rules on top of typing. Typing is concerned with assigning a type to any object. Duck typing is concerned with establishing the suitability of an object for some purpose.

Although I'm more partial to the description - if it walks like a duck and swims like a duck and quacks like a duck, I'll call it a duck!

Simply put the term Duck Typing in coding refers to the fact that you don't need a type in order to invoke an existing method on an object - if a method is defined on it, you can invoke it.

So how does this work in Ruby?

Say we have a class Duck

And a class Person

And we define these methods

If we call 'game' what will we see?

You may think that 'in_the_forest john' will not work as we've only defined the method 'in_the_forest' with '(duck)' as an argument. But Ruby doesn't care what the argument is, and so if, in our case, the new Person can quack and has feathers then Ruby goes with it - if it looks like a duck and quacks like a duck it must be a duck, right?

So our output reads -

The duck has white and gray feathers.
The person imitates a duck.
The person takes a feather from the ground and shows it.

Duck Typing saves time on writing code, as we only need to be concerned with ensuring that objects behave as demanded of them in a given context, rather than ensuring that they are of a specific type.

Monday, July 20, 2015

It's OK To Be Stuck

So the first day of my Makers Academy Ronin course, which will see me undertake an intensive 12 week coding course, involved........ absolutely no coding!

And you know what?

That was fine with me!

The pre-course had been quite intense, I think more so than was advertised, and so today was kinda perfect. To step back, think about what we had learned on our own(-ish), and find out how that will be applied in the coming weeks.

We also got a good chance to meet (virtually) all the other Ronin cohorts, and the off-line students in London. Several introduction/team-work/bonding games we're played - one involving spaghetti and marshmallows (which resulted in my laptop covered in marshmallow goo - nice!) - and we were told something really important.

For the vast majority of this course we will be stuck!

And that's OK. Because a developer spends his day solving problems, some of which have likely never been tackled by anyone else before. It's the job.

Our coding course is really just 12 weeks of problem solving, but solving those problems through writing code. And I can't wait to get started...

Sunday, July 19, 2015

Pangs of guilt

Tomorrow morning, 9am, I start a 12 week intensive course in coding.

Oh my god!

I've just completed a 4 week pretty-intensive pre-course, where weeks 3 and 4 were especially full-on, but the enormity of the upcoming task is only starting to really hit me now, and I've been feeling terribly guilty about it these past few days.

I'm 44, married with three wonderful daughters. They are my life, and everyday there is something amazing about them. I'm with them all most of the time, and there are so many things I'm going to miss. Just simple things like sharing a story with my youngest when she's sleepy in the middle of the afternoon, or picking my 8 yr old up from school and singing Uptown Funk in the car on the way home (I haven't reached the 'embarrassing dad' stage yet so I'm making the most of it), or attending a sports day (which I'm going to miss - ouch), or playing LEGO Star Wars with my eldest on a rainy day. Not doing these little things is going to be the hardest, I think.

Their school holidays are around the corner, and I'm going to miss most of it as I'll be locked away coding. It's obviously my choice, and I really do want to do this. I also want to get the most out of it, but I guess I'm only just starting to feel the weight of the huge sacrifices I always knew were coming. We're going to have to fit a lot of fun into the weekends. I'm going to have to get as much as I can out of the early mornings and 'bedtimes' with them. It's going to be very hard.

On a much less guilty note, but upsetting in a different way, I've also had to hand over the reigns to my other baby. I've been running WarpedFactor for the last 18 months, and as well as being ultra proud of the success the site has had, I've also made some good friends through it. People I talk to most days, but I suspect I won't have time to chat much over the next three months - well at least not about anything but coding! It'll be very strange not having that geek outlet in my life. I guess it's radical changes all round.

I'm sure I'm not the only person who has felt like this when starting something as completely insane as learning to become a web developer in just 12 weeks (every time I say it - madness!), and I won't be the last. But in this instance I don't care about anyone else, it's a personal thing and these new-found pangs of guilt just add to the difficulty of the task ahead.

It's an old cliche but the last few days really have been a roller-coaster of emotions. I'm excited. It's scary. I can't wait to get started. What the hell am I doing? This is the greatest thing ever! I feel guilty. All of this, and rinse and repeat. But I'm also quietly confident that I'll come out of it the other side and realise it was absolutely all worth it, and very likely the best thing I've ever undertaken career wise. That is what I have to keep telling myself.

So here we go. Head first into the abyss...

Friday, July 17, 2015

Week 4 and all is well.

Week 4 of the Makers Academy pre-course has really been a continuation of week 3. Ruby, ruby, ruby, ruby. And a good thing too, as there's so much to learn.

I'm mildly dyslexic. My father and eldest daughter struggle a lot with it. I've learnt a lot of tricks to help over the years, and spell check is a good friend of mine, but for me it mainly manifests in reading. I'm quite slow at it, but can usually cope OK. However this week I have really struggled to read The Well-Grounded Rubyist in pdf form and, in a separate browser window, do the exercises or challenges included. I need a physical copy for both speed and ease of use. I ordered one a week ago, unfortunately there has been a delay in delivery and it won't arrive until this coming Monday (estimated), meaning I've only got through 3 chapters in four days. I'm a little upset with this as I feel it's been hugely beneficial, and although I will carry on over the weekend, I wish I'd started sooner and done more. It's a great enlightening book, and I recommend it to anyone thinking about learning Ruby or becoming a developer.

I had some good advice this week - don't be my own bottleneck, which I know I can be. We have a lot of resources available to us where we can get/find help. I don't know, maybe it's pride or something, but I'd shied away from using them. However, once I took the plunge and asked for help it felt good. There are no stupid questions, and everyone who knows the answer has been stuck on something simple at some time in the past, so I need to understand this more and ask for help sooner rather than spending too long stubbornly trying to solve an issue myself. Essentially, I gotta get over my own pride - and not be my own bottleneck.

I'm starting to grasp certain areas of Ruby a lot more than I did, there's still a heck of a lot to come to terms with but no-ones gonna become fully competent in 2 weeks are they? That's almost as ridiculous as signing up to become a web developer in 12 weeks!

I'm know I'm not the only one who's equally excited and terrified about the main course beginning in just a few days. The Makers Academy Slack channels have been brilliant in sharing this experience with the other members of the cohort, and realising that I'm not in this alone.

So, roll on Monday, when the fun starts for real...

Sunday, July 12, 2015

'Cause there's so little else occupying my head....

Ruby, Ruby, Ruby Ruby....

Last night I had a dream. I was trapped in a binary world and was being made to dig my own grave by a giant hashtag.

It wasn't the first coding dream I'd had this week, but all the others have been about problems I'd been stuck on and possible solutions for them, whereas this was obviously a lot more abstract. I shared the dream on our Makers Academy Slack channel and got a brilliant response -
"Don't worry, in this course we execute the code and not the other way around."
I wish I'd thought of that.

Week 3 of the Makers Academy pre-course has been all about Ruby - the coding language we will largely be studying. It's really flexible, certainly more so than any other coding language I've used. I struggled a bit with the whole object orientated aspect of the language, having being more used to top-down programming, but I'm getting the hang of it.

I decided to go back to the beginning of Chris Pine's Learn To Program book, which was something we were asked to read up to chapter 8 before our interview. I figured it had been a couple of months and in going over it all again I'd get a better understanding. I think it's helped as I'm starting to understand how to do things, or at least feel as if I'm getting there, but I'm really struggling to remember all the terms (as in method, variable, argument, etc etc). This can be problematic when trying to understand a question and I find myself referring to multiple notes and taking much longer to get things done. So there's been a lot of late nights.

The challenges in the Learn To Program book started to get much much harder, and so I decided to go for the alternative option of Ruby-Kickstart - so far so good. Ruby-Kickstart seems a lot more user friendly and I'm working through it at a nice pace.

And then...

Our Friday Challenge was to sign up for Codewars, where you earn points by solving coding challenges and problems. Our task was to get 60 points before the weekend was out, and 125 before the course begins for real (in 8 days now, argh!). The prize? A sticker! Oh man, I love me a sticker!!

Getting a 125 points is not the biggest problem with this challenge (well, it's still a problem as there's a lot of tricky stuff on Codewars), oh no! The biggest problem is that nobody mentioned how ridiculously addictive Codewars is. It's like coding cocaine. Very moreish.

I'm just going to attempt one more, then I'll stop. Just one more, then I'll go to bed. I could stop anytime I wanted to. Honestly...

...10 hours later.

So by the end of week 3, sleep is a thing of the past, I'm having bizarre Codewars infused dreams, and I'm loving every minute of it!

I know at this stage my code is not always 'pretty'. Most of the time I'm getting there and it runs, but I know I need to stop repetition and work on easier more concise ways of doing things. I also know there are many areas of Ruby I just don't understand at all - Blocks, Procs, Lambdas etc etc, but I'll get there...

Oh, and by the way.

Currently, at the end of the day today, I check out of Codewars with 178 points! Now where's my sticker... (mic drop).

Friday, July 3, 2015

Excursion on the Version!

I've found week 2 of the Makers Academy pre-course has been a lot more straightforward than week 1, mainly because 90% of the issues I had last week were caused by 'not having a mac'. After I'd sorted all the ins and the outs of using Nitrous as a coding platform it's all been going OK (famous last words!!!). I mean, it's still a challenge, but I feel less stressed with it all and am really enjoying the learning process.

So what have we been learning about? Well, Version Control, which is the management of changes to code, documents, computer programs, and other collections of information. We've been using Git locally on our computers and the web service GitHub to push/pull our code to - which is essentially backing it up and accessing it remotely.

Version Control is something I'd never used before, or even heard of, so it's been very enlightening. One of the most useful things this week was the Git Immersion course in which we found out all about Branching, using Alias', and being able to collaborate on each others codes via GitHub.

In short, I'm no expert but I'm finishing the week feeling quietly confident that I understand what we're supposed to right now. Which must be good, right? Plus with pretty much everything we've done this week I can see how useful it'll all be for any future projects (and hopefully career).

Roll on week 3...