Question

This might sound weird and probably is, but I am struggling to find a good place where to place what I will just call "Doers" for lack of a better name.

Basically, my project currently has these Namespaces (Folders in src)

/
/Error (Custom exception classes)
/Facade (Facades for legacy operations of things not yet converted)
/Model (Entity classes and helpers for ORM mapping)
/Repository (Repository classes that wrap ORM)
/Utility (Anti-pattern probably, things like extension methods, translation,...)

Now, I need to implement a class that will receive a file (CSV) and import that file into the database, following an algorithm to decide what to do with each entry.

To me, this is a class that actively does something (in contrast to e.g. the entity classes).

Because it operates on the database, one might be tempted to put it into the Repository space, but that doesn't really fit, because it won't be a repository class - it will just import things following a specific logic.

Currently, the classes that actively do stuff are all legacy facades, so they already have a place in the Facade namespace. But what about new things? Where to put them?

What would I describe this class as? It is a ThingImporter, but what is its "parent"? It feels dirty to put in the root namespace...

Was it helpful?

Solution

You could go for 'Workers'? But what I find worrying is that your name spaces are grouping by 'type' rather than responsibility.

For example, I would put the errors with the component that throws them, not all together in one name space.

Licensed under: CC-BY-SA with attribution
scroll top