Monday 10 October 2016

Learning Python part 4: Airport Challenge

My first-week challenge at Makers was to create an airport system using ruby over one weekend. It was tough when I first approached it but it was such a good project covering so many ideas of software design (albiet on a small scale) that I have borrowed it to learn Python.

This project involved a lot of ideas such as:
  • Object oriented design (SRP, dependency injection, encapsulation)
  • Test Driven Development
  • Behaviour Driven Development
  • Testing ideas (stubbing randomness, mocking)
  • Refactoring (class extraction, encapsulation, DRY)
  • Use of different types of syntax of the language
  • Object interactions
  • Dealing with exceptions
  • Similar to technical tests offered by employers
  • Use of Behaviour Driven Development, outside in testing, feature tests
I felt doing this in Python would be a good challenge to improve my command the language syntax and also strengthen my OO design and TDD. 


You can look through my commits and see how I did each section of the tests and code for each user story.

A major issue was trying to stub randomness and create doubles with methods.

At first, I had issues with injecting the weather object in the airport class, so when Airport is instantiated I created a new weather object. Instead, I had to pass the Weather object as an argument in the airport's instance methods that required it. This resolved itself after some research, where I ended up injecting Weather into the Airport constructor (thus decoupling the two objects).

I have already done this project twice using Ruby and Javascript at Makers Academy, so the design ideas were not a problem just the implementation in a new language. Thus this project was definitely a good step in learning the language.

My thoughts so far...

I feel more confident with Python, but still need to do more work. I was given a test in the language Groovy, to build a twitter clone for the command line, I think doing this in Python will be a good way to cement my learning of the language. Although, I think doing another project which is totally new will be better, thus allowing me to think about design as well as review syntax of code and testing.

Generally, after this stage, I feel that syntax and testing is fairly easy to use. Any other program will be more about the design and little about the language features. 

Another task, such as building a web app (with CRUD) will also be another project on the list.

No comments:

Post a Comment