After receiving numerous emails about when my book would be released… I have finally taken a few minutes to put together a web site for my book. You can sign up on the book mailing list to be notified when there are announcements regarding my book, Programming Rails
It’s not finished yet… but at least this way I will be able to keep track of all of you who are interested. :-)
If you know me at all by now… you might know that I am a huge fan of PostgreSQL. Coming to the Rails camp was a bit of an eye-opener./ Working with PostgreSQL used to save me quite a bit of work and let me sleep at night. I have dealt with the problems that many developers face while working with MySQL. Like many of us in the Open Source world, I was exposed to MySQL more often than PostgreSQL. For several years, I convinced myself that MySQL was awesome because it was fast… but speed isn’t always the most important factor in the technology world. Otherwise, we’d all be coding in C. What PostgreSQL provided to me as a developer was better relational integrity. Foo cannot exist unless Bar does, or vice versa.
ON DELETE CASCADE was a godsend and saved me quite a bit of work when building an application. Triggers… Procedural Languages… oh so beautiful.
PostgreSQL was (and is) the Open Source database server that both the Enterprise DBA and Developer could agree on.
Enter Ruby on Rails
At first, I just ignored my instincts and jumped in head first. Pluralization? Primary keys named
id? Blasphemy! Yet, I moved forward. After a few days of consistently reminding myself of these new-fangled conventions (I even printed out a little cheat sheet and taped it to my monitor)... I was hooked. Rails worked with PostgreSQL. Let me say that again.
RAILS WORKS WITH POSTGRESQL!
- Table names are not forced
- Primary Key field names are not forced
- Foriegn Key field names are not forced
- Legacy databases can work with Rails
- Active Record (like much of Rails) can be customized for your particular application’s needs
I was, and still am, concerned about trusting Active Record with handling my relational data… because in some cases it wasn’t doing what it should. But, that is being worked on… and because Rails is Open Source, the issue is transparent for us developers to see and help fix.
In the past, you might have found me advocating the addition of business logic in your database server, whenever possible. It is the gate keeper. The key master. It is not meant to be flexible with your data. If business rules are to change, you change them there so that if you have one or more INPUT streams into your database, the data will not get into your server unless your business rules are met. PostgreSQL even provides you with a nice ERROR message, which some other servers do not. If you can control everything through one INPUT stream (Application Database), then putting these constraints solely in your database abstraction layer is a-ok. However, if you are interfacing with your server through a variety of avenues (Integration Database), you probably already know that your system is going to be a pain to maintain in the long run. So, what are you to do?
Handling Legacy systems is going to be a headache, regardless of what you do… but you can’t always rebuild the whole thing and migrate your data. Add that to your Someday-Maybe list.
When you’re adding new pieces to your application, start by using good tools, frameworks, and practices. For example, try your best to follow the Application Database path to pragmatic enlightenment. Begin working on a new layer for your legacy database. Add on web services that use this layer. Refactor your existing applications. Can they use these new services? ReThink everything. That is… if you have the time and resources to do so.
If you are questioning whether or not to put your business logic in your database abstraction layer, stop. Just do it™. But, do it with caution. Test it. Test it well. I’ll admit that I still add some constraints into my database schemas-
I am not ready to give up that extra layer of data security. But, that’s just me. :)
PostgreSQL works with Rails!
...and I promise to show you how to do some fun legacy stuff with Rails in my book. :-)
From my years of working in the open source community, I have not seen a community so friendly and so cultured (meaning, we come from PHP, Java, .NET, Perl, Python, etc.) The elitism is minimal in the Ruby community… we all just want to have fun and write elegant code. :-)
Do you find the Ruby community friendlier?
2 comments Latest by kh Mon, 21 Aug 2006 10:41:35 GMT
Today, RubyURL reached two-thousand happy rubyurls!
That’s right! 2,000!
The traffic has picked up a bit since a few bots started to use it in IRC channels and with the easy browser toolbar feature is. It’s cool to see people using it on the ruby-related mailing lists, and there seems to be quite a few people in Japan who use it to link to/from Japanese fetish sites (I won’t ask what a green-tea-zipper-party is…). Whatever floats your boat. ;-)
In any event, HAPPY 2000!
Let’s hit 10,000 before it becomes one year old! :-)
The RubyForge.org downloads currently take up just over 1GB in disk space and they say that they are getting just over 200GB of transfer a month now. We’re happy to help out. :-)
We should be put into the rotation sometime in the next day. Until then you can start downloading stuff now at http://rubyforge.planetargon.com/.
How do you measure the ROI on a project like this? How do I get PostgreSQL or Ruby-on-Rails credit for reuniting a twelve year-old girl with her father who had been missing for three weeks or any of the other amazing stories we heard everyday at Windsor?
It’s great to hear that Open Source is used for situations like this. The money that would have been spent on commercial applications and support would be better spent on the people that they are trying to help.
I tried to figure out exactly which page might be using Rails (as they are using Gallery, WordPress, etc for a few other pieces of their system). I found this, which looks like it might be based in Rails.
Disclaimer I couldn’t find too much information about this, just their blog and a few links from it. If you find more information, please comment and I’ll update this entry. :-)