mardi 27 octobre 2020

Is it an anti-pattern to use the suffix "Template" for the class name of the template method pattern?

I am using the template method pattern.

My abstract class has a skeleton method processing iteration and logging.

like this:

abstract public class ImportingTemplate implements Importing{
    
    
    public void importArticles(List<Long> articleIds)
    {
        for(long articleId : articleIds)
        {
            Log log = importArticle(articleId);
            logService.save(log);
        }
    }
    
    protected abstract Log importArticle(long articleId);

}


I can't use "Importing" because it is a name for the interface.

I can't come up with a better name than using "Template" on the suffix.

Is it an anti-pattern to use the suffix "Template" for the class name of the "template method pattern"?

Is it better to use "ImportingContext"

Aucun commentaire:

Enregistrer un commentaire