liveBook · Manning

Chapter 4: Coding the first version of our application

What you will learn in chapter 4 of Coding with AI

The chapter introduces the need for a sound application foundation and explains how stubs let developers assemble and run an application before implementing its functionality.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces the need for a sound application foundation and explains how stubs let developers assemble and run an application before implementing its functionality.

Key terms: foundation, requirements, stubbing, stub

4.1 Stubbing: Building the skeleton of your application

The section introduces stubbing as a way to build and test an application’s structure before implementing its full functionality.

Key terms: stubbing, stubs, overall structure and flow, early integration, parallel development, testability, faster iteration, dependencies

4.1.1 A simple code example

This section shows how database stubs let an application run before its database code is ready and gives guidelines for creating stubs strategically.

Key terms: stub, connect_to_database(), fetch_data(), DatabaseManager, dummy values, stubbing strategically, method signatures, class structures, TODOs, YAGNI

4.2 Extracting requirements from the design

This section explains why requirements need careful interpretation when using generative AI and gives a brief process for extracting them from a design document.

Key terms: requirements, stakeholders, generative AI, prompts, structured output, potential pitfalls, follow-up prompts, validate, hallucinate requirements, key requirements

4.2.1 Step 1: Extract the requirements using ChatGPT

This section uses ChatGPT to turn a software design document into high-level requirements, then explains why a human must validate the result.

Key terms: design document, requirements, ChatGPT, high-level requirements, Question Pool Database, Question Selector, stakeholders, validate, hallucinates, human reviews

4.2.2 Step 2: Gathering requirements from Gemini

The section compares Gemini’s requirements with ChatGPT’s, shows how a second AI tool can help review a design, and explains why the more detailed list was chosen for the application.

Key terms: generative AI, model divergence, question pool, 35-question tests, future considerations, second opinion, cross-reference, stakeholders, hallucinated features, ChatGPT-generated list

4.3 Setting up our development environment

This section sets up a project folder and terminal, then creates and activates a Python virtual environment for the application.

Key terms: dedicated directory, Visual Studio Code, terminal, WSL, Python virtual environment, hrpractice, activate, prompt

4.4 Flask application structure

This section uses ChatGPT to propose an organized Flask project structure, explains the roles of its main files and folders, and treats the suggestion as a starting point rather than a final design.

Key terms: Flask, single Python file, file structure, routes, templates, static, models, utils, tests, context (thread)

4.5 Stubbing out our application

The section turns design requirements into a human-reviewed application skeleton of folders, files, classes, and method stubs.

Key terms: requirements extraction, user story creation, stub generation, features, file structure, stubs, placeholder methods, iterative development, AI limitations, critical evaluation

4.6 Running our application

The section uses GitHub Copilot chat to get a stubbed Flask application running, then emphasizes that developers must understand and evaluate AI suggestions.

Key terms: GitHub Copilot chat, run.py, python run.py, Flask application, Hello, World!, AI as an idea generator, not a decision maker, domain knowledge, generated source code, human judgment, application skeleton

4.7 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 3: Design and discovery Chapter 5: Using Blackbox AI to generate base code →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.