Tag Info

Hot answers tagged

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 ...


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 ...


11

The API being designed follows the Rest style of resources-centric URI and CRUD operations mapped to HTTP verbs. This is your problem right here. You have limited your resources to (I'm assuming) the models in your database. As such it is taking ages to load all these resources because your server has no concept of resources that don't have a ...


4

As your API depends on a library that is licensed with the GPL license, the answer to your first question is: No, you can not apply those restrictions to your API. The GPL is a copyleft open-source license. This means that any project that is based upon (or links to) GPL code must be made available under the same license (this is the copyleft nature of the ...


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 ...


3

In general: User logs into some authentication system. Authentication system provides a token that effectively says "Authentication System X asserts that you are Bob, until 3:00 PM 8/31/2015 UTC". User then passes that token as metadata (header, some data envelope) to the various APIs. The various APIs look at it and decide if they trust Authentication ...


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 ...


2

In the first place it seems to be right, but I think you want to hide these implementation details. Ask your self: where is the difference between a local database and some remote data servers? You probably want to have a been for each resource like User and a store like UserStore. Each store has some methods for interaction like: public User ...


1

Is it necessary/sound to add the token to a database or can I just use the payload to identify the user? I think both approaches are fine. I've implemented token based authentication in .Net, and we put all identity related information in the token. I would argue it's more scalable, especially for a web farm. All the authentication information we need ...


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 ...


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 ...


1

I would consider this to be a solution in search of a problem. I've never seen developers care that a changelog contains extra information - they fall into 2 broad groups, those who don't read the changelog anyway and those who read it all to see what's been happening. What you can do is make the changelog easier to read and parse. I would simply ...


1

I guess you are talking about a system where you have access to the complete source code of all developers involved, and it is all within one organization, right? I do not think this will work well on the API level, you have to do something like this on the component/module/library level. Even if you do not change the API syntactically, internal changes in ...


1

I generally grumble about both approaches. If I had to choose between only those two choices I would probably pick the fully typed one because it will tell me more about what I am required to provide just by looking at the method signature and argument types. The Dictionary solution requires me to go look at API documentation or worse yet the ...



Only top voted, non community-wiki answers of a minimum length are eligible