Implementing Design Patterns Using Java 8 Lambda

Implementing Design Patterns Using Java 8 Lambda

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 3h 08m | 505 MB

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.

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

Course Overview
1 Course Overview

Introducing Default Methods to Chain and Compose Functions
2 Introducing the Course – Designing API with Functional Interfaces
3 Who Are You – What Should You Know to Follow this Course –
4 Introducing the Agenda of the Course and This Module
5 Creating Default Methods to Chain Consumers as Lambda Expressions
6 Implementing the Consumer.andThen Method to Chain Consumers
7 Preventing the Chaining of Corrupted Lambdas Using Exceptions
8 Wrapping up the Use of Default Methods to Chain Lamdbas
9 Leveraging Default Methods to Combine Predicates
10 Implementing the Predicate.and Logical Operator
11 Negating a Predicate with a Predicate.negate Default Method
12 Wrapping up the Use of Default Methods to Combine Lamdbas
13 Setting up the Generic Types of a Chained Function
14 Implementing the Chaining of Functions with Default Methods
15 Understanding the Difference between Chaining and Composing
16 Using Static Methods on Functional Interfaces to Create Lambdas
17 Checking the Real Functional Interfaces from the JDK
18 Module Wrap Up

Using Function Composition and Chaining to Build Comparators
19 Introducing the Module and Its Agenda
20 Writing a Comparator of Person Comparing Their Names
21 Creating a Factory Method of Comparators Using a Key Extractor
22 Reversing a Comparator with the User of a Default Method
23 Making the Factory Method Generic to Accept Any Comparable Object
24 Wrapping up the Creation of Comparators Using Key Extractors
25 Leveraging Default Methods to Combine Comparators
26 Improving the Design of the API to Make It Fluent
27 Checking the Real Comparator Interface from the JDK
28 Module Wrap Up

From Factory and Registry to Builder Using Lambda Expressions
29 Introducing the Module and Its Agenda
30 Creating a Factory by Extending the Supplier Functional Interface
31 Adding Functionalities to a Factory Using Default Methods
32 Extending the Factory to Handle Constructor with Parameters
33 Making the Factory Fluent Using Generics and Method References
34 Updating the Factory to Implement the Singleton Pattern
35 Wrapping up the Factory and Singleton Patterns Using Lambdas
36 Introducing the Registry and the Builder Pattern
37 Designing an API to Create a Registry Using the Builder Pattern
38 Introducing the Registry and the Builder Examples
39 Writing the Registration of a Factory Using a Consumer of Builder
40 Making the Registry Functional to Implement It Using a Lambda
41 Testing the Registry to Create Different Kind of Shapes
42 Controlling Missing Keys with Exceptions Defined at the API Level
43 Wrapping up the Registry and Builder Built with Lambda Example
44 Module Wrap Up

Implementing The Visitor Pattern Using Functions and Composition
45 Introducing the Module and Its Agenda
46 Adding Operations on Classes Using the Visitor Pattern
47 Organizing a Simple Object Model to Implement the Visitor Pattern
48 Writing a Visitable Set of Classes along with a Visitor
49 Adding Methods on a Class without Changing It Using Lambdas
50 Writing the Lambda Visitor Pattern on the Car Model Object
51 Adding the Static and Default Methods for the Pattern to Compile
52 Implementing the Registry of Types to Be Visited and Functions
53 Running the Pattern with the Initialized Registry
54 Adding a Second Element to the Registry – A First Version
55 Fixing the Multi Element Registry with the Chaining of Consumers
56 Making this Visitor Pattern Type Safe Using Gnerics
57 Module Wrap Up

Using Partial Application and Lambdas to Build Validators
58 Introducing the Module and Its Agenda
59 Setting up a Person Bean with Two Validation Rules
60 Understanding the Validation Rules and Setting up Examples
61 Writing the Validator Pattern in the Case of a Person Bean
62 Implementing the Validator Interface in the Case of a Valid Bean
63 Extending the Validator to Handle One Violated Rule
64 Introducing the SuppressedExceptions to Wrap Exceptions Together
65 Handling Several Exceptions with the Suppressed Exceptions
66 Module and Course Wrap Up