Blog | Shared | Projects | Info
Browsing posts tagged with: Ruby on Rails
I wrote here about how beautiful urls should look like. This week I listened to a speech which Tom Coates gave at the Future Of Web Applications conference in London. He talked about beautiful urls and made an important statement. A URL should never change so it is not allowed to include technical details into an URL such as: www.mywebsiterunsonphp.com/about.php. What happens when someday you do not want to use php anymore? You still have to support a URL which will tell the user wrong information about the resource because this resource is not generated by php anymore. Lots of sites in the internet include the technology in the url (.php;.jsp;.do;.asp) fortunately Ruby on Rails does not do it :)

Visit Toms weblog for more interesting ideas about URLs.
Lately, I become more and more interested in domain specific languages (DSL). A great example for a DSL is XML builder for ruby. Ruby on Rails ships with it and you can use it in .rxml templates. Builder allows you to create xml files without much coding. Furthermore the coding you have to write looks like a custom language but its just plain ruby code. I use builder to generate the RSS feed of this site. Since it took me a while to find out how I can add the RDF namespace here is the code: As you can see you generate tags by writing xml.<tagname>(content). Furthermore with the help of blocks builder is able to know when it has to open and close tags. So 15 lines of code for generating a rss feed, not bad ;)
During the last month I really became obsessed with beautiful urls. So what is beautiful and what not? Take a look at the url for my weblog at the SAP Software Developer Network (SDN)

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/32510

As you see it is not self explaining and hard to decode. So a more beautiful version would be this one:

https://www.sdn.sap.com/weblogs/author/thomas-ritter

Of course, this url will never be a permanent link because sometimes people want or have to change their lastname. But you should get the idea.

I admit that I used these ugly url parameters (http://url-from-hell.com?word1=I&word2=AM&word3=EVIL) before I discovered rails. But now there is no need to be evil anymore ;)

Btw the rails implementation which allows you to create these nice urls is really simple check out the official guide here: http://manuals.rubyonrails.com/read/chapter/65.
The ruby on rails podcast is the only podcast I am currently listening. The show is always pretty good with lots of interesting projects and questions. For example the interview with the seaside developer was great. So the latest podcast with Sean Chittenden was something special because he is the one behind the new Penny Arcade backend (former php now rails powered). He answers a lot of interesting questions regarding: Apache webservers and fastcgi, Open source licenses, MySQL vs. PostgreSQL. Highly recommendable.
So yesterday I installed the new version of this site (my first rails application) and so far it works good. I found some glitches which I will try to fix during the next days. Oh and I will switch over to fastcgi when all problems are sorted out. It should make the site a lot faster.