Appendix D — The Online Coding Workflow
“The instrument doesn’t matter. The skill does.” — Chapter 1
For Coding 1 and Coding 2, the instrument is your browser. Coding 3 will take you off the training wheels.
Why we’re using OnlineGDB (and not a local compiler)
In these first two courses, you are going to spend your hours writing code —
not installing compilers, not fixing PATH variables, not figuring out why your
laptop’s antivirus quarantined g++.exe. The web has caught up; a free,
zero-install C++ and Java IDE that runs in any browser is more than enough for
everything we’ll do here. OnlineGDB is the default. Equivalent tools
(Replit, JDoodle, Programiz) work too if you prefer one of them, with the same
submission rules.
Coding 3 will introduce a local toolchain (git, a real IDE, debugger, build system) properly. For now: write code, save the project, share the link.
Setting up an OnlineGDB project
- Go to onlinegdb.com.
- Create an account. Top-right → Sign up. Email or Google login.
- Once logged in, you can create named projects that persist between sessions. (Without an account, you can write code but it won’t be saved.)
- Create your first project:
- Hover “New File” → choose C++ (or Java for Phase 2).
- Give it a sensible name like
p1_apologist_card. The textbook will tell you the conventional name for each project.
- Set the compiler flags (one-time per project, important for C++):
- Click the gear icon (⚙) → “Extra Compiler Flags” → enter:
-Wall -Wextra - These turn on the warnings the textbook expects. Code that’s “clean” in this course means clean with these flags enabled.
- Click the gear icon (⚙) → “Extra Compiler Flags” → enter:
You’ll create one project per assignment. Repeat the above for each.
Working on a project
Write your code in the editor. Press the green Run button (top of page) to
compile and execute. Input the program needs (from cin or Scanner) goes
into the Stdin panel below the editor.
Multiple files
C++ and Java projects in this course are sometimes multi-file (especially Chapters 10+ for C++, and most Java projects). OnlineGDB supports this:
- Add a file: Right-click the project name in the file tree (left panel) →
“New File” → name it (e.g.,
Account.java). - For Java, OnlineGDB compiles all
.javafiles together; you tell it which class hasmainby setting the main class name in project settings. - For C++, you can have multiple
.cppfiles — OnlineGDB compiles them together when you press Run.
Saving
OnlineGDB autosaves your projects when you’re logged in. Always check the project name in the breadcrumb at the top. If it says “Untitled” you’re not saved.
Submitting your work
Every assignment in Coding 1 and Coding 2 has the same submission shape:
1. Get a shareable link
In OnlineGDB:
- Top toolbar → Share button.
- A modal opens with a URL like
https://onlinegdb.com/abc123XYZ. - Make sure the visibility is “Anyone with link can view” — that’s the default but worth confirming.
- Copy the URL.
2. Leave the program in a “graded” state
The instructor will open your link and press Run. Whatever state you leave the program in is what they’ll see. Two ways to do this:
Option A — Hard-coded inputs (easy):
At the top of main(), hard-code the inputs the program needs. The grader
won’t have to type anything; they hit Run and the program demonstrates your
work.
int main() {
// Hard-coded values that demonstrate the Normal tier.
string name = "Maya";
int age = 21;
// ... rest of program uses these
}
Option B — Pre-filled Stdin (also easy): Paste sample input into the Stdin panel below the editor in OnlineGDB. That input gets fed to your program automatically when the grader runs it. The instructor will see your Stdin too.
Either is fine. Hard-coding inputs at the top of main() is the more
beginner-friendly path.
3. Add a reflection comment
At the very top of your main source file (the one that contains main()),
include a block comment like this:
/*
* Tier targeted: Normal / Medium / Hard
* Features done: list the ones you finished
* What I learned: one short paragraph; no bullets
* What I'd change: one sentence
* AI usage: where and how, if any. Be honest.
*/
This replaces the README.txt from the old submission model. Same content,
different home.
4. Submit the URL
Submit the OnlineGDB link via the course portal (the instructor will tell you where — typically a discussion-board post or LMS dropbox). One URL per project.
That’s it. No demo.txt, no ZIP file, no screenshots. The instructor opens your link, reads your comment block, runs your code, and grades against the rubric.
”But what if I want to code locally?”
That’s allowed. If you have a working local C++/Java setup (you bring your own or you’ve followed Appendix A / B for setup notes), you can:
- Develop locally.
- Push your code to a public GitHub repository.
- Submit the GitHub repo URL in place of an OnlineGDB link.
Requirements still hold:
- The reflection comment block at the top of the main source file.
- The program needs to compile cleanly when checked out. The instructor will
clone, compile (
g++ -Wall -Wextraorjavac), and run. - If your project needs specific inputs to demonstrate the tier, put those in
a
sample_input.txtfile in the repo or hard-code them inmain.
You are responsible for the local setup. If your code doesn’t compile on the grader’s machine because of a missing library, missing file, or platform difference, that’s not the grader’s problem to debug — it’s yours. This is why we recommend OnlineGDB for Coding 1 and 2: there’s nothing to debug at the environment level.
Things that can go wrong (and the fix)
“The grader can’t access my OnlineGDB link.” You probably didn’t set visibility to “Anyone with link can view.” Reopen the project → Share → check that checkbox.
“My program needs input but I didn’t hard-code it.” The grader will likely guess reasonable inputs (your name, your age, etc.) and run it. If your program requires very specific inputs to show off the tier, either hard-code them OR paste them into the OnlineGDB Stdin panel before saving the link.
“My code compiles locally but not on OnlineGDB.”
99% of the time this is a missing #include. Add the include. The instructor
will use OnlineGDB to grade unless your link is a GitHub repo; “works locally”
is not a defense.
“I want to use Replit / JDoodle / Programiz instead.” Fine. Use any web-based IDE that produces a shareable URL where the code is visible and runnable. The submission rules are the same.
“OnlineGDB is down on the day my project is due.” Email the instructor with a screenshot of the OnlineGDB outage page. Don’t let it ruin your day.
Why no demo.txt anymore?
Earlier drafts of the course asked students to capture a terminal session and
submit a demo.txt showing the program working. That made sense when projects
lived in a local file system the instructor never saw. Now that every project
is one click away on OnlineGDB, the instructor just runs your code themselves
— the live run is the demo.
The reflection comment block (the “what I learned” paragraph) is still required. It’s the most-read part of the submission and the part where you do the most growing. Don’t skip it.
What about Coding 3?
In Coding 3 (or whichever course continues this curriculum), we’ll introduce:
- A real local development environment (VS Code or your choice)
- Git and GitHub workflow
- Multi-file build systems (Makefiles, Gradle/Maven)
- Debuggers, profilers, version control
- Working in a team on a shared repository
For now, save those for later. The skill we’re building first is writing code. Everything else is scaffolding around that skill, and we’ll add it when the code itself is no longer the hard part.
Up next: Open Chapter 1 and start the first rep.