Re.Mark

My Life As A Blog

Archive for June 2008

Made Up Technical Terms #9

with one comment

Narkitecture – an irritating architecture.

Advertisements

Written by remark

June 27, 2008 at 7:38 am

Posted in Architecture, General

Availability Bias

leave a comment »

I’ve always been amazed at our memory of weather.  My experience is that everyone (in the UK), regardless of age, grew up in a period of cold, snowy winters and long hot summers.  Occasionally, high winds or heavy rain make an appearance.  I figure that this happens because we the unusual stands out in our memories while the commonplace fades into the background.  Why does this matter?  It matters because there’s a phenomenon called availability bias that affects our decision making.  When asked whether murder or suicide are the cause of more deaths most people say murder, when in fact suicide is far more prevalent (according to a 1978 study called Judged Frequency of Lethal Events.)  Apparently, we judge the probability of events by the ease with which they are recalled.

What has this got to do with architecture?  Quite a bit I’d say.  It’s crucial for us to understand how decisions are made, and be able to see the flaws in decision making (especially our own.)  Because availability bias leads us to overestimate the likelihood of that which we recall easily, we are likely to spend more time, money and energy on stuff which, although it may have very nearly derailed our last project, is actually far less important than the stuff we’re ignoring.  The way to counter this bias is with data – anecdotal evidence will only serve to reinforce the bias.

Written by remark

June 26, 2008 at 10:46 pm

Posted in Architecture, General

Ruby Tuesday #11 Update : First Steps with Shoes

with one comment

When I left my last post, I had been encountering some crashes with Shoes.  So, I took the Ruby code I’d written, installed Shoes on a Mac (running Leopard) and, hey presto, it worked.  I haven’t tested another Vista PC to see if it’s Shoes or the PC I was using.  Here’s the code:

require 'Twitter'

translator = Translator.new
client = Client.new

Shoes.app :title => "Twitter Shoes", :height => 750, :width => 750 do
  background rgb(240, 250, 208 )
  stack :width => 700, :height => 1.0, :margin => 20 do
    background "#eee", :radius => 12
    border "#00D0FF", :strokewidth => 3, :radius => 12
    stack :margin => 20 do
      button "Get Timeline" do
        alert("Username is {#@username.text} and password is {#@password.text}")
        timeline = ""
        translator.xml_to_tweets(client.download_friends_timeline(@username.text, @password.text)).each do |tweet|
        timeline << "#{tweet.user.screen_name} says #{tweet.text}\n\n"
      end
      @label.replace timeline
      #alert "done"
    end
  end
  stack :height => 550, :margin => 20 do
    background "#eee"
    @label = para ""
  end
  stack :margin =>20 do
    @username = edit_line :height =>50, :width => 100
    @password = edit_line :secret => true, :height =>50, :width => 100
   end
 end
end

So, what needs to be done next now is to provide a way to tweet from the Shoes form.  And it could do with some tidying up.

To help if you’re following this series, I’ve posted the source files for Twitter.rb and App.rb.

Oh, and there’s a space between 208 and the closing bracket in the line beginning background because if I don’t put the space in, WordPress converts the sequence 8 followed by a bracket to a smiley face wearing sunglasses.  Like this 8) .  Which looks a bit weird in code.

Written by remark

June 24, 2008 at 10:11 pm

Ruby Tuesday #11 : First Steps with Shoes

leave a comment »

Last week, I decided that Shoes was the toolkit I’d use to build a GUI for the Twitter client I’ve built in Ruby. So, I downloaded Shoes and installed it on a machine running Vista. There’s a bunch of samples that come with Shoes – to run the Timer, for example, type Shoes samples\timer.rb.

Before I got any further, I checked my feedreader and noticed that Scott Hanselman had blogged about Shoes – and said that it’d be a grat idea to build a Twitter client in Shoes. Timing is everything. Let’s put our shoes on.

I like to start simple. In fact I pretty much like to end simple, too. Anyway, I thought I’d start out with a button that downloads the public timeline when you press it. Here’s the code:

require 'Twitter'

translator = Translator.new
client = Client.new 

Shoes.app :height => 150, :width => 250 do
   background rgb(240, 250, 208 )
   stack :margin => 10 do
     button "Get Public Timeline" do
       timeline = ""
       translator.xml_to_tweets(client.download_public_timeline).each do |tweet|
         timeline << "#{tweet.user.screen_name} says #{tweet.text\n"
       end
       @label.replace timeline
     end
     @label = para ""
   end
end

OK, a couple of confessions. The first is that it looks pretty awful. The second is that on my machine the require was causing an exception in Shoes, so I replaced it with the code from Twitter.rb. I’ve shown the code here with require because it should work and it’s much simpler to read.

Let’s see if we can tidy that up a bit. There’s a couple of issues. There’s no scrollbar for the tweets and all the tweets run into each other. By putting stacks inside a containing stack, we should be able to sort that out. Here goes:

require 'Twitter'

translator = Translator.new
client = Client.new

Shoes.app :title => "Twitter Shoes", :height => 750, :width => 750 do
   background rgb(240, 250, 208 )   stack :width => 700, :margin => 20 do
     background "#eee", :radius => 12
     border "#00D0FF", :strokewidth => 3, :radius => 12
     stack :margin => 20 do
       button "Get Public Timeline" do
         timeline = ""
         translator.xml_to_tweets(client.download_public_timeline).each do |tweet|
           timeline << "#{tweet.user.screen_name} says #{tweet.text\n\n"
         end
         @label.replace timeline
       end
     end
     stack :height => 650, :margin => 20 do
        background "#eee"
        @label = para ""
     end
   end
end

I borrowed the colours and border from the jot example in the samples that come with Shoes. I think that looks much better. What would be even better is if it downloaded your friends timeline (i.e. you and those you follow.) I put some text boxes (edit_box) in to enter the username and password and even figured out how to mask the password (:secret => true) but started to have some issues with Shoes crashing. So, next week’s task will be to see if I can overcome the crashing and get a more functional client.

Written by remark

June 24, 2008 at 8:10 pm

Movies and Applications

leave a comment »

This post about how software is represented on the big screen is well worth a read.  And when you’re done reading, check out the showreels the post links to (large and not-so-large.) 

Written by remark

June 23, 2008 at 8:13 pm

Posted in Design, General, Software

Don’t build or buy

leave a comment »

All of us have heard the old chestnut "Build vs Buy".  As a way of starting a conversation about software decisions it’s fairly unhelpful.  Firstly, it’s a false opposition.  If you choose to build, are you going to build everything?  Chances are you’ll build on top of something else.  (And the buy part should really be "license", since not all software needs to be purchased.)

So, what we really should be doing is assembling: using stuff we already have, licensing bits we don’t have but need, extending bits where necessary and assembling it.

Written by remark

June 22, 2008 at 6:58 pm

Posted in Architecture, Software

Firefix

leave a comment »

Having installed Firefox 3 recently, I was having some trouble with extensions.  They wouldn’t install and those that were installed didn’t do what they said they would on restarting Firefox.  After a little headscratching, I found this article.  And Firefox is fixed.

Written by remark

June 22, 2008 at 6:54 pm

Posted in General, Software, Tools