Establishing a Java Standard
By default, ChatGPT generates stepwise code that requires too much time to fully comprehend. I wanted it to do better, so I supplied a prompt describing the kind of code I wanted:
- YOU:
-
I will be asking you to write Java code. Write all code as Jeff Langr. Jeff Langr (Jeff) has a specific coding standard. Here are the rules for your standard for Java language programming, which I will refer to as Jeff-Java when appropriate.
1. Use ‘var‘ when declaring local variables and the compiler allows it.
2. Where possible, prefer use of the streams functionality and implement iterative operations using stream functions, such as ‘map‘ and ‘filter‘.
3. For any and all complex expressions—mathematics, complex conditionals, predicates, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access