DEV Community

Philip Perry
Philip Perry

Posted on

Repository/Service pattern, did it finally click?

If you don't know what the repository and service patterns are, check out this article:

https://www.vodovnik.com/2015/08/26/repository-and-services-pattern-in-a-multilayered-architecture/

While I had made use of the repository pattern before, I still made the mistake of putting the method getOfficeContactData() into a service class, even though the name (the data part) should have made it obvious that this is something that belongs into a repository class. In addition, it was shared by two service classes!

Thanks to my code reviewer who pointed it out to me. I think I now understand the purpose of each layer better and will pay more attention to where I put methods in the future.

Top comments (0)