Thursday, June 30, 2011

Kanban with David Anderson


This week I enjoyed attending a two day Kanban training class by David Anderson, the Father of Kanban-style software development.  The class provided an overview of Kanban and offered many tips on how to get the most out of Kanban.  David rolled through a deck of some 150 slides and answered various questions.  On the practical side, the class was divided into four teams and each team had to design a Kanban board for an actual company and then play an entertaining Kanban game, which turned out to be quite competitive.  The team I was on, Grand Kanban :) managed to squeeze out a slim victory with around $62,000 in revenue, which according to David was a pretty good score ;-)

Few points from the class:

The Kanban Method is based on three core principles:
  •    Start with what you do now
  •    Agree to pursue incremental evolutionary change
  •    Initially, respect current processes, roles, responsibilities & job titles

The five keys to a successful Kanban implementation are:
  •    Visualize Workflow
  •    Limit Work-in-Progress
  •    Manage Flow
  •    Make Process Policies Explicit
  •    Improve Collaboratively (using models & scientific method)

Key class takeaways according to Dave were:

  • Kanban is like water 
    • It goes around obstacles and slowly changes them, rather than removing them like a bulldozer
  • Change has to come from within
    • How many experts does it take to change an organization?  Answer: One.  But people are going to have to want to change

Surprising fact from the class:


According to a research done by David, getting more done only ranks number 4 on most manager's lists!  The list of their preference being:
  1. Predictability
  2. Business Agility (ability to respond to changes in market)
  3. Good Governments (managing budgets, money spent the way intended, etc.)
  4. Getting more done

Playing the Kanban game

All in all a good class and I look forward to continuing the improvement of Kanban at Hugsmiðjan where we develop the Eplica CMS.

Wednesday, February 16, 2011

Jfokus Conference

This week I had the pleasure of attending the JFokus conference in Stockholm, Sweden.  This was a gathering of some 1250 Java geeks and some excellent speakers.  I thoroughly enjoyed sessions by Arun Gupta, Guillaume Laforge, Mario Fusco, Henrik Kniberg, Neal Ford, and many others.  Here are some of the technologies that caught my attention and I will be considering putting to use at my current work on the Eplica CMS system.

  • Lambdaj - This library is just brilliant and really simplifies working with Collections.  Write more readable code in fewer lines.  Stop writing loops!  Mario Fusco's slides.
  • CKJM - Use this library to intelligently pick areas of your code base to refactor.  To get bang for your buck you want to pick classes with high Cyclomatic Complexity and high Afferent Coupling.  That is, complex code in frequent use.  Comes as part of a Sonar plugin.  And BTW, if you are not already using Sonar, use it!
  • Groovy - I have been intrigued by this language for some time now but never actually put it to use in my work.  I think it is time to change that.  Groovy to me is a natural progression of the Java language.  Making the boring/tedious parts of Java optional and adding syntax improvements and useful features like closures.  The kind of changes you might envision seeing in Java 10 or somewhere way down the road.  Why wait so long?
    As a starting point I am thinking about using these Groovy frameworks for our web based testing:
    • Geb - Browser automation framework based on Selenium.
    • HTTP Builder - A convenient API for complex HTTP requests.
  • WADL & Jersey - When consuming/publishing RESTful web services from/to our customers I prefer to have a contract to work by.  WADL is just that and Jersey an API (JAX-RS 1.1 implementation) for creating/consuming REST services.
  • JDK 7 - Obviously eagerly awaiting that one.  Planned GA date July 28, 2011, according to Tomas Nilsson at Oracle.
Other technologies I found interesting but don't envision using in the near future (just not a good fit for Eplica CMS): Scala, Clojure, deploying to the cloud,  NoSQL, Vaadin and DDD.

All in all a great conference which I highly recommend to Java developers.

Saturday, January 1, 2011

Easily Size and Arrange Windows on Mac OS X

One idiosyncrasy of Mac OS X is that application windows can only be sized from their lower right corner, and Mac OS does not have any kind of "snap windows into place" feature similar to Windows 7.  At work I have the pleasure of working on a large 27" iMac screen, so I frequently arrange two apps side by side while working, or might even have more than 2 apps visible on the screen at any given time.   Arranging that kind of setup is tedious when done manually with the mouse, but with a nifty little tool called Divvy the task becomes quite easy.   As can be seen in the Divvy in Action video on their site, when activated, Divvy overlays a grid on your screen and can be used to visually size an application to a specific portion of the screen.  That is great, but what I found faster and easier was to assign global OS X shortcuts to window arranging operations I frequently use and let Divvy do its magic without bringing up the grid panel at all.  Creating shortcuts is covered towards the end of the video, but to make them global you need to check the "Global Shortcut" check box.  Here is a screen shot of some of the configurations I set up:


For example if I need to have an application fill the left 50% of my screen I just hit ctrl-shift-1 (with the app in focus) and it will jump right into place.  While developing, I often arrange things so that my IDE uses the entire right-side of the screen, the website I am testing covers the upper left-side of the screen and the application sever console (logging output) covers the lower left-side.  To put the windows in place I simply put them in focus one at a time and hit ctrl-shift-2, ctrl-shift-3 and ctrl-shift-4, in that order, and the apps snap into place, filling the screen like this:


No space is wasted on the screen and no annoying mouse-dragging operations are needed. Of course you can assign whatever keyboard shortcuts make sense to you.
Divvy is not freeware, but low cost, and can be used in demo mode (periodically pops up a registration message) if you don't want to cough up the $14.  It supports multiple monitors and is available for Windows too.

Sunday, December 19, 2010

Evernote - A "shoe box" organizer that works

I have been an iPhone owner since the iPhone 3G was released in the USA on July 11, 2008. Why do I remember the exact day? Because I was one of the nerds that stood in line outside Tuttle Mall, in Columbus, Ohio, way before the AT&T store opened! Anywho, I often get asked what my favorite iPhone app is. Having tried out a fair share of apps from the App Store, I have to say my all time favorite is Evernote.

If you are the type of person that tends to forget things, loose things, and hates to spend a long time organizing information, then this is app is for you! And you don't really need to have an iPhone to use it. It is available for all major smart phones. Plus you can use it directly through www.evernote.com, or via multiple Web Browser addons or use one of the many thick client versions they have for all major operating systems.

If I need to remember anything for later (a store receipt, notes from a lecture, a good deal I see in the paper, a shopping list, recipe from a friend, a note from my kids' school, the name of a good wine bottle,.. you name it) I simply snap a picture of what I want to remember and send it to my Evernote account via the Evernote iPhone App.  If I feel up for it I might tag the note (e.g. Recipe) and add a descriptive title (e.g. "Chili Recipe from Bob").  But often I am to lazy to do that, and it typically doesn't matter.  I just file it and forget it.  What Evernote does when it files my note is to automatically perform OCR on the picture and store any text it extracts as metadata along with the note.  So if Bob showed me a handwritten recipe that he had titled "Bob's kick ass Chili" then that piece of text (granted it is written in legible writing) would automatically be stored in the metadata index for the note.  So if years later I searched my Evernote account for "Chili", or "Bob" AND "Chili" I would find the recipe.

To me, Evernote is the shoe box method for organizing, that actually works!  Meaning, you can get away with throwing all your junk into one large shoe box and thanks to Evernote's powerful search capabilities have it at your fingertip anytime you need it.  Feeling left out at a chili cooking party? Just whip out your cell phone and say "One second, I have a better recipe!" and voila you are the star of the party! ;-)

For more info on Evernote, check out one of their many introductory videos on www.evernote.com.  Then sign up and get an account!  The basic account is free and should be sufficient for most users.

Wednesday, November 17, 2010

Notes on Test Driven Development and Testing

This week I attended the Agilis 2010 conference, including a 2 day course on Test Driven Development by Nat Pryce. Below are a few notes from his class. Not necessarily the key teachings, but rather nuggets of information that I found interesting.
  • One of the main arguments for using TDD is that it encourages you to improve the design of your code.  Writing the test for a software component that you have designed, but have yet to implement gets you to think about and question the purpose and nature of your design.  E.g., if when writing a unit test for a given class you discover that the test code gets way to complex or convoluted, then that is probably an indication that the class being tested has too broad responsibility and should be refactored into smaller, simpler units.  I had always thought of TDD as more of a means to ensure you build a comprehensive test suite and as a result have fewer bugs in your software, but had not given much thought to the fact that it is in essence a way to get you to improve your software design; hence making your code easier to understand, use, and maintain. 
  • We did some exercises using the JMock framework, that Nat Pryce co-wrote.  JMock is a neat tool to help you mock out interfaces that your code interacts with and to validate that your code is using the interfaces as expected.  JMock allows you to command the mock object of the interface to behave a certain way (e.g. return specific results) and set up expectations for how you are planning to call the interface (e.g. methodA will be called once and only once with arguments "ABC" and 99).  These expectations are integrated with JUnit and if not fulfilled by the end of your test run then JUnit will fail the test.  
    • The following JMock Cheet Sheet page provides an overview of he JMock syntax.
    • During the Q&A session with Nat he admitted that JMock was probably best suited for green-field projects (new systems) while frameworks like Mockito where better suited for brown-field projects (preexisting systems that you are trying to create tests for).
  • We spent some time discussing Monitoring Events, which is the concept of having your system broadcast notifications (events) about your code execution.  E.g. when an order is placed or when a user logs into your system a notification of the event is sent to a JMS Topic that interested parties can subscribe to.
    • This is great for logging.  A logger component can subscribe to the topic and log all events in the system.  It can then allow you to filter out certain events or do things like group events by requestid and provide a holistic overview of a single user transaction (as opposed to having to grep through numerous log files on multiple servers to try piece together what happened when a given user transaction ran through the system, which may have spawned multiple threads in multiple JVMs).
    • Monitoring Events are great for testing too.  Imagine trying to assert that a call to a checkout service (to complete the purchase of a product) will result in a proper inventory reduction in asynchronous inventory system.  If your test runs straight through and checks the inventory status as soon as it has completed the purchase, then the test will likely fail, since the inventory system hasn't had time to process its update inventory request.  One might try to fix such a test by adding a sleep statement of say 10 seconds after the checkout call but before the inventory is checked (which still might fail if the system is running slow).  Or (which is a little better) one might implement a loop that every 1 second pulls the inventory system to see if the update has been received (succeed fast).  In both cases we are polluting our tests with sleep statements and lengthening the time to feedback, when we run a suite of tests.  A better way would be to have the test subscribe to the Monitoring Event (topic) and complete (succeed) as soon as it has received an inventory update notification.
    • You can also use Monitoring Events to build a support tool for your system.  E.g. the tool could send an email or SMS text message to a support person when a certain event is received (OutOfMemoryError,  External service not responding, etc) or a when certain number of events have been received over a given time frame.
  • Miscellaneous tips on testing and coding
    • If you are ever testing code that depends on the system clock (e.g. at noon every day the system is supposed to execute some function) then a neat trick to make that code more testable is to refactor out the dependency on the system clock.  E.g. instead of your class making a direct call to say System.currentTimeInMillis(), have your constructor take in a generic Clock object (or define a class variable and use dependency injection to inject a Clock implementation).  Then you can have a SystemClock implementation that simply uses the current system clock, where as during your test run, the class under test is initialized with a FakeClock implementation that hardcodes the time to 12 PM)
    • In your system tests, which load up and work with data in a database, have your JUnit setUp method clear out the database, rather than the tearDown method.  This way you have  actual data to look at if a test fails (rather than a clean swiped database).
    • Use Simplicators to simplify communication with 3rd party APIs.  That is, a facade that maps the 3rd party interface and artifacts over to your domain model or something that makes sense in your system.  This way you can more easily test your own code (by using mock Simplicators that don't have a dependency on a 3rd party system) and likewise your code is more easily maintained (e.g. a type change or renaming of a field in some 3rd party XML response may require you to update your Simplicator implementation, but might have no impact on your business code if the response has already been mapped over to your domain model.
    • Have separate tests that test your production setup.  Basically tests that you can run in production to verify a deployment.  Don't deploy your unit/system tests into production. Avoid the painful lesson that GitHub recently experienced where a test run in production cleared out their entire production database!
    • When programming, don't have your methods return null!  Null checks pollute you code and make it harder to debug. Return empty objects instead. 

Sunday, March 21, 2010

Agile netið Founded


This week I took part in founding the Agile Network (Agile netið), a consortium of agile minded Icelandic companies, one of which is Hugsmiðjan, my current employer. The purpose of the non-profit organization is to advocate Agile and Lean development practices and sponsor agile lectures and conferences in Iceland. The founding partners are 10 companies that have been doing agile for awhile and are interested in sharing their experiences and learning from each other. At the founding meeting we elected a 3 person board for the organization, of which I got elected secretary :-) Hopefully it wont be too much work :) I am very excited to be part of this process and hope to learn a lot from my fellow members. The website for the organization is www.agilenetid.is. No English version yet, but we are working on it. Then there is a Facebook group for those interested in keeping up with what were are doing. Fans wanted :)

Saturday, October 10, 2009

Join MP3 files with a UNIX shell command

I have been listening to a lot of audio books lately, which I have typically imported from CDs onto my iPhone via iTunes. Most of the Icelandic audio CDs I have listened to are in MP3 format and described in the SMIL markup language, which iTunes has no concept of. The files are named 01.mp3, 02.mp3, ... and so on and are void of any ID3 information, with all the metadata in those .smil files. Anywho, to my frustration once imported into iTunes, neither iTunes nor my iPhone have the good sense of playing the files in the correct order. Why they play them in some arbitrary order other than by file name, I have no idea, and iTunes does not seem to have any way of changing the play order. So I figured I needed some way to join the files into a single MP3 file so iTunes/iPhone couldn't mess up the order. After googling around for products to join MP3 files and mainly finding shareware software that I wasn't willing to pay for, I stumbled up on the fact that since MP3 is a streaming format you can simply concatenate MP3 files using the good old Unix cat command! So I came up with the following one-liner to join the files together (in alphabetic order), which happily runs on my Mac:

find /Volumes/My\ Disc/*.mp3 -exec cat {} >> MyAudioBook.mp3 \;


Where "/Volumes/My\ Disc/" is the Mac CD drive, and MyAudioBook.mp3 is the final output file that can be imported into iTunes.
Anyways, I figured I'd share this one, as I have to admit I was surprised to learn that MP3 files could simply be "cat"ed together :-)

Thursday, January 22, 2009

Don't Click, SlickRun!



I recently discovered the Windows utility SlickRun, thanks to a comment from Jim Holmes in this blog entry from Jeff Blankenburg. I have to say that I absolutely love this utility and at this point can't imagine work without it! It has saved me numerous mouse-clicks and tedious search and navigation through Windows menus. If you are unfamiliar with this utility it basically allows you to start almost any application or file on your computer with just a few strokes on your keyboard. For example if I type "[W]-q memlogin" it opens up my IDE (unfortunately BEA Workshop) with the Membership-Login project that I am currently working on. Or if I type "[W]-q wls" it starts my WebLogic Server instance. Or if I type "[W]-q wikip la lakers" it will fire up my default web browser and take me to the Wikipedia entry for The Los Angeles Lakers (where "la lakers" is a dynamic search term). The words "memlogin", "wls" and "wikip" are keywords (SlickRun calls them MagicWords) that I have configured to fire up stuff that I care about. I can type those directly into the SlickRun prompt (see image at the top of this blog entry) which can be placed anywhere on your screen. I have mine auto-hide and then use the "[W]-q" key sequence to bring the SlickRun program into focus ([W] being the Windows Key on my keyboard).
I spent some time creating keywords for pretty much anything I use at work. Here are some of things I have set up:

  • Keyword for every Java project I have worked on at my current client.

  • Keyword for each Wiki page I maintain at my current client

  • Keyword for each website I frequent. Using the "$W$" marker to plug search parameters into URLs that have query strings.

  • Keyword for each application I regularly use (MS Office apps, FireFox, XMLSpy, Cygwin, WinMerge, NoteTab, Toad, Putty, SoapUI, JMeter, Eclipse, etc.)

  • Keywords for folders I frequently need to access on my computer (My Documents, c:\user_projects, etc). The keywords will open up the appropriate folder in Windows Explorer.

  • Keywords for my most frequently used Windows operations. For example to go to standby, to shutdown, to put on the screen saver, or to open up the display configuration (which my docking station keeps getting messed up).


If you are tired of mouse-clicks and menu navigation I suggest you give this tool a try. It just might make your workday a little more productive. It can't hurt to give it a try, it is free! Be forewarned though that the product could be a little more polished, especially their setup screen which did some funny things for me, but once you get it all set up it does work very well.