futuremint

futuremint

Dave Woodward  //  Father and Programming Language Enthusiast. Has a love/hate relationship with computers. Insufferable iconoclast in almost all walks of life. Prefers dynamic languages with s-expressions and unpretentious technology. However, still prefers small words. And irony.

Dec 31, 2010 / 1:30pm

2010 Retrospective On This Whole Futuremint Thing

This year I’ve actually made an effort to try to blog on a reasonably regular schedule. I started off attempting it monthly, but it slipped over the summer. Expect me to get back to maybe… bi-monthly? I think I’ll start with something I know I can handle. So bi-monthly sounds good.

This was a big year of change… but not all for the better. I often change things just to see if there is something better somewhere else. I always say, “you can’t knock it till you try it!” But I do it in ways where I can test the waters a little on the other side and still come back if I need to. I’ve done a bit of “coming back” this year.

I was doing Rails freelance work at the beginning of the year on some products I helped build so I knew the code bases well. I stopped freelancing in April to focus on just my day job (a change). Turns out I think I need to be doing more than one thing at a time (coming back). I wanted to focus on only Smalltalk this year (a change). I’m now just as annoyed by Smalltalk’s shortcomings in production as I am with Ruby’s (coming back… sort of; mostly just irritated).

I switched to Ubuntu exclusively in May and stopped using OS X (a change). Turns out I still get annoyed by Linux’s small little broken things here and there just like I did a decade ago. I’m in the process of switching back to OS X over the next month or so just because day to day usage is easier for me (coming back). All of the software I need is more of a pain to install on OS X than Ubuntu, but that happens less often than Ubuntu’s daily irritations. Its truly been “death by a thousand paper-cuts” for me. But Linux is still second-to-none on the server.

I started up freelance work on Rails again. Its good to be back! Changing to Ruby 1.9 & Rails 3 really alleviates some pain points that drove me away. However, impolite monkey-patching by library writers still infuriates me. It will be the death of Ruby, and the Refinements feature proposed for Ruby 2.0 can’t be finished — and back ported — soon enough!

Over the summer I switched our Smalltalk app from using the Magma OODB (written in Smalltalk) to CouchDB (a change). This was definitely a change for the better. Every time I get to work with CouchDB I’m happy. It really is great to work with (see my previous posts about it). So this change is a win! I’m even starting a few Rails projects on CouchDB. However I am predictably unhappy with what’s out there for CouchDB integration with Rails 3. I guess I’m just getting old and cranky, or its just NIH.

I did a project in Scheme for work about 5 years ago, and I’ve started to get back into some more Lisps (a change). I can already tell that a Lisp (Clojure or Common Lisp, not sure yet) will be my favorite language of choice! Scheme just didn’t do it for me. But a good Common Lisp environment in Emacs is my favorite over any Smalltalk, or any commercial IDE money can buy. Clojure in Emacs isn’t quite as smooth, but still really good. I’ve really been enjoying working through Land of Lisp, and can’t wait for the final version of Joy of Clojure. I also have some Lisp projects (also on CouchDB) that I’m excited to put more time into next year. One may even make it to see the light of the public!

Something that always bothers me in a programming language is how hard it is to increase the levels of abstraction. Most languages can only go so far. Ruby breaks down because of its open classes and lack of macros (though evaling interpreted strings is… sort of a hack that works at times). Smalltalk breaks down because everything is message sends to an instance of a class. You can’t abstract above an instance of a class. I know there is more to it but practically this is what happens. There is no easy way to abstract a pattern of a collection of interacting class for example.

Lisp on the other hand has macros. Common Lisp’s macros are awesome. They’re messy and you can shoot yourself in the foot with them and they need to be used sparingly… but there is absolutely no better way to make yourself a nice little DSL than macros in Common Lisp. I’ve made a few mini-DSLs in Smalltalk and Ruby and the code that runs them behind the scenes is really ugly. There is a visual shift between using the DSL and implementing it in code.

But the implementation is just as easy to read in Lisp as the usage because of its syntax. Yes… I love all of those parenthesis. Once you realize what they let you do you will too. But you absolutely need an editor that balances them for you.

So lots of things changed, some things went back to the old ways. Expect more exciting posts next year about your favorite (or not) programming languages or goofy web technologies here! Happy New Year’s!

Filed under  //  Clojure   Common Lisp   CouchDB   Lisp   OS X   Rails   Ruby   Smalltalk   Ubuntu  

Comments (2)

Apr 16, 2010 / 10:43am

Caching in Seaside vs. Rails

This one will be short as I stopped programming momentarily to write this.

One more reason (of many) I enjoy developing with Seaside vs. Rails is that caching is much easier and is "built-in" in a Smalltalk environment. This difference is primarily from the way Rails is structured. When a request comes in to Rails, the Dispatcher initializes new instances of your controller which then pulls in models from the DB, which also get instantiated in memory, and when the request is over this is all thrown away to start over again in the next request/response cycle.

Because of the image-based nature of Smalltalk, your model instances are always there in memory. This can change depending on your persistence strategy, but for the simple cases you usually arrange to have them in the image at all times. Sometimes they get instantiated at image start-up, other times on-demand (but this is slow, just like Rails!). Incidentally this makes Seaside much faster for the same relative level of optimization work because it skips ActiveRecord's step of instantiating your model objects on-demand. Seaside's rendering times are faster out of the box because your object instances are already there in memory ready to go.

Anyway... my point is that I needed some simple caching of a method's results to help a page load a little faster in Seaside. All I did was add a new instance variable to my model instance that lazy-loaded the result of the calculation. I then added a few more places where this "cache" gets invalidated from other method calls, and I'm done.

I didn't have to install gems, configure a new server like memcache, read docs on a gem's interface to memcache, etc. I simply leveraged the tools available in Smalltalk, and built a simple thing that just works. I don't have to worry about persisting it as its lazy-loaded. Which really is how memcache is usually used with Rails, as a place to temporarily store the results of an expensive computation.

There is nothing stopping one from doing this same thing in Rails, but it doesn't go with-the-grain of the way Rails is built and you are expected to use it. Rails is "opinionated software" after all, and I've worked on many Rails projects where one piece or another has to violate the opinions and work on it becomes painful.

For whatever reason solutions in Smalltalk end up much simpler and therefore lend themselves to easy extension and expansion.

Filed under  //  Rails   Ruby   Seaside   Smalltalk   Web Development  

Comments (0)

Jan 1, 2010 / 1:15pm

Smalltalk (and Seaside) versus Ruby (and Rails): Intro

I've been using Rails since 2004, and some of its' libraries before that (I setup a local Instiki that, AFAIK, is still running at my old employer). Once I started using Rails at my then job at a radio station group (designing/managing the websites), I decided that Rails was a superior development experience. So I started looking for a way to use Rails as a full-time job. I've since enjoyed most of the long hours I've spent developing various things with Rails for various companies.

My current full-time job still includes maintaining a Rails application (one that I built in late 2005 on a contract), and I still enjoy it. I get to make the technology choices at my current company, so in early summer of 2009 I was tasked with separating some functionality of the existing Rails app out into a stand-alone application. I initially wanted to go the route of some sort of NoSQL database with a JS only (or mostly JS) front-end (some sort of combination of CouchDB, Rails & jQuery).

However, I've also had my eye on Smalltalk ever since hearing about it from a co-worker in 2004 (around the same time I discovered Rails). I did some investigation and spent some late nights with a few quality online tutorials. I started with "Seaside Tutorial" , as well as "Learning Web Development with Seaside". Now there is the much more detailed and up-to-date book "Dynamic Web Development with Seaside". Anyway, I basically learned Smalltalk and Seaside at the same time, and decided to build the new app in Seaside.

So now almost a year later I much prefer developing with Smalltalk & Seaside than Ruby & Ruby on Rails. I use Pharo Smalltalk exclusively for development and the server deployment (I used Squeak 3.10 until Pharo went beta). The database I use is SandstoneDB from Ramon Leon, which is basically an Object Database that just persists the objects as text files (it's essentially Prevayler with an Active Record style API). Once this app needs to scale, I'll probably move it to Gemstone/S (the people behind Maglev for you Ruby folks).  For business applications, I'm currently of the opinion that nothing beats a web application in a dynamic language on top of an object database.

I still switch back and forth between Smalltalk and Ruby, and will be doing so for the foreseeable future. Most days I'm using both, sometimes inside the same hour! 

I'll be giving a talk about Seaside & Smalltalk at the February Indy.rb meetup. The similarities between Smalltalk and Ruby are pretty interesting, and now I know what people mean when they say that "Smalltalk isn't dead, it survives in most languages used today!" You can find language features inspired by, or stolen from Smalltalk in Java, Ruby, Javascript and many other languages in common use today.

I already have 3 posts I'm ready to write comparing the two languages and frameworks from a development perspective, so expect to see those over the coming months. I also have some thoughts I'm going to share about development environments. I used to be completely anti-IDE. I used to only use TextMate to edit my code, and the command line for all of the tools. Then I moved to GNU Emacs and loved it. Now I get frustrated and bogged-down in a text-editor only setup. I use RubyMine for Rails work, and Smalltalk has awesome development tools (even in the "under-developed" open source versions). The modern IDE has its roots in Smalltalk and Lisp, and once you use an IDE that actually IS "integrated" as the acronym suggests, you will never turn back.

Filed under  //  Rails   Ruby   Seaside   Smalltalk   Web Development  

Comments (6)