2D Text-Based Breakout Game

Defusing the IF Strategy in Collision Detection

Anti-IF Programming Workshop

Live Online with Francesco Cirillo
December 18 - 19, 2024
Wednesday to Thursday
07:30 AM EST - 11:00 PM EST (New York)
01:30 PM CEST - 05:00 PM CEST (Berlin)
04:30 PM GST - 08:00 PM GST (Dubai)
2 Days | 7 Hours Total | 3.5 Hours per Day

Register

Individual Enrollment

First 2 New Clients: $240 per participant
Next 3 New Clients: $255 per participant
Standard: $525 per participant

Group Enrollment

Small Team (2-4 participants): $315 per participant
Medium Team (more than 4 participants): $262.50 per participant

Is This Workshop Right for You?

This workshop is ideal for senior developers, software architects, and anyone looking to enhance their design skills by learning and applying Anti-IF Programming, Emergent Design, and Test-Driven Development (TDD)

  • You’ll work with a real application: the 2D Text-Based Breakout Game.
  • Breakout is a classic arcade game where players control a paddle to bounce a ball toward a wall of bricks, aiming to break them all.
  • Standard IF-based collision detection algorithms are an example of centralized algorithms. Through Anti-IF Programming, we’ll explore an innovative, decentralized approach to collision detection.
  • You’ll learn how to implement collision detection without relying on traditional IF statements, effectively defusing the conventional IF Strategy.
  • If you want a deep understanding of how Anti-IF works to defuse the IF Strategy, let new abstractions emerge, and lower the cost of change in software development, this workshop is for you.
def detect_collision(rect, circ):
  if circ.x + circ.radius < rect.x or circ.x - circ.radius > rect.x + rect.width:
    return False
  if circ.y + circ.radius < rect.y or circ.y - circ.radius > rect.y + rect.height:
    return False

  if rect.x <= circ.x <= rect.x + rect.width:
  if rect.y - circ.radius <= circ.y <= rect.y + rect.height + circ.radius:
    return True
  if rect.y <= circ.y <= rect.y + rect.height:
  if rect.x - circ.radius <= circ.x <= rect.x + rect.width + circ.radius:
    return True

  for corner_x, corner_y in [(rect.x, rect.y), (rect.x + rect.width, rect.y),
    (rect.x, rect.y + rect.height), (rect.x + rect.width, rect.y + rect.height)]:
    if ((circ.x - corner_x)  2 + (circ.y - corner_y)  2) <= circ.radius ** 2:
      return True
  return False
            

What Makes This Workshop Unique

In this workshop, Francesco Cirillo demonstrates how Anti-IF Programming, Emergent Design, and Test-Driven Development (TDD), can be applied to build a 2D text-based Breakout game without relying on traditional IF statements.

  • Rethinking Collision Detection:
    Transform a complex, IF-heavy, centralized algorithm into a decentralized, performant system of objects.
  • Decentralized Collision Detection Design
    By moving away from IF-based, centralized logic, this workshop will show you how to build a decentralized system of objects, where each object collaborates smoothly without added complexity.
  • Emergent Abstractions
    Experience how Anti-IF Programming and the absence of IFs, fosters emergent abstractions that lower the cost of change and make the codebase robust and adaptable.
  • Hands-On TDD Practice
    Francesco will guide you through TDD, demonstrating how to test and grow software in small, manageable steps that support natural abstraction.
  • Lowering the Cost of Change:
    Embrace a design approach that reduces the cost of adapting to new requests, making each evolution more sustainable.
  • Interactive Mentoring
    Francesco combines presentations with live discussions, encouraging you to reflect on design decisions, collaborate, and build confidence in a truly interactive learning environment.

The Challenge

One of my personal challenges—something I’ve been mulling over for years—is collision detection. We all know classic 2D games like Mario and Space Invaders. And if you think about it, the real magic, the moment that makes you cheer for Mario or brace yourself in Space Invaders, comes down to one thing: collision detection. Without it, there’s no game.

I’ve read countless articles and books on collision detection algorithms. And, time and again, the answer is the same: a centralized, algorithmic system that decides “from above” whether Mario has hit a coin or if a bullet from your base collides with an invader. This inevitably leads to code heavy with if statements—an omniscient logic that checks every condition.

But what if there’s another way? What if collisions could be detected directly between objects, in a decentralized, emergent, intentional object-driven way? And what if we developed this system one test at a time, incrementally and carefully?

This workshop was born to explore that question. It’s about creating a collision detection system that’s flexible, adaptable, and developed incrementally, one test at a time—where each object knows its role in a larger dance of interaction.

Curious if it's possible to streamline your code effectively? Join us to discover innovative strategies that can transform your programming approach.

Register

Program Outline

Day 1: Foundations in Anti-IF, and TDD

Setting Up for Emergent Design

Duration: 3.5 Hours

Introductions and Workshop Overview

  • Participants introductions and setting expectations.
  • Overview of the workshop: What to expect over the course of the two days.

Module 1: Defining the Game

  • Understand the basics of game development.
  • Design the initial game setup: building the core mechanics and defining the game objects.

Module 2: Introducing the Ball

  • Learn to draw elements in the console.
  • Implement strategies for reducing flickering through a new abstraction.
  • Write tests to guide the ball's behavior, seeing the first hints of Anti-IF programming in action.

Module 3: Adding the Border and Paddle

  • Define and implement the game’s borders and player-controlled paddle.
  • Avoid complex IF conditions by designing each object with self-contained logic and interactions.

Day 2: Expanding the Game with Dynamic Elements

Building a Decentralized Design

Duration: 3.5 Hours

Module 4: Decentralizing Collision Detection

  • Instead of using a central IF-driven algorithm, apply decentralized collision handling using on_collision methods within each object.
  • Example Code: Francesco will demonstrate how each object manages its state based on interactions, sharing sample code to illustrate this decentralized approach.

Module 5: Decentralized Scoring

  • Implement scoring without a central score management system. Each object will update the score as needed, maintaining modularity.

Module 6: Transforming the Game – What If It Were a Bullet?

  • Explore how to adapt the design if the ball were a bullet, demonstrating the flexibility of the decentralized architecture.
  • Reflect on how Anti-IF programming allows you to change core game elements without a complete rewrite.

Q&A and Wrap-Up (30 minutes)

  • Open forum for participant questions and reflections.
  • Final thoughts and next steps for applying TDD and Anti-IF in practice.
  • Farewell and closing remarks.

Workshop Objectives

Designing for Change: Anti-IF, Emergent Design, and TDD

  • Design Adaptable Code with Anti-IF Programming: Discover how to eliminate IF statements, making your code modular, scalable, and easy to modify.
  • Apply TDD as a Design Tool: Use tests to guide your design, allowing abstractions to emerge naturally.
  • Achieve Decentralized Object Interaction: Build a game where interactions are handled by objects themselves, removing the need for centralized control.

Additional Details

  • Recording Access: Participants will have access to the session recording for 30 days post-workshop.
  • Student Discounts: Students studying software architecture, computer science, or software engineering can email us for a chance to receive a voucher for a full discount on the workshop fee.
  • Limited Spaces: Secure your spot today and start transforming the way you develop software!

Join us for this engaging workshop and transform the way you approach coding challenges with Francesco's expert guidance and innovative techniques!

Register $240.00

Anti-IF Workshop

Online Live Course

Join Francesco Cirillo in a live, interactive 7-hour online workshop focused on applying Anti-IF Programming and TDD. You’ll learn how to develop the solution step-by-step without anticipatory thinking.

Direct Interaction

Francesco will personally answer your questions, offering detailed explanations and tailored support.

Access to Recording

Receive access to the workshop recording for one month, allowing you to review the content at your convenience.

Platform: Zoom

Conducted on Zoom, ensuring easy access from anywhere and effective, interactive participation.

Certificate of Participation

Obtain a certificate at the end of the workshop, validating your participation and the skills acquired. Enroll today to transform your understanding of TDD and elevate your programming skills!

Register $240.00

Upcoming Events

TRAINER

...

Francesco Cirillo

Francesco’s journey in software spans over 30 years, influencing startups, corporates, and individual consultants.

A seasoned mentor, he has impacted countless professionals and teams. From his early days with Sun Microsystems to pioneering Agile Methods and creating XPLabs, Francesco's mark on the software industry is profound.

Notably, he's the creator of the groundbreaking Pomodoro Technique, a time management method embraced worldwide, as well as the visionary behind the Anti-IF Programming philosophy, challenging conventional coding practices.

Testimonials

Carlo Garatti

"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!"

Alessandro Ruzzon

"What did I like the most? In this workshop the theory part matches up with the practical part. You don't only hear WHAT TO DO but also HOW TO DO IT, and you start practicing it right away in the labs! That's really what the Workshop is about: real-life practice aimed at consolidating theoretical notions. This approach helps in understanding problems"

Break the Chains of Conditionals!