On 5th of February our small Cherhihiv community made 2nd CodingDojo. This time it was dedicated to JavaScript programming. We tried to code some Design Patterns in new language. What we attained during 2 two 1 our long session is following patterns implemented

  1. Singleton, yeah yeah yeah :)

  2. Factory method

  3. Template method v1 (prototype hierarchy)

  4. Template method v2 (runtime meta-programming)

  5. Decorator

What we found very good during retrospection is usage of TimeBox policy for changing pilot/co-pilot, we used 7 minutes limited time box and IntelliJ IDEA Pomodoro plugin was helpful on this.

During programming we all suffered of our Java mindset. Even plain looking into Wikipedia description and attempt to re-implement Java code samples in JavaScript were damaging our brains :) Lack of interfaces (as in Java) and completely different approach of creating class hierarchy slowed down our development speed. Another issue was immense scope of our Dojo. Certain targets (patterns) were chosen only at the beginning of session and it was a challenge to create domain object for certain patterns without detailed design session for which we have no time.

What we decided to do next

  1. Pick up and implement some Kata to have more certainty on what we wanna achieve

  2. Increase time box to 10 minutes, let’s see if helps

  3. Get some cookies and drinks to not starve during session :)

My personal observations

The easiest part was Jasmine. This BDD tool was adopted seamlessly by all of us since TDD tools and practices are familiar to us from Java world and Jasmine is very similar.

The hardest was start thinking again in higher level OOP terms, not in their equivalents in Java. All those interfaces, classes limited to the same named file and other limitation imposed by Java were hard to overcome. Considering present of duck typing in JavaScript we get rid of interfaces, abstract classes and class hierarchy at all. Another uncommon point was API concentrated in module not in class as in Java it it was also a bit frustrating from the beginning.

But anyway the coolest thing was our success in short and stressful session as well as knowledge obtained. I think attitude to JavaScript should change a bit towards paying more respect for this amazing and underestimated language (my IMO though).