Chapter 2 Design Patterns and Principles
THE OCP EXAM TOPICS COVERED IN THIS CHAPTER INCLUDE THE FOLLOWING:
- ✓ Advanced Java Class Design
- Develop code that declares, implements, and/or extends interfaces and use the @Override annotation
- Create and use Lambda expressions
- ✓ Lambda Built-in Functional Interfaces
- Use the built-in interfaces included in the java.util.function package such as Predicate, Consumer, Function, and Supplier
- ✓ Java Class Design
- Implement encapsulation
- Implement inheritance including visibility modifiers and composition
- Implement polymorphism
- Create and use singleton classes and immutable classes
What does it mean to write good code? How do you measure code and differentiate good code from bad code? Although your previous study may have focused on learning how to develop Java code that compiles and executes properly at runtime, this chapter assumes that you already know how to do that. The primary goal of this chapter is to teach you best practices for designing Java classes and writing applications that lead to code that is easier to understand, more maintainable, and that you and other developers can leverage in future projects.
Adhering to the design principles and design patterns enables you to create complex class models that smoothly interact with other developers’ applications. The better your software application is designed, the better ...
Get OCP Oracle® Certified Professional Java® SE 8 Programmer II now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.