Level 3: Train Reservation

Train Reservation Office Kata

Introduction to Level 3

Welcome to Level 3: Train Reservation! This level is designed to challenge you in developing a comprehensive web application for reserving train tickets. You'll delve into various key aspects of web development, including web API design, error handling, and layered architecture. Mastering these skills will equip you to build robust, scalable, and maintainable web applications. Additionally, you will practice writing HTTP tests and unit tests to ensure the reliability of your code.

Concepts to Master

  • Web Application: Develop a fully functional web application.

  • Design Web API: Learn to create RESTful APIs to enable communication between different parts of your application.

  • Error Handling: Implement strategies for managing and responding to errors gracefully.

  • Layered Architecture: Structure your application into layers to separate concerns and improve maintainability.

  • HTTP Test: Write tests to validate the behavior of your web APIs.

  • Unit Test: Continue to write unit tests to ensure the correctness of individual components.

  • Discovery and Planning: Master the art of understanding requirements, breaking down tasks, and planning your development process.

  • Structured Note-Taking: Develop skills in documenting your specifications, design decisions, and implementation plans in a clear and structured manner.

  • Incremental Development: Practice committing code frequently and incrementally to facilitate review and ensure continuous progress.

  • Iterative Design: Embrace an iterative approach to design and development, refining your work based on feedback and testing results.

  • Communication: Enhance your ability to communicate your ideas and progress effectively, both in written form and through code reviews.

  • Best Practices in Software Development: Adhere to best practices for writing clean, maintainable, and efficient code.


Train Reservation Office Kata

Part 1: Discover and Plan

Approach

Approach this exercise like a “real project.” This means taking the time to understand the requirements, designing the system, and planning your work before diving into the implementation.

Tasks

  1. Suggest a UI to Book Seats

    • Design an intuitive and user-friendly interface for booking train seats.

  2. Design the Backend API

    • Create a RESTful API that supports the necessary operations for the train reservation system.

  3. Task Breakdown

    • Split the work into manageable tasks and plan them into 45-minute focus time boxes.

Part 2: Execute and Build/Publish

Execution

Execute your tasks using best practices in software development. This includes writing clean, maintainable code and following an iterative development process.

Best Practices

  • Commit Often

    • Commit your code frequently to facilitate review and express your approach clearly.

  • Publish Your Backend or Web App

    • Publish your backend or web application incrementally as you implement each feature or rule.


Exercise Guidance: AI-Driven

From Specification to Code: AI-Driven Approach

Steps

  1. Formalize and Structure Your Specification

    • Document your specifications clearly with examples and commit them to your repository.

  2. Create a Plan and Commit It

    • Develop a detailed plan for your project and commit it to your repository.

  3. Project Setup

    • Set up your project based on the architecture you have defined, with guidance from AI tools as necessary.

  4. AI-Guided Testing Suite

    • Use AI to help guide the creation of your test suite. This includes both HTTP tests for your web APIs and unit tests for individual components.

  5. Frequent Commits

    • Commit your code frequently to ensure progress is well-documented and easily reviewable.

Specifications

There are various business rules and policies around which seats may be reserved.

For a train overall, no more than 70% of seats may be reserved in advance, and ideally no individual coach should have no more than 70% reserved seats either.

However, there is another business rule that says you must put all the seats for one reservation in the same coach.

This could make you and go over 70% for some coaches, just make sure to keep to 70% for the whole train.

here an example of formated json that can be return when retrieving data from a train :

Example Mapping

You can discover Rules and create a share understanding with examples

Example of UI

Edit the mock up

Live view of the mock up read-only

Mock up of Train View

Mock up of Reservation View

Last updated