Overview
The course helps participants to learn functional programming with lambdas and streams, as well as the Java Platform Module System (JPMS). UML, Design Patterns, and the use of composition versus inheritance are taught, as is unit testing.
Objectives
At the end of Advanced Java training course, participants will be able to
- Solidify their Java foundational knowledge, including the important contracts of class Object | Understand the uses and consequences of inheritance and composition, and reinforce the role of interfaces | Leverage fundamental OO principles such as cohesion, coupling, and polymorphism | Use the JUnit testing framework and become fluent in writing assertions to verify correct program behavior | Understand UML modeling in class diagrams and sequence diagrams | Use advanced techniques for object creation, including factories and singletons | Use established design patterns for object composition, including Strategy, Decorator, and Facade | Write and use generic classes and methods | Leverage the use cases for inner classes and refactor existing code to use them when appropriate | Create and use custom annotations | Use reflection and how to use it | Understand the role of functional interfaces | Understand lambda expressions and method references, and use them to pass behavior (methods) | Use the Stream API to perform complex processing of collections and other input sources | Create and use Java modules, understanding module descriptors, modular JARs, exports and dependencies, and the modulepath | Understand the structure and behavior of the modular JDK, and how it supports modular applications as well as legacy classpath-based code | Solidify their Java foundational knowledge, including the important contracts of class Object
- Understand the uses and consequences of inheritance and composition, and reinforce the role of interfaces
- Leverage fundamental OO principles such as cohesion, coupling, and polymorphism
- Use the JUnit testing framework and become fluent in writing assertions to verify correct program behavior
- Understand UML modeling in class diagrams and sequence diagrams
- Use advanced techniques for object creation, including factories and singletons
- Use established design patterns for object composition, including Strategy, Decorator, and Facade
- Write and use generic classes and methods
- Leverage the use cases for inner classes and refactor existing code to use them when appropriate
- Create and use custom annotations
- Use reflection and how to use it
- Understand the role of functional interfaces
- Understand lambda expressions and method references, and use them to pass behavior (methods)
- Use the Stream API to perform complex processing of collections and other input sources
- Create and use Java modules, understanding module descriptors, modular JARs, exports and dependencies, and the modulepath
- Understand the structure and behavior of the modular JDK, and how it supports modular applications as well as legacy classpath-based code
Prerequisites
All participants must have a working knowledge of Java programming, including the use of inheritance, interfaces, and exceptions.
Course Outline
- Java Release Cycle
- New Java Versions
- Java Environment
- Classes and ObjectsInstance Variables, Methods, Constructors, Static MembersOO Principles: Data Encapsulation, CohesionObject Contracts: toString(), equals() and hashCode(), Comparable and Comparator
- Packages, Enums, Arrays
- Exceptions
- Date and Time API
- New Language Features
- Instance Variables, Methods, Constructors, Static Members
- OO Principles: Data Encapsulation, Cohesion
- Object Contracts: toString(), equals() and hashCode(), Comparable and Comparator
- UML Overview
- InheritanceDefinition and IS-A RelationshipMethod Overriding, @OverrideOO Principles: Principle of Substitutability, Polymorphism and Encapsulation of Type, Coupling, Open-Closed PrincipleConstructor Chaining
- InterfacesDefining and Implementing, Interface TypesInterface Inheritance
- New Interface Features (Java 8+)Default Methods, Static MethodsFunctional Interfaces
- Guidelines
- Definition and IS-A Relationship
- Method Overriding, @Override
- OO Principles: Principle of Substitutability, Polymorphism and Encapsulation of Type, Coupling, Open-Closed Principle
- Constructor Chaining
- Defining and Implementing, Interface Types
- Interface Inheritance
- Default Methods, Static Methods
- Functional Interfaces
- Overview
- Tests, Assertions, and FixturesWriting and Running TestsAssertionsTest Fixtures, @Before and @After, @BeforeClass and @AfterClassTesting for Exceptions
- Best Practices and Test-Driven Development Overview (TDD)
- Writing and Running Tests
- Assertions
- Test Fixtures, @Before and @After, @BeforeClass and @AfterClass
- Testing for Exceptions
- Collections OverviewGenerics and Type-Safe CollectionsDiamond Operator
- Lists, Sets, and MapsInterfaces and ContractsIteration and AutoboxingUtility Classes – Collections and Arrays
- Writing Generic ClassesInheritance with Generic TypesWildcard Parameter TypesType Erasure
- Generics and Type-Safe Collections
- Diamond Operator
- Interfaces and Contracts
- Iteration and Autoboxing
- Utility Classes – Collections and Arrays
- Inheritance with Generic Types
- Wildcard Parameter Types
- Type Erasure
- Design Patterns Overview
- Controlling Object CreationLimitations of new Operator, Alternative Techniques
- Singleton Pattern
- Simple Factory
- Factory Method Pattern
- Other TechniquesNamed Objects, JNDIDependency Injection Frameworks
- Limitations of new Operator, Alternative Techniques
- Named Objects, JNDI
- Dependency Injection Frameworks
- Inheritance and Composition – Pros and ConsComposition and DelegationHAS-A, USES Relationships
- Strategy Pattern
- Decorator Pattern
- Façade and Other PatternsFaçade, Proxy, Template Method
- Composition and Delegation
- HAS-A, USES Relationships
- Façade, Proxy, Template Method
- Overview and MotivationStronger Encapsulation, Rules and Caveats
- Defining and Using Inner ClassesMember-Level, Method-Local, Anonymous Classes
- Static Nested ClassesNested Classes, Nested Interfaces, Nested Enums
- Stronger Encapsulation, Rules and Caveats
- Member-Level, Method-Local, Anonymous Classes
- Nested Classes, Nested Interfaces, Nested Enums
- Overview
- Using AnnotationsTarget and Retention PolicyAnnotation Parameters, Parameter Shortcuts
- Writing Custom AnnotationsSyntax, Using the Meta-AnnotationsUsing a Custom Annotation
- Target and Retention Policy
- Annotation Parameters, Parameter Shortcuts
- Syntax, Using the Meta-Annotations
- Using a Custom Annotation
- Overview and APIThe Class Called ClassObtaining and Inspecting Class Objects
- Working with Objects ReflectivelyCreating Instances, Invoking Methods, Setting Field Values
- The Class Called Class
- Obtaining and Inspecting Class Objects
- Creating Instances, Invoking Methods, Setting Field Values
- Functional Interfaces and Lambdas
- Target Context
- Using Lambda ExpressionsSyntax, Lambda CompatibilityVariable CaptureType Inference
- Method ReferencesThree Types of Method ReferencesRefactoring Lambdas into Method References
- Syntax, Lambda Compatibility
- Variable Capture
- Type Inference
- Three Types of Method References
- Refactoring Lambdas into Method References
- OverviewStreams vs. CollectionsAnatomy of a Stream
- Understanding the Stream APIIntermediate Operations and Stream PipelineJava 8 Functional Interfaces: Predicate, Comparator, Function
- Stream ProcessingFiltering, Sorting, MappingTerminal Operations
- CollectorsConceptsPartitioning and Grouping
- Streams vs. Collections
- Anatomy of a Stream
- Intermediate Operations and Stream Pipeline
- Java 8 Functional Interfaces: Predicate, Comparator, Function
- Filtering, Sorting, Mapping
- Terminal Operations
- Concepts
- Partitioning and Grouping
- Motivation and Overview
- Types of Modules
- Modular JDK
- Our Approach
- Defining and Using Modules
- Services
- Compatibility and Migration