Code generation
Code generation is the production of program code by transforming inputs such as specifications, models, templates, or existing representations.
Coding with AI
Code generation is the automated production of source code from natural-language instructions, existing code, or other structured input.
- How it is used
- Accelerates implementation by drafting functions, scaffolds, and application code from comments, prompts, and surrounding context.
- How deep it goes
- Explains context-aware generation through prompt refinement, review, testing, refactoring, and project-wide customization rather than model internals.
- Examples
- Demonstrates CSV processing, text-file cleanup, SQLite connection code, Flask quiz interfaces, and a generated web-application foundation.
- What you can do after
- Apply it via AI coding tools to draft code, evaluate suggestions, correct deficiencies, and validate changes incrementally.
Building User-Friendly DSLs
The automated production of source code or executable artifacts from a higher-level representation.
- How it is used
- Generates executable JavaScript from a DSL AST, connecting domain-oriented representations to runtime artifacts.
- How deep it goes
- Builds from templates through AST parameterization, helper functions, expression dispatch, and diagnostics; it stops short of a complete runtime.
- Examples
- Uses a Rental class, record-type and attribute ASTs, template helpers, numeric expressions, attribute references, and generator watch commands.
- What you can do after
- Build it from scratch by parameterizing templates, running the generator, and checking generated output against reference code.
Read how Building User-Friendly DSLs explains code generation →
Go in Practice, Second Edition
Code generation is the automated production of program source or implementation code from declarations, schemas, or other inputs.
- How it is used
- Uses generation to replace repetitive typed declarations or repeated runtime reflection with compiled Go code.
- How deep it goes
- Works through a directive, a template-based generator, generated files, and their use in a program.
- Examples
- Builds a typed queue generator and demonstrates generated JSON codec methods and gRPC client scaffolding.
- What you can do after
- Build it from scratch with `go generate` and Go templates, or apply it via `codecgen` to tagged structs.
Read how Go in Practice, Second Edition explains code generation →
Generative AI in Action
Code generation is the computational production of source code by a model from learned programming-language patterns and inputs.
- How it is used
- Augments enterprise developers with function-level drafts, scaffolding, onboarding help, and automation of repetitive development tasks.
- How deep it goes
- Explains prompt-and-file-context suggestions and gives generated-code examples, but does not derive model internals or promise complete applications.
- Examples
- Shows a Python OpenAI API greeting-and-translation script and a Copilot-generated function that calls Stability AI to save an image.
- What you can do after
- Apply it via GitHub Copilot to draft bounded code, then review, test, and verify suggestions before production.
The Quick Python Book, Fourth Edition
Code generation is the automated production of source code from prompts, specifications, templates, or other inputs.
- How it is used
- Uses text prompts to produce Python solutions for programming exercises, then subjects those solutions to comparison and review.
- How deep it goes
- Works through prompt scope, generation, testing, and correction, while leaving the generators’ internal mechanisms unexplained.
- Examples
- Uses temperature statistics, text cleaning, word counts, and a weather-data CSV whose generated county filter requires correction.
- What you can do after
- Apply it via Colaboratory or GitHub Copilot to draft Python code, then test the output and correct mistakes.
Read how The Quick Python Book, Fourth Edition explains code generation →
ASP.NET Core in Action, 3e
Code generation is the automated production of source code or related artifacts from a higher-level description or specification.
- How it is used
- Automates strongly typed C# API-client creation from OpenAPI descriptions.
- How deep it goes
- Details setup, build integration, client usage, naming, customization, and tradeoffs without explaining generator internals.
- Examples
- Uses a FruitClient to create and retrieve fruit through generated asynchronous methods.
- What you can do after
- Build and apply an NSwag-generated C# client for an OpenAPI-described API.
Read how ASP.NET Core in Action, 3e explains code generation →
Starting Data Analytics with Generative AI and Python
The automatic production of executable source code from prompts, specifications, or other program representations.
- How it is used
- Supports data analysts by translating analytical requests into workflows, visualizations, and executable code.
- How deep it goes
- Explains prompting, IDE integration, and validation practices, but stops short of detailing code-generation internals.
- Examples
- Uses Excel-to-Power BI dashboards, Google Tag Manager and Google Analytics 4 tracking, GitHub Copilot, and financial-product pricing code.
- What you can do after
- Apply it via GitHub Copilot or a conversational model, then test, inspect, and revise generated analytical code.
Read how Starting Data Analytics with Generative AI and Python explains code generation →
Automating API Delivery
Code generation is the automated production of source code or scaffolding from a formal specification or other input.
- How it is used
- Uses an OpenAPI definition as the source of truth for generating API service scaffolding and keeping artifacts aligned with changing requirements.
- How deep it goes
- Walks through a Spring Boot generation command, generated files, and controller behavior without teaching Java or prescribing Spring Boot project structure.
- Examples
- Uses a generated Spring Boot product-catalog service, a product lookup controller, curl responses, and an invalid-UUID error response.
- What you can do after
- Apply it via OpenAPI Generator CLI to generate Spring Boot service stubs, implement endpoint behavior, and regenerate after specification changes.
Introduction to Generative AI, Second Edition
The automated production of source code from a natural-language description, specification, or other input.
- How it is used
- Improves programming productivity through autocomplete, code drafting, documentation, testing, and related software tasks.
- How deep it goes
- Explains prompting, autocomplete, agentic action, and risks, but stops short of implementation details or systematic evaluation methods.
- Examples
- Uses GitHub Copilot, Cursor, Devin, Claude Code, Replit Agent, Windsurf, DiagramGPT, and generated docstrings as examples.
- What you can do after
- Apply it via LLM-assisted programming tools to draft functions, complete code, generate documentation, and visualize code or schemas.
Read how Introduction to Generative AI, Second Edition explains code generation →
gRPC Microservices in Go
Code generation is the automated production of source code from a higher-level specification.
- How it is used
- Turns gRPC service contracts into client stubs that microservices can consume across language boundaries.
- How deep it goes
- Works through compiler flags, generated Go files, client use, and CI automation; defers complete client-server wiring.
- Examples
- Uses an order-creation RPC, its generated Go client, and a tagged workflow for order, payment, and shipping services.
- What you can do after
- Apply it via protoc and GitHub Actions to generate, publish, and consume Go gRPC code.
Read how gRPC Microservices in Go explains code generation →
Quarkus in Action
Generated code is source code produced automatically by a software tool from project settings, templates, or other inputs.
- How it is used
- Uses project settings, extensions, and schemas to bootstrap application resources and communication code.
- How deep it goes
- Explains generated artifacts and triggering commands, but stops short of detailing generator internals.
- Examples
- Uses a generated GreetingResource, Quarkus tests, a Car protobuf model, and InventoryService gRPC stubs.
- What you can do after
- Build generated REST, protobuf, and gRPC artifacts using Quarkus extensions and Maven compilation.
Geometry for Programmers
Code generation is the automatic translation of a representation or formula into source code in a target programming language.
- How it is used
- Turns solved symbolic formulas into executable code for programming and engineering calculations.
- How deep it goes
- Shows API-level translation and output formats, but does not explain code-generation internals.
- Examples
- Uses SymPy equations for Va and Vp, symbolic output, Python code, and printable LaTeX.
- What you can do after
- Build executable formula implementations with SymPy's pycode or language-specific code-generation functions.
Read how Geometry for Programmers explains code generation →
How Large Language Models Work
Code generation is the automated production of computer-program source code from prompts, specifications, or other inputs.
- How it is used
- Deploys LLMs as coding agents that produce source code and support software-development workflows.
- How deep it goes
- Explains token handling, compilation, unit tests, and incremental syntax checks, but does not detail implementation beyond these validation methods.
- Examples
- Uses Python and Java code, comments, descriptive names, compilation, unit tests, and a Python if-statement syntax check.
- What you can do after
- Diagnoses generated code by compiling it, testing its behavior, and detecting syntax errors during token generation.
Read how How Large Language Models Work explains code generation →
Kafka Streams in Action, Second Edition
Code generation is the automated production of source code or programming-language objects from formal specifications such as schemas.
- How it is used
- Automates schema-to-object conversion during the application build cycle.
- How deep it goes
- Explains tools, input directories, output configuration, compiler selection, and the generation command.
- Examples
- Uses Gradle generation, schema source directories, configured output paths, and a Maven Central protoc compiler.
- What you can do after
- Build it from scratch by configuring Gradle plugins and running a task that generates Java model objects from schemas.
Read how Kafka Streams in Action, Second Edition explains code generation →
Learn Go with Pocket-Sized Projects
Code generation is the automatic production of source or executable code from schemas, specifications, or other input artifacts.
- How it is used
- Generates Go message and gRPC service implementations from Protobuf definitions in a habits-tracker application.
- How deep it goes
- Traces installation, compiler flags, import resolution, output layout, and automation, but stops short of generated-code internals.
- Examples
- Uses protoc commands, generated habit.pb.go and service files, directory trees, and a go:generate directive.
- What you can do after
- Operate protoc and its Go plugins to generate organized message and gRPC service source files.
Read how Learn Go with Pocket-Sized Projects explains code generation →
WordPress Power Toolkit: Harness AI to build next-level websites
Code generation is the production of source code by an automated system from instructions, specifications, or other inputs.
- How it is used
- Speeds the creation and customization of website elements such as HTML tables.
- How deep it goes
- Demonstrates prompt-based HTML generation and iterative formatting, without explaining programming internals.
- Examples
- Uses a five-largest-lakes table and progressively styled column headings as concrete examples.
- What you can do after
- Apply it via Claude to generate, insert, inspect, and refine HTML website elements.
Read how WordPress Power Toolkit: Harness AI to build next-level websites explains code generation →
Building Web APIs with ASP.NET Core
Code generation is the automated production of source code or compiled code from a higher-level specification.
- How it is used
- Automates gRPC client and server stub creation from a protobuf contract during the .NET build.
- How deep it goes
- Explains contract definition, project configuration, service implementation, and endpoint registration without detailing generator internals.
- Examples
- Uses a grpc.proto contract, a csproj Protobuf entry, GrpcService.cs, and Program.cs registrations for a board-game endpoint.
- What you can do after
- Build a gRPC endpoint from a protobuf definition and connect its generated types to application data.
Read how Building Web APIs with ASP.NET Core explains code generation →
Related concepts
- interpreteralternative to · An interpreter is software that executes or evaluates source code or another program representation according to its defined semantics.
- language modelproduced by · A language model is a computational model that represents patterns in linguistic tokens to estimate sequence probabilities and predict or generate language from context.
- conversational aiused by · Conversational AI is artificial intelligence that enables software systems to interact with users through natural-language dialogue.
- GitHub Copilotused by · GitHub Copilot is an AI-powered programming assistant that provides code suggestions, generation, and other software-development assistance based on prompts and programming context.
- testmeasured by · A test is a procedure or check that evaluates behavior using specified inputs or evidence against expected results or criteria.
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.
















