0

I have a client that returns and sends data to a server. Currently the data that it returns is only composed of types in the Core Library (Foundation).

It would be helpful if the client sent back data already converted to my Model classes.

Is it a bad idea to couple my Model with my Client ? I was thinking of doing this in an extension this way it's separated from the main client implementation.

I do want to note that I thought about moving this into a helper class but I think it would be confusing to move a client method call into another class.

For example: Helper.getDataFromServer

Ideally we would want: Client.getDataFromServer

3366784
  • 2,423
  • 1
  • 14
  • 27
  • I think this question is too broad to get a useful answer. There are lots of valid ways to structure an application. Even within the "MVC" label you get a range of interpretations of how models, views, controllers, and other app components should communicate. Additionally it's unclear which of those roles, if any, a "Client" plays and which other roles it should communicate with or have knowledge of. – Jonah Apr 10 '17 at 20:51
  • I agree with @Jonah. This is a very broad question. Generally speaking I would suggest to separate your classes. Is your `Client` really concerned with getting data from a server? Usually that is not part of the business logic which belongs to the model. Maybe you should add a class `Connector` with a method `getClientData` which returns a new Client filled with the data. – Ray Wojciechowski Apr 10 '17 at 21:57

0 Answers0