A mindset improvement exercise for modern developer

A mindset improvement exercise for modern developer

In today’s fast-moving software world, technical skills alone aren’t enough. The true difference between a good developer and a great one lies in how they approach problems, architect solutions, and anticipate change.
To illustrate this, let’s walk through a fun but revealing challenge: building an HTTP API for an internet-connected document printer.

Internet-connected Document Printer API

Requirements

Design and implement an HTTP API that controls an imaginary internet-connected document printer. Your solution must meet the following criteria:

  1. When the endpoint GET /print-document is called, the API must return a 200 OK status code with a success message and the current date/time in the response body, formatted as an ISO-8601 value. Example:

        {
          "message": "Your document has been printed successfully",
          "printedAt": "2021-02-03T11:56:24+0700"
        }
  2. Every seventh call to the /print-document endpoint must return 503 Service Unavailable with a JSON body indicating that the printer is overheating:

        {
          "error": "Printer is overheating. Please wait before trying again."
        }
  3. If the current date is December 25th (Christmas Day), all calls to /print-document must return 418 I’m a teapot with a cheerful message:

    {
      "message": "The printer is celebrating the holidays. Try again tomorrow!"
    }

Non-functional Requirements

  • The solution must be implemented using .NET Core.
  • You are free to choose any architecture, libraries, or frameworks, but should be ready to explain your design choices.
  • The solution must include extensive testing for all scenarios (unit tests, integration tests, or a combination).

Change Requirements

Following customer feedback, the team is excited to introduce a new feature:

  1. When /print-document is called, the system should query a third-party weather service (e.g., OpenWeather API).

    • If the current temperature is above 30°C, modify the response message to:
              "Your document has been printed — remember to stay cool!"
    • If the current temperature is below 0°C, modify the response message to:
              "Your document has been printed — stay warm!"
    • Otherwise, return the standard message:
              "Your document has been printed successfully"
  2. The original behaviors for the 7th call overheating (503) and the December 25th holiday break (418) must still be enforced.


Notes

  • Overheating on every 7th call simulates realistic machine failure.
  • Holiday break on December 25th aligns with real-world business closures.
  • Dynamic weather-based messages introduce fun and adaptive user experiences based on external data.