The development of FilmDev (part one)

So, a while back I blogged about wanting to learn a new programming language.

A mere year after that I actually started doing something about it and a full year on I have some real progress to report!

I’d decided to learn Ruby and as I’m a Web developer by trade I decided to take a look at Ruby on Rails.

My first project was a very basic “point rails script at database” application to track the stupid amounts of photographic film that I keep buying on eBay.

It was simple to set up but as it was little more than a glorified spreadsheet I didn’t feel I had learned a lot about Ruby and/or Rails (it really helped me get my film addiction under control though).

I needed a meatier project to get stuck into…



Architecture – boncey

About this time I’d started developing my own black and white film.

I’d been umming and ahhing over doing it for quite a while and after reading dozens of “It’s easy!” type posts on various film groups on Flickr curiosity overcame my inertia and I decided to take the plunge.

Turns out they were right; it was quite easy. Even the dreaded “getting the film onto the damn reel in pitch darkness” bit seemed to go well (a combination of luck and a brand new Paterson reel I suspect).

As I only had Ilford film I followed their instructions, using Ilford DD-X as my developer.

Of course, there’s no rule saying you have to match a particular film with a particular developer – part of the fun of home developing is experimenting with different combinations.

It was whilst ruminating over this that I was struck by the idea that it would be really useful if there was a Website that provided an easy way to compare the results of developing a particular film with a particular developer.

The basic principle would be to allow people to sign in and describe what method they used to develop a particular film – a film developing “recipe”.

These recipes could then be linked to photos on Flickr via a special tag.

Thanks to the Flick API this would all be fairly straightforward to put together.

This then would be my first proper Rails project.

I started the project around the beginning of March 2008 and announced it to the world about 5 weeks later.

The site can be seen at filmdev.org.

Although the initial version was basic, it fulfilled my brief, which was to learn some Ruby (and some Rails).

But at this point I still had a lot of gaps in my knowledge.

My hosting solution was a bit ropey – relying on Fast CGI (hey, it seemed like a good idea at the time!).

And such wonders as Capistrano were still a closed book to me.

I still had a lot to learn…

Thinking in Ruby

So, I’m learning Ruby (it only took me a year to get started!).

I’m working my way through Programming Ruby and doing a few different scripts to see what it can and can’t do.

Most of it seems fairly straightforward stuff and I’m liking what I’m seeing for the most part.

One of the things that crops up from time to time in examples in books and online is something along these lines:

print total unless total.zero?

That’s it, the “unless construct”.

I’ve seen this before in Perl and I’ve always avoided using it – I personally find it unintuitive so I always write my code in the if x do y style.

Do x unless y has always seemed a little, errr, backwards.

Seeing it again in Ruby I again decided I’d avoid using it and carry on as I had before – then I began to wonder if I was simply imposing my “Java programming style” on to my Ruby code.

It’s an easy enough trap to fall into, much like early C++ programmers wrapping their C-style static methods up in a class and think they were doing OO.

Thinking about it, most of my Perl code is written in a similar style to my Java – I always apply “use strict” and enable warnings, always put code into methods, almost always have a main method etc.

But hold on, am I writing Perl in a Java style and thereby restricting my ability with the language, or am I simply applying sensible practices to my Perl code?

My Perl code never really extended much beyond occasional scripts to process photos so I have no clear answer to that.

I hope that my Ruby coding will move beyond that (possibly into the realm of Ruby on Rails) so as it does I’ll have to constantly be asking myself if I am thinking in Java or thinking in Ruby.

Need a new Programming Language

I need to learn a new Programming Language.

This is for two reasons.

In my time as a programmer I’ve learned and used; Basic, Ada, C, C++, VB, Perl and Java.

So that’s 7 (5 if you merge Basic with VB and C with C++).

It’s a reasonable amount, a little on the small side.

But that list is only half the truth; most of those languages I’ve not touched in years, some I’m definitely never going to touch again (Ada!).

The only ones I now use in any form now are Java and Perl.

I use Java in my day job and to write things like this site, and I use Perl for the odd scripting task.

My first reason for needing a new language is a pragmatic one. I need to learn a new scripting language.

I need a new scripting language because every time I go to do something in Perl I find I have forgotten how to do one of:

a, list the files in a directory.

b, pass an array to a function.

c, iterate over an array.

d. all of the above.

This is because I find Perl’s syntax to be on the whole inconsistent and unintuitive.

So, I’ve had enough of Perl’s kooky ways and would like to learn something a little bit more “sane” (definition: consistent and intuitive syntax).

My second reason goes a little deeper.

I’ve been reading a few articles and blogs of late that in some way or another point out some problems with Java.

A Quick Tour of Ruby

Java doesn’t provide a utility method for opening a text file, reading or processing its lines, and closing the file. This is something you do pretty frequently.

— Steve Yegge

Can Your Programming Language Do This?

Java required you to create a whole object with a single method called a functor if you wanted to treat a function like a first class object.

— Joel Spolsky

What was interesting was that once I was over my initial denial of such heresy, I found myself mostly agreeing with what they had said.

The surprising part for me was that I had not consciously noticed these things myself – even though I now realise such things had annoyed me at the time.

The reason that they had not bubbled up to the level of consciousness was that I could not see beyond the Java language itself.

Something was awkward to do in Java (ever tried reading a file?) – well, that’s just the way Java is.

I couldn’t question it, because I was so deeply ingrained in the ways of Java, I could see no alternatives.

This worried me somewhat, what other concepts and ideas was I ignorant of due to my Java mindset?

Sometimes you need to take a step back and get a fresh perspective on things.

And what better way than to learn a new programming language.

I’m a busy guy though.

I can’t simply afford to take two weeks off just to learn a new language.

So, to be pragmatic (I’m a pragmatic guy too) I’m going to try to solve both of these problems with a single language.

So, I want a general purpose language that’s also good for scripting work.

My shortlist of languages is not long:

Python.

I’ve dabbled with Python.

It’s fun, quick, easy etc.

I’ve not done enough to know if it’s “sane” as defined above, it doesn’t seem as freaky as Perl though.

Ruby.

Ummm, everyone’s talking about it.

A friend of mine is learning it and he’s not swearing about it too much yet.

Apparently it’s mostly “sane”.

I’ve not completely decided yet, I’m leaning towards Ruby at the moment mind.

Anyone care to convince me either way, or suggest other languages I should be looking at?