We may earn an affiliate commission when you visit our partners.
Course image
Academind by Maximilian Schwarzmüller and Maximilian Schwarzmüller

As a developer, you should be able to write code which works - of course.

A lot of developers write bad code nonetheless - even though the code works. Because "working code" is not the same as "clean code".

Read more

As a developer, you should be able to write code which works - of course.

A lot of developers write bad code nonetheless - even though the code works. Because "working code" is not the same as "clean code".

This course teaches you how to write clean code - code that is easy to read and understand by humans, not just computers.

In this course, you'll learn what exactly clean code is and, more importantly, how you can write clean code. Because if your code is written in a clean way, it's easier to read and understand and therefore easier to maintain.

Because it's NOT just the computer who needs to understand your code - your colleagues and your future self needs to be able to understand it as well.

In this course, we'll dive into all the main "pain points" related to clean code (or bad code - depending on how you look at it) and you will not just learn what makes up bad code but of course also how to turn it into clean code.

Specifically, you will learn about:

  • Naming "things" (variables, properties, classes, functions, ...) properly and in a clean way

  • Common pitfalls and mistakes you should avoid when naming things

  • Comments and that most of them are bad

  • Good comments you might consider adding to your code

  • Code formatting - both horizontal and vertical formatting

  • Functions and how to limit the number of function parameters

  • How to write clean functions by focusing on "one thing"

  • How levels of abstraction help you split functions and keep them small

  • How to write DRY functions and avoid unexpected side effects

  • Avoiding deeply nested control structures with guards and by extracting functionality into functions

  • Errors and error handling as a replacement for if-statements

  • Objects & data containers/ data structures and why that differentiation could matter

  • Cohesion and how to write good (small. ) classes

  • The Law of Demeter and why it matters for clean code

  • What the SOLID principles are and why they matter when it comes to writing clean code

  • Much more.

This course is a compilation of common patterns, best practices, principles and rules related to writing clean code.

In this course, you'll learn about a broad variety of concepts, rules, ideas, thoughts and principles and by the end of course, you'll have a good idea of what to keep in mind when it comes to writing clean code.

This is not a design patterns or general patterns course though - we will entirely focus on patterns, rules and concepts that help with writing clean code specifically.

All these concepts and rules are backed up by examples, code snippets and demos. And to ensure that you get the most out of this course, and you don't just learn a bunch of theory which you forget soon after, there also are plenty of challenges for you to apply what you learned.

This course uses Python, JavaScript and TypeScript for code examples but you don't need to know these languages to follow along and get a lot out of the course. In addition, the course does not focus on a specific programming style or paradigm (like functional programming, object-oriented programming etc) but instead covers general concepts and techniques which will always apply.

What are the course prerequisites?

  • Basic programming knowledge (no matter which language) is required.

  • You don't need to know any specific programming language or programming paradigm to follow along

  • NO prior experience with writing clean code is required

Enroll now

What's inside

Learning objectives

  • Learn how to write code which is readable and understandable
  • Keep code alive by increasing maintainability with clean code
  • Learn about key principles, rules and concepts that allow you to write clean code
  • Learn with hands-on examples and "bad to good code" transformations

Syllabus

Let me introduce you to this course, the topic of "clean code", what exactly "clean code" is, what "bad code" is and what you're going to learn in this course!
Read more
Welcome to the Course!
What is "Clean Code"?
Clean Code - Key Pain Points & How To Write Clean Code
How Is This Course Structured?
Course Prerequisites
Clean Code & Strongly Typed Languages
About The Course Code Examples
Join Our Learning Community!
Functional, OOP, Procedural: The Course Concepts Always Apply!
Clean Code, Principles & Patterns & Clean Architecture
Clean Code vs Quick Code
Module & Course Resources
Learn how to name things properly. That includes naming variables, constants, properties, functions, methods, classes and more. Good naming is a key part of writing clean code!
Module Introduction
Why Good Names Matter
Choosing Good Names
Casing Conventions & Programming Languages
Naming Variables & Properties - Theory
Naming Variables & Properties - Examples
Naming Functions & Methods - Theory
Naming Functions & Methods - Examples
Naming Classes - Theory
Naming Classes - Examples
Exceptions You Should Be Aware Of
Common Errors & Pitfalls
Demo Time!
Your Challenge - Problem
Your Challenge - Solution
Module Resources
Learn how to structure and format code correctly and learn about bad and good comments and why you should typically avoid adding comments.
Bad Comments
Good Comments
What is "Code Formatting" Really About?
Vertical Formatting
Formatting: Language-specific Considerations
Horizontal Formatting
Learn how to write clean, short, concise and focused functions / methods. Learn how many parameters you should use and how much code you should keep in a function body.
Analyzing Key Function Parts
Keep The Number Of Parameters Low!
Refactoring Function Parameters - Ideas & Concepts
When One Parameter Is Just Right
Two Parameters & When To Refactor
Dealing With Too Many Values
Functions With A Dynamic Number Of Parameters
Beware Of "Output Parameters"
Functions Should Be Small & Do One Thing!
Why "Levels of Abstraction" Matter
When Should You Split?
Demo & Challenge
Stay DRY - Don't Repeat Yourself
Splitting Functions To Stay DRY
Don't Overdo It - Avoid Useless Extractions
Understanding & Avoiding (Unexpected) Side Effects
Side Effects - A Challenge
Why Unit Tests Matter & Help A Lot!
Learn how to avoid deeply nested if-statements, how to write clean code with control structures in general and how to utilize "real errors" and error handling.
Useful Concepts - An Overview
Introducing "Guards"
Guards In Action
Extracting Control Structures & Preferring Positive Phrasing
Extracting Control Structures Into Functions
Writing Clean Functions With Control Structures
Inverting Conditional Logic
Embrace Errors & Error Handling
Creating More Error Guards
Extracting Validation Code
Error Handling Is One Thing!
Using Factory Functions & Polymorphism
Working with Default Parameters
Avoid "Magic Numbers & Strings"
Module Summary
Learn what makes up objects and data containers and how to work with objects and classes in a clean way.
Important: This is NOT an OOP or "Patterns & Principles" Course!
Objects vs Data Containers / Data Structures
Why The Differentiation Matters
Classes & Polymorphism
Classes Should Be Small!
Understanding "Cohesion"
The "Law Of Demeter" And Why You Should "Tell, Not Ask"
The SOLID Principles
The Single-Responsibility-Principle (SRP) & Why It Matters
The Open-Closed Principle (OCP) & Why It Matters
The Liskov Substitution Principle
The Interface Segregation Principle
The Dependency Inversion Principle
Let me summarize what you learned and walk you through the key concepts again. I also got a "checklist" (kind of) for you.
Concepts Summary & Checklist
Let me round up the course and explore some possible next steps with you!
Staying Clean!

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Develops skills and concepts that are essential to software engineering: the principles and practices of writing software code that is easy to understand, maintainable, and bug-free
Examines concepts that are not bound to one programming paradigm, but instead can be used in many languages including Python, JavaScript, and TypeScript
Taught by Maximilian Schwarzmüller of Academind, an expert in software development and a respected instructor
Offers a comprehensive overview of the key concepts of clean coding, from naming conventions to object-oriented design
Includes interactive challenges and examples to reinforce learning
This course is recommended for students with some prior programming experience

Save this course

Save Clean Code to your list so you can find it easily later:
Save

Reviews summary

Clean code essentials

learners say this course on clean coding is largely positive. It presents concepts related to writing clean code in an accessible and engaging way, emphasizing the importance of good coding practices and providing practical examples to illustrate the principles discussed. The course receives praise for its clear explanations, well-organized structure, and use of real-world examples to demonstrate the application of clean code principles. According to students, the course is well-suited for developers of all experience levels, providing a solid foundation in clean coding principles and offering valuable insights for experienced developers looking to enhance their skills. The instructor's expertise and ability to convey complex concepts in a straightforward manner are highly appreciated. Overall, learners report that the course is effective in helping them write cleaner, more maintainable, and readable code.
Using descriptive and consistent naming conventions enhances code readability and makes it easier to understand the intent of variables, functions, and classes.
"I liked the sections on function - level of abstraction, control structures - guards, extracting methods, using factory functions and polymorphism, Classes - Single responsibility principle."
Using guards to handle different cases and avoid deeply nested code improves code readability and reduces the risk of bugs.
"The explanation of SOLID was excellent and would help anyone especially using OO but I think the explanation of guards is what will make your code less buggy and what should have been made more clear is that using guards will cut down the number of bugs in your program substantially because of errors caused by too many nested if clauses."
Writing code that is easy to read and understand by others improves code maintainability and collaboration.
"The course is well-suited for developers of all experience levels, providing a solid foundation in clean coding principles and offering valuable insights for experienced developers looking to enhance their skills."
Implementing clean coding practices, such as modularity and low coupling, makes code easier to maintain, extend, and refactor in the future.
"The emphasis on maintainability and writing code that can be easily understood by others is a valuable aspect of the course."
Applying SOLID principles (Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion) promotes loose coupling, high cohesion, and maintainability in code.
"The explanation of SOLID was excellent and would help anyone especially using OO but I think the explanation of guards is what will make your code less buggy and what should have been made more clear is that using guards will cut down the number of bugs in your program substantially because of errors caused by too many nested if clauses."
"The sections on open closed principle, dependency inversion principles, law of demeter explained properly. I wish the tutor could either explain these with more details and take his time to explain the examples or pick better examples."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Clean Code with these activities:
Read Clean Code
Review key concepts and principles of writing clean code to prepare for the course.
View CLEAN CODE on Amazon
Show steps
  • Purchase and read the book.
  • Take notes on key concepts and principles of clean code.
  • Apply these concepts to your own code.
Code Refactoring Challenges
Practice refactoring code to improve readability and maintainability.
Browse courses on Code Refactoring
Show steps
  • Find online code refactoring challenges.
  • Attempt to refactor the code according to clean code principles.
  • Review your refactoring with an experienced developer.
Pair Programming with a Clean Code Expert
Collaborate with an experienced developer to enhance your clean coding practices through pair programming.
Browse courses on Pair Programming
Show steps
  • Find a clean code expert willing to pair with you.
  • Work together on a coding project, taking turns writing and reviewing code.
  • Discuss clean code principles and best practices throughout the session.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Follow Tutorials on SOLID Principles
Enhance your knowledge of SOLID principles through guided tutorials to improve code design and maintainability.
Browse courses on SOLID Principles
Show steps
  • Identify reputable tutorials on SOLID principles.
  • Follow the tutorials and take notes on key concepts.
  • Apply the principles to your own codebase.
Participate in Code Clean-Up Competitions
Put your clean code skills to the test and gain valuable feedback by participating in code clean-up competitions.
Browse courses on Clean Code
Show steps
  • Find and register for reputable code clean-up competitions.
  • Refactor and optimize code according to clean code principles.
  • Submit your code and receive feedback from experts.
Write a Blog Post on Clean Code
Reinforce your understanding of clean code by writing a blog post about its principles and benefits.
Browse courses on Clean Code
Show steps
  • Choose a specific aspect of clean code to focus on.
  • Research and gather information about the topic.
  • Write a blog post that explains the concepts clearly and concisely.
  • Get feedback on your blog post from other developers.
Develop a Clean Code Style Guide
Establish a consistent coding style within your team or organization by creating a comprehensive clean code style guide.
Browse courses on Clean Code
Show steps
  • Review existing clean code style guides and best practices.
  • Define specific coding conventions and guidelines.
  • Document the style guide clearly and concisely.
  • Distribute the style guide to team members or stakeholders.

Career center

Learners who complete Clean Code will develop knowledge and skills that may be useful to these careers:
Software Architect
A Software Architect designs and develops the overall architecture of software systems. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Software Architects can write code that is easier to read and maintain, which can improve the quality and performance of software systems.
Software Engineer
A Software Engineer designs, develops, tests, and maintains software systems for various purposes. The course, Clean Code, helps build a foundation for a Software Engineer, as the course teaches how to write clean, maintainable, and readable code. Additionally, Software Engineers can benefit from understanding the SOLID principles and how to apply them in their work.
Agile Software Developer
An Agile Software Developer uses agile development methodologies to design, develop, and test software applications. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Agile Software Developers can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of agile software development.
DevOps Engineer
A DevOps Engineer combines software development and operations to improve the efficiency and reliability of software delivery. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, DevOps Engineers can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of software delivery.
Computer Scientist
A Computer Scientist researches and develops new computing technologies and applications. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Computer Scientists can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of their research and development.
Systems Analyst
A Systems Analyst analyzes and designs computer systems to meet the needs of businesses and organizations. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Systems Analysts can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of computer systems.
Web Developer
A Web Developer designs and develops websites and web applications. The course, Clean Code, may be useful to this role, as the course teaches how to write clean and maintainable code. By understanding the principles of clean coding, Web Developers can write code that is easier to read and maintain, which can improve the quality and performance of websites and web applications.
Data Scientist
A Data Scientist collects, analyzes, and interprets data to identify trends and patterns, and to make predictions for businesses. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Data Scientists can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of data analysis and prediction.
Cloud Engineer
A Cloud Engineer designs and implements cloud computing solutions for businesses and organizations. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Cloud Engineers can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of cloud computing solutions.
Quality Assurance Analyst
A Quality Assurance Analyst ensures that software and applications meet quality standards throughout the software development process. The course, Clean Code, may be useful for a Quality Assurance Analyst, as the training teaches how to write clean code and avoid common pitfalls. By understanding how to identify and fix code issues, Quality Assurance Analysts can improve the quality of software products and ensure that they meet customer requirements.
Information Security Analyst
An Information Security Analyst protects computer systems and networks from unauthorized access and cyber threats. The course, Clean Code, may be useful to this role, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Information Security Analysts can write code that is easier to read and maintain, which can improve the security and integrity of computer systems and networks.
Data Analyst
A Data Analyst collects, analyzes, and interprets data to identify trends and patterns, and to make recommendations for businesses. The course, Clean Code, may be useful for a Data Analyst, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Data Analysts can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of data analysis.
Database Administrator
A Database Administrator designs, implements, and maintains database systems to ensure the integrity and security of data. The course, Clean Code, may be useful for a Database Administrator, as the training teaches how to write clean, maintainable, and readable code. By understanding the principles of clean coding, Database Administrators can write code that is easier to read and maintain, which can improve the efficiency and effectiveness of database systems.
Technical Writer
A Technical Writer creates documentation for software, hardware, and other technical products. The course, Clean Code, may be useful to this role, since Technical Writers need to be able to understand and explain complex technical concepts. By understanding the principles of clean coding, Technical Writers can write documentation that is easier to read and understand, which can improve the usability and effectiveness of technical products.
Software Developer
A Software Developer designs, builds, and maintains applications or programs for businesses and individuals. The course, Clean Code, may be useful to this role, because as a Software Developer, your code is a representation of you, your team, and your business. Clean code is not just about writing code that works, but writing code that makes sense. By understanding the principles and techniques of clean coding, Software Developers can write code that is easier to read, maintain, and debug.

Reading list

We've selected 13 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Clean Code.
This classic text on clean code can be used as both a supplemental and a foundational resource for programmers of all experience levels and in all industries.
This classic work describes the most important design patterns used in object-oriented programming.
This approachable book will help readers learn the essential concepts of design patterns in an intuitive and practical manner.
Can be used as a general reference guide on software engineering, as it covers a wide range of topics related to the field, including coding standards, unit testing, and debugging.
Provides a comprehensive overview of software testing and can be used by course participants who wish to learn more about the topic.
Provides a set of best practices for software architecture and can be used to supplement the course's focus on clean code.
Provides a practical introduction to test-driven development (TDD) and can be used by course participants to learn more about this important topic.
Can be used by participants as a foundational resource as it covers a wide range of topics related to software engineering ethics and best practices.
Classic work on software engineering and can be used by participants to gain a deeper understanding of the challenges of software development and how to overcome them.
Provides a detailed overview of domain-driven design (DDD) and can be used by participants to gain a deeper understanding of this approach to software development.
Provides a practical guide to agile development in C# and can be used by participants who are interested in learning more about this topic.
Provides a thorough introduction to the Java programming language and can be used by participants who are new to Java or who want to refresh their knowledge of the language.

Share

Help others find this course page by sharing it with your friends and followers:
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser