Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROS:
- One advantage of anonymous inner classes is that no one can ever use it anywhere else, whereas a named inner class can be used anywhere you want.
- The key benefit of an anonymous class is encapsulation.
- Inner classes also implements encapsulation.
- Keeping the small class within top-level classes places the code closer to where it is used and makes the code more readable and maintainable.
- While lambda expression increases conciseness.
- CONS:
- Lambda expression decreases readability and are difficult to understand.
- Inner classes get limited support of ide/tools as compared to the top level classes.
- While using anonymous inner class you cannot define a constructor.
- Ans 2:
- Because lambda expressions are nothing more than a language feature that the compiler translates into the exact same code that you are used to working with.
- And also there are no performance implications since the compiler will translate your lambda expression into equivalent code.
- Ans 3:
- Event-Driven Systems pass and persist events, these events are immutable and can be replayed to allow the systems to take snapshots of its behavior.
- A lot of transaction issues are alleviated once idempotency and retrial logic is added to a system. The system can retry messages an infinite number of times to the recipient until there is a message acceptance and acknowledgment from the receiver.
- These abstractions enable the programmer to focus on the business logic of a system and add subscribers to events with minimum coupling with other services. Decoupling the system is one of the advantages of event-driven systems.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement