O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code scattering

Code scattering means crosscutting concerns are duplicated across all modules of an application. Let's look at the following example to understand code scattering:

public class TransferServiceImpl implements TransferService {  public void transfer(Account source, Account dest, Double amount) {    //permission check    if (!hasPermission(user) {      throw new AuthorizationException();    }  }}public class AccountServiceImpl implements AccountService {  public void withdraw(Account userAccount, Double amount) {    //Permission check    if (!hasPermission(user) {      throw new AuthorizationException();    }}

As we saw in preceding code sample, the permission check (security) is our crosscutting concern that is duplicated in all services.

These code tangling ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required