1

First I'd like to begin by illustrating the basic idea that I want to get done.

I'm designing a system by following the layered model view controller design. I essentially have a server and I would like to use tablets as the view/display. Now because I want to send data to and from the tablets through serialization, I can't figure out where to play the view controller classes for those tablets.

Ideally, when you'll boot up the tablet, you will have an option as to which view you wish the tablet to display (1 through whatever), but a view can't instantiate it's own controller I don't think.

So I just don't know where to have the view controller that technically creates the said views and how to allow it to communicate to said tablets. (This will be done in java/android)

Alex-v-s
  • 187
  • 1
  • 14

2 Answers2

1

MVC pattern is meant for one machine. So you can have the MVC pattern on your tablet. The controller here is kind of the glue code which instantiates the view and also creates the models (DAOs - Data Access Objects) to get data from the server.

This is all independent from what you will use on the server. You could say that on the server you also want to have something similar like MVC - in that case, the controller handles the REST, SOAP, ... - requests and instantiates a DAO which will retrieve the information from a file, database, ... The view afterwards could be seen as a serialiser which creates XML or JSON documents out of the fetched data.

What you might rather ask yourself, is if you want to have a Rich- or a Thin-Client. Rich-Clients have more independent logic, can maybe cache the data, ...; while Thin-Clients only display data and forward every performed action to the server.

peter
  • 14,348
  • 9
  • 62
  • 96
  • Yes, that clears things up, thank you. At the moment I'm "emulating" tablet windows by using separate frames, so that was obfuscating the proper structure for me. Supposing I want a thin client, that only displays data and sends action performed stuff, would I essentially have a single controller class on the server to handle all the incoming tablets, or generate a new controller as each tablet connects, or have a completely separate controller for any particular screen the tablet is currently displaying? Or is there a single controller creating a separate DAO for each tablet? – Alex-v-s Mar 26 '14 at 18:12
  • Controllers encapsulate logic. So you want to have different controllers for different part of your systems, but every user / client will access all of those controllers. However, you probably won't have the same instance, just the same type ([What is the difference between an Instance and an Object?](http://stackoverflow.com/questions/2885385/what-is-the-difference-between-an-instance-and-an-object) for more information on Instances VS objects) – peter Mar 26 '14 at 18:16
  • Haha, well certainly. I believe you helped me get an ideas as to what to do now, thank you! – Alex-v-s Mar 26 '14 at 18:18
1

Actually I think you're mixing two different concepts which go well together but still, are different. The MVC pattern is a pattern for implementing user interfaces and is only used as an architectural pattern on very small project. On the other hand the layered architecture can be used server-side to implement a more complex application.

The two are often mixed because of the well-known 3-tier architecture (Presentation tier - Application tier - Data tier) on which analogy to the MVC pattern is easy (View = Presentation tier / Controller = Application tier / Model = Data tier) yet false.

About your problem specifically see zahorak's response about the thin/fat client choice you'll have to make.

m4rtin
  • 2,445
  • 22
  • 34
  • I appreciate you clearing that up. I did have an idea that one was based on another, but now that you've clarified the whole "MVC being used for small things" and being essentially single platform specific, it made sooo much more sense now, so thank you for that. – Alex-v-s Mar 26 '14 at 18:16