Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7531701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:14:40+00:00 2026-05-30T05:14:40+00:00

How do you name repository and service interfaces and their implementing classes? For example

  • 0

How do you name repository and service interfaces and their implementing classes?

For example I have a model with the name Question. What would you name the repository (interface and implementation) and the service (interface/implementation).

After reading these posts:
Java Interfaces/Implementation naming convention
and Interface naming in Java I reconsidered what I already had done 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:14:41+00:00Added an answer on May 30, 2026 at 5:14 am

    I think that there are roughly two approaches to naming in DDD:

    1) Stereotype based. This is where you include class stereotype in its name. For example:

    QuestionsRepository, TaxCalculatingService etc
    

    2) Domain based. In this approach you use only domain language and omit any stereotypes in the class names. For example:

    Questions (or AllQuestions), TaxCalculator etc.
    

    Implementation classes would be named like SqlQuestions or InMemoryQuestions.

    I tried both but I now prefer 2nd option as it seems to be more aligned with DDD mindset. It seems more readable and have a better signal-to-noise ratio. Following is a quote from a great article on repositories by Phil Calçado:

    The concept of a Repository as a list of objects is not too hard to understand but it is very common for those classes to end up with methods that are not related to lists at all.

    After coaching many teams in the adoption of a Ubiquitous Language and related patterns, I’ve found out that the best way to make people remember that Repositories are not DAO-like classes starts with how you name them.

    Years ago Rodrigo Yoshima told me about his convention when naming Repositories. Instead of the more common naming style displayed below:

    class OrderRepository {
       List<Order> getOrdersFor(Account a){...}
    }
    

    He promotes this:

    class AllOrders {
       List<Order> belongingTo(Account a){...}
    }
    

    It looks like a small change but it helps a lot…

    The whole article is well worth reading and bookmarking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access @Service defined class Interfaces are defined, here is an implementation
I'm implementing the service \ repository pattern in a new project. I've got a
I have this entity service in my domain model with two datetime type properties
Does Git only use the remote name origin for a repository which was created
On my laptop, I use the computer's name when accessing my svn repository (e.g.
I have a service level methods, which make few changes to database and I
I have a repository: public ObservableCollection<ProjectExpenseBO> GetProjectExpenses() { //Get by query IQueryable<ProjectExpenseBO> projectExpenseQuery =
I am designing a WCF service using DDD. I have a domain service layer
I have a list of products coming from a repository. Simple enough. Now I
I have an class library called ServiceLayer which acts as a repository for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.