inchworm

inchworms

Summer of Coding, one inch at a time...

Learning to Love irb More

inchworms -

Matt greeted us in the morning with these:

strawberries

Locally grown, sumptuously sweet, and the surest sign that summer has arrived in Berlin.

We should have known this was merely a ploy to distract us because shortly thereafter Matt had us refactoring upon what we had already refactored, apparently to make our app better (but which we thought made it more confusing).

So, while we finished the strawberries, we decided (unanimously) to put his suggested changes into a new branch titled matt is evil.

Then we went back to our master branch.

We added error handling, for cases where users try to load dodgy urls (and by dodgy we mean urls pointing to things that don’t exist, like ../songs/1/mattistboese), then we continued with v2 of the app.

	irb(main):001 > This is when our love for irb grew even more.

We’re basing our sample app on the one Darren Jones builds in his Jump Start Sinatra book. But while he uses slim (an html rendering engine), we’re sticking with erb. Consequently there are a few differences between his syntax and ours, which meant our app started throwing errors. At one point, for example, we couldn’t work out how to delete one of our database objects. But by using the irb console we were able to test what worked and what didn’t before writing too much application code. It was time efficient and much less annoying than writing code, saving the file, refreshing the browser window, reading through the error message, writing more code, etc…

We spent the rest of the day implementing the ability to create, edit, and delete songs and added a bit of rudimentary styling.

Tomorrow we’ll be adding validation to our form (to make it check for any input errors - like a badly formatted date entry for example) and breaking our screencast outline into bite-sized chunks.

Hasta mañana amigas…

refactoring