Showing posts with label controllers. Show all posts
Showing posts with label controllers. Show all posts

Thursday, April 14, 2011

Agile Web Development with Rails

Ahh, it feels good to have a new coding book! Online tutorials and help from srs Rails guys is a fantastic resource, but a good book is absolutely invaluable.

I picked up a copy of Agile Web Development with Rails this week. I even sprang for a hard copy, despite my philosophy against owning physical media. Seriously, cavemen had books. Look it up. Anyway! I finally got a chance to sit down with it this evening. (Saying "finally" here is funny, since I just got it yesterday, but couldn't do anything with it since the Indy RB meetup was last night)

STILL, "finally" feels appropriate, considering I spent all day at work foaming at the mouth to get home and start coding. So far I really like the book. Like Beginning Ruby, it's written in an easy to follow, engaging manner with practical examples. Is there any other way to write a coding book? Probably not if you want people to read it. So far a lot of what I've seen in the book is refresher material for me, since I've spent the last couple of weeks doing Rails work by following online tutorials and working on Dungeon Roller.

Still, I've already learned some helpful things. Such as having two terminal windows open: one to run the Rails server of my project, and one to perform tasks. I had no idea! It simply did NOT occur to me that I could have two windows open. Another helpful tidbit came with generating a controller. If you write the code as such:

rails generate controller Say hello goodbye

Rails creates a controller named Say, with two empty methods inside of it: hello and goodbye. This definitely saves time later, because up until now I'd been writing methods by hand. Finally (and this is getting into code theory, but we're talking kiddie pool stuff here) I learned the idea that the controller holds the data and the view displays it. Pretty basic, but essentially even though you CAN write code directly into the view, it's a better idea to have the controller handle it. This idea is similar to separating raw HTML from styling.

On a side note, I've decided to rename Dungeon Roller to Manticore, both as a nod to Dwight from the Office and in homage to my favorite mythological creature.

Tuesday, March 22, 2011

Swear to blog

I just finished up the Blog tutorial I've been working on the last few days. It was clear, easy to understand and a great introduction to views, models and controllers, as well as building a functional Ruby on Rails application.

I know people always go on and on about how easy Ruby is and I'm starting to see why. I still don't have a grasp on writing my own code, but I get why something is done. I feel like I've got a good understanding of the basics, which is absolutely important for proceeding.

I'm also amazed at how easy it is to add new functionality to an existing program. Initially I built the blog and was able to create, view and destroy posts. Then I went back and added comments with the ability to create and destroy them as well. THEN I went back and added tags.

So I'm getting it. I've gotten over feeling overwhelmed (to be fair, I got over that a while ago) and I just feel excited about learning. More coding!

I think my next step will be to return to Beginning Ruby and skip over chapter 13 altogether. I'll probably read through it for reference, but it used MySQL a lot and I really got hung up on that crap for a while. Still, that book has been a great resource and finishing it up will be worthwhile.