Java Best Practices
Are you frustrated or slowed down by messy code? Make sure you don't write such code yourself! This course will teach you how to write clean, readable, and maintainable code that human beings can read and understand clearly.
What you'll learn
Most software is built to last a long time, and one of the key challenges is to keep technical debt at bay. Applying programming best practices is crucial to the long-term success of any software project. In this course, Java Best Practices, 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 best practices for creating objects, implementing methods, and the multiple constructs that are involved. Then, you will explore higher-level practices of clean code that go beyond a single class. Finally, you will learn hands-on practical tips to write better automated tests. 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
- Introduction 1m
- Adhere to the CQS Principle 2m
- Keep Your Parameter List Short 3m
- Demo: Reducing the Parameter List 4m
- Demo: Removing Flag Arguments 5m
- Prefer Enums Where Appropriate 2m
- Demo: Replace String with LocalDate 1m
- Failing Fast in Methods 1m
- Null Objects - the Next Level 2m
- Reducing Verbosity with var 5m
- Avoiding Unnecessary Object Creation 1m
- Returning Proper Values 4m
- Prefer the Optional 3m
- Module Summary 2m
- Introduction 1m
- Catch Specific Exceptions 2m
- Some RuntimeExceptions Shouldn't Be Caught 1m
- It's OK to Catch Some RuntimeExceptions 4m
- The Rules of the Catch Block 2m
- Translate Exceptions 2m
- Pass Pertinent Information 4m
- Use Multi-catch Where Appropriate 1m
- Prefer try-with-resources 3m
- Module Summary 1m
- Introduction 3m
- Poor Name Tests 4m
- Demo: Fixing Poor Name Tests 2m
- Clueless Tests 4m
- Demo: Making Tests More Focused 2m
- DRY vs. DAMP 2m
- Demo: DRY vs. DAMP 3m
- Consider Using Libraries 1m
- The Benefit of Helpful Messages 1m
- Demo: Writing Helpful Messages 2m
- Making Tests Independent 2m
- Favor Composition in Test Infrastructure 2m
- Demo: Refactoring to Composition 1m
- Further Study 1m
- Module Summary 1m