Donate using PayPal

CycleStreets blog

News from CycleStreets

Patrick reports back

Back in July we introduced our summer intern, Patrick. Here, he reports back on his achievements over the three-month period.

Patrick

This summer I worked for Cyclestreets as a paid intern for three months. During this time, I became acquainted with the large codebase the site runs on, and made several structural changes to the organisation of the code. After my work at Cyclestreets I feel much more comfortable working with sizeable codebases, and the focus on refactoring and identifying optimisable code has made a huge change in the way I approach coding my own projects.

One of my main tasks as intern was to refactor the existing codebase into an MVC-style layout. Building on a similar structure designed into Ruby on Rails, we set out to create classes with distinct personalities; views, models and controllers. Establishing rules that govern class content contributes to building a strong framework that isolates code into functioning categories. Once an MVC structure has been implemented, crosstalk between classes can easily be analysed and anomalies can be identified.

Cyclestreets runs two main environments (contexts) – a GUI environment and an API environment. These two systems had become merged over time due to feature development, so re-establishing the functional dichotomy between these entities became a priority. This was a long process, as a long period of development had led to a proliferation of technical debt in the codebase.

The concept of refactoring, or changing code structure without altering the code function, reverses this process. It is risky, as refactoring can introduce subtle bugs. It is also very easy, as I found out on several occasions, to dig yourself into a hole as one alteration leads to another, and another, until it is extremely hard to finalise the series of sequential refactorings. To avoid this, refactoring must be done systematically.

Design patterns can be identified that provide targets for refactoring, and over the summer I became familiar with identifying duplicated code, contrived complexity, over-large classes, and long methods, to name a few of the ‘bad smells’ I learned to identify in the code.

Rolling out my changes to the main servers was always a nail-biting moment. I didn’t want to be “that guy” that brought down the system while users in London were relying on the excellent CycleStreets app to get to work during the Underground strikes that went on during summer. [Ed.: Don’t worry, we deploy in dev first :) ]

The team at CycleStreets were extremely supportive, and I thank them for the time they took to broaden my knowledge of PHP and good coding practices. It was a very enjoyable summer, one I will look back on fondly as in the years to come I design my own apps and come across the issues I learned to rectify during this internship. Thank you Martin and Simon!

Martin and Simon thank you back, Patrick – the codebase has moved forward significantly over the summer, with several long-running problems resolved. You were a pleasure to work with, arguing your case well when there were difficult decisions to take in the code, and taking on feedback.

Comments are closed.

We welcome your feedback, especially to report bugs or give us route feedback.

My comments relate to: *






Your comments: *
URL of page: * https://www.cyclestreets.net/footer.html
How did you find out about CycleStreets?:
Your name:
Our ref: Please leave blank - anti-spam measure

* Items marked with an asterisk [*] are required fields and must be fully completed.