Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

This is a generic question about class names and ORMs, but for context; I'm working on a Flask web app in Python using SQLalchemy.

I'm struggling with naming a new class that will contain the business logic to process reminders. In the database there is a table named "reminders" that contains data I need. The ORM has created a class 'Reminders' to access it.

Of course, for the business-logic class, the only good name I can think of is also "Reminders", but as I said, there already is a class with that name in my models. I was thinking this could potentially lead to confusion.

My question is; is this still the way to go, two different classes with the same name (but with a different path), or is there a better way/convention to tackle this?

PS: There is one limitation on what I can do; the database is legacy and used by other software, so renaming the table would be 'problematic' at best.

share|improve this question

closed as primarily opinion-based by durron597, Snowman, MichaelT, gnat, Ixrec Aug 29 at 20:08

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

In general, there is nothing wrong in reusing the same name, while putting it in a different namespace to avoid confusion and name collisions.

I don't know Python, but from I've seen right now from Google, there are modules and namespaces, given that your data access layer would probably be a module.

share|improve this answer
yes, there are namespaces in Python, so it's possible. But are there conventions that dictate class names to prevent duplicates, or is the proper way just to use a duplicate class names and use the namespaces to differentiate? –  Rico Suave Apr 29 '13 at 8:04
IMO, keep the names the same. But MetaFight suggestion is valid too, unless you end up with names like ReminderBusinessRulesFactoriesCollectionDataAccessInitialization. –  MainMa Apr 29 '13 at 8:57
If the namespace makes it clear what the class is for, then I see no problem in keeping the class names the same either. After all, then end goal is that the code be readable and self-documenting. –  MetaFight Apr 29 '13 at 9:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.