Monthly Archives: June 2008

Can the Government be Agile? – discussion with a PMP PM

I’ve enjoyed my relationship with my brother-in-law for a long time. We’ve often talked about business and career, sharing where we are at, and the directions we are taking.

Over the past few years Paul has been doing a great job as a project manager in Canberra, in particular his involvement with the Department of Defence in the successful and ambitious e-voting project (Remote Electronic Voting Federal Election 2007). It has been great hearing about his work, and some of the stories around it. He has also been sharing his growing understanding of project management, and some of the courses and information he has been collecting, and applying. I have been listening with interest, and a degree of skepticism, thinking that much of what he has been learning would not apply directly to me, as it seems to be focused on heavyweight/rigorous methods, and I very much prefer working in Agile environments, where good smart people are encouraged to do great work.

So it was with great interest that I was recently listening to him discussing and presenting some of his recent thinking and work around scrum. Paul has been looking at how to apply scrum to government projects, and has some great ideas about this. I was particularly interested to hear what he saw as the strengths that scrum would bring, and the advantages he saw in outcome based results (delivery of working software that meets outcomes) versus delivery based results (traditional waterfall delivery of documentation is part of the results).

I look forward to seeing Paul’s work going forward, and to seeing how he continues to apply agile techniques to his work. If you are in Canberra, and are looking for a great contract or consultant project management, it is well worth talking to Paul and the team at Barton Institute of Management.

Howto Learn an API

I recently have been learning a number of different APIs. After reflecting on my process for learning I have ended up with the following strategy for working with APIs.

  1. Find someone who has used the API in the past and get a brief introduction.
  2. Read documentation about the product (starting at the central documentation site for the product, include any tutorials and getting started guides). The goal from this first step is to get a general background understanding of what the product is about, the core concepts and jargon and principles of the product.
  3. Use the product without the APIs. If there is a gui to access to product that is available, ensure that you know this, and the jargon around the product. Try and ensure that the information you have from step 1 is grounded in reality.
  4. Read more documentation around the APIs. Make the top goal for this round to get enough of an understanding of what you can do.
  5. Explore the APIs to see what they expose of the feature. The set of features exposed by APIs often do not match up with what is exposed through the GUI. The most important spot to aim for is the subset of features that are supported by both the API and the GUI.
  6. Google (as usual it’s your friend). Sometimes there are some useful results in google that are missed elsewhere. Start with searching for the product name, try adding in API/howto/tutorial/getting started keywords to filter down content if you get too many results.
  7. Write some exploratory code to see how the APIs work, and what they do. This should enable you to know enough to actually write the code that you need.

All steps are required, as there are often features which are not easily discovered by just taking one of the above paths. One of the most important steps is ensure that you do understand the subset of what is supported by the API and the front-end. This helps to ensure that you are actually hitting the right part of the API.

From time to time there are options which are not well documented at all, and are only alluded to in technical documents. It can be worth contacting authors of documents if the feature is not clear. The coding and exploration of the system will need to continue after this. It should be expected to continue learning the APIs. At every stage there is value in talking to whatever experts/more experienced people you have available. Being able to quickly pickup a technology and move from no knowledge to confidence in using the API is a valuable tool for developers. Learning new technologies has been an important part of my job as a software engineer, and I expect that it will continue to be for many years to come.

Facebook Phishing Scams

 

It was only a matter of time, but facebook phishing scams have hit the wild in a big way.

At work we saw a number of emails from a facebookmail.com address (that’s where facebook e-mails come from), suggesting that you might want to add a friend.

facebook-phising.png

The add a friend link actually sent you off to an isgreat.org domain, which had a facebook look-alike login page.

This was the closest that I’ve ever come to clicking on a phising link. I only stopped for two reasons

  1. my work e-mail isn’t associated with facebook at all.
  2. the name didn’t tempt me at all.

If it went to my real facebook account I might have been tempted (but sure won’t now).

The security adage – Don’t click on links in e-mails is definitely true. Even for facebook sending nice helpful e-mails with links.

This isn’t the only way that phishing is happening for facebook. See here, and techcrunch

Empty Tags in Internet Explorer

In Case you were wondering…. <span class="replaceMe"></span> does not behave the same as <span class="replaceMe"/>  in ie, even though they are semantically equivalent. The second option will cause sites to crash, and not render if using ajax calls to update them (in particular with Prototype, with the use of Element.replace, or event innerHTML).

So, even though <span class="replaceMe"></span> should be equivalent to <span class="replaceMe"/>. Don't use the later if you want dom manipulation to work (which is pretty much the main reason to use an empty span tag in the first place.  The real moral to the story is Don't use empty span tags if you want to support the most popular browser on the planet.

Finding Large Files on OSX

After a recent security push at ephox (highlighted by a stolen laptop, and then me forgetting that I left my laptop in the office overnight), I've been working on freeing up some space on my laptop so I can turn on FileVault. A quick search of the internet found some great tools for doing this. My weapon of choice was Disk Inventory X. It presents your drive as a tree map, coloured by file type. I was quickly able to find the large files to kill (a couple of 1 GByte hprof files, and some large logs were the guilty parties on my machine).

Disk Inventory X is a good little utility for helping to cleanup up your machine.  If you are ever in need of a tool for OSX to find large files, it is well worth using.

TestDox IntelliJ Plugin Reviewed

I’ve recently started using the TestDox plugin with IntelliJ. It’s a nice little tool that fits in well with agile test driven development practices. It’s easy to get started with, either installing it from the IntelliJ plugins repository using your IDE, or downloading it directly from the plugins repository, and copying it into the plugins directory.

The premise on which the test dox plugin is based on is the idea that your test methods should be long sentences using CamelCase to break up words. By doing this your tests become your documentation. The plugin takes this premise, and exposes the following behaviour in IntelliJ:

  1. automatic translation of CamelCase test names to sentences. This is exposed through two different views, which, when coupled with nice navigation synchronisation options, makes it possible to use your tests to understand what the code is meant to do at a high level, and makes it easy to drill down to the specifics when needed.
  2. There is a simple mapping between classes and tests – TestDox knows that HelloWorldTest is the test for HelloWorld. This is configurable to suit your environment (test classname prefixes and suffixes can be specified, as well as test packages).
  3. documentation windows will be context sensitive, using the above mapping to show the appropriate documentation for the class/test currently being edited.
  4. alt-shift-t swapping between the test class and the base class – great for navigation
  5. alt-shift-t will prompt to create a test class if it doesn’t exist. Very cool fr the cases where you have created a class before the test (for whatever reason)

Overall this is a great little tool. There’s only a couple of minor tweaks I’d like to see made to the tool.

  1. The biggest that would be nice for the open source project, would be to make editing the source code of the IntelliJ plugin slightly easier. It would be cool to be able to make slight changes to the software, and help improve the project, but the cost of entry was slightly too high for me.
  2. It would be good for the alt-shift-t auto creation to work both ways. That is I want alt-shift-t to help me automatically create the class as well as the test.
  3. I saw a couple of minor screen repaint issues on 7.0.3 on OSX 10.5

TestDox is a good tool for IntelliJ, and you really should install it and use it.

Utility method for TDD of a SwingBorderLayout

I have been working with different ideas for Test Driven Swing code for a while now. Recently, Suneth and I came up with a new strategy for testing Swing BorderLayouts (unfortunately requiring reflection).

Here is what we did.

When using a border layout you are specifying the relative position of the components. To TDD this, you really want to say whether your component appears in the NORTH, SOUTH, EAST or west location.

Unfortunately this isn't exposed directly, hence the need for reflection.

Here is the method that we wrote to do this:

private JComponent getComponentAt(BorderLayout layout, String position)
    throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
  Method method = BorderLayout.class.
    getDeclaredMethod("getChild", new Class[]{String.class, boolean.class});
  method.setAccessible(true);
  return (JComponent) method.invoke(layout, new Object[]{position, Boolean.TRUE});
}

The layout is the layout containing the component, and the string position needs to be one from the BorderLayout constants (BorderLayout.NORTH etc).

The method will retrieve the component at the specified position using reflection, allowing you to write simple assertions around this.

Creating a Surround in Quote Live Template in IntelliJ

One of the features I like about TextMate is the smart insertion of characters, like when I’m typing text, highlight a word, and type ", TextMate will wrap the word in quotes. Unfortunately IntelliJ doesn’t have this behaviour by default, and makes surrounding some text in quotes messier than what would be preferred.

It is possible to make this task much easier, through the use of live templates. Here is how to do it.

  1. navigate to the add a live template screen via the following path: settings – live templates – add
  2. type "$SELECTION$" as the template text, ensure that the context is suitably broad, give it a meaningful name, and you are done. This can be seen in pictures.

IntelliJ setingslive templatesadd template screen

You will now be able to access the template using the cmd-option (ctrl-alt) t "surround with" shortcut, making it easy to wrap text (code) in quotes using IntelliJ.