Thursday, February 17, 2011

Ruby and Databases

I started digging into Chapter 9 in Beginning Ruby tonight. It's all about databases and while I never, ever thought I'd be excited about working with databases, this chapter is something I've been looking forward to for a while.

Let me tell you why.

Up until now, for all the little programs and tests I've been making, I've been inputting static variables. It's my understanding static variables have limited real-world application. I want to learn how to write code that can write, interpret and modify data and this database work is the first step to understanding that process.

So far, I've been able to get Ruby to create a new text file, write something in that file and then close it. I've learned how to open files in read or write only mode, in read AND write mode, in append mode and so on. Fascinating! But it's a bit difficult to grasp. Still, I think I've got the basics of how it works, now I just need to keep working through and figuring out what I can do with these commands.

Is there a site you can join to write and publish Ruby code for testing? Is that what Heroku is for? Anyone?

Bueller?

3 comments:

  1. Heroku is for web applications. What do you mean by testing?

    ReplyDelete
  2. I'm trying to figure out how to use a database for things like user interaction and input. Do you just test code locally before deploying it to a webserver? How do you use a database before publishing an application on a site?

    Maybe I'm getting ahead of myself here.

    ReplyDelete
  3. Maybe a bit! Rails developers usually run a local database that they develop against, and then eventually push their code to a server with a different database. This isolation is for safety and speed of development.

    ReplyDelete