Hardcoding
Hardcoding is embedding fixed values, rules, configuration, or behavioral choices directly in code or another artifact rather than supplying or deriving them separately.
Build Financial Software with Generative AI (From Scratch)
A hardcoded value is a literal configuration or data value embedded directly in source code or another fixed artifact instead of being supplied dynamically.
- How it is used
- Uses hardcoding as both a configuration risk to remove and a temporary shortcut for application prototypes.
- How deep it goes
- Explains security and maintenance concerns and walks through replacing database credentials with environment variables.
- Examples
- Uses PostgreSQL credentials, fixed FastAPI responses, ACH upload rows, and a login with hardcoded users.
- What you can do after
- Operate/configure Docker services to supply database credentials through environment variables instead of embedding them in application code.
Read how Build Financial Software with Generative AI (From Scratch) explains hardcoding →
Data-Oriented Programming in Java
Hard coding is embedding environment-specific values or infrastructure assumptions directly in application code.
- How it is used
- Exposes hidden coupling in test fixtures and integration-test files, then redirects tests toward visible, data-driven inputs.
- How deep it goes
- Diagnoses gradual coupling and demonstrates generation, parameterization, serialization, and randomization, stopping short of general application-configuration treatment.
- Examples
- Uses shared Account helpers, fixed CSV paths, generated rows, serialized files, and scalable Stream.generate datasets.
- What you can do after
- Diagnose brittle tests and replace hidden fixtures or files with parameterized, generated data whose assertions reflect explicit inputs.
Read how Data-Oriented Programming in Java explains hardcoding →
Also covered in
- Object-Oriented Software Design in C++
- Test Driven: Practical TDD and Acceptance TDD for Java Developers
- Practical Automation with PowerShell: Effective scripting from the console to the cloud
- Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
- Authorization in Action
- Learn AI Data EngineeringIn early access (MEAP)
- Software Design for Python Programmers
- Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
- The Art of Unit Testing 3e
- Unit Testing Principles, Practices, and Patterns
- Building Distributed Applications that Work
What to know first
- software testingSoftware testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- HTTP requestAn HTTP request is a message sent by a client to a server using the Hypertext Transfer Protocol, specifying a method and target and optionally including headers and a body.
- inheritanceInheritance is a mechanism in which a derived type or descendant element receives properties or behavior from a parent, subject to rules that may allow specialization or overriding.
Related concepts
- factoryaddressed by · A factory is a function, method, or component that creates and returns values or objects while encapsulating construction or selection logic.
- brittle policyproduces · A brittle policy is an authorization policy whose conditions depend on volatile facts that can become invalid when organizational circumstances change.
- decorator design patternaddressed by · The decorator design pattern adds behavior or responsibilities to an object by wrapping it in another object that preserves its interface.
- faking itused by · A test-driven development strategy that temporarily substitutes a fake implementation, often a fixed result, to make a failing test pass.
- flexibilitycontrasts with · Flexibility is the capacity of a system, design, or process to adapt to changing requirements or conditions without extensive restructuring.
Questions about hardcoding
What is hardcoding?
Hardcoding is embedding fixed values, rules, configuration, or behavioral choices directly in code or another artifact rather than supplying or deriving them separately.
Which Manning books explain hardcoding?
Build Financial Software with Generative AI (From Scratch) and Data-Oriented Programming in Java.
What should I know before learning hardcoding?
Manning books that teach hardcoding usually introduce software testing, function, HTTP request and inheritance first.
What is the difference between hardcoding and dynamic expected value?
Hardcoding is embedding fixed values, rules, configuration, or behavioral choices directly in code or another artifact rather than supplying or deriving them separately. A dynamic expected value is a test expectation computed by executing logic rather than specified directly as a fixed value.
What is hardcoding also called?
Hardcoding is also called hardcode, hardcoded or hard-coding.
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.

