Project-starting tool
The Blank Page Killer
This template does not design a program or write it for me. It turns a blank source file into a sequence of decisions: mission, smallest working version, inputs, outputs, data, flow, known tools, research boundaries, and the next observable checkpoint.
Looking up syntax is part of programming. I still own the intent, architecture, data model, control flow, decisions, and understanding of the code I keep.
The goal is not βCan I write this entire program from memory?β The goal is βDo I know what I am trying to build, and can I work out how to build it?β
blank-page-killer.cpp
raw source β/*
============================================================
THE BLANK PAGE KILLER
============================================================
A C++ project-starting template.
RULE:
I do not need to know the syntax from memory.
I need to know what I am trying to accomplish.
This template is a character sheet, not a solution.
It does not design the program for me.
It gives me the questions I need to answer so I can design it.
Looking things up is part of programming.
I own:
- The intent
- The architecture
- The data model
- The control flow
- The decisions
- Understanding the code I keep
I am allowed to look up:
- Syntax
- Standard library APIs
- Documentation
- Compiler errors
- Small examples
- Concepts I do not yet understand
The goal is not:
"Can I write this entire program from memory?"
The goal is:
"Do I know what I am trying to build,
and can I work out how to build it?"
============================================================
PROJECT
============================================================
Name:
============================================================
MISSION
============================================================
In ONE sentence, what am I making?
Example:
Read a security log and count failed SSH login attempts.
============================================================
WHY DOES THIS EXIST?
============================================================
What sounds useful, interesting, funny, or worth learning here?
-
============================================================
SMALLEST WORKING VERSION
============================================================
What is the smallest observable thing I can make work?
Do NOT describe the finished project.
Example:
- Accept a filename.
- Open the file.
- Read every line.
- Print every line.
-
============================================================
INPUT
============================================================
What information enters the program?
Examples:
- Command-line argument
- User input
- File
- Network data
- Hard-coded test data
-
============================================================
OUTPUT
============================================================
What should the program produce?
Examples:
- Console output
- Modified file
- Count
- Parsed object
- Error message
-
============================================================
DATA MODEL
============================================================
What information does the program need to represent?
Think about the DATA before worrying about syntax.
Example:
- filename -> string
- log lines -> collection of strings
- failed login count -> integer
- employee -> struct/class eventually?
-
============================================================
PROGRAM FLOW
============================================================
Explain the program in plain English.
No C++ required yet.
1.
2.
3.
4.
5.
============================================================
THINGS I ALREADY KNOW HOW TO DO
============================================================
Give myself credit for existing knowledge.
Examples:
- Use getline() in a loop
- Print with std::cout
- Compile with clang++
- Use an if statement
-
============================================================
THINGS TO LOOK UP
============================================================
LOOKING THESE UP IS EXPLICITLY ALLOWED.
Putting something here does not mean I failed to learn C++.
It means I successfully identified the boundary of my
current knowledge.
Examples:
- Exact std::filesystem syntax
- How vector::erase() behaves
- Which header provides a particular function
- Meaning of a compiler error
-
-
-
============================================================
QUESTIONS / UNKNOWN SHIT
============================================================
Things where I don't yet understand the CONCEPT,
rather than simply forgetting syntax.
These may require actual learning.
-
-
-
============================================================
NOT BUILDING YET
============================================================
Good ideas that are NOT part of the current slice.
Put them here and leave them alone.
Examples:
- Authentication
- Configuration files
- Fancy UI
- Refactoring everything into classes
- "Wouldn't it be cool if..."
-
-
-
============================================================
NEXT CHECKPOINT
============================================================
ONE observable thing.
What will I be able to see working when the next slice
is complete?
Example:
Running:
./log-explorer fixtures/auth.log
successfully prints every line in the file.
-
============================================================
END-OF-SESSION RECEIPT
============================================================
Fill this out only if useful.
OUTPUT:
What did I build/fix/change?
-
UNDERSTANDING:
What do I understand now that I didn't understand before?
-
FLUENCY:
What could I do, explain, predict, or retrieve with less help?
-
NEXT TIME:
What is the smallest obvious place to resume?
-
*/
// ============================================================
// DEFAULT TOOLBOX
// ============================================================
//
// These are common tools, not mandatory dependencies.
//
// Keep what the program uses.
// Delete or comment out what it doesn't.
//
// The comments are intentionally here to reinforce the mapping
// between "thing I want to do" and "standard library tool".
// ============================================================
// Console input/output:
// std::cout, std::cin, std::cerr
#include <iostream>
// Text:
// std::string, std::getline
#include <string>
// Dynamic collections:
// std::vector
#include <vector>
// File input/output:
// std::ifstream, std::ofstream, std::fstream
#include <fstream>
// Parse and construct text using streams:
// std::stringstream, std::istringstream, std::ostringstream
#include <sstream>
// Common algorithms:
// std::find, std::sort, std::count, etc.
#include <algorithm>
// Files and directories:
// std::filesystem::path, exists(), directory_iterator, etc.
#include <filesystem>
// ============================================================
// OPTIONAL TOOLBOX
// ============================================================
//
// Uncomment when the problem calls for them.
// ============================================================
// Ordered key/value storage:
// std::map
// #include <map>
// Fast key/value lookup:
// std::unordered_map
// #include <unordered_map>
// Fixed-size collections:
// std::array
// #include <array>
// Timing and duration measurement:
// std::chrono
// #include <chrono>
// Threads and sleeping:
// std::thread, std::this_thread::sleep_for()
// #include <thread>
// Random-number generation:
// std::random_device, std::mt19937, distributions
// #include <random>
// Explicit integer sizes:
// std::uint8_t, std::uint32_t, std::uint64_t
// #include <cstdint>
// A value that may or may not exist:
// std::optional
// #include <optional>
// Smart pointers and dynamic ownership:
// std::unique_ptr, std::shared_ptr
// #include <memory>
// Sets of unique values:
// std::set, std::unordered_set
// #include <set>
// #include <unordered_set>
// ============================================================
// PROGRAM
// ============================================================
int main()
{
/*
Start with the smallest working slice.
Do not build the whole program.
Make ONE observable thing work.
Compile it.
Run it.
Understand what happened.
Then move the checkpoint.
*/
return 0;
}