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.

Location, current course term

Contact us

Custom Customized Training (date, location, content, duration)

The course:

Hide detail
  • 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
Assumed knowledge:
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 AM - 5:00 PM )
Course price:
384.00 € ( 464.64 € incl. 21% VAT)
Language:

Vybrané zákaznické reference

O2 IT Services s.r.o., Jiří K.
Java Clean Code: How to Write Clean Code in Java ( JAV6)
"Za mě naprosto spokojenost jak s probranou látkou, tak s výkladem jako takovým. Cvičení byly dostatečně dovysvětleny a byla to i dle mého názoru dostatečná výzva aby se člověk zdokonalil v tématice. Děkuji :)"
O2 IT Services s.r.o., Lukáš S.
Java Clean Code: How to Write Clean Code in Java ( JAV6)
"Celkovy dojem super, lektor ochotny, zkuseny; temata, priklady i vyklad zamerene na praxi"
Quadient Technologies Czech s.r.o., Zdeněk M.
Java Clean Code: How to Write Clean Code in Java ( JAV6)
"Nachystaný projekt byl super, všechno dobře vysvětleno, příklady byly lehce pochopitelné"