I originally just wanted to post my findings on implementing an HTTP client to serve as an example to others learning Eiffel, but I realized that the importance of the following example would be lost on many people without a little background on the subject and felt like an explanation in the form of a rant should also be included. Therefore, if you’re just looking for the example, scroll down to the later sections and take a look. Otherwise, keep reading.
(more…)
Man oh man am I happy. I recently discovered Merb, a more lightweight thread-safe alternative to Ruby on Rails. I might devote an entire post to this framework because there’s a lot to be said, but I want to get this off my chest.
I need a mini-framework
I’ve been looking at all these different frameworks to find something that can run more efficiently on my tiny little ghetto server, because I don’t have the resources to run these memory hogging rails apps for my relatively tiny websites. I really need a small framework for the kind of apps I make. You know, pull out a quick blog, wiki, or other, with no DB access at all. What about Camping? No, that’s a little too small. I settled on Merb. Merb is considerably bulkier than Camping, and for a bit I was wondering if even it was too much, until now…
The Merb guys have just released a developer version 0.9.0 which has some neat changes, but what definitely caught my eye was (from the last few lines of the post) the –very-flat option for the application template generator. No need to explain, I’ll just show you how awesome it is:
titanium:merb jinx$ merb-gen blog --very-flat
Fri, 15 Feb 2008 22:57:23 GMT ~ Not Using Sessions
RubiGen::Scripts::Generate
create /blog.rb
create /README.txt
Now, if we load up the one file created for our project:
Merb::Router.prepare do |r|
r.match('/').to(:controller => 'blog', :action =>'index')
end
class Blog < Merb::Controller
def index
"hi"
end
end
Merb::Config.use { |c|
c[:framework] = {},
c[:session_store] = 'none',
c[:exception_details] = true
}
BAM!
Imagine that? That’s all there is to our app. That’s the entire source code– program logic, configuration and support files. It’s fully executable as its own application with the command merb -I blog. Microframework indeed. Granted, it’s pulling all of the ‘merb-core‘ gem, but that’s pretty small. This code is super portable (in the put-it-on-a-usb-key sense, not the platform-to-platform sense) and really quick to develop with. Step aside, Camping.
Granted, I don’t think I’ll use this method of development since it’s the same reason I won’t use Camping, but it’s nice to know I can drop down to the really simple level if I need to just prototype one quick "one-button" app and still have room to grow it out. The fact that Merb can actually do this is what’s most mindblowing. It’s a true testament to the modularity and extensibility of the framework’s design. Getting Rails to run without ActiveRecord is a pain enough, let alone pulling out everything but routing and controllers.