i have a general question regarding naming convention.
if I separate the data and operations into two separate classes. one has the data elements (entity), the other class manipulates the entity class. what do we usually call that class that manipulates the entity class?
(the entity I am referring to has nothing to do with any kind of entity framework)
manager? controller? operator? manipulator?
thanks in advance
It depends on what kind of operations you're doing on those data contracts/entities. Here are some of my conventions. Let's use the example of a Fruit
entity (and I'm not trying to imply these are all static methods, just pseudocode):
FruitRepository.Save(Fruit item);
InventoryManager.ShipFruit(Fruit[] items, string address);
FruitController.ShowDetails(string fruitId);
FruitProcessor.RemoveSeeds(Fruit[] lotsOfFruit);
FruitManipulator.PeelFruit(Fruit item);
FruitProvider.GetAllTypesOfFruit();
FruitProvider.IsInSeason(string fruitName);
FruitExporter.Save(string spreadsheet);
FruitAnalyzer.Weigh(Fruit[] items);
FruitAssembler.Combine(string speciesFile, string quantitiesFile);
FruitFactory.CreateApple(); // red delicious, McIntosh, etc
FruitBuilder.AddSeeds(5); FruitBuilder.AddStem();
These are all somewhat loose. The main goal is to stay consistent within your own codebase and avoid conflicts with the technologies you're using-- ie. don't have a lot of Controller classes that aren't controllers if you're doing ASP.NET MVC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With