0

I have a Helper class and a Service class currently and I read this other question about the difference between a service class and a helper class and got confused. A method to get all products in my situation is just a convenience thing for me from a developer point of view as it is used to get all products for a specific account and this logic is used across the application. Therefore I was thinking to add it in the Helper class but is it a "utility" if it has to query the database?

Our service classes are very specific for application features rather than 1 database table corresponding to 1 service. I have seen other applications use the latter approach and was wondering if we were using services and helper classes in a non-SE way.

What's your opinion? What layer/object should I be using for this (to query all products relating to an account)?

Thanks.

  • 1
    The fact that that other question is closed as "primarily opinion based" should be a clue that there is no generally agreed-upon boundary when to call something a "service class" and when to call it a "helper class". – Bart van Ingen Schenau Jul 24 at 11:09
  • @BartvanIngenSchenau well it would be nice to know if adding database query methods to a helper class has any negative advantages or SE principle/pattern violations at the very least. A lot of SE is opinion based if that's the case... – Mayron Jul 24 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.