I have this idea, of exploiting the kata concept for learning and teaching more than just the traditional areas of TDD and refactoring. I already put some of this in action in my university courses, where I encourage students to perform katas as a means to learn some technology; for instance Ruby on Rails.
Here is a collection of ideas for katas that stress the mastery of some technique or technology, rather than pure algorithmic or TDD/refactoring skill. All of these katas are to be performed in your favourite programming language, with your tools of choice.
[Web] Write a blog application in 30 minutes. For extra points:
- users should be able to comment
- the data should be validated (i.e., no empty entries)
[Web, DB] Write a web app that shows a table of data, with pagination. The data can be in a static, big table that simulates a database. For extra points:
- Clicking on a column header reorders the table according to the column you clicked on.
- Get data from a real database
[Web, DB] Write a standard CRUD. With validation. Writing to a real database.
[DDD, ATs, Fitnesse] Write the domain model for a Monopoly game (idea from Craig Larman’s book)
- Write acceptance tests using a tool like Fitnesse or Cucumber
[Web, Gui, SVG, TDD] Plot a function. Begin with a fixed function, such as sin(x). Then make it so that the user can specify an arbitrary function. The rendering technology can be anything you like: for instance, ascii graphics, SVG, Gnuplot, jQuery + canvas tag, … Be sure to apply TDD. Try to develop a working solution without ever looking at it until the end! (Not that I recommend working like this in real work. This is an exercise; in real work I would frequently check that my application really works, expecially when the app is visual and/or I don’t master the technology.)
[Web, sockets, TCP] Write a tiny web server. It should serve files from its working directory (but should not allow the users to browse outside of its working directory!)
[Web, sockets, TCP] Write a chat server.
[Distributed programming] Write a messaging service with guaranteed delivery. Suppose you need to send a message to a remote service. You have a faulty communication channel, that can lose messages without warning. The remote service may also fail during the processing of the message, or before or after the processing of the message. Your system should guarantee that eventually the message will be delivered successfully. You should also guarantee that the message is not processed more than once on the receiving end. You must design the protocol that the two endpoint use. You decide the format of the messages.
[Distributed programming] Write a system that performs a distributed transaction. Simulate a database service and a payment service. Your system should accept a “Transaction” order, that simulates the fact that a User buys something. The system should let the user pay, and then record in the database that he successfully paid. Both the database service and the payment service fail 1/4th of the time. Your system should guarantee that it can never happen that the user has paid, but we don’t record this fact, or that the user is recorded to have paid when in fact they didn’t.
[Algorithmics] Anagram server: write a service that finds anagrams of a given word or phrase.
[Parsing] Basic interpreter: write an interpreter for a simple Basic language, such as the one in the Commodore 64 of yore.
[Parsing, DDD] Text adventure: write a game that plays a simple text adventure.
[Parsing, algorithmics] Format subsets of HTML. For instance, your input is an arbitrary HTML table; your output should be an ascii rendering of the table.