Java Coding Practices

Paths

Java Coding Practices

Authors: Andrejs Doronins, Dan Geabunea

Writing clean and maintainable code is a skill every developer needs to know how to do. Clean code is easier to extend, lowers maintenance cost over time and is easier to work... Read more

What you will learn

  • Naming conventions for classes, methods and variables
  • How to write methods that are maintainable and easily understood
  • Class and code organization strategies
  • Defensive coding practices
  • Strategies for refactoring code
  • The SOLID principles and their application

Pre-requisites

Knowledge of the Java programming language

Beginner

Writing high quality code starts with writing clean code. In this section you will learn how to write code that is clean and maintainable by using good naming conventions, writing better methods and organizing your classes properly. Then you will learn how to write code that is more robust by learning the best practices around defensive coding.

Java: Writing Readable and Maintainable Code

by Andrejs Doronins

Apr 15, 2019 / 2h 24m

2h 24m

Start Course
Description

Most software is built to last a long time, and one of the key challenges is to keep technical debt at bay. Applying fundamental principles of clean code is crucial to the long-term success of any software project. In this course, Java: Writing Readable and Maintainable Code, you will gain the ability to write high quality code that others will enjoy reading and working with. First, you will learn the importance of naming and how to choose great names for your classes, variables, and methods. Next, you will discover the pitfalls of Java constructors, methods, tests, comments, and exception handling before examining how you can either prevent or overcome them. Finally, you will learn some hands-on practical tips on how you can maintain the top quality of your code. By the end of this course, you will have the necessary skills to write clean, readable and maintainable code that human beings can read and understand clearly.

Table of contents
  1. Course Overview
  2. Clean and Maintainable Code Concepts
  3. Naming Matters
  4. Better Constructors
  5. Implementing Methods
  6. Handling Exceptions
  7. Class Organization
  8. Writing Comments
  9. Improving Tests
  10. Maintaining Clean Code

Defensive Coding in Java

by Andrejs Doronins

Nov 13, 2019 / 2h 1m

2h 1m

Start Course
Description

At the core of software development is a thorough knowledge of troubleshooting and debugging, but it is hardly "fun". It is better to prevent bugs, or at least react to them as early as possible. In this course, Defensive Coding in Java, you'll learn how to write safer and more robust software. First, you'll learn the concept of failing early and how to effectively use a variety of guard clauses in both methods and constructors. Next, you'll explore a set of very popular helper libraries that will make your defensive code more concise and elegant. Then, you'll see how important it is to return predictable and understandable values from your methods and you'll learn how to choose and implement them. Finally, you'll discover a variety of defensive techniques that are often overlooked, yet they greatly contribute to the overall software quality. When you're finished with this course, you'll have the necessary skills to write code that is more reliable and easier to maintain.

Table of contents
  1. Course Overview
  2. Why Defensive Coding Matters
  3. Validating Method Input
  4. Using Frameworks for Validation
  5. Improving Method Return Values
  6. Using Other Defensive Practices

Intermediate

Refactoring is the process of changing the structure of code to be more readable and maintainable without altering its underlying functionality. It is also a critical skill to develop so you can transform messy code into clean code when called upon, which you will learn to do in this section.

Java Refactoring: Best Practices

by Andrejs Doronins

Jul 16, 2019 / 2h 8m

2h 8m

Start Course
Description

Technical debt grows with the size of any software project. Without refactoring it will eventually fail, thus refactoring may be considered an essential skill of any professional software engineer. In this course, Java Refactoring: Best Practices, you will learn how to efficiently refactor and produce cleaner software. First, you will see what code smells are, and why they are bad for your codebase. Then, you will explore how to recognize and refactor them using a variety of techniques to achieve cleaner and more maintainable code. Finally, you will discover the most important principles that apply to refactoring and clean code. By the end of this course, you will have the necessary skills to convert a mess into flexible and robust software, one line at a time.

Table of contents
  1. Course Overview
  2. Why Refactoring Matters
  3. Splitting Bloaters
  4. Fixing Object-oriented Abusers
  5. Dealing with Change Preventers
  6. Refactoring Couplers
  7. Removing Dispensables
  8. Refactoring Tips and Principles

Advanced

Are you a SOLID developer? By applying the SOLID principles to the code you write, you will write code that is easier to understand, maintain and extend. The course in this section will teach you what you need to know to implement these principles in your code.

SOLID Software Design Principles in Java

by Dan Geabunea

Jun 25, 2019 / 2h 0m

2h 0m

Start Course
Description

All software developers know the burden of working with brittle systems that acquire lots of technical debt over time. Those applications are fragile, rigid, and almost impossible to evolve. In this course, SOLID Software Design Principles in Java, you will gain the ability to create applications that are less coupled, easier to test, and more maintainable. First, you will learn why it is better to keep your methods and classes small and focused. Next, you will discover how to effectively extend functionality and create correct relationships between your classes. Finally, you will explore how to design proper interfaces and how to decouple your system by depending on abstractions. When you are finished with this course, you will have the skills and knowledge needed to build robust, maintainable applications in Java.

Table of contents
  1. Course Overview
  2. Saving the Day with SOLID
  3. Understanding the Single Responsibility Principle (SRP)
  4. Evolving Code with the Open Closed Principle (OCP)
  5. Applying Liskov Substitution Principle (LSP)
  6. Modularizing Abstractions with the Interface Segregation Principle (ISP)
  7. Decoupling Components with the Dependency Inversion Principle (DIP)