The Bowling Kata Challenge Course

"Have you ever noticed how many IFs have been used in Bob Martin's Bowling Kata solution? "Is this an effective solution from an evolutionary design perspective?"

Damir, a participant of our Programming with Francesco Mentoring Programme asked Francesco Cirillo how he would have developed that same kata in TDD and with no bad IFs.

In this Course, Francesco Cirillo shows his solution.

This Course is available in several formats:

Live Online Course The Bowling Kata Challenge
4 x 2-hour sessions (max 8 participants)
Group Discount: Buy 2 of the same courses, get 1 FREE! (3 courses = €1350.00 €2025.00).
New participants get 50% off their first purchase: Request the Voucher Code.
€675.00 Buy
Video Course Subscription The Bowling Kata Challenge - Premium Subscription
Access to all video modules, as they're released. Full source code for each module/TDD step. Discord Community: ask questions and discuss the Challenge with the community. All Basic Updates.
€495.00/year Soon
Live Online Coaching Programming with Francesco - Private Guided Tour
Only for the Premium Subscription: 2 hours of 1-on-1 Coaching with Francesco Cirillo to get direct feedback or discuss your design solutions. Request the Voucher Code.
€300.00 €500.00 Soon
Github Repository Download the Final Solution - The final source code. Free Soon

* Price excludes VAT


Nicole Lemke

Software Manager, 4flow AG

If you not only want to know what “Object-Oriented Programming” means, but are also interested in its origins and what it can achieve, start here, at the very beginning. Let Francesco take you on a journey. Learn about the essence of good objects and write good stories that those objects can tell.


Carlo Garatti

Software Engineer, Oracle

If your question is about how to write valuable software, this program is for you!! Through one-on-one lessons with Francesco you will learn how to fit the right techniques and tools in the exact phases of the software development cycle. You will fix and apply these ideas in real cases. And, last but not least, in an enjoyable way!


About this Course

The Bowling Kata Challenge is a Course in which Francesco Cirillo, develops one or more features of an application that can calculate the score of a bowling match. Francesco demonstrates how he makes software design decisions, applies TDD, emergent design principles, his choices of one pattern over another, and his preferences of certain practices.

Course Info

Format
Live: 4x2 hour sessions (max 8 participants) over two weeks.
Video: 30 breakdown sessions for a total of 8 hours.

Language
English

Delivery Options
Live online, onsite, in-house, recorded video.

Trainer
Francesco Cirillo

Is this training for you?
This Course is ideal for Software Developers and Technical Coaches.

What do you need for your training?
No previous knowledge is needed. Much passion is required!
It is strongly recommended to watch the video Three Bowling Kata Solutions"

Join the conversation
Are you interested in asking questions, clarify specific aspects of the Challenge, or share your solution? The Bowling Kata Community is the place for you.

Certificate of attendance
This Certificate is delivered to all the participants who have attended the four sessions of the online course.


Objectives

As a result of this course, you will learn to:

  • Apply Test-Driven Development (TDD)
  • Grow software by applying Emergent Design Techniques.
  • Use Product and Process Metrics to assess the effectiveness of software design.
  • Apply User Stories, Scenarios and Requirements.
  • Replace the "IF Strategy" with more effective design strategies capable of reducing the complexity of the software system and favour its change and evolution.

The Story Behind this Challenge

Francesco Cirillo tells the story behind the Bowling Kata Anti-If Challenge.

"This Challenge was born out of a request from Damir, one of the participants in the Software Production You and Me Mentoring Programme. One day, he asked me: 'I would like to see how you would develop the Bowling Kata without IFs.'

I admit that I did not know of the Bowling Kata. This Kata is about developing an application that can calculate the score of a bowling match. Robert Martin provided a solution in 2005 to demonstrate how he applies TDD. Robert Martin's solution is considered by many as a 'procedural solution.' The result of applying the 'IF Strategy' several times to deal with new tests. I understand the reason for Damir's request.

	public int score() {
		int score = 0;
		int frameIndex = 0;
		for (int frame = 0; frame < 10; frame++) {
			int frameIndex = 0;
IF=>		if (isStrike(frameIndex)) {
			score += 10 + strikeBonus(frameIndex);
			frameIndex++;
IF=>		} else if (isSpare(frameIndex)) {
      				score += 10 + spareBonus(frameIndex);
					frameIndex += 2;
IF=>		} else {
					score += sumOfBallsInFrame(frameIndex);
					frameIndex += 2;
      		}
      	}
      	return score;
      }
      

I do a bit of Googling to see alternative solutions:

  • Most of the solutions repeat Martin's steps and generate the procedural solution.
  • Several people are surprised by the absence of an abstraction that emerged through his TDD solution and propose the introduction of a Frame class.
  • Matteo Vaccari and Antonio Carpentieri in their "Open/Closed Principle Dojo" propose a number of new interesting user stories (ie 20 frames instead of 10, 3 rolls per frame instead of 2 and other interesting stories). They show the IF tangle that Martin's solution would become by implementing those stories in continuing Martin's way of doing TDD.
	public int score() {
		int score = 0;
        int currentRoll = 0;
        int numFrames = isMartian() ? 12 : (isVenusian() ? 11: 10);
		for (int frame = 0; frame < numFrames; frame++) {
IF=>		if (callistoVariant() && isLastFrame(frame) {
        		while(isStrike(currentRoll, frame)) {
                	score += 10 + sumOfTwoRolls(currentRolls+1);
                    currentRoll++;
                }
IF=>		} else {
IF=>            if(isStrike(currentRoll)) {
                	score += 10 + sumOfTwoRolls(currentRolls + 1);
                    currentRoll++;
                }
            }
IF=>		} if (isSpare(currentRoll)) {
      			score += 10 + rolls[currentRolls+1];
				currentRoll += 2;
IF=>		} else if (isMartian() {
				score += sumOfThreeRolls(currentRolls);
				currentRoll += 3;
IF=>		} else {
				score = sumOfTwoRolls(currentRolls);
				currentRoll += 2;
			}
		}
      	return score;
      }
      
	public boolean isStrike(int currentRoll, int frame) {
IF=>	if (isVenusian()) {
			return rolls[currentRoll] == frame;
		}
		return rolls[currentRoll] == 10;
	}

Note

In the comments of this Blog Post you can find the design solution that Matteo seems to suggest: an implementation of the Chain of Responsibility Design Pattern.


The Bowling Kata: defusing the "IF Strategy"

Subscribe to the Bowling Challenge Video Stream


About the Trainer

Francesco Cirillo

Francesco Cirillo has worked at the forefront of the software industry for more than 30 years. In a career spanning startups, corporations and freelance consulting, he has mentored thousands of professionals, developers, managers and software teams.

In the 1990s he worked as a Senior Consultant and Mentor for Sun Microsystem, expert in Software Architectures and Software Development Processes and Java and Object-Oriented Evangelist.

Francesco is one of the pioneers of Agile Methods. He started working on XP and TDD in 1999. He was chosen by Kent Beck to develop the XP community in Europe and as reviewer of the second edition of the book Extreme Programming Explained. In 2000 he created XPLabs, the first company in Europe to offer comprehensive services on XP: software development, training and consulting.

In 2007 he created the Anti-IF Campaign to raise awareness in the international community of software developers to apply good design principles to grow software in a sustainable way.

Since 2008 Francesco stopped actively working on Agile Methods and started to develop RRP, a new method of software development. In 2013 he created Cirillo Consulting based in Berlin to offer professional training and consulting on productivity and software development.

Francesco invented the Pomodoro® Technique, a renowned time-management method used by millions of people all over the world, while being a university student looking for a way to get more done in less time.

Read the Francesco Cirillo's complete profile.


Price & Conditions

Live Online Course
The Bowling Kata Challenge

€675.00

Learn by interaction

  • 4 x 2-hour sessions over 2 weeks.
  • Small classes, max 8 participants.
  • Free access to our Practice Community.

Video Course Premium Subscription
The Bowling Kata Challenge

€495.00/YEAR

Learn at your own pace:

  • Access to all video modules,
    as they're released.
  • Full source code. You get the full source code for each module/TDD step.
  • Discord Community. Ask questions and discuss the Challenge with the community.
  • All Basic Updates.

Live Online Coaching
Programming with Francesco
Private Guided Tour

€300.00 €500.00

Only for the Premium Subscription:

  • Two hours of 1-on-1 Coaching with Francesco Cirillo to get direct feedback or discuss your design solutions.

Request the Voucher Code.

Please read our terms and conditions for training courses here.


Marco Isella

Software Engineer

Francesco has changed the way I work, and more.


Upcoming Sessions

Here you can find the next session of this event:

Here you can find the next session of this event:


Useful Resources

Three Bowling Kata Reviews

Learn software design by comparing, fixing and expanding three Bowling Kata solutions. In this session, Francesco Cirillo reviews three different...

The Bowling Kata Challenge Solution

Have you ever noticed how many IFs have been used in Bob Martin's Bowling Kata solution? "Is this an effective...

The Anti-IF Workshop

Learn how to replace the 'IF Strategy' with more effective design strategies that will enable you to reduce the complexity...


FAQ

Do you have a question not listed here?

Pomodoro® Web App

The Pomodoro® Timer Web App will be your time tutor and help you stay focused so you can get more...

Pomodoro® Sheets

To help you get started, check out the official templates of the Pomodoro Technique that you can download and print....

Pomodoro® Book

This fully updated edition includes new and exclusive material about teamwork, to make you and your team more dynamic than...