Java EE 8 Design Patterns and Best Practices by Rhuan Rocha
Author:Rhuan Rocha
Language: eng
Format: epub, pdf
Tags: COM051280 - COMPUTERS / Programming Languages / Java, COM051010 - COMPUTERS / Programming Languages / General, COM048000 - COMPUTERS / Systems Architecture / Distributed Systems and Computing
Publisher: Packt Publishing
Published: 2018-08-09T10:35:51+00:00
Summary
In this chapter, we have seen that interceptors and decorators are the platforms through which the JEE platform provides aspect-oriented programming. Interceptors are used to interpose the invocation of some method or life cycle events that occur in an associated target class. The interceptor takes care of technical tasks, called crosscutting tasks, that are repeated throughout an application, such as logging, auditing, and exception handling. These tasks are separate from business logic, and it's a good idea to put the interceptor in a separate class for easy maintenance.
We learned how the classic interceptor mechanism works for EJB, as well as the CDI inspector mechanism, which can intercept any managed bean and not just EJB-managed beans.
While the interceptor takes care of the technical tasks, we can add functionality to the existing business logic with the decorators. We learned that the decorator pattern is a well-known structural design pattern. A decorator is a type of interceptor for business classes, and is used when we want to add functionality to a business class while also keeping it intact.
The use of interceptor and decorators promotes low coupling and easy maintenance. However, we must use them carefully. For example, with regards to decorators, we should avoid excessively spreading them through the application. Excessive decentralization can cause an inverse effect and worsen code maintenance.
An interceptor belongs to the same transactional context of the business class that it interposes. As an interceptor only deals with technical issues, tasks related to it cannot influence the execution of business logic. Consequently, errors generated in technical tasks cannot be thrown to the business logic. In a similar way, the execution time of these tasks cannot compose the execution time of business logic.
Download
Java EE 8 Design Patterns and Best Practices by Rhuan Rocha.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ada | Ajax |
Assembly Language Programming | Borland Delphi |
C & C++ | C# |
CSS | Compiler Design |
Compilers | DHTML |
Debugging | Delphi |
Fortran | Java |
Lisp | Perl |
Prolog | Python |
RPG | Ruby |
Swift | Visual Basic |
XHTML | XML |
XSL |
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9794)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8292)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7775)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6785)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6511)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6378)
Kotlin in Action by Dmitry Jemerov(5061)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4315)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3976)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3762)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3705)
The Ultimate iOS Interview Playbook by Avi Tsadok(3680)
