mardi 27 novembre 2018

Should suffixes like "Builder" and "Factory" only be used when that pattern is being utilised?

One of things I struggle with most as a junior is coming up with suitable names for the classes that I am creating. I'm learning a lot about different coding patterns at the moment, and some of the patterns that are coming up regularly are Builder, Factory, and Repository.

However when I'm writing my code I'm unsure whether or not these suffixes should be reserved and only used when that particular pattern is being utilised within my code. So unless I'm implementing the builder pattern I should not use the 'Builder' suffix.

However if this is the case then this leaves me with the problem of not knowing what I should name my classes. Obviously there are some classes that have the responsibility of "building" a product from data or other classes, what suffixes or naming conventions should I use for these classes in particular?

Using C# if that matters.

Aucun commentaire:

Enregistrer un commentaire