Chapter 5. Aspect-Oriented Programming and Components
Many times in programming, we see pieces of source code that are repeated in different methods. In some cases, we could refactor our code and move them to separate modules. Sometimes, however, this is not possible. Some notable examples include logging and verification. Aspect-oriented programming is helpful in such cases, and we will get an understanding of it by the end of this chapter.
Components are reusable pieces of code that provide a number of services and have some requirements. They are extremely useful for avoiding code duplication and of course, for promoting code reuse. Here, we will see how to build components and how Scala makes the writing and use of components easier than other languages.
While getting familiar with aspect-oriented programming and components, we will go through the following top-level topics:
- Aspect-oriented programming
- Components in Scala