Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Clean Code with Java examples
Rating: 4.5 out of 5(108 ratings)
12,424 students

Clean Code with Java examples

In this Clean Code Java course you will learn useful software principles that you can use in your every day programming.
Created byLiviu Oprisan
Last updated 1/2026
English

What you'll learn

  • How to write clean code
  • How to keep your functions small
  • How to name your variables, functions and classes
  • How many parameters a function should have
  • What to do about boolean, nullable and return parameters
  • How clean code affected MVC
  • How to beautify predicates
  • Why comments are bad and when you can use them
  • The difference between an OOP object and a Data Structure Object
  • What kind of exceptions to use
  • Why composition is good and inheritance is bad
  • What are the symptoms of bad code
  • What state is and why it's important
  • Why your code should have low coupling and high cohesion
  • How to avoid spaghetti code
  • What are Command and Query separation, Tell Don't Ask and The Law of Demeter
  • The test pyramid and TDD
  • How over-engineering is not a solution to bad code

Course content

6 sections28 lectures2h 3m total length
  • Why this course2:25
  • Clean code: From Art to Science2:48

    In this video I explain what clean code is and how I started to be interested in it.

  • What people say4:39

    In episode 2 of the Clean Code course I talk about what people say related to clean code.

  • Let's look at some code3:03

    In this video I take a look at samples of code: some bad code and some good/clean code.

  • Empathy3:12

    In this episode I talk about why empathy is important for clean code.

    I also recommend to check out what Robert C. Martin (Uncle Bob) has in the area of clean code.

Requirements

  • You have to know the basics of writing code (in a language like Java, or PHP, or Python or C#)

Description

This is a course about useful clean code principles.
My aim is to teach you concepts that you can use every time you write code.
In the last section I also provide a file to put in your AI agent context to help it write more maintainable code.

The course has Java examples and I sometimes mention things like Spring and Lombok.
The same clean code principles apply also to PHP, C# and Python.

What can this course do for you?

It can save your company and yourself a lot of development time and therefore a lot of money.
How?
Bad code practices can make development very slow on your medium and big projects.
This means a lot of money wasted on development time.
This type of projects are also remarkably unpleasant to work on.
This course helps you avoid this by using clean code principles. 

The course is structured in 4 parts:

1. Introduction - where we discuss what is clean code and why it's important

2. Small Functions - I gave small functions an entire section because I think its one of the most important principles of clean code, together with small classes, Single Responsibility Principle and Not crossing Different Levels of Abstraction.

3. Clean code: Fundamental Principles - I discuss here about fundamental things like method and variables names, parameters, comments and exceptions

4. Clean code: Advanced Principles - Here I talk about more abstract topics like the difference between an OOP Object and a Data Structure Object, Composition over Inheritance, Symptoms of Bad Code, State, Low Coupling - High Cohesion, Command and Query Separation, Tell Don't Ask, The Law of Demeter and more.

The course also contains some memes because you can't spell clean code without fun.

I tried to focus on things you can use every day when programming and stay away from barren theory. 
There's no point wasting our time with useless knowledge that would just seem like it's helping you as a programmer, but that you will forget in 2 weeks.
If that would have been the point, this would be a 10 hours course about programming patterns.
But it isn't.

I tried to make the course full of useful information but not too long. 
If you invest as little as two hours of your life in this course, about the time you would spend watching a movie, you will become a much better developer.

Who this course is for:

  • Starter developers that want to learn clean code to write maintainable applications
  • Intermediate developers that want to improve their clean code skills
  • Senior developers that want to fine tune their clean code mastery and like programming principles