Device Driven Kata
Device Driven Kata
Practice makes perfect. Learn from a fellow developer how coding dojos allow devs to collaborate with and learn from one another.
Join the DZone community and get the full member experience.Join For Free
You've been hearing a lot about agile software development, get started with the eBook: Agile Product Development from 321 Gang.
Barcelona Software Craftmanship organized a coding dojo to practice the Device Driver Kata of Emily Bache and I had the luck and pleasure of attending it and got the opportunity to learn and improve my knowledge in pair programming and TDD.
Barcelona Software Craftmanship
The members of Barcelona Software Craftmanship regularly organize those types of events. Actually, almost every week you can find some kind of practical event related to software development and good practice, usually on Mondays or Thursdays.
In general, the events are held in the offices of some of the many companies that are involved and interested in the Software Craftsmanship movement and good practices in software development. In this case, Magento offered their office and we were able to proceed with the meetup.
A coding dojo is a meeting of software developers and people interested in software development to practice exercises and improve their techniques when it comes to building quality software. The idea is to solve a software problem in a collaborative way, getting to know different techniques and mechanisms to reach a solution to a specific problem.
Device Driver Kata of Emily Bache
Here, the idea was to develop the Device Driver Kata of Emily Bache. A kata is a methodology of martial arts where we conduct an exercise performing a sequence of repetitive steps to complete it. The constant repetition of the exercises in question improves coordination and agility of the participant and it allows him/her to do the exercise in a more effective way.
For software development, the idea is to solve a given problem doing pair programming development techniques, extreme programming, and TDD. This allows the developer to improve his understanding of software problems and find common patterns to solve problems and therefore be more effective and “agile” when proposing technical solutions to different problems in his professional life.
The idea of the kata was to simulate the functioning of a device that reads and writes data on a flash memory system. The aim of the practice was to learn to identify what type of test doubles exist and what is the best option to use in each case of this type of test. Another objective was to know and learn to use the different libraries of the existing mockups in different languages and offer the best possible solution to the problem.
How the Meetup Went
Once we arrived at the offices of Magento, the organizers explained how the process of a coding dojo works. They told us to split up into pairs, and to try to match up with people with whom we usually work or with whom we had already done some kata, as one of the main objectives of this type of exercises is to get to know different points of view when considering possible solutions to a problem by doing pair programming. Another fun part of doing a kata is that it tries to make people get out of their “comfort zone” and get them to know and practice other languages that they don’t normally use in their professional field to develop their professional skills. In my case, I worked with Jesús Salas, a .NET developer, so we decided to solve the exercise using Microsoft tools (Visual Studio and C# as a programming language).
On the website of the kata, the conditions that have to be fulfilled by the system are indicated. Usually, each condition is translated to a unit test and, from that, you start writing the minimum code that allows to pass the test.
We decided to start with the option of solving the problem of the reading of the device. We created a test that, by passing by a defined direction of memory, would return the data contained in that direction.
After defining the required test we created a test double of type “fake” that would return the corresponding data.
We then attacked the problem of the writing method and we solved the first premise quickly, but then we got stuck on the second premise because our solution was not the most appropriate (using a dictionary to go on keeping the relationship between the position of the memory and the data). At the end of the Kata, we discovered that our proposed solution wasn’t bad but, for the writing part, it would have been better to use a list instead of a dictionary.
Anyways, the goal of a kata and dojo itself is not about reaching the best possible solution to a problem, it’s about knowing different types of solutions in different languages and to see the point of view of everyone and what things must be taken into account or not.
At the end of the exercise, the teams that want can present their solutions and contrast the design and implementation decisions that were taken and the reason why they were taken with others. This results in a very rich debate about what good ideas address that kind of problem.
To conclude, the Device Driver Kata meetup was a really nice experience for me. But I would like to add that such events boost the sharing of ideas on software development and on how to improve the construction and design of software, using techniques and recommendations from other developers. It is also a good way to introduce yourself to other working environments and other tools and to answer questions and exchange opinions with other devs about what is or is not correct when creating software. Personally, I believe that every developer who likes their profession should participate once in a while in such events because they enrich your knowledge and they give you the opportunity to discover different points of view and different ways to solve problems that would otherwise be pretty difficult to find on your own.
Published at DZone with permission of Abel Fernandez . See the original article here.
Opinions expressed by DZone contributors are their own.