Implementing custom Domain logic
A Domain class should not restrict itself to containing logic purely related to Apex Triggers. In the following example, the code introduced in the previous chapter to calculate championship points has been refactored into the Contestants
Domain class. This is a more appropriate place for it, as it directly applies to the Contestant record data and can be readily shared between other Domain and Service layer code (which we will look at later in this chapter):
public void awardChampionshipPoints( fflib_SObjectUnitOfWork uow) { // Apply championship points to given contestants for(Contestant__c contestant : (List<Contestant__c>) Records) { // Determine points to award for the given position ChampionshipPoints__c pointsForPosition = ChampionshipPoints__c.getInstance(String.valueOf(contestant.RacePosition__c)); if(pointsForPosition!=null) { // Apply points and register for udpate with uow contestant.ChampionshipPoints__c...