Thursday, November 30, 2006

Coding Dojo FAQ

The concept of coding dojos has been generated a lot of interest lately. Some people mailed me to learn more about coding dojos, how to conduct them, and how they can help an organization. So I decided to set up a FAQ. But before I say anything more, the credit for this concept goes to Dave Thomas who conceptualized the idea of coding katas (similar to dojos but to be done individually).
Q1. What is a coding dojo?
A1. A dojo is a exercise that brings the element of practice to programming. It lets developers explore various solutions and approaches to a problem without time pressures. Just like musicians and sportsmen practice to improve their skills, these exercises help raise the bar of a programmer's skills.
Q2. How is a dojo conducted?
A2. The dojo begins with the facilitator/coach explaining the problem statement to the group, followed with a quick design discussion. Once everyone has understood the problem, the first pair starts programming while the others watch on the projector screen. The audience should be a participative audience and not a passive one. They should point out alternate solution paths and mistakes. Everyone should contribute their knowledge. After 20 minutes the first pair returns to the audience and the next pair continues programming from where they left of... and so on. It is the responsibility of te programming pair to ensure that everyone in the audience understands what they are doing. If someone has a doubt, they can stop the pair and request them to clarify what they are doing.
Q3. Are there other learning opportunities for the participants besides "raising the bar of programming skills"?
A3. A lot of "technology learning" can also happen as a side effect. When I conduct dojos for clients, I take every opportunity to transfer technology specific knowledge every time an opportunity arises. For example, once we needed to use some IO classes, and I spoke to the group about the IO and Reader hierarchies and about the Decorator design pattern. Once we needed to implement a callback, so I took the opportunity and explained anonymous inner classes and callbacks. Several learning opportunities will arise, but they will usually change with each exercise.
Q4. What kind of equipment do we need to conduct a dojo?
A4. A computer loaded with necessary software and a projector.
Q5. What software needs to be loaded on the computer?
A5. Assuming you will be working in Java: JDK(1.4+ is a good idea), an IDE (Eclipse, NetBeans...), JavaDocs for the JDK classes, and any other tools, libraries that are specific to the exercise.
Q6. How many participants can attend a dojo?
A6. Between 4 - 16. Try not to exceed 16.
Q7. How long is a typical coding dojo?
A7. It depends on the exercise. In my opinion, for ant meaningful learning to happen you need about 4 - 6 hours.
Q8. Can I take a large exercise and break it into multiple dojo sessions.
A8. Well, it can be done, but I will not recommend it, because breaking up will mean that participants have to spend time remembering what they did in the last session. This break in the may waste some time and reduce the learning.
Q9. Can a dojo be conducted without a coach/facilitator?
A9. Yes, but that will work well only with a group of experienced developers.
Q10. What are the skill levels needed to participate in a dojo?
A10. Fresh developers to very experienced programmers can all benefit from a dojo. Software development is an art and there is always scope for improving skills. However I will suggest that participants have academic exposure to the programming language in which the dojo will be conducted.
Q11. What kind of a mix of people (from a skills perspective) is best for an effective dojo?
A11. Having a group of similarly skilled people usually works out better. Even though this can be subjective, a good guideline is to group people with the following experience ranges together: 6 months - 12 months, 12 months - 36 months, 36+ months. Again, this is very subjective, and your mileage may differ.
Q12. Can dojos be used to explore refactorings?
A12. Yes, infact they can be used very effectively to understand refactoring principles. In this case the dojo starts with smelly code that needs refactoring, and the exercise is to refactor the code while discussing pros and cons of each refactoring.
Q13. Can dojos be used for anything else?
Q13. I think dojos can be used as a learning tool to understand any concept that needs hands-on practice and an exchange of ideas. Design patterns, test first development, pair programming, specific API's and probably many other skills can be learned very effectively with dojos.
Q14. Are there any links to resources and example exercises?
A14. You must check out Dave Thomas' excellent page
Q15. Do you conduct dojos?
A15. Yes I do. I conduct open as well as inhouse dojos in Pune, India. If you are located elsewhere, I will be glad to share my experiences and help you conduct the dojos yourself. You can mail me at - info (at) adaptivesoftware (dot) biz
Alternately, you can also post your questions as comments to this post. I will be gald to answer them here. 

Monday, November 27, 2006

Unconferences and open spaces

Bruce Eckel and several other people have been experimenting very successfully with unconferences and open space conferences. On the face of it "open spaces" seems to a very broad (open) ended concept, but it can be a very interesting and powerful concept if the participants are mature enough to make proper use of it. Here is the broad outline of my understanding of open spaces:

Open spaces are conferences propelled by a concept or question. The driving concept could be anything from "How do we make our neighborhood cleaner" to "What is the best way to utilize web services". These are not preplanned conferences. The person or organization who wishes to explore a concept/problem will send out invitations in the community. People/companies who have similar interests will accept the invitation to attend. An invitation fee is usually charged to compensate for food, equipment, and conference room costs. The conference is a self organizing conference, which means there is no pre-planned agenda. However the duration of the conference and time slot place holders are pre-determined. The time slots are later filled with a concrete agenda. On the day of the conference the initiator gives a keynote presentation on the main issue, after which participants volunteer topics that they would like to explore under the main umbrella. Each participant who volunteers a discussion fills up a time slot and place. Those with similar interests also sign up. Note that all time slots and spaces may not be signed up for. More topics may emerge after the discussions start.

Once the self organizing agenda has been determined, participants group up in various corners or wherever they want to, and discuss the issue they signed up for. Participants may move around from one group to another or may stay with a group for the planned duration. The person who initiated a particular topic is responsible for maintaining the transcripts and documenting any interesting findings or observations. On the last day all conversations are consolidated by the lead participants (participants who initiated discussion topics) by briefly telling everyone what was discussed and any interesting findings that may have emerged. Important findings and insights are noted and may be published on a website or a technical journal for later reference.
Open spaces has a huge potential for learning and education. We are living in a time when technology is changing very rapidly and people have different learning requirements for the same technology. For example different developers who want to learn about multi-threaded programming will most likely want to learn it at different levels. Some might want to just scratch the surface to understand concurrency, while other may want to learn in greater detail to write code that uses concepts of multi-threading, while a few people might actually want to gain a high degree of expertise in it, to create a multi-threaded server. Couple this with the fact that different people also have different learning speeds, and you will soon realize that a traditional workshop to teach "multi-threading in Java" is going to yield sub-optimal results.
What we need is an environment where people can pursue their learning needs at a speed and depth of their choice. I think open spaces offers one way to create such a personalized learning environment. 

Notes: This text was originally posted on my earlier blog at
Here are the comments from the original post

AUTHOR: ranjan
DATE: 11/28/2006 01:05:03 PM

I hope to attend( I am in the wait list) the ' unconference' by Global Voice( in Delhi on 16th Dec ...
Thanks a lot for this post sir..
I know what an unconference is ... otherwise I always thought its just on of the spelling mistakes that people make :)

DATE: 11/29/2006 08:07:35 AM
That's nice Ranjan. Do blog about your experience and let us know what it was like.


Monday, November 20, 2006

Java infrequently answered questions

Peter Norvig has an excellent list of Java related IAQ's (Infrequently Answered Questions) on his website. He talks about stuff that cover various subtleties in Java. Here's an example:

Q:Within a method m in a class C, isn't this.getClass() always C?

No. It's possible that for some object x that is an instance of some subclass C1 of C either there is no C1.m() method, or some method on x called super.m(). In either case, this.getClass() is C1, not C within the body of C.m(). If C is final, then you're ok.

-- Peter Norvig


Free Web Based Courses On Java Programming Best Practices and Obect Technology and Design 

Thursday, November 16, 2006

Learnings from a discussion on EJB 3.0

Yesterday I had a learning discussion session with some developers on EJB 3.0 It was a very interesting discussion and we all took home some new and interesting stuff. The key learnings were:

  1. EJB 2.1 was a 300 lb gorilla that used a crane to lift a peanut. EJB 3.0 is a nimble chimpanzee :-)
  2. EJB 3.0 uses annotations instead on the xml deployment descriptors that were so hard to maintain. So beans, security constrains and everything that was earlier defined using the deployment descriptor can now be done in code using annotations. I think this is really neat, especially for small applications.
  3. We no longer need to define all the 2.1 interfaces to get an EJB working. In fact we need not define interfaces at all. A business interface will be automatically created for us by the annotation processor. I read somewhere on the net (do not remember where), that we must not generate the business interface automatically (but create it manually and have the EBJ implement it), because the automatically generated interaface will include every public method from the bean and make it available to client code. Now I think that should not be a problem. Public methods are meant to define the public interface of a class, so if we do not want client code to invoke a method, then it should not be public. So the existence of public methods that should not be available to client code, smells to me of bad design.
  4. EBJ 3.0 entity beans are now POJO's, which is again really nice and makes development light weight. Again a big plus for small applications, and for maintainability.
  5. EBJ 3.0 uses dependency injection. The container will inject environment related objects in the client automatically. Client code now does not need to do any complex JNDI lookups. By the way Martin Fowler has written an excellent article on dependency injection here.
  6. We can still use deployment descriptors to override annotations, but in my opinion this should be avoided (unless absolutely necessary), because it will make the application harder to maintain.
Overall EBJ 3.0 is a huge advancement towards easing enterprise development. I am certain this specification will be adopted and accepted by the developer community much better than the previous one.

Saturday, November 11, 2006

Coding dojo

Last Saturday we conducted a coding dojo session for a software development company in Pune. A coding dojo is an exercise that brings the element of practice to programming. All sportspersons, musicians... practitioners of any craft, do a lot of practice, where they explore various aspects of their art, explore different techniques, tools, and solutions. But software developers never do that. The way they enhance their skills is by learning while working or traditional workshops.

Workshops are a good way to bring a group of people up the learning curve on a new technology, but they fall short when we use them to improve developer's programming skills. Programming skills are best improved by practice. Practicing alone is good, but practicing with a group and a mentor is even better. This is exactly what a dojo is. A group of software developers that gets together to practice programming, to explore solutions, learn and improve their programming skills in the process.

For this dojo, we decided to code Dave Thomas' Kata 4 - Data Munging. We were a group of six developers. After an explanation of the exercise, we started programming in pairs, but not all at the same time. What we actually did was projector programming. The first pair started coding and the rest watched as a participative audience. By participative I mean, they were not just watching, but also suggesting solutions, pointing typos, and generally participating in the solution. After 20 minutes, the first pair went in the audience and the next pair took over for the next 20 minutes... and so on.

Here's what we had after completing part 1 (Weather data) and part 2 (Soccer data).  

DataMunging.gif drove the weather data. Actual parsing of data was done by and represented the data. Ditto for soccer data.

Part 3 of the coding kata is DRY fusion. We have to identify repititive code and refactor it so that it follows the DRY (Don't repeat yourself)  principle.

I would like to urge you to actually program the solution as explore how we can elliminate duplicate code. We can elliminate duplication with inheritance or with composition. I am inclined to use composition as the first choice because inheritance trees are more difficult to maintain, and also since polymorphism is not warranted here. Your views however might differ, and if they do, please write about them as a comment here or as a trackback to your own blog.

We will solve the DRY fusion problem this week, and will explain the solution here. 

Thursday, November 09, 2006

Ending notes on software design series

Software design is all about decontructing a system into manageable units, identifying relationships among them and getting the units to interact to fulfill system requirements. To become a good object oriented designer, you first have to replace the "procedural mindset" with an "object oriented" one. That, however is not as simple as it sounds. The best way to get there is by practice, lot's of it. Take every opportunity to create a good design.

When creating an entire system, think about the classes, their relationships, and interactions. When creating a class, think of what responsibilities it should fulfill. What should the API be like? How does it relate to other classes? When creating methods, think about the method signature and about the code in the method. Does the method do one and only one thing? What exceptions should it throw? Is is intuitive and easy to use? At whatever level you are creating the system, you can always think of design. Remember, there is a lot of power in the process of understanding, reflecting, practicing, and writing. Use it to learn continuously.

The natural progression after understanding basic design principles is understanding design patterns and then enterprise architecture. Start with the "Gang Of Four's" design patterns and then move towards more complex topics.

A few good resources for for reference:


I hope you have enjoyed this course and found it useful. Good luck... and wishing you have a very successful and enjoyable career in software development.

Wednesday, November 08, 2006

Your feedback on translating requirements into system design

Please take a couple of minutes to give your feedback on this section. Would you like to see any additions, subtractions, or changes? How did you like the audio and video descriptions used in this section? I know they are not optimal, and I hope to improve them, but it will really help me if I get feedback on exactly what should be improved to make the course more effective for you.

Note: This post was originally posted on my blog at

Friday, November 03, 2006

What is object oriented programming - by Alan Kay

Alan Kay coined the term object oriented programming in the 60's. Even though the progression of this paradigm has been a collaborative effort, Alan Kay has played a very important part in the creation of this paradigm.

In 2003 Stephan Ram could not find an authoritative source on what "object oriented" really meant, so he decided to ask Alan Kay himself.

Here's a link to his reply. A must read for anyone who is interested in object oriented programming and design.