Midterm Project — Build a Real CLI Tool
মিডটার্ম প্রোজেক্ট — একটি বাস্তব CLI টুল তৈরি করুন
1. The Brief — Ship Something Real
You now know enough Java to write a complete program. This midterm project asks you to pick one of four tracks, build the tool end-to-end, push it to GitHub, and write a real README. Small but complete — that is the mantra. The goal is not a perfect tool; the goal is a tool that works and that you are comfortable maintaining.
2. The Four Tracks — Pick One
Track A — Todo Manager (কাজের তালিকা)
todo add "Buy rice" --priority hightodo list— pretty-printed table, sorted by prioritytodo done 3— marks task 3 completetodo rm 3— deletes task 3- Persist to
~/.todos.json. Create if missing.
~/.todos.json ফাইলে সংরক্ষণ। first run-এ ফাইল না থাকলে তৈরি করবে।
Track B — Weather CLI (আবহাওয়া CLI)
weather Dhaka— calls a free weather API (e.g. Open-Meteo)- Uses Java 11
HttpClient— no external HTTP library - Parses JSON (Jackson, Gson, or hand-rolled)
- Prints temperature, feels-like, humidity, and tomorrow's forecast
- Caches last response to
~/.weather-cache.jsonfor 10 min
Track C — Password Generator (পাসওয়ার্ড জেনারেটর)
pwgen --length 16 --upper --digits --symbols- Uses
java.security.SecureRandom(neverMath.random()) - Reports a simple strength score (bits of entropy)
- Option
--count Nto produce N passwords - Option
--no-ambigto exclude ambiguous characters (O 0 I l 1)
SecureRandom দিয়ে password বানায়, entropy হিসেব করে দেখায়।
Track D — CSV Stats (CSV পরিসংখ্যান)
csvstats sales.csv --col price- Computes count, min, max, mean, median, stddev for the chosen column
- Uses streams and
DoubleSummaryStatistics --group-by regionoption prints per-group stats- Handles missing/invalid cells gracefully
--group-by দিলে group-অনুসারে।
3. Project Structure and Starter Skeleton
Use Maven. Three to six classes. Below is a runnable skeleton that shows argument parsing, a sub-command
dispatch, and a clean exit code on failure. It runs here in the sandbox.
class Main {
public static void main(String[] args) {
// simulate: todo add "Buy rice"
String[] demo = { "add", "Buy rice" };
int rc = dispatch(demo);
System.out.println("exit code = " + rc);
}
static int dispatch(String[] args) {
if (args.length == 0) {
usage();
return 2;
}
String cmd = args[0];
return switch (cmd) {
case "add" -> add(args);
case "list" -> list();
case "done" -> done(args);
default -> { usage(); yield 2; }
};
}
static int add(String[] a) {
if (a.length < 2) { System.err.println("need a title"); return 2; }
System.out.println("added: " + a[1]);
return 0;
}
static int list() { System.out.println("(no items)"); return 0; }
static int done(String[] a) { System.out.println("done"); return 0; }
static void usage() {
System.err.println("Usage: todo [add|list|done|rm] ...");
}
}
4. Deliverables Checklist
| Item | Required | বাংলায় |
|---|---|---|
| GitHub repo (public) | yes | public GitHub repo |
README.md with run instructions | yes | run instructions সহ README |
Maven pom.xml | yes | Maven build file |
| 3–6 classes organized in packages | yes | ৩–৬টি class, package-এ organized |
| At least one unit test (JUnit 5) | yes | অন্তত একটি JUnit 5 test |
| Proper exit codes (0 ok, 1 error, 2 usage) | yes | সঠিক exit code |
Error messages to stderr, not stdout | yes | error System.err-এ |
| Short demo GIF or terminal screenshot | recommended | screenshot/GIF (সুপারিশকৃত) |
| License file (MIT or Apache-2.0) | recommended | LICENSE file (সুপারিশকৃত) |
5. Rubric — How You Will Be Scored
| Criterion | Points | বাংলায় |
|---|---|---|
| Works end-to-end (no crashes on sample input) | 30 | end-to-end ঠিকমতো চলে |
| Code structure & naming | 15 | code structure ও নামকরণ |
| Error handling & exit codes | 15 | error handling ও exit code |
| Unit test present and passing | 10 | unit test থাকা ও pass হওয়া |
| Persistence / I/O correctness | 10 | persistence ও I/O সঠিকতা |
| README clarity | 10 | README-এর স্পষ্টতা |
| Polish (formatted output, flags, defaults) | 10 | polish — formatted output, flags |
6. Common Pitfalls to Avoid
⚠️ Mistakes graders see often
- Putting everything in
main— split into classes - Swallowing exceptions silently with empty
catch - Printing errors to
stdoutinstead ofstderr - Hard-coded file paths that break on other OS
- No README or a one-line README
- Using
Math.random()for password generation
✅ Habits that impress
- A clean
--helpflag with usage text - Meaningful exit codes
- README has a one-command "how to run"
- Tests cover the core happy path
- No mutable static state leaking between calls
- A tiny demo GIF in the README
7. Vocabulary
| Term | Meaning | বাংলায় |
|---|---|---|
| CLI | Command Line Interface — text-only program driven by arguments. | argument-চালিত text program। |
| Exit code | Integer a program returns to the OS; 0 = success. | OS-কে ফেরত দেওয়া status (০ = success)। |
| stdout / stderr | Standard output stream / standard error stream. | standard output / error stream। |
| Persistence | Storing state across program runs (file, DB). | একাধিক run-এ state টিকিয়ে রাখা। |
| Unit test | A small automated test of a single unit of code. | কোডের ছোট অংশের স্বয়ংক্রিয় test। |
| README | Project's front-page documentation. | project-এর প্রথম documentation। |
8. The Project
Your single "practice problem" for this module is the project itself. Pick a track, build it, push it. Use the checklist above as a live TODO list.
-
Midterm Project: Build and ship one of the four CLI tools (Todo, Weather, Password, CSV Stats). Fulfil the deliverables checklist, meet the rubric, and submit the GitHub link.মিডটার্ম প্রোজেক্ট: চারটি CLI-এর একটি বানান এবং ship করুন (Todo, Weather, Password, CSV Stats)। Deliverables checklist পূরণ করুন, rubric-এ pass করুন, GitHub link জমা দিন।
Example submission layout (উদাহরণ)
todo-cli/ ├── pom.xml ├── README.md ├── LICENSE └── src/ ├── main/java/com/abcl/todo/ │ ├── Main.java ← argument dispatch │ ├── TodoService.java ← business logic │ ├── TodoStore.java ← JSON persistence │ └── Todo.java ← data record └── test/java/com/abcl/todo/ └── TodoServiceTest.javaREADME skeleton:
- What it does (2 sentences)
- How to build:
mvn package - How to run:
java -jar target/todo.jar add "Buy rice" - Example session (copy-paste terminal)
- Tech used (Java 21, Maven, JUnit 5)
- License
উপরের structure অনুসরণ করুন — আলাদা file-এ business logic, persistence, data class। README-তে এক command-এ কীভাবে চালাবেন সেটা দিন।
Summary — Module 36 · Midterm
The midterm exists to prove to yourself that you can ship a complete Java program, not just run snippets in a browser. Pick the track that excites you, follow the deliverables checklist, and submit a link that a stranger could read and run. This is the habit of a professional engineer.