Monday, May 5, 2014

Strange Errors Are Good

Or, How I Learned to Stop Worrying and Love the Feedback.

((crickets chirp))

Well, then. Ahem. 

I've been plowing through a few RSpec tutorials (here and here), trying to increase my understanding and decrease my mind-numbing fear of all those error messages. Intellectually, I understand that error messages are our friends. The kind of friends who want to make us better and are willing to use some tough love to get us that way. Deep down inside, there's still that little part of me that makes my heart jump when I see a screen of errors go flying by. It's the same little panicky part that I successfully subdued into calm at the sight of the command line. I subdued the panic then and I will do it again.

In the meantime, I'm learning great things about RSpec though my little detour in tutorial-land.

Today I learned:
1.  You can run all of the tests in your spec/ directory by typing rspec spec (or rake exec rspec spec in Rails) on the command line. Frying pans! Who knew?

And, more importantly:
2.  Yes, at least at this point in my experience and training, it is totally worth the time to read through the entire tutorial first. It's tempting to just jump in and start hacking, but ultimately it's much more frustrating when I try to follow along. I typically end up hacking away and then I don't scroll down to see that the error message I think is due to some mistake on my part is really all part of the whole BDD/TDD plan. And, yes, I should have learned this lesson quite some time ago but it was hammered in today when I read through the tutorial before even opening my editor. I saved myself a ton of time and tears.

Sunday, May 4, 2014

Lesson #1 From TDD: Do Not Fear Errors

Test-Driven-Development is really a bit of a misnomer. It's really more like Error-Driven-Development. In a (nearly over-)simplified form, you write and then run your tests, read the error messages and then write the code that will prevent those errors and failing tests.

The first lesson for me (and perhaps for you, too) is to resist the gut reaction of "oh, no, I suck at this" when errors and test failures come up instead of automatically passing tests. Theoretically, I understand that we're going to get more failures than successes in TDD. It's convincing my subconscious that all of those 'F's really are expected and OK.

I've been working through the Ruby for Newbies: Testing with RSpec tutorial over at Nettuts+. That brings me to my first lesson for TDD tutorials: read the entire tutorial first! I spent nearly an hour trying to figure out why I was getting a strange error when running the first test, only to scroll down a bit and see that we're supposed to get that error at that point of the tutorial. That's when I remembered a nearly identical problem (same problem, different error) while working through Michael Hartl's Rails Tutorial. Sigh...

Tee Design by CoryWayDesign

Enough introspection. Back to the fray!

Saturday, May 3, 2014

Two Steps Back === A Better View

After finding some success with shot-in-the-dark code snippets from StackOverflow, I'm listening to Vizzini and going back to the beginning.

Luckily, I'm in a bit better shape than Indigo up there. But I'm just as far from my goal.
Back to the beginning, because blindly typing in the code from various tutorials and guides is simply not giving me any understanding and leaving me in utter confusion when I get errors.

I've put a few RSpec books on hold at my terrific local library and cast about for an online tutorial in the mean time. I found one by Jeff Nyman that I've actually tried before but was foiled by problems with Watir-Webdriver. CodeSchool has a paid course on RSpec, but I'm looking for the cheapest option here. There's a well-reviewed tutorial on NetTuts that's next on my list to kick around. I'll post my success or failure with it tomorrow.

Friday, May 2, 2014

Stubbing My Toe

Sorry about the yolk. I thought it was punny.

I'm still fighting my way through a series of failing tests in Rspec. Via this question over on StackedOverflow, I found a snippet of code that adds the create method to FactoryGirl. It got me past a few of the scenarios in the failing Rspec tests, but not all of them.
Next on the error stack is the missing email method. So, back to work for me.

Thursday, May 1, 2014

Practice Plus A Smidge of Inspiration

Today is the kind of day that I typically wouldn't blog about. (Ed. Every attempt to end that sentence with acting other than a preposition sounded silly, so I left it.) I didn't make the time to code because I had a very high-stakes VIP visitation at work today. The visit did not go well. It could have gone worse but it did not go well and certainly didn't turn out the way I worked so hard to make it. Overall, it has been a depressing day.

I'm blogging because it's a new day. I have no wisdom to impart. Tomorrow will be better, though, so I should have something interesting to say then.

Edited to add: The Complete Flake's Guide to Getting Things Done by Sonia Simone just popped to the top of my Pocket queue. Even if you're not a flake, there are some gems in there and it's definitely worth a look.

Wednesday, April 30, 2014

Dancing With My Fear

I, along with several million other people, read Seth Godin's blog. He writes every day, sharing his nuggets of wisdom to anyone who's willing to read them. Confession time: I often catch myself in a comparing another's middle to my beginning (a great nugget from Rebecca Garcia) trap. But that's a lost for another day.

I just finished a little blog playlist with Zen Habit's advice to writers, Seth Godin's piece called "How To Get Rid Of The Fear" and I'm now listening Denise Jacobs on  Hanselminutes on building the creativity muscle.

Leo Babauta's piece focused on how to get past procrastination, face the fear of discomfort or hard work or inadequacy and getting the work done. Then Seth Godin's piece was a reminder that feeling fear means you're doing something worthwhile. And Denise Jacobs was the kick in the pants reminder that great artists work everyday, painting or writing or practicing, whether they're "inspired" at that moment or not.

So, here I am, writing (Swyping, to be frank) this blog post, practicing shutting up the critical mind, writing a blog post. Feel free to check out the links above. You might have a different reaction.

Tuesday, April 22, 2014

What a Summer This Will Be

Through luck and skill and more than a little chutzpah, I am a newly minted Gnome/FOSS OPW intern on the Open Historical Street Map Project. I will be working with a terrific team of engineers[1] who are volunteering their time to this project, including Robert Warren, who will be my mentor through this journey. I feel deeply honored and incredibly lucky to have this opportunity.

The Wikimaps project seeks to draw together data from the OpenStreetMap and OpenHistoricalMaps projects to enable users to view maps backward through the 4th dimension: time. (Allowing users to view maps that reach forward in the 4th dimension is, sadly, out of the scope of this project. ;) )

The entire project has three main modules:

1. Enhance the iD, the Javascript map editor, and The_Rails_Port, the OHM backend, so that a Javascript time/date slider can be added to control the time period that is of interest.

2. Enhance the iD and The_Rails_Port so that meta-data hooks are added to the code that allow for custom deployments of both software. This will allow multiple interfaces to be generated from the same data source.

3. Modify, Mapnik, the software that renders the map images, to handle starting and ending dates for maps shown.

My next steps will be to get up to speed on the nitty-gritty of the iD and The_Rails_Port code bases and to develop a Minimum Viable Product for the time slider. Stay tuned for updates!

[1] Susanna Ånäs (Project Leader), Sanjay Bhangar, Jeff Meyer, Robert Warren, and Tim Waters.