30 June 2013

DemoCamp Help Wanted

Last Friday an Eclipse DemoCamp took place in Vienna. If you do not know, a DemoCamp is an "informal event for Eclipse enthusiasts to meet up and demo all the cool technology being built by the Eclipse community." (Eclipse Wiki) The Vienna DemoCamp is usually a mixture of product presentations, local companies sharing their experience of how they use Eclipse and pure demos of the newest and hottest stuff, usually delivered by our DemoCamp veteran speaker Tom. Roughly four hours of presentations are made perfect by additional two hours of space in between, filled with discussions, networking, food and free beer. And we make sure that there is enough beer. Once we ran out of beer and since then we are haunted by the fear that we might not have enough which usually ends that everybody has to take some bottles home in the end ;-)

T-Rex Help WantedThis was the 13th DemoCamp invitation by the Eclipse Foundation and the 8th DemoCamp held in Vienna. It went very well. In the last four years we have built a community of Eclipse enthusiasts and there are a few companies who actively support their employees in participating in the DemoCamp. The "word is spreading", and after two years I finally managed to bring a colleague to the DemoCamp, which is a huge success as people from my employer are usually not participating in any community activities.

We are organizing the DemoCamp in our free time and it is worth it but there are times when the tide is high and there is little time left for extra work involved in running an event for 60 to 80 people. Our Platinum sponsor agent°ex supports us a big deal, still there are many things which need to be done. And we would like to do more like invite more speakers from abroad, have some games, give away free T-shirts and so on. To do that we need help. If you are enthusiastic and want to be part of this, contact us. Your local Eclipse Community needs you!

18 June 2013

TDD Exam Questions

Last year I ran a three day in-house training on unit-testing and TDD using Eclipse. I wanted the course to be as interactive as possible to keep the attendees engaged all the time. Besides my slides I carried out exercises like Jason Gorman's TDD from Hell and played short movies to keep the content varied. At the end of each chapter I showed a slide with a few questions about the topic just covered. These questions gave the audience a break to recall the content just studied and reflect on it before moving on. I searched for such questions but did not find any, so I had to come up with my own.

These are my sanity-check questions. They are not complicated or long-winded, just simple questions to verify if the content was understood. Some questions also served as a base for further discussion. The developers in the audience were exposed to TDD for the very first time, so I kept them simple. If you are a seasoned developer I am sure these questions will not challenge you at all.

Writing ExamsUnit Testing with JUnit
  • What is a test fixture?
  • Which assert is used to compare the values of objects?
  • What about assertTrue(true);?
  • What about assertTrue(a.equals(b));?
  • How to test for an expected exception?
  • What about System.out.println(...); in tests?
  • How to data-drive tests?
  • How to time-out tests?
  • How to test the contents of a private field? (This is a trap, the answer is not to test it but to change the design.)
  • Does full code coverage mean the code is fully tested?
Test Driven Development
  • What are the benefits of using TDD?
  • Is TDD primarily a testing technique?
  • When do you write tests? (This is a joke and the expected answer is "all the f*cking time" according to Bryan Liles' TATFT.)
  • What should you do when you cannot add another test?
  • If the code passes all the unit tests why should you still change (refactor) it?
  • Why not refactor on a red bar?
Mocking and Test Doubles
  • Why use stubs or mocks?
  • How are objects called that are passed around but never actually used?
  • How are objects called that can return fixed values in answer to calls made.
  • How are objects called that can verify the behaviour of the system under test, in addition to using asserts to verify its state.
  • What is used for testing state?
  • What is used for testing behaviour?
  • What is a spy?
ExamRefactoring
  • What is your favourite Refactoring?
  • How do we refactor? (This is a word play and the expected answer is mercilessly.)
  • Should Refactoring and adding new code be done at the same time?
  • During Refactoring, how long does your code not compile?
  • During Refactoring, when should we run the tests?
  • What Refactoring can be used when a method is too long, has duplicated code or Feature Envy?
  • What Refactoring can be applied to long parameter lists?
  • In Eclipse, what do the short-cuts Alt-Shift-R, Alt-Shift-L and Alt-Shift-M do?
Working with Legacy Code
  • What is Legacy Code?
  • How can you break dependencies?
  • What are Singletons and why are they evil?
  • Do you write them?
Using these questions, small exercises and short movies I kept the participants fully engaged for a whole day of TDD theory. It was awesome!