Archives For Ruby

Understanding MVC: Coding

October 15, 2009
This entry is part 3 of 3 in the series Understanding MVC

In the [intlink id=”453″ type=”post”]first part[/intlink] on this series about the MVC (Model-View-Controller) design pattern, I discuss the individual parts and what they represent. In the [intlink id=”505″ type=”post”]second part[/intlink], I layout some common conventions of MVC frameworks. Both of those posts lead up to this one, in which I want to talk about actual code. In my opinion, it’s not too hard to understand what MVC means, in theory, or to follow a framework’s naming rules, but then you start developing a project and can quickly become confused as to where you actually put your code.

Continue Reading…

JetBrains just released version 1 of a new Ruby and Ruby on Rails IDE called RubyMine. It features everything you’d expect in an IDE, like code completion, project navigation, HTML/CSS/JS editing, version control software (VCS) support, plus lots of Ruby and Rails-specific features. Version 1.1 of RubyMine is expected in May, with support for version 2.3 of Rails (a significant upgrade). The software is available under two licenses, one (free) for open-source projects and another commercial license ($99 US at the time of this writing).

Benchmarking a Web site is the simple act of measuring its performance. Measurements may look at how long it takes a page to load in the client (see my post on the YSlow Firefox plug-in). This can be a reflection of the page itself—the amount of images, HTML, JavaScript, CSS, and other media—and a reflection of the client: their download speed, their computer speed, the browser they’re using, etc. Because of the client-side factors, this kind of benchmarking is best, I feel, to just analyze the amount of information being downloaded and how efficiently that’s taking place (again, see YSlow for more on this).

On the other side of the equation, you can perform benchmarks on the server. Finding, and later improving upon, these measurements will improve the experience for all clients, regardless of download speed, computer, or browser type. This is particular important when using server-side technologies like PHP.

Among the many utilities available to benchmark a Web site is Siege, from Joe Dog Software. One of the nice things about Siege, besides it being free, is that it tests a Web server under duress, something that’s impossible for a single individual to replicate. So you can tell Siege to access your site using X number of simulataneous connections and then see the result. On the downside, you have to compile it on Unix-like systems, including Mac OS X, in order to use it. For more, see the Siege Web site and it’s simple-to-follow manual.

A couple of months ago I started hearing about the Merb framework, an alternative to the Rails framework for creating Web sites in Ruby. As you may know, Rails came under some fire for not scaling well; Twitter, in particular, had several problems. (Although I would argue that the demands of a site like Twitter are probably in the top 0.1% of all sites, so this concern may not be an issue for most Web sites.) Version 2 of Rails specifically addressed these concerns, but still, people started to look around for alternatives, including not using Ruby at all. This is where Merb came in: a smaller and faster Ruby framework. I hadn’t yet gotten to play with Merb but was going to add it to my framework-comparison homework. That may be a moot point now, as it was just announced that Merb and Rails will work together on the next version of both frameworks. Version 3 of Rails will incorporate some of Merb’s best attributes, resulting in a better Ruby framework for Web development and ending a minor feud within the Ruby community. So the next version of Merb will be Rails 3.0 and the next version of Rails will be influenced by Merb: what does this mean? Continue Reading…

Ruby, PHP, and Frameworks

November 30, 2008

I began my computer consulting career in 1999 as a PHP programmer. For several years, all of the Web sites I created were written in PHP. (I have done a couple of ASP.NET sites, and although I find the technology and the development tools to be impressive, the requirements that you develop and run ASP.NET on Windows is a non-starter for me.) In 2005, while at the Apple Worldwide Developer Conference, I first played with the Ruby on Rails framework, released a couple of months earlier. So, like many people, I came to Ruby after seeing how brilliant the Rails framework was. At that time, there really were no PHP frameworks that were comparable, although perhaps the Zend Framework, among others, are close enough today. I wanted to talk a bit about how I see PHP and Ruby, but first, a discussion of frameworks… Continue Reading…