A stub is simplified placeholder code that stands in for functionality not yet implemented. Stubs let an application’s structure and flow run early; real behavior is added incrementally afterward. section 4.0 section 4.1
Use stubs to make early development more manageable:
- Connect components early and expose compatibility problems before their full implementations exist. section 4.1
- Let team members develop components in parallel by simulating dependencies. section 4.1
- Establish interfaces with empty functions, method signatures, dummy returns, and TODOs; ensure the stubbed application runs before filling in behavior. section 4.1.1
- Stub one feature at a time and avoid speculative interfaces for features that may never be built. section 4.1.1
Database placeholder
A DatabaseManager can provide connect_to_database() and fetch_data() before it connects to a real database. Placeholder messages and dummy values allow dependent code to be tested; each method can later be replaced with a real implementation. section 4.1.1
class DatabaseManager:
def __init__(self):
pass
def connect_to_database(self):
# TODO: Implement this method to connect to the database.
print("Connecting to the database...") # Placeholder
return True # Simulate successful connection
def fetch_data(self, query):
# TODO: Implement this method to fetch data from the database.
print("Fetching data...") # Placeholder
return [] # Simulate empty result set
This listing shows a small Python class whose methods declare a database-facing interface while returning controlled placeholder results. section 4.1.1
AI can accelerate the initial skeleton: extract requirements, turn them into user stories, then request feature-organized classes and method stubs. Treat generated structure as a suggestion—validate requirements and deliberately keep, revise, or reject the output. section 4.5 section 4.2 section 4.6









