Monday, April 18, 2011

Headaches and fixing mistakes

You want to talk about Rails headaches? Ok, here we go.

While working on this shopping cart application this evening, I accidentally entered some code into the carts_controller test that was supposed to go into the line_items test. At first I just got frustrated, then tried deleting the cart scaffold and then generating a new cart scaffold. Unfortunately, the carts table already existed, so this didn't work. Then I tried creating a new scaffold called shopping_cart, but I realized that would be too tedious to work with, since every instance in AWD4R will mention cart instead of shopping_cart. Finally I just rolled back the migration, then generated the scaffold again and that worked. Success!

What did I learn from this?
Pay attention.
Keep calm and carry on.
Don't try to hack my way around problems - try solving them correctly.

I'm proud of myself for not quitting when I realized I had a problem and for eventually finding the correct solution. Other than this little hiccup (and it WAS a little hiccup, all things considered) I'm making a ton of progress. What does it say about me that I can't wait to get back to work on Manticore, now that I know how to run rake tests and fix errors that it finds?

One last thing. Speaking as someone with absolutely zero development experience, when I decided to take the advice of my friend Eli (aka jqr) I faced a gigantic learning curve. Here's how I got over my fear of just how much I had to learn: I looked the learning curve right in the eyes and said FUCK YOU. The best way I've found to deal with feeling overwhelmed or in over my head is to find a way to stop being scared of something new and start getting excited about it. Rails is no different.

Sunday, April 17, 2011

+3 to Code Spear

I really can't say enough good things about Agile Web Development for Rails. I clocked some serious quality time with it this weekend and I've been learning a lot of things I wanted to know how to do while working on Manticore (or Dungeon Roller, if you've been following my progress) such as how to apply CSS and how to write tests and make sure everything is working.

Remember when I would just delete the entire project and start over because I'd screwed the code up so bad and had no idea how to fix it? Yeah, me too. (It was last week) But those days are over!

So here's my game plan: blast all the way through Agile Web Development for Rails, then get back to work on Manticore. Probably a good time to start using Git as well. It shouldn't take me too long to finish up this book, considering I've had it less than a week and I'm already 100 pages in. My progress with this book is definitely faster than my progress through Learning Ruby, probably due to a combination of AWB4R being much more practical and having some experience under my belt now.

On a side note, I spent maybe 6 to 8 hours working on Rails this weekend and I still feel like I'm not doing enough. I have a suspicion most developers feel this way no matter how much code they're writing.