Implementing Design Patterns Using Java 8 Lambda
Being able to design simple and fluent API to make your business applications easier to read is what you will get by following this course. All the tools brought by Java 8 to implement the standard Design Patterns are covered with many live demos.
What you'll learn
As a Java developer, mastering the standard design patterns from the Gang of Four book allows you to create better business applications, more robust and easier to maintain in the long run. In this course, Implementing Design Patterns Using Java 8 Lambda, you will learn how you can leverage the tools Java 8 added to the platform to write better code: easier to read and with better performances. These tools bring several functional programming paradigms to the Java language: function chaining and composition, and partial application. First, you will study how these tools have been used to improve the JDK itself through several examples including the Comparator API. Then you will see how you can use the same approach to implement several patterns on live demo examples, including the Factory, the Builder, the Singleton, and the Registry, following the principles of clean code. You will even implement the Visitor pattern in a functional and non-intrusive way. Finally, you will apply those principles to create your own Validator, purely functional and fluent. Mastering these techniques will help you creating performant, readable and versatile Java applications.
Table of contents
- Version Check 0m
- Introducing the Course: Designing API with Functional Interfaces 2m
- Who Are You? What Should You Know to Follow this Course? 2m
- Introducing the Agenda of the Course and This Module 2m
- Creating Default Methods to Chain Consumers as Lambda Expressions 6m
- Implementing the Consumer.andThen Method to Chain Consumers 2m
- Preventing the Chaining of Corrupted Lambdas Using Exceptions 3m
- Wrapping up the Use of Default Methods to Chain Lamdbas 1m
- Leveraging Default Methods to Combine Predicates 4m
- Implementing the Predicate.and Logical Operator 3m
- Negating a Predicate with a Predicate.negate Default Method 3m
- Wrapping up the Use of Default Methods to Combine Lamdbas 1m
- Setting up the Generic Types of a Chained Function 5m
- Implementing the Chaining of Functions with Default Methods 2m
- Understanding the Difference between Chaining and Composing 4m
- Using Static Methods on Functional Interfaces to Create Lambdas 2m
- Checking the Real Functional Interfaces from the JDK 2m
- Module Wrap Up 3m
- Introducing the Module and Its Agenda 2m
- Writing a Comparator of Person Comparing Their Names 4m
- Creating a Factory Method of Comparators Using a Key Extractor 3m
- Reversing a Comparator with the Use of a Default Method 2m
- Making the Factory Method Generic to Accept Any Comparable Object 4m
- Wrapping up the Creation of Comparators Using Key Extractors 1m
- Leveraging Default Methods to Combine Comparators 5m
- Improving the Design of the API to Make It Fluent 3m
- Checking the Real Comparator Interface from the JDK 1m
- Module Wrap Up 3m
- Introducing the Module and Its Agenda 2m
- Creating a Factory by Extending the Supplier Functional Interface 5m
- Adding Functionalities to a Factory Using Default Methods 2m
- Extending the Factory to Handle Constructor with Parameters 4m
- Making the Factory Fluent Using Generics and Method References 5m
- Updating the Factory to Implement the Singleton Pattern 1m
- Wrapping up the Factory and Singleton Patterns Using Lambdas 2m
- Introducing the Registry and the Builder Pattern 3m
- Designing an API to Create a Registry Using the Builder Pattern 3m
- Introducing the Registry and the Builder Examples 2m
- Writing the Registration of a Factory Using a Consumer of Builder 6m
- Making the Registry Functional to Implement It Using a Lambda 2m
- Testing the Registry to Create Different Kind of Shapes 2m
- Controlling Missing Keys with Exceptions Defined at the API Level 5m
- Wrapping up the Registry and Builder Built with Lambda Example 1m
- Module Wrap Up 2m
- Introducing the Module and Its Agenda 1m
- Adding Operations on Classes Using the Visitor Pattern 2m
- Organizing a Simple Object Model to Implement the Visitor Pattern 2m
- Writing a Visitable Set of Classes along with a Visitor 2m
- Adding Methods on a Class without Changing It Using Lambdas 1m
- Writing the Lambda Visitor Pattern on the Car Model Object 3m
- Adding the Static and Default Methods for the Pattern to Compile 3m
- Implementing the Registry of Types to Be Visited and Functions 3m
- Running the Pattern with the Initialized Registry 3m
- Adding a Second Element to the Registry: A First Version 4m
- Fixing the Multi Element Registry with the Chaining of Consumers 7m
- Making this Visitor Pattern Type Safe Using Gnerics 8m
- Module Wrap Up 2m
- Introducing the Module and Its Agenda 1m
- Setting up a Person Bean with Two Validation Rules 2m
- Understanding the Validation Rules and Setting up Examples 2m
- Writing the Validator Pattern in the Case of a Person Bean 2m
- Implementing the Validator Interface in the Case of a Valid Bean 3m
- Extending the Validator to Handle One Violated Rule 2m
- Introducing the SuppressedExceptions to Wrap Exceptions Together 3m
- Handling Several Exceptions with the Suppressed Exceptions 7m
- Module and Course Wrap Up 4m