Puzzle hacking

24 Jan 2008 | By Alex Young | Comments | Tags art artists

Artist Kent Rogowski creates montages using puzzle pieces from different jigsaw puzzles. The resulting images are both spectacular and surreal, and definitely inspiring if you’re a programmer knee deep in plugins, libraries and web mashups.

Protip: Start using Test Driven Development today

18 Jan 2008 | By Alex Young | Comments | Tags testing programming

Test Driven Development (TDD) is one of the techniques I use for creating Helicoid’s products. I’m still the only developer here, so I have to work incredibly efficiently and effectively. In fact, this technique is the greatest secret behind successfully “one man banding” without losing all of your evenings and weekends.

TDD will:

  • Help you write better code: by working with the public interfaces from the start you’re encouraged to make cleaner interfaces
  • Help design code
  • Improve your confidence, ease deployment headaches: your tests will show recent changes are safe
  • Communicate your intentions to colleagues (or yourself in the future!)

Don’t worry about UML, XP or any other unfamiliar jargon

There are plenty of books about TDD, and on the implications of it. Don’t read books about TDD, just start doing it right now.

  1. If you don’t already write tests, look how people usually write unit tests in your project’s language
  2. Take one of your project’s classes, and think about how you’d test the public methods
  3. Try and write discrete tests, communicating how the class should behave
  4. If your boss says writing tests wastes time and he needs this feature right now, consider ignoring him

Test from the ground-up

When adding new classes to a project, start by creating tests.

  1. Imagine you’re designing an API rather than a class that’s tied to your project
  2. Write a set of unit tests that define how the class should behave
  3. Start adding methods to your class to satisfy the tests
  4. As edge cases become apparent, add more tests
  5. If no edge cases are obvious, try writing more tests to discover them

Fixtures: an opportunity for design rather than a chore

When I write tests for a Ruby on Rails project, I have to create sets of test data. I used to regard this as a chore that slowed me down. However, carefully defining test data can force you to consider the validity of your assumptions about underlying data structures.

Don’t worry about volumes of data, because if volumes are required for particular types of tests you could easily generate sets of data in loops. If you’d like to create loops in your Rails fixtures, remember that you can use erb to safely embed ruby code.

It’s important to realise that repeated data created using random numbers is sometimes less useful than carefully hand crafted test data, since this should be closer to real user-input. I’ve found scrappy test data that just exists for the sake of testing is nowhere near as useful as real data.

Mock objects

When testing classes that rely on network resources or files, it’s tempting to just use real resources that you know should be available. This can make tests seem less encapsulated, so consider employing “mock objects” to avoid this.

  1. Find a mocking and stubbing library suitable for your project (Mocha is good for ruby projects)
  2. By mocking certain aspects of a system you can focus on testing a particular part of it without requiring a remote resource
  3. Mock objects are excellent for testing edge cases: for example, what happens when a network connection fails or a file could not be opened?

Coverage reports

There are great tools out there for producing test code coverage reports. These reports will show you code that hasn’t been tested, sometimes in a graphical way. If you’re a fellow ruby developer, have a look at rcov. Rcov will produce HTML coverage reports, so it’s very easy for you (or your boss!) to see what’s currently tested.

Coverage reports are a good way to make you feel confident about your code’s quality. They also give a temporary sense of closure on a new feature.

TDD getting started checklist

If you do any of these things today, you’re already doing TDD:

  1. Learn how to write basic tests in your chosen language – don’t worry about fully learning the test framework, start by copying examples
  2. When adding a new feature, start by creating tests first. Write code to satisfy these tests
  3. Refactor old code to work well with automated tests
  4. Write test data carefully and patiently, using this as a design technique for exploring the quality of your data modelling
  5. Find a mocking library so you can write encapsulated tests that don’t require external resources
  6. Find a tool for producing coverage reports in your chosen language
  7. Investigate automated testing triggered when deploying/releasing code

Helicoid Insider

18 Jan 2008 | By Alex Young | Comments | Tags announcements

Since this blog covers our product announcements, we’ve decided to launch a new blog entitled Helicoid Insider, covering:

  • Technical tips on building web applications
  • Interface design, and design culture
  • Web industry observations, opinions, discussion

Recent posts include:

Helicoid Insider

Get your Tiktrac dashboard widgets here!

10 Jan 2008 | By Alex Young | Comments | Tags tiktrac tips

Tiktrac, our time tracking app, has just been furnished with a Mac OS Dashboard widget.

To download the widget and get instructions on how to use it, visit the widget’s page.

We’d love to hear from you (and give you awesome free stuff) if you’ve used Tiktrac’s API to make any widgets, gadgets or interesting things. Also get in touch if you’d like help building something like this.

20 free icons dedicated to programmers

10 Jan 2008 | By Alex Young | Comments | Tags icons graphics images free

The Helicoid Icon Set is a collection of icons we use in our applications, including:

  • Navigational cues
  • Credit card images
  • Scalable buttons
  • Images to enhance web applications

Why are we giving these icons away for free?

As the lead programmer and designer of Helicoid’s applications, I’ve worked ridiculously hard over the last year at two jobs: programming and design. Programming software is my passion, but I’ve had to teach myself design skills in order to get our applications released on a shoestring budget.

I realised there might be a lot of programmers out there in a similar situation (especially open source developers), so these icons are dedicated to you. If you open them up in Adobe’s Illustrator (or try the SVG file with an open source image editor) you’ll find it’s easy to change colours around and scale the icons.

License

These icons are released under the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.


Creative Commons License

Download

10 essential ruby gems

08 Jan 2008 | By Alex Young | Comments | Tags ruby programming code tips

There’s a few things I can’t live without when I’m programming. To that end, this is a list of 10 essential ruby gems that will make your life much easier, even if you only spend a small amount of time working with ruby.

Gems come and go, but these are keepers!

capistrano

Capistrano makes Rails application deployment less of a hassle. It’s also a clever framework for interacting with remote servers. I actually have backup scripts written with Capistrano, as an alternative to Rake/Net::SSH or shell scripts.

chronic

Chronic is a natural language time parser, with the added bonus of having a pun for its name.


>> Chronic.parse('3rd wednesday in november')
=> Wed Nov 19 12:00:00 0000 2008

ferret

Ferret will make your boss/clients/customers love you. It provides tools for fast text searching, and you can even index PDFs and Office documents. I’ve used Ferret on some pretty big sites, and my clients all said “wow this is just like Google!”

hpricot

hpricot is a fast and easy HTML parser. If you find yourself needing to extract content out of HTML or even XML, hpricot is one of the easiest ways to do it. I actually use it for a few things in Helipad

rcov

rcov is one of the reasons you don’t see our applications crashing too often. It analyses your source code, and highlights sections missing from your tests. It’s fast, doesn’t get in the way, and helps reduce headaches.

scruffy

I’ve used Gruff for graphing, and while it’s very good, I prefer the design of scruffy’s API. The way it works is pretty ingenious: simple XML is generated to drive SVG graphs. Since SVG provides a way to work intuitively with image primitives, a lot of messy image magick code is just thrown away.

I’ve quite liberally inherited and overridden stuff in scruffy to create all kinds of clever graphs, so give it a try if you’re feeling a bit stuck with your current graphing library.

simple-rss

simple-rss parses RSS and atom feeds, does a good job of it and does it quickly. Its parser is easy to extend too, so you should be able to tame invalid or proprietary feeds.

thin

Thin uses EventMachine, Rack, and Mongrel to create a very fast web server. I use it for my local Rails development, and it’s slightly faster than mongrel. To use it with my Rails app I just type thin start in my app’s directory. At the moment I’m having problems with thin and IE cookies, so it’s worth remembering that if you run into the same problem and think your app might be at fault. (Note: This now seems to be fixed with 0.6.1 and Rails 2.)

To get thin, gem install thin.

turn

Turn makes your Test::Unit output easier to read. Turn might not seem like much, but it really helps me read my tests. I rely heavily on tests for maintaining Helicoid’s applications, so anything that helps make the process more intuitive is welcome.

To get turn, gem install turn.

wirble

wirble makes irb easier to use. You get better history support (between sessions) and colour, so your eyes and fingers do less work in the long run.

Welcome to Helicoid Insider

07 Jan 2008 | By Alex Young | Comments | Tags blog news general

Helicoid Insider is Helicoid Limited’s blog about design, code and the web industry. This blog will include materials and lessons learned while creating our applications. Comments, guest posts and feedback are more than welcome!

This blog is in addition to our company’s product blog, which provides updates and tips on our web applications.

Who are Helicoid?

Helicoid Limited was officially founded by Alex Young and Gabriel Gironda in 2005, with the help of Alex’s fiancé (Yuka Mizuno) and Kevin Ford. All Helicoid’s applications are currently designed and programmed by Alex, with thoughtful input and copy writing from Yuka, technical guidance and inspiration from Gabriel, and system administration and security help from Kevin Ford.

Coming soon: Tiktrac dashboard widget

07 Jan 2008 | By Alex Young | Comments | Tags tiktrac announcements

Tiktrac widget: Saturday afternoon edition

Tiktrac: 1000 days worth of time tracked

04 Jan 2008 | By Alex Young | Comments | Tags tiktrac thoughts fun

We recently updated the homepage for Tiktrac, our time sheets web application. While going over the copy we had an interesting idea: why not include a dynamic counter for the total time tracked?

So now you can see the total amount of time recorded by the Tiktrac community. It currently displays 22210 hours, which is almost 1000 days.

That’s a lot of work… maybe soon we’ll have to switch the counter to days instead of hours!

Tiktrac: Import data from Excel, Open Office, Numbers

03 Jan 2008 | By Alex Young | Comments | Tags tips tiktrac

Tiktrac data imports

Tiktrac now supports data imports from CSV files. This allows you to import time sheet data from spreadsheets straight into Tiktrac.

Each sheet now has an Import tab, which takes you through the steps to import your data.