My software apprenticeship

I have recently had the privilege of being accepted as an apprentice to software craftsman and philosopher Enrique Comba Riepenhausen. This is part of Eden Development adopting a craftsmanship approach to software creation.

I am very excited at this new development in my career. It’s going to be hard work because i have a lot to learn, but i am pleased to have made the commitment and to know that i have someone who is playing a very active part in my personal and professional development. Funnily enough, the more i learn, the more i realise how little i really know. The first task that i have been set as part of my apprenticeship is really showing me that.

Eden Development has given me a blog to talk about my progress during my apprenticeship. So i have decided that my apprenticeship blog will become the place that i talk about my technical and coding interests, leaving this blog to be more personal. So if you are interested in me from a technical point of view, please follow edendevelopment.co.uk/blogs/aimee.

There are actually now five apprentices at Eden Development. If you are interested in software craftsmanship it is well worth looking at the Eden staff blogs aggregation to read all our thoughts and experiences on our own journeys.

Advertisements

The Lord's Prayer, for coders

The following comes from a funny (and slightly weird) conversation i had on a walk with a colleague this afternoon. This is literally the way we often talk when we go out for our walks around the fields of Barton Farm! One day we’re probably going to have a day when we only speak in Ruby!

@heaven = Heaven.instance
@father = God.trinity[0]
@earth = Universe.galaxies.find_by_name("Milky Way").solar_system.planets[2]

@father.open_connection do
  @father.current_location.should == @heaven
  @father.name.should be_hallowed

  kingdom = mock_model(Kingdom)
  Kingdom.stub!(:new_for).with(@father).and_return(kingdom)
  kingdom.should_receive(:come!).and_return(true)
  @earth.should be_like(@heaven)

  @earth.current_population.each do |person|
    person.should_receive(:bread).daily
    @father.should_forgive(person) && person.should_forgive(:others)
    @father.should_not lead(person).into(:temptation)
    @father.should deliver(person).from(:evil)
  end

  while true do
    [Kingdom, Power, Glory].collect do |klass|
      klass.all.should be_attributed_to(@father)
    end
  end
end

Shame i haven’t updated for such a long time. I was unable to log into my blog for a while, and even when i fixed it i couldn’t think of anything to write to make a suitable come-back! Hopefully this satisfies! :)

A website in a day

Sometimes it’s excellent fun to work with somebody to produce a website in a day. With no requirement for ongoing support, just get it up and running, instant gratification. In a way, it says, “Look what we can do when we set our minds to it!”

New site for the Winchester Web Scene
winchesterwebscene.co.uk

Yesterday, @sydlawrence phoned me to ask if i’d like to help make a new site for the Winchester Web Scene. Without a second thought, i said, “DEFINITELY!” We got together at 3pm today at the Bridge Patisserie. We drank lots of coffee, went on to the Bishop on the Bridge, then went back to Syd’s house and ate pizza. We got the whole site designed, coded, integrating with Twitter, Flickr, Google Maps, Gravatar and Campaign Monitor for email subscriptions, with a blog plus comments, events list and RSS feeds … in about 5 hours.

It was nice that two Winchester web companies, Marmalade on Toast and Eden Development were able to combine talent to work on a fun social project together. The two of us had a great time making it!

The site gives a far greater prominence to the Winchester Web Scene than the old Ning site did. Still in its first few hours of existence, the site has already had 71 unique visitors. The future of the Winchester Web Scene is looking very bright!

The next event is a barbeque at the Hyde Tavern on the 6th July from 7pm. If you live near Winchester and are interested in anything to do with the web, you’re very welcome to come along! :)

Rails on Ubuntu in 14 minutes

I recently installed Ubuntu Jaunty Jackalope and hadn’t yet got around to putting Rails on to it.

Installing Ruby and Gems and Rails and getting them all to work nicely together can be a pain, so i’m happy to say i managed to go from nothing to Rails installed and working in 14 minutes this time! Thanks very much to Installing Ruby on Rails on Debian/Ubuntu for most of the tips. Here’s how it panned out for me:

Continue reading

CouchDB and data storage

Alexander Lang has written a great article about why CouchDB is not compatible with ActiveRecord, and why you should not try to coerce CouchDB into mimicking a relational database. It really is a very different thing altogether: The case of ActiveRecord vs. CouchDB

In my experience of CouchDB i first tried out ActiveCouch because of my familiarity with ActiveRecord. I soon came across problems because it was trying to make CouchDB something that it is not. As i exclaimed at the time, “LOL. ActiveRecord this is not!”

I had far more success with couchrest which is a much closer CouchDB wrapper, enabling CouchDB to be used as it’s intended: as a RESTful interface with map/reduce views.

Domain-Driven Design

Recently i have been reading Domain-Driven Design by Eric Evans. Through reading it my understanding of Rails – and web programming – has completely turned around. My thinking used to be entirely database-centric. I saw Rails as little more than an easy access into the database. For ages i didn’t even realise that you could have models that weren’t connected to a database table!

Now my thinking has changed and i consider the primary focus to be the domain model. I think about the classes and the design patterns that apply to them. I consider how they fit together, how they communicate with each other, and the boundaries between the core domain and subdomains. In my mind, the database has gone from being the most important thing to being just a method of persistence for the data in the domain model.

When you think of things this way round you are less likely to get hung up on the differences between ActiveRecord and CouchDB. You work out your domain, design the classes and then think about the most appropriate database platform to support your model.

Update: I’ve just come across a useful article that provides three methods to achieve a has_many relational structure in CouchDB. CouchDB “Joins” by Christopher Lenz.

Right Now Search

With all this talk of Google wanting to buy Twitter, it got me thinking about the exciting potential for real-time searching. I’ve seen some greasemonkey scripts for adding Twitter search results into Google, but i wanted something a little bit different. I wanted to search multiple places and bring them together in columns. Something a bit like this:

Right Now Search

So i spent the whole afternoon figuring out how to do it (and in the process, learning how to do object-oriented PHP!) and you can try it out here: rightnow.aimee.mychores.co.uk

I need help on making it more interactive. It should be fairly easy to define new search locations like plugins. I want people to be able to choose which they wish to search on. I would like AJAX updating with auto refreshing. And of course i need a lot of help with the design!

If you fancy having a play, fork it on Github! github.com/sermoa/right_now_search :)

Epoch countdown

Epoch countdown

Terribly geeky, i know! Many modern computers count their time in the number of seconds since Unix Time, an epoch beginning on 1st January 1970.

In about 8 minutes it is going to reach 1,234,567,890 – something which i find oddly exciting! Keep up with it on coolepochcountdown.com

Update: GOT IT!!

My little ruby program recorded it for me!

Also, coolepochcountdown.com started doing fireworks and playing “Celebration” at 1234567890 o’clock! It was excellent!! :D

Also, there are many geeky celebrations on Flickr!

On learning Vim

I’m sure Vim is going to be a wonderful thing for me to have learnt – a skill that will stay with me and benefit me for the rest of my life. It’s just getting there that’s so hard!

I started using Vim in earnest this week. On Monday i used Vim in the morning, and switched to TextMate when i got too frustrated. Tuesday was periodic switching between the two. TextMate when Vim got on my nerves, and back to Vim when i found myself missing Vim features. Yesterday and today i have been entirely on Vim.

Yesterday was great – i really felt i was getting somewhere, and gaining speed. It started to be less about me getting around Vim, and more about me doing my work. Today has been a bit more frustrating, as i know it is slowing me down significantly in the short-term, but i’m sure it will be worth it!

I keep finding myself smiling at Vim when i have elegantly told it to do something quite complex. It’s like “Wow, Vim, you’re so clever!” Selecting a block of text and duplicating it, going five words in and changing the text to the end of the quote marks: vapyP5wct" – said as “visual a paragraph, yank, Paste above, 5 words, change till quote marks.

It’s so cool to have Git integration right within Vim, and now that i’ve got the hang of the NERD Tree, and manipulating windows and buffers, i’m coming along a treat! I’ve discovered i have quite a strong perception of the layout of a project – without a project drawer i just couldn’t think what to do or where to find anything! I’ve also decided i really like side-by-side windows so that i can see code and spec at the same time. I’ll do a screenshot when i’m on my big computer.

The biggest problem in fact is not the super-amazing-cleverness of Vim and its plugins. I’m getting the hang of them pretty fast. The hardest thing is just learning the basic commands – like – moving around! I still get j and k mixed up, and it requires so much brain energy to remember whether i want to type a or i, o or capital O … even to remember to press <Esc> to come out of insert mode. Invariably i get it wrong and have to undo all the time. Either that or i’m undoing when i don’t want to, because i think u is for up. Fortuately i discovered on a Dvorak keyboard, k is underneath u so that sort of reminds me that k is up.

I just hope it is not my dyslexia making it hard to learn the basic movements. Most of Vim makes a lot of sense to me. I like that it uses mnemonics and mostly pressing one key at a time. I love how you can combine keystrokes in sequences to achieve really powerful effects. I hear that when you get really good at Vim you’re not even aware of exactly which keys you’re pressing. You just think about what you want to do, and your fingers do it automatically. I’m sure i can get to that level of proficiency … it’s just a case of being patient with myself whilst i’m still learning.

It was like this when i was learning Dvorak, but i’m glad i did, and my fingers do just type without my having to think about where the letters are. I type at around 80 words per minute, which is pretty nice, so i’m sure with the power of Vim, i could be truly awesome!

GeoURL – a new WordPress plugin

Whoops, it’s another late night, but … i just wrote a WordPress plugin!

Every time i change my theme i hardcode in the meta tags for GeoURL to detect my location. GeoURL is then able to find other sites that are geographically nearby. It gives me a little button link to use, like this:

GeoURL

The way this works is very simple: just poking these meta tags into the header of my blog page:


Note, that is not *exactly* where i live – it is just somewhere random near the centre of Winchester!

I thought there must be an easier way than hardcoding the meta tags into the theme. I had a look but didn’t find a plugin for it, so i made one myself! :) It allows you to easily add your location coordinates and ping the GeoURL server. Pretty simple, but i’ll find it useful. It’s already working on my own blog and once i get a subversion repository from WordPress, i’ll upload it for sharing! :)