Layers of Logic for Java
The VS Code side of Layers of Logic. Fetch an exercise, write it here, and have it
checked on your own machine.
What you need
A JDK, version 17 or newer. Not a JRE: compiling needs the full kit. If you do
not have one the extension says exactly what to install for your system.
Nothing else. JUnit ships inside the extension as a single jar, so there is no
Gradle, no Maven, and nothing downloaded the first time you run a check.
Getting started
- Run Layers of Logic: Choose Course Folder and pick somewhere to keep your work.
- Open the Layers of Logic panel in the activity bar. The course loads.
- Click any exercise. It is written to
<your folder>/ex-10-1-a/ and opened,
with the task beside it.
- Write your answer, then press
cmd+alt+t (ctrl+alt+t on Windows and Linux)
or run Layers of Logic: Check My Work.
What a folder looks like
ex-10-1-a/
├── TASK.md the task, the signatures, and any hints you have opened
├── src/TheTrade.java your work. Only this file is yours to change
└── test/TheTradeTest.java the checks. You are meant to read these
The tests are not hidden. They are the most exact statement of what an exercise
wants, and reading tests is a thing the job asks of you. Every one of them has
been run against a reference solution before it shipped, so if a check fails,
your code is what is wrong, not the check.
Commands
| Command |
What it does |
| Layers of Logic: Check My Work |
Compiles and runs the checks. cmd+alt+t |
| Layers of Logic: Next Hint |
Opens one more hint. Three per exercise, the last is nearly the answer |
| Layers of Logic: Show the Task |
Opens TASK.md beside your code |
| Layers of Logic: Reset This Exercise |
Puts the starter back. Your attempt is kept in .attempts |
| Layers of Logic: Refresh Course |
Re-reads the course and re-checks which JDK you have |
Settings
| Setting |
Default |
What it is |
layersOfLogic.apiUrl |
https://layersoflogic.com |
Where the course is served from |
layersOfLogic.courseFolder |
none |
Where your work is written |
layersOfLogic.javaHome |
empty |
Set only if you have several JDKs and want one in particular |
layersOfLogic.checkOnSave |
false |
Check every time you save. Off, because a half written method failing is noise |
Running it from source
npm install
npm run compile # copies the runner in, then compiles
npm test # generates and serves the API, then runs VS Code host tests
npm run package # writes a versioned .vsix without publishing it
Then press F5 in VS Code to open an Extension Development Host.
npm run compile vendors ../runner into extension/runner. That is the same
code the content gate runs in CI, on purpose: what passes there is what passes
on your machine.
npm test is self-contained. It rebuilds the static exercise API and serves it
on an unused local port for the life of the test run. You do not need to start
the site first.
To develop against the site instead of the published course, run npm run dev
from the repository root and set layersOfLogic.apiUrl to http://localhost:4321
in the Extension Development Host.
Offline
Everything fetched is saved. Once an exercise has been opened, reading the task,
writing your answer and checking your work all happen with no network at all.