Home > Articles

This chapter is from the book

This chapter is from the book

EXERCISES

 

EXERCISE 4.1: The Evolution of the Developer Workflow

Practice using a terminal-based agentic tool like Claude Code to manage a project from initialization to completion, focusing on giving high-level, multistep commands and letting the agent handle the execution.This project challenges you to act as a project manager and architect, directing an AI agent to build a small web application or data processing script. You will focus on orchestrating the agent’s actions across the entire SDLC, from scaffolding the project to testing and version control.

Setup:

  • Install and configure a terminal-based AI agent mentioned in the chapter, such as Claude Code.

  • Initialize a new project directory and a git repository.

Execution:

  • Build a simple REST API with two or three endpoints. For example, a To-Do List API with endpoints to

    • GET /tasks: Retrieve all tasks.

  • POST /tasks: Add a new task.

  • DELETE /tasks/{id}: Delete a specific task.

  • Your primary interface for this project will be the command line, issuing natural language instructions to the agent. You will only use the code editor to review the agent’s work.

    • Document a log of the high-level commands you issue. Examples might include:

  • “Set up a new Python project using Flask. Create a requirements.txt file and a main app.py.”

  • “In app.py, create an in-memory list to store tasks and define a GET endpoint /tasks that returns it as JSON.”

  • “Now, implement the POST endpoint to add a new task. The task should be received in the request body.”

  • “Write unit tests for the GET and POST endpoints using the pytest framework.”

    • “Run the tests and fix any issues that arise.”

    • “All tests are passing. Stage all changes and commit them with the message ‘feat: Implement initial task endpoints and tests’.”

Deliverables:

1. The final source code of the completed API project, hosted on a Git platform (e.g., GitHub)

2. A PROMPT_LOG.md file in the repository that contains the chronological list of high-level commands you gave to the AI agent

3. A short reflection (1 page) on the experience, focusing on

  • The agent’s ability to maintain “intent” and context across multiple commands

  • The effectiveness of the agent in handling file system operations, testing, and git workflows

  • The difference between this agentic, terminal-based workflow and an editor-centric one

EXERCISE 4.2: Comparative Analysis of AI Refactoring and Debugging

You will evaluate and compare the capabilities of two different AI coding tools on a complex, multifile task. This project will test the agents’ ability to understand a larger codebase, track dependencies, and perform sophisticated modifications.

For this project, you will act as a software engineer tasked with improving an existing codebase. You will find a small, suitable open-source project and perform the same refactoring or debugging task using two different AI tools.

Preparation:

  • Select two distinct AI coding tools from the chapter (for example, Cursor and Sourcegraph Codi, or Claude Code and GitHub Copilot).

  • Find a small open-source project on GitHub that could use improvement. Look for things like

    • A “god object” or a single, large file that could be broken into smaller modules

    • An open “bug” issue in the repository that seems solvable

    • Code with low test coverage that needs unit tests

  • Fork the repository so you have your own copy to work on.

Task Execution and Comparison:

  • Define a clear, specific task. For example: “Refactor the data_parser.py script into three separate modules: loader.py, transformer.py, and validator.py, ensuring the application’s entry point correctly imports and uses them.”

  • Attempt 1: Use the first AI tool to complete the task. Document the prompts you use, the steps the AI takes, and any manual corrections you have to make. Note how well the tool handled changes across multiple files.

  • After completing, revert your repository to its original state.

  • Attempt 2: Use the second AI tool to perform the exact same task. Document your process in the same way.

Deliverables:

  • A link to your forked repository, with two separate branches showing the final result from each AI tool (for example, refactor-with-cursor and refactor-with-codex)

  • A detailed comparative analysis report (three to four pages) that addresses the following:

    • Which tool was better at “seeing” the entire codebase and understanding how changes in one file would affect another?

    • Did the agents break down the high-level goal into logical steps? How did their approaches differ?

    • Compare the quality of the code generated by each tool. Was it idiomatic, efficient, and correct?

    • Which tool required more prompting, clarification, and manual intervention to achieve the goal?

  • Based on your findings, provide a recommendation for which tool is better suited for large-scale refactoring or complex debugging tasks, referencing concepts from the chapter like “handling larger amounts of code at once” and “tracking multifile dependencies.”

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.