AlbertoHdezCerezo / stv-ahc-challenge

0 stars 0 forks source link

Rename `parse` method in `ParserService` classes #4

Open AlbertoHdezCerezo opened 9 months ago

AlbertoHdezCerezo commented 9 months ago

By definition, Service classes perform only a specific action. The purpose of this action is usually reflected within the name class, and thus, many people use the convention of having a common interface for all Service classes consisting of a call method.

How about renaming parse to call? I feel the name of the method is already redundant (the Service class name already indicates it is a parser, and its interface consists of only a parse method). This change could be a great convention for future services (so they all present the same public interface).

Any thoughts?

mtrolle commented 9 months ago

In our true framework you'll not write services but inherit from Parser instead and therefore you have a parse method - so the test is probably flavored a bit from our internal systems ;) I do agree in services should just have a call method as the ultimate destination, however I have given myself a habit many years ago of calling the method perform instead inspired by ActiveJob and kind of stuck with it as it has spread throughout my systems 🙈