Refactoring Legacy Code with Java 8
Execute parallel streams and implement design patterns using lambdas
Join experts Richard Warburton and Raoul-Gabriel Urma to learn how to make effective use of advanced features in Java 8, beginning with parallel streams, how they work, and recommended guidelines for using them. Through hands-on guided exercises you’ll go deep into Java’s functional programming features and develop a working knowledge of all major API enhancements to Java 8.
What you’ll learn—and how you can apply it
By the end of this live, hands-on, online course, you’ll know:
- Best practices for developing using Java functional programming features
- The ins-and-outs of parallel streams
- All major API enhancements in Java 8 including Date/Time, Optional and CompletableFuture
- How to apply testing and debugging practices for streams and lambdas
- How to Refactor old Java code to use modern Java 8 features for increased flexibility and code concision
This course is for you because…
- You are an experienced Java developer or software architect who is interested in taking your knowledge of Java 8 topics to the next level
- You are a team member or leader who see the value in learning Java 8 as a team in order to increase overall productivity and work together with a shared understanding
Prerequisites:
- Familiarity with Java 8 programming fundamentals
- Able to write lambda expressions and process collections in a functional and declarative manner
- Know how to run unit tests using JUnit
Schedule
- Collectors (30 minutes)
- Advanced queries
- How to write your own collector
- Participant exercise: Composing collectors to build advanced data processing pipelines
- Easy data parallelism (60 minutes)
- What is data parallelism?
- Why is this important?
- Parallelizing your streams
- Parallel gotchas
- Decomposition performance
- Participants learn about how they can make their streams API code be run in parallel
- Break (15 minutes)
- Testing and debugging lambdas (20 minutes)
- Unit testing lambda expressions
- Debugging with laziness
- Stack traces
- Participants learn about how lambda expressions can be debugged with live coded examples
- Default and static methods on interfaces (45 minutes)
- Motivation for default methods
- Static methods in interface
- Useful default methods
- Patterns for default methods
- Resolution rules
- Participant exercise: Implementing and using default methods, resolving resolution ambiguity
- Enhanced design with lambdas 1 (45 minutes)
- Execute around: Resource handling
- Deferred execution: Logging
- Participant exercise: Using the execute around pattern to extract out file handling logic
- Lunch (60 minutes)
- Enhanced design with lambdas 2 (45 minutes)
- Design patterns
- Using lambdas and exceptions in APIs
- Participant exercise: Implementing the observer and strategy pattern using lambda expressions
- Break (15 minutes)
- Date and time in Java 8 (60 minutes)
- The problem with existing date and time libraries
- The core classes: LocalDate/LocalTime
- Common API patterns
- Timezones
- Participant exercise: Building a birthday diary using date & time and streams.
- Break (15 minutes)
- The Optional data type (45 minutes)
- The problem with null
- How Optional improves upon null
- How to use Optional in your code
- Alternative data modeling approaches
- Participant exercise: Using the Optional data type to safely handle configuration validation
- CompletableFuture (20 minutes)
- Future and executor service in a nutshell
- Common patterns with CompletableFuture
- Participants learn about they can use CompletableFuture to build an ecommerce pricing system
Register now
Participate in this workshop from the convenience of your home, your office… whatever environment you find most comfortable and conducive to an intensive educational experience.
Group ticket
Working as a team? Learn as a team.
Taking this course as a team ensures that everyone is on the same page and understands both the immediate and long-term and immediate goals of your project. Exploring new ideas and collaborating on exercises together is a great team-building experience; everyone on your team will have the opportunity to ask questions, discuss use cases, and learn from other participants.
For group tickets and enterprise licensing, please contact onlinetraining@oreilly.com.
Once you have registered, further details about joining the workshop will be available in your members.oreilly.com account. After the event concludes, access to the recording of the event will be added to your account.