Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I know when a class is a Helper or a Service?

i'm using DDD architecture in my project and I need to create a class to generate a GUID to use in another class.

This class that generate my GUID is a Infrastructure Service or a Infrastructure Helper?

How I know when a class is a Helper or a Service?

like image 306
Acaz Souza Avatar asked Sep 30 '11 12:09

Acaz Souza


1 Answers

Service able to serve some clients, and often this is a SOA specific entity. Helper provides a set of methods which commonly are pure functions.

From my point of view if a class which provides the GUID generation functionality stores or uses this GUID for further needs - it is a Service class, otherwise I would say it is a Helper because simply work by principle do and forget / generate and forget.

Often if you can make method a static method - this is a helper method, it does not depends on any class state and does not affect it as well.

like image 75
sll Avatar answered Sep 20 '22 14:09

sll