In a CodeSOD article published by The Daily WTF on 2026-10-07, Remy Porter presents a Java example from a team led by Robert. A junior developer asked how to read command-line input and act on it. A long-serving senior developer who enjoys mentoring supplied an application called ScannerTool.
The program stores Optional<Character> keys in a map. Each value is a Map.Entry containing a response string and a Boolean flag. The map has entries for A, B, and an empty input. The main loop repeatedly asks the user to enter A or B, then calls nextCharacter(). That method creates a UTF-8 Scanner for System.in, reads a complete line, returns its first character in an Optional, or returns Optional.empty() for an empty line.
Porter points out that nextCharacter() actually reads the first character of the next line, so its name is imprecise. Scanner is also a full parser for common input types, which makes it heavy for this task. The larger construction uses Map.Entry objects as improvised tuples. Porter notes that standard Java does not provide general-purpose tuples, and that tuple support in the javax namespace associated with Enterprise Edition is uncertain. The article treats the design as an extreme example of overengineering, delivered to a beginner as a lesson in reading one character.




Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Nothing arrived? Check your spam folder — and mark the mail as "Not spam" so it lands in your inbox next time.