Recent non-work programming projects: I’ve been getting back to working on dbcdb, converting the database editing part from Java to Ruby. And, last Tuesday, BayXP had a hands-on session where we all did some pair programming getting us exposed to Behavior-Driven Development in Ruby. (See the RSpec web page.)

I don’t have much to say about the details of this (BDD in particular I can take or leave), but I really enjoy programming in Ruby. I missed the previous month’s BayXP meeting, where they did BDD in Java, but I can’t imagine that the code they came up with was as simple as what we came up with this month. (Even setting aside the fact that Ruby makes implementing BDD easier by letting you add methods to Object.)

And the more I program in Ruby, the more I wonder how I could have been so blind to the fact that internal iterators are so much better than external ones. Or, in general, that I forgot how wonderful creating functions on the fly could be; while I still maintain that destructors are a fine thing, I don’t feel their lack in Ruby the same way I do in Java because I can write functions like

    def perform_and_close
	yield self

which I then use as in

    def edit(id, db)
      db[table_name].perform_and_close do |table|

(And yes, you can put the body on one line, with slightly different syntax: I only wrote it that way to avoid making the lines too long.) Which really isn’t any more typing than creating and using an RAII class in C++. (For this example, at least; I don’t have enough experience yet to make general statements.)

I need to get back to programming on the weekends. I’ve done it twice in a row, which is a start; a streak worth continuing.

Post Revisions:

There are no revisions for this post.