Coding Kata Exercises
August 8, 2011 John Blanco Methodology, TDD
Coding Kata are simple problems you can solve using TDD techniques to help you practice unit testing and development with various platforms and languages as well as to “sharpen” you up for the day. Get the brain working. The fingers moving. You know. :-)
I’m compiling a list of Kata to practice with here. Give one a try:
- Convert Arabic Numbers to Roman Numerals
1 to 100.
- Fizz Buzz
If a number is divisible by 3 return “Fizz”. If it’s divisible by 5 return “Buzz”. If it’s divisible by both, return “FizzBuzz”.
- Calculator
Given a string such as “5+4*3”, calculate it. Order of operations should be observed.
- ROT13 Encoder
Encode a string with ROT13. (A is N, B is O, etc.)
- Logic Gates
Build a set of logic gates that can be combined to create large expression. (AND, OR, XOR, NOT)
- Fibonacci
Return a fibonacci sequence of any specified length. (1, 1, 2, 3, 5…)
- Prime Numbers
Create an isPrime() method.
- Time is Relative
Write a Facebook-style method that returns time qualitatively. If the difference between two timestamps is less than 5 seconds, return “Just moments ago.” If less than a minute, return “X seconds ago.” If less than an hour, return “X minutes ago.”
- A Better Array (iOS-specific)
Jazz up NSArray and NSMutableArray. Add methods such as firstObject, secondToLastObject, map (creates a new array from iterating each item of an existing), and reverse.
John Blanco is a freelance iOS developer living in Lakewood, Colorado. He's been developing mobile apps for over 15 years, beginning in the medieval days of Java ME and Blackberry and all the way through iPhone and Android!
He's led development on dozens of apps across a wide variety of domains such as retail, vision, orthotics, games, sports, and more!
More Posts - Website
Follow Me:
kata, tdd, unit testing
Comments are currently closed.