# CodeSOD: An Overengineered Java CLI Input Example

DevFeed: [CodeSOD: An Overengineered Java CLI Input Example](<https://devfeed.tech/articles/codesod-a-tool-for-you-66573.md>)

Original publisher: [Read original article](<https://thedailywtf.com/articles/a-tool-for-you>)

Author: Remy Porter

Published: 2026-10-07T06:30:00Z

Content type: opinion

Language: en

Sources: [The Daily WTF](<https://devfeed.tech/sources/the-daily-wtf.md>)

Topics: [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>)

Tags: [cli](<https://devfeed.tech/tags/cli.md>), [codesod](<https://devfeed.tech/tags/codesod.md>), [java](<https://devfeed.tech/tags/java.md>), [mentor](<https://devfeed.tech/tags/mentor.md>), [team](<https://devfeed.tech/tags/team.md>)

## AI overview

The article criticizes a senior developer's elaborate Java example for reading user input from the CLI. The code uses nested maps and map entries to handle simple responses, prompting criticism of its complexity and mentoring approach.

## Source excerpt

A junior dev on the team had a simple question: in Java, how do I correctly read user input from the CLI and act on it? Now, we can wonder about a junior dev not having such basic knowledge, but maybe they're new to Java specifically. Who knows. But Robert's team has a senior on it who "likes to mentor". This senior has strong opinions about how to write software, extreme confidence in those opinions, and has somehow been around the company long enough that he knows where the bodies are buried and no one will fire him. Here's his sample application for reading input. import java.nio.charset.StandardCharsets; import java.util.*; public class ScannerTool { public static void main(String[] args) { Map<Optional<Character>, Map.Entry<String, Boolean>> map = new HashMap<>(); map.put(Optional.of('A'), new AbstractMap.SimpleEntry<>("You entered A.", true)); map.put(Optional.of('B'), new AbstractMap.SimpleEntry<>("You entered B.", true)); map.put(Optional.empty(), new AbstractMap.SimpleEntry<>("You entered nothing.", false)); Optional<Character> input; do { System.out.println("Please enter A or B:"); } while (!map.getOrDefault((input = nextCharacter()), new AbstractMap.SimpleEntry<>("", false)) .getValue()); System.out.println(map.get(input).getKey()); } public static Optional<Character> nextCharacter() { String l = new Scanner(System.in, StandardCharsets.UTF_8).nextLine(); if (l != null && !l.isEmpty()) { return Optional.of(l.charAt(0)); } return Optional.empty(); } } Look, I know Java is verbose, but this is entirely next level. Giving this to a junior has to constitute an attempt to drive the youth out of the industry, because any sane person being told, "your job is to write this" would realize they've committed a grave error in their career choice and needs to escape now. nextCharacter in this case actually returns the first character of the next line, not the next character. And if there isn't one, it returns an empty optional. Which, fine, we only expect one character