I have an Order
value object with getters. Currently I pass this object to a Formatter
class which creates a specific array structure using the getters. This array is then encoded as JSON and sent to a remote URL.
There are different URLs which require different array structures so I have created multiple Formatter
classes which build the respective arrays. In a way these formatters 'wrap' the original object but i do not have a public getter method exposing the original object from a formatter. Also there is only one single public method exposed in each formatter called format
.
Could these formatters be described as decorator/wrapper patterns or is this even a pattern at all? Im not explicitly looking to apply patterns for the sake of it, but i've discovered I was using other patterns in other parts of the code and renamed them appropriately to less confusion.
Aucun commentaire:
Enregistrer un commentaire