Thursday, February 25, 2016

Completing Assignment 1

Over the reading break, we finished our first larger assignment in this class. As it was one of the larger projects that I've coded for a while, there were a few important take-aways from this project

1. Break down the problem.
It was much easier to simply focus on implementing every single small part of the ride-sharing simulation at a time. My partner and I focused on Location, then Container, then Driver, then Rider - doing the most basic classes before trying to implement higher level classes. In doing so, I realized that by simply breaking down the problem beforehand when planning the project, and then focusing on each class' function makes the problem much easier to solve.

2. Trace back the errors.
There were many errors in initial code while doing the assignment - checked during doctests, or during runtime, or otherwise. An important skill I worked on during the assignment was reading my error messages, tracing them back to the root of the problem, and hence fixing the errors.

3. Repeatedly test the code - any small misstep can ruin things.
One example of an error that I created, and took about 20 minutes to fix, was that instead of the request_driver method finding the driver who was closest to the rider's origin, I accidentally made the rider find the driver who was closest to the destination. I realized later that this could have been easily avoided if I tested that method more rigorously - and that I should thus try to rigorously test every portion of my code as I developed it.

No comments:

Post a Comment