Rails Book
I’ve had the Agile Web Development with Rails book authored by Dave Thomas and David Heinemeier Hansson for some time. Looking through Amazon I found out that there are several Rails book coming in the next few months. Dave Thomas is a good author, I also have his PickAxe book Programming Ruby: The Pragmatic Programmer’s Guide. In this post I want to quote some insights from Dave Thomas found in Agile Web Development with Rails.
The needs of the developer are very different when writing code, testing, code, and running that code in production. When writing code, you want lots of logging, convenient reloading of changed source files, in-your-face notification errors, and so on. In testing, you want a system that exists in isolation so you can have repeatable results. In production, your system should be tuned for performance, and users should be kept away from errors.
Why use an artificial primary key such as id?
The reason is largely a practical one – the format of external data may change over time. For example, you might think that the ISBM of a book would make a good primary key in a table of books. After all, ISBNs are unique. But as this particular books i being written, the publishing industry in the US is gearing up for a major change as additional digits are added to all ISBNs.
There are few absolutes when it comes to performance, and everyone’s context is different. Your hardware, network latencies, database choices, and possibly even the weather will impact how all the components of session storage interact. Our best advice is to start with the simplest workable solution and then monitor it. If it starts to slow you down, find out why before jumping out of the frying pan.
Use GET requests to retrieve information from the server, and use POST requests to request a change of state on the server.