Re.Mark

My Life As A Blog

Archive for the ‘Tools’ Category

Seeing the Big Picture

leave a comment »

K. Scott Allen’s post on the limits to visual tools is an interesting read.  The main contention is that visual tools don’t scale and consequently have a limit.  The examples in the post back up this point.  I wonder if this is a problem with visual tools per se, a limitation of current tools or a misuse of the tools.  It may be a combination of these factors.  The first question to ask is: do text based tools scale well?  The good news is that we can split a system up into an arbitrary number of files.  This is great for understanding the contents of a file – but the system as a whole is still very difficult to understand, especially for those coming to the system cold.  Putting everything into one diagram is the equivalent of putting all our code into one text file – I’m going to assume you agree with me that that’s a bad idea for all but the most trivial of system.  With a well factored codebase, the best route into the system for most people, in my experience, is some sort of graphical overview – the key here being that it must be at the right level of abstraction.

In creating and reviewing architectural documents and walkthroughs, I’ve often faced the same issue of getting the right amount of information into diagrams.  There is a temptation to have one diagram that shows everything – this temptation should be resisted as it leads to confusion.  Having a number of views of a model (each at differing levels of abstraction and with a different perspective and focus) is the best way I’ve found of distilling the right amount of information.  What we need from the tooling is a way to link the views together.  When you think about it, the principle here is similar to that used in splitting up a codebase into multiple files.  Diagrams and models are, of course, not text free – but in the right context one diagram can save a lot of time and effort.

So, I’m not convinced that there is an inherent quality of visual tools that limits their ability to scale – but the way in which we use them and some of the functionality provided may need to change to accommodate scale.  Another thing to consider is that models can be represented with both text and diagrams – potentially allowing different people to use representations that are closest to their natural strengths.

Written by remark

May 27, 2008 at 3:01 pm

Ruby Tuesday #6 : A little XML

leave a comment »

Last week I wrote some code to download the public timeline from Twitter.  The public timeline is in XML format, so we need a little code to translate it into something more readable.  Before getting to the XML reading, I moved the code from last week into a new file called, very imaginatively, Twitter.rb.  I also discovered that the name I gave the method (getUrl) isn’t very Rubylike, so I changed it (to get_url).  Now, I’m not the biggest fan of underscores, but part of this learning Ruby business is to learn the culture and customs as well as the language itself.

Next, I decided that it would be good to have a class representing a tweet and another class representing a user.  I put both of them in the Twitter file.  Here are those classes:

class Tweet
  attr_reader :created, :id, :text, :source, :truncated, :user

  def initialize(created, id, text, source, truncated, user)
    @created = created
    @id = id
    @text = text
    @source = source
    @truncated = truncated
    @user = user
  end
end

class User
  attr_reader :id, :name, :screen_name, :location,
    :description, :image_url, :url, :protected

    def initialize(id, name, screen_name, location, description, image_url,
    url, protected, followers_count)
       @id = id
       @name = name
       @screen_name = screen_name
       @location = location
       @description = description
       @image_url = image_url
       @url = url
       @protected = protected
       @followers_count = followers_count
    end
end

I’ve used the attr_reader method to create read-only attributes which are set in the initialise method of each class.  For those who, like me, are new to Ruby the initialise method performs a similar purpose to a constructor.  The funny @ signs denote instance variables.  I could have made these classes by using attr_accessor (which creates a getter and a setter), but I like this style of object.  I expect I’ll find a simpler way of doing it as I go along.

Next we need to read XML into these objects.  I created a class called Translator and in it created a method called xml_to_tweets (and a method it calls called element_to_user.)  Here’s the class:

class Translator
  def xml_to_tweets(xml)
    tweets = []
    xml_document = Document.new(xml)
    root = xml_document.root
    root.elements.each("status") do |element|
      tweets << Tweet.new(element.elements["created_at"].text,
      element.elements["id"].text,
      element.elements["text"].text,
      element.elements["source"].text,
      element.elements["truncated"].text,
      element_to_user(element.elements["user"]))
    end
    tweets
  end


  def element_to_user(element)
    User.new(element.elements["id"].text,
    element.elements["name"].text,
    element.elements["screen_name"].text,
    element.elements["location"].text,
    element.elements["description"].text,
    element.elements["profile_image_url"].text,
    element.elements["url"].text,
    element.elements["protected"].text,
    element.elements["followers_count"].text)
  end
end

REXML is a conformant XML processor, so if you’ve done any XML programming before, it’ll be familiar.  Three things to note here.  Firstly, this code is using the REXML library (more info here) so I had to add 2 lines to the top of the file.  Those lines are:

require 'rexml/document'
include REXML

Secondly, for my fellow Ruby noobs, note that the value of the last expression in a method is returned (no return statement needed, although you can put it in if it you like.)

Thirdly, for the noobs again, note the array syntax.  A new array is created with the [] syntax and new elements are added with the << operator.

So, all that’s required now is some code to see if it works.  I used this code:

require 'Twitter' 


translator = Translator.new

translator.xml_to_tweets(get_url('http://twitter.com/statuses/public_timeline.xml')).each do |tweet|
  puts "#{tweet.user.screen_name} says #{tweet.text}"
end

The output of that is a lot friendlier than the XML I was outputting last week, and it was fairly easy to write.  Next week I’ll need to extend the code to call some of the other methods of the Twitter API. 

Written by remark

May 20, 2008 at 8:25 pm

Ruby Tuesday #4 : Time to Productivity

with one comment

So far I’ve concentrated on setting up an environment.  Meantime, I’ve been reading about Ruby and trying to learn the syntax.  It’s at this point that you wonder if you can ever be productive in the new language.  The syntax is relatively easy – it’s the rest that is more daunting.  The rest is the stuff you take for granted in your preferred language, stuff like how to organise and layout files, how to deploy, what’s in the standard libraries, etc.  It’s like learning a new language: despite a grasp of the grammatical rules, all you can say is “Where might I find the nearest tractor repair shop?” – and you don’t quite understand the response.  This wouldn’t be an issue if you weren’t already proficient in a language because you wouldn’t know how much more you could achieve.

So, the question is how long does it take to become productive and how best to go about learning the real stuff.  From past experience of learning new programming languages, the answer seems to be build something – in addition to continuing to read as much as possible.   What should that something be?

Written by remark

May 6, 2008 at 5:55 pm

Posted in Design, Development, Ruby, Tools

Ruby Tuesday #3 : Surveying the Rubyverse

with one comment

Last week, I installed Ruby on a PC and on a Mac.  I installed what is often called MatzRuby or MRI (Matz’s Ruby Interpreter) – but there are other implementations of Ruby.  I was already aware of IronRuby and JRuby.  Via this post on RubyInside, I found this post by Charles Nutter that covers the implementations that are available.  I’m mostly interested in MatzRuby and IronRuby, but it’s good to know what else is available, what stage they are at and so forth.

Having installed Ruby, the next thing that many of us would look for is an IDE.  You don’t need an IDE for Ruby, a text editor (preferably with syntax highlighting) will suffice.  Being new to Ruby, I don’t know whether I’ll plump for a Ruby IDE in the longer term.  There’s an interesting question here about programming habits – which come from your experience and preference and which come from the language you are trying to learn.  There are a number of IDEs for those interested – Sapphire in Steel puts Ruby into Visual Studio, and there’s a ruby specific version of NetBeans.  There is, no doubt, some way of editing Ruby in Eclipse, but I haven’t looked yet (I’ve used Eclipse before and it feels a little unwieldy to me, so the idea of Eclipse for Ruby seems somehow wrong to me.) For now, I’m going to be using a combination of text editors and IDEs to see what fits.

Written by remark

April 29, 2008 at 3:03 pm

Django on IronPython

leave a comment »

At PyCon 2008 in Chicago earlier this month, the latest release of Django (0.96) was shown running on IronPython.  There’s an interesting post about it here, and there’s some background info here from Dino Viehland.

It’s great to see IronPython supporting Django.   It demonstrates the power and ambition of IronPython, but, more to the point, the combination of Django and the .NET platform is exciting.

Written by remark

March 30, 2008 at 10:21 pm

Twittering

with one comment

When I first heard of Twitter, I thought it was ridiculous.  Why on earth would you want to post messages that are shorter than text messages onto the web?  But then in conversation with a colleague a month or so ago, I saw how it could be used to create and maintain a sense of community – and as a result I’ve started my Twitter experiment. As part of this experiment, I followed Mix through Twitter.   I don’t know how it’ll work out, but it’ll be an interesting ride.

If you’re after more thoughts about Twitter, this post is a great place to start.

Written by remark

March 11, 2008 at 9:04 pm

Posted in General, Software, Tools

Making del.icio.us even tastier

leave a comment »

I’ve used deli.icio.us for quite a while now.  Saving links that are stored in the cloud that I can access from any browser works well for me.  But it could be better – here’s how.  I am part of a network on del.icio.us: a group who share links.  What if I want to be part of two separate networks?  In real life I can and do participate in discrete networks – for instance, work and groups of friends.  And the interests of those groups may overlap, but they’re not the same – and, of course, there’s the small matter of confidentiality.  So del.icio.us would be improved by adding the ability to belong to discrete networks.

Turns out a number of social networks take the same, rather naive approach to networks.  Rather than mimic real life networks, they assume that each of us belongs to one big network.  And that, for now, limits their usefulness and effectiveness.

Written by remark

February 1, 2008 at 10:55 pm

Posted in General, Tools

What BizTalk does

leave a comment »

Here‘s a useful resource if you want to find out the capabilities of BizTalk Server 2006.  It’s an interactive poster that uses Silverlight to allow you to zoom in and out and pan around.  And you can click on a capability to get more information.

Written by remark

January 24, 2008 at 10:56 pm

Posted in .NET, General, Software, Tools

Tagged with ,

Newsgator Consumer Products Now Free

leave a comment »

Newsgator have announced that their desktop readers are now available free. I’ve been using NetNewsWire Lite for several months now – today I’ve installed NetNewsWire. The compelling feature offered by NewsGator readers is that they synchronise their local data with an online store and you still get all the benefits of a desktop app (and I haven’t found an online reader I like) – so I can install readers on different machines (for example, I will be installing FeedDemon on my Windows desktops) in the knowledge that I won’t be having to remember what I’ve already read. And for those moments when you’re using a machine without a reader installed, there’s NewsGator Online.  For more information, here’s the announcement on the Newsgator blog.

Written by remark

January 9, 2008 at 10:52 pm

Posted in General, Software, Tools

Dynamic Data

leave a comment »

During the latter half of 2006, I spent a little time getting to know Django.  I was impressed – especially by the automatic admin functionality.  The challenges of using Django for real, however, were so substantial – the abandonment of a known, tried and trusted environment being first on that list – that the interest never developed further.

So, when I saw the Dynamic Data feature of the ASP .NET 3.5 Extensions Preview, I felt compelled to give it a go.  After a false start trying to use the latest CTP of SQL Server 2008 – this is only preview software, so I’d expect that SQL Server 2008 will be supported in a future version – I switched to the already installed SQL Server 2005 Express and followed the example in Scott Gu’s blog.  It boils down to three steps:

  1. Create a project
  2. Add LINQ to SQL Classes and drag the tables you want onto the designer.
  3. Modify the web.config file to enable Dynamic Templates.

Then you run it.  And it just works.  Really.  The whole thing took me less than 5 minutes.  And you can customise the look and feel easily.  This will be a great way of rapidly creating data entry screens that can be used for admin functionality or for facilitating data entry while the main application is being built.  Prototyping and creating real functionality that can be used and can evolve over time are other uses of this framework.  And being built on ASP .NET 3.5 and LINQ, it’s built on technology that you (will) know.  My only worry is that it doesn’t have a cool enough name.  (For what it’s worth, I’d suggest Aspen – ASP Extensions.) 

Written by remark

January 3, 2008 at 11:25 pm

Posted in .NET, c#, Development, Software, Tools

Follow

Get every new post delivered to your Inbox.