Home Learning Day One or : How I Learnt to Stop Worrying and Love the Object

Today was the first day of the Andela home learning sessions. Being nobody’s fool, I had already started working on the labs assigned on Saturday and by this morning, I was well on my way to completion.

There were three main labs:

  1. Data Types
  2. FizzBuzz (The famous one)
  3. Car Class (Object Orients Program in Python)

Now the first two were not that difficult to deal with and the lessons that I learnt from them are:

  • How to manipulate different types in Python and how they interact
  • String manipulation (concatenation etc)

The biggest challenge today was the Car Class. This is the one that had literally the whole cohort stumped. For me, it had been a really long time since I wrote any Object Oriented code and as such, I had to brush up on my inheritance, classes, instance variables, and all that entails OOP.

Thus began the gruelling process of learning about objects in Python and how everything acts as an object. It got quite dizzying at some points but I soldiered on. After all, it was not enough to solve the problem at hand and have my solution pass all the tests. I had to get an understanding of the underlying concept if this was going to be of any benefit. That’s the only way to grow in your craft, understand how things work and why they work the way they do.

After I felt fairly confident that I had fair grasp of OOP, I set upon the lab. I wish I could tell you that I breezed through the problem and was done in five minutes. This isn’t that kind of story though. This is the story of how one guy spent all day working on what seemed like a simple class implementation. Of how that guy used all of his lifelines: “Call a friend”, “50–50”, all of them and still ended up going nowhere, fast. I soon realised that simply reading about OOP would not make me an expert on it. This is something I love about the Andela process, it makes you think harder and learn through doing. I find that this kind of learning tends to stick longer and faster.

With the 4.30p.m deadline fast approaching, I did what any reasonable programmer would do. I threw out all the code, took a brief walk to clear my mind then came back with a can-do attitude. I wrote the most beautiful implementation of that class that I could muster. I mean, it dealt with edge cases, gotchas, and every thing. I finally submitted the code and with a few minutes to spare too.

What did I learn today?

  1. Python object properties can be declared separately from the object declaration
  2. These properties have getter and setter methods that come in handy when you need to change them on the fly
  3. Think outside the box — The solution is not always as straightforward as you think
  4. Getting a second opinion can help get you out of a rut — That extra pair of fresh eyes might be just what you need to see the problem from a new perspective

Well, that was a very exhausting yet rewarding day. I can’t wait to get started on the adventure that awaits me tomorrow. Oh, and to share it with you.

See you then.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.