Click here to Skip to main content
15,845,598 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There's a 1st sofwtare (s1) that generates data and then there's one or more software's (s2, s3) that will receive that data(objects), based on pre configured actions that define the type of data to transmit.
A middleware (api) needs to get the data from s1 and convert it to s2 or s3 structure depending on configuration. The thing is there's some validations during convertion that's depends on the destination (s2 or s3) of the data. The objective is to support a wide range of destination software's.
The Adapter pattern seems to be the best way to reuse as much of code to different actions or destinations, but i'm afraid that the management of it in the future may be even dificult and complex. Is there any other aproach that makes it easir to implement or mantain, as separate parts as possible? what am i missing?

PS: I inhereted the current api, but i'm trying to convince my coleagues to refactir it, and i need some arguments, best examples,

Thank you for your help!

What I have tried:

So far i used interfaces, wich derived the converter of (s1 or s2), with an instance factory that returns the
correct instance of the current configuration.
Overal with seems to do the trick, but its not easy to maintain the diferent actions(object data type) as it needs a method for each object type convertion , in each of the number of destinations classes.
Also when a parameter changes I'm forced to update the interface and every other method that aplies it.
This seems rather workfull to maintain in the future.
Updated 30-Apr-18 5:16am

1 solution

So in pursuit of better maintainable architetcure, i'm been running some tests with strategy pattern, this way i can develop a bunch of strategies based on the pair sw1/datatype, but if i implement with some hirearchy, i can decouple the datatype selection and destination selection. Although the concrete implementation has to be kept apart it is not strong coupled... Plz leave your comments
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900