Java Clean Code: How to Write Clean Code in Java (JAV6)

Programming, Java, Spring

This course is for Java developers who know the basics and already work on commercial team projects. Through hands-on reviews you will learn to recognize poor code patterns, explain why they fail and adopt practices for robust software, focusing on Java, maintainability and teamwork.

You will learn to spot and fix anti-patterns, write small, single-purpose functions and meaningful names, use tests, exceptions and refactoring to reduce defects and duplication. The course emphasizes readability, automated testing and sustainable design while improving craftsmanship.

THIS TRAINING COURSE WILL HELP YOU:

  • Identify and explain poorly written Java code
  • Write clear, small functions and meaningful names
  • Use unit tests (JUnit, Mockito) and TDD practices
  • Apply design principles for maintainable systems

WHO SHOULD ATTEND?

  • Java developers with basic language skills
  • Developers working on commercial team projects
  • Engineers who want to improve code quality and tests

COURSE LOCATION AND AVAILABLE DATES



Public courses are usually delivered in Czech, but this course is also available in English. We can arrange private training for your team online, at your premises or in our classrooms, and tailor the content to your needs.

For groups of around 4 or more participants, private training can already be comparable in price to booking individual places on a public course. Send us your requirements and we’ll recommend the best format and provide an exact quote.

Request training in English

Course content:

Hide details
  • Clean Code
    1. What is bad code and its consequences for a project
    2. The Boy Scout Rule, Javadoc @author
  • Meaningful names
    1. Names that reveal intent; pronounceable and searchable names
    2. Class and method names; how to avoid confusion and ambiguity
    3. Use domain terms; one word per concept rule
    4. Meaningful and justified context
  • Functions
    1. Small, single-purpose functions; one level of abstraction
    2. Function parameters: one, two and many parameters
    3. Side effects and unintended behavior of functions
    4. Exceptions vs error codes; correct use of switch
    5. DRY principle; preventing code duplication
  • Comments
    1. Prefer documenting by writing clear code
    2. Examples of good comments
    3. Examples of bad comments
  • Code formatting
    1. Purpose of formatting and team formatting rules
    2. Vertical formatting
    3. Horizontal formatting
  • Handling error states
    1. Use exceptions; start with try-catch-finally pattern
    2. Unchecked exceptions; add context for the caller
    3. Principle of not returning or passing null
  • System boundaries
    1. Using third-party code; the Adapter design pattern
    2. Discovering system boundaries; learning tests; keeping boundaries clear
  • Unit tests
    1. The three laws of TDD; BDD
    2. Clean tests: one test per concept; refactoring tests
    3. Using JUnit, Mockito and AssertJ
  • Classes
    1. Class organization; small classes; structure ready for change
    2. Single Responsibility Principle (SRP)
    3. Objects vs data structures; the Law of Demeter
  • Systems
    1. Separate system construction from usage; separate responsibilities
    2. Scaling, AOP, optimizing decision logic
    3. Test-driven system architecture design
  • Parallel processing
    1. When concurrency makes sense; challenges of parallelism
    2. Defensive programming for concurrency
    3. Importance of understanding chosen technology and computation models
    4. Rules for small critical sections; issues with shutdown routines
    5. Testing multithreaded code
Prerequisites:
Participants must have basic Java knowledge; prior commercial team project experience is recommended.
Recommended previous course:
Java – Introduction to Programming (JAV1)
Schedule:
2 days (9:00-17:00)
Price per person:
384.00 € ( 464.64 € incl. 21% VAT)

Training and learning environment