Tag Info

New answers tagged

0

There are two "auth" words you want to become familiar with. Authentication - which is where users provide evidence that they are who they say they are. Authorization - which is where the system allows or prevents actions attempted by an authenticated user. Both aspects are relatively easy to start with for simple solutions, and both can quickly get ...


1

Your model classes should be simple and only store the data you wish to model for your application. You should avoid having any complicated methods or business logic in your model classes. I usually have constructors and basic properties (i.e. public getters, private setters) in my model classes and that tends to suffice. Your view model classes should ...


6

When the HTTP request is completed, it will return some data, and the model gets updated by the responsible part of your system. Then raise an event which tells everyone who subscribed to it "new data has arrived", but do not pass the actual data in this event, only the relevant information for the subscribers which part of the model has changed. The event ...


0

I can't help but feel like you missed an obvious solution. Maybe I'm missing something here, but why doesn't your form implement all three interfaces? I don't see the need to try to keeping trances of the views inside of another view. public class DocumentationViewer : Form, IDocumentationViewerView, ITocPaneView, ISearchView { public ...


0

In a slight variation of JDT's answer...if I'm understanding all of it correctly, this is how I view it (pardon the pun): View/Controller: Both part of the presentation concern. The controller acts as the intermediary between the view and the model, affecting changes to the model (unless you have binding to the model from the view) and reflecting model ...


0

I had the same problem but my situation was a little bit different, let me explain. In my project I had to use files for two purposes: Store data (database) Track errors (log file) So my model was dedicated to the interaction with files used as database and i created some helpers (I was using Codeigniter) to write log files. In this way i could invoke ...


5

None of the above, actually. It is the responsibility of your controller to write the data to file, although I'd recommend writing a specific class for that and just having the controller use that class. It is not a view because views in MVC are strictly about rendering data in the UI. The data itself should probably be put into a model and that model ...


4

Part of the difficulty with any discussion of MVC is that different groups have co-opted it to mean different things. The implementation of MVC used in, say, a Rails app, would be almost unrecognisable to someone writing a Swing app. To the extent that MVC is still a well-defined thing, it's more of a set of guiding principles (separate the core application ...


1

Might be way off here, but this is how I feel about WebApps and working with [complex] remote API's in many cases: I would make it a class (ie, a library of data mitigate methods) instead of model (ie, stack of data mitigate functions). It seems like it would act more transparent, more logic/schema agnostic, and you could use it wherever without ...


2

Your model should never contain any actual code, and should be seen as more of a message or a struct used to manage content manipulated by the controller and displayed by the view. Your controller should be responsible for contacting any APIs, databases, services, etc... requesting a change and managing any necessary updates to the model. The entire ...


12

There's a common (intentional?) misunderstanding about what M, V and C are. Not about the roles they take, but what are they. In the original, desktop GUI definition of MVC, they were modules. Typically an application had several of them, sometimes working in triplets, sometimes having a variety of views and models that a few controllers could mix and ...


1

Here, the model is described like this: A model stores data that is retrieved to the controller and displayed in the view. Whenever there is a change to the data it is updated by the controller. I'd say that the controller either includes the logic of calling the service or calls a separate Service object. If the service is separate, you can more ...


28

The model is not limited to interaction with the database, the model is responsible for getting and manipulating data. So, to your view and controller, it should make no difference, if the data comes from a database or from a webservice or is even totally random, therefore you should do it in model. MVC is a presentation pattern, that only separates the ...


2

That's the responsibility of your controller as that is the class that is responsible for receiving data from the view and translating it onto methods for the model, as well as receiving data from the model and handing it up to the view. This does not mean the controller has to do this directly however. Your model can use ViewBuilders for example to build ...



Top 50 recent answers are included