Tag Info

New answers tagged

0

You can have a common BLL component, exposed as a web service quite happily. Simply expose 2 interfaces on the WCF side of things that are implemented by the same methods in the BLL. Both thick clients and the MVC website will make calls to this common WCF webservice, but each using a different interface. So you have a Website only web service the web site ...


0

As mentioned by Pelican, you are taking the right approach in terms of tailoring your viewmodels to your views. That said, you can still abstract some functionality out for reuse. For example, you might have use for paging lists in multiple views. In that case, create a generic model that can be reused in multiple viewmodels. If you find you require more ...


0

In MVC it's very uncommon to have a single model or controller. It is however common to have one or very few view "flavors" which all render templates differently. Each controller should have a single purpose, whether it's routing, or applying business logic to a model. You should route the request to the appropriate controller for each model, ideally ...


0

Using PHP you would access the current user SessionToken cookie stored when you authenticated the user to check if: There is one present It has not passed its expiry It is the current token for that user stored in a session database I would implement this by writing the code in a separate file/module and include it into each page of your project or main ...


1

Is this your basic model, sorry, not sure if I understand your text: Hardware_table(Id, GUID, Description, etc) this holds your primary object one of each Document_info_table(Id, HId, Name, size, mime type) this holds documents related to primary object Using SQL you would have to link Hardware_Table to Document_Info_table by inserting the PK from the ...


1

Very purpose of ViewModel is to covert and display the data in your model to match the view. Simply creating a ViewModel per view would be the best way to handle this.


0

An interesting problem! I would suggest that a web site itself is unsuited to listening to these TCP streams. Instead I would add an intermeditate layer or two. 1: abstract legacy systems : Create a service which listens to the streams and converts the info into messages which it then places on a queue. (perhapse msmq, zmq or rabbitmq could be used here) ...


0

It will probably be a lot easier for you if you don't have to pass the Session to every method call on a controller. This puts the requirement for keeping the Session on the view and that's not really where it belongs. It also makes your controller methods very heavy as they will need to always have this parameter, even if it makes no sense. Instead, why ...


0

Well.. main idea of CQRS to separate read and write operations. You might use of this pattern for one main reason, The change that CQRS introduces is to split that conceptual model into separate models for update and display - Martin Fowler So if you have two of these models to maintain, it would be very hard not to use commands, command handlers and ...


-3

I think MVC is used just a buzzword by theorists that are managers. However, having said that, the current iteration of the web with HTML5 prevalent, responsive design, and trying to create a single line of database programming that will work on the web and on an iPhone lends itself to the general ideas of MVC. The web front-end technology is literally ...


3

This rule and consequent warning is sensible - I definitely wouldn't like to see class/constant definitions mixed with side-effects in one file. But in this particular case I wouldn't mind - PHP bootstrap files are usually a bit like this - setting up the environment which sometimes consists of several distinct (and possibly unrelated) steps. You could ...


1

Let the View directly subscribe to the ObjectAEvent event. We've now coupled the View into the internals of the Model, which I believe violates the Law of Demeter. I'm pretty sure this also violates the concept of MVC by definition. MVC isn't about total decoupling. It's about avoiding coupling to elements that are unstable. As for Law of Demeter, ...


0

Practical URL length limit is around 2000 characters - think about whether you could optimize you filters to fit into it. It this is not possible I'd probably implement this as a POST request. Disadvantages: although this is in line with HTTP semantics of POST request (POST can be used for almost anything), it's not a best fit - it's effectively ...


0

Short Answer The primary benefit of decoupling application logic from any presentation/external interfacing layers is to allow consumers to vary independently without duplicating logic. Therefore, the necessity of decoupling is dependent upon how many consumers your application will have. Long Answer Using Domain-Driven Design nomenclature, your question ...


0

If you can thoroughly test the view, then there is no limit to how smart it can be. If it is not practically feasible to test the view, then it should be so dumb that you can tell that it is correct by just looking at it. Let's take an example. Suppose that you have a model which deals with public opinion polls, exposing poll results as a list of floats, ...


0

You quoted the Wikipedia article out of context. It actually says: The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. A use case controller ...


0

In MVC pattern, a controller mediates between view and model. Action methods in a controller should be thin and should not have logic embedded in them.In GRASP you can look for Indirection pattern (http://en.wikipedia.org/wiki/GRASP_(object-oriented_design)) So how many controllers should we create or how many action methods should be in one controller, ...


0

Entity Framework is an Object-Relational Mapper; it translates the results of SQL queries into objects and collections. For example, this query: SELECT name, address, city, state, zip FROM customers; might produce a collection IEnumerable<customer> result of objects that looks like this: public class Customer { public string Name { get; ...


2

This is an ancient debate really. It goes all the way back to the first databases and the notion of "referential integrity", which in turn is a variation of the strong-typing / weak-typing debate. Who's job is it to make sure that data is stored in a consistent and "known good" manner? MVC purists will tell you it's the controller's job. Database ...


0

If you only want to check that the name exists, yes it belongs to the model. From wikipedia: A controller can send commands to the model to update the model's state (e.g., editing a document). It can also send commands to its associated view to change the view's presentation of the model You are not doing any of those. You are checking if the ...


0

A code example would help, but in rails, validations belong in the model. Check out validates_inclusion_of. Also, you should be aware that models dont nescessarily have to be backed by persistence. There are lots of times when it's appropriate to use plain ruby objects. In general, its best to keep as much functionality out of the controller as possible, ...


1

Take maxims such as "thy model shall only care about the database stuff" with a grain of salt. Dogma has no place in engineering. In order to answer this question you need to first understand the nature of this validation array, and whether it fits conceptually with the model or with controlling the model. The fact that these names are stored inside ...


2

In order to find the right grouping for controllers, think of the testing. (Even if you don't actually do any testing, thinking of how you would go about testing your controllers will give you some very good insights on how to structure them.) An AuthenticationController is not testable by itself, because it only contains functionality for logging in and ...


-1

IMHO and in my understanding, You are validating the data from the given array, not from the database. So I strongly believe you should do it in the controller. the general rule of thumb is to only write database interactions inside model.


0

As it turns out, it's sort of a combination of the Authorization flow and the Implicit flow. The Implicit flow is for client-based applications, and the authorization flow allows for server-to-server access, I think. What ended up being the right answer is retrieving an access_code from Google, with a specific audience specified. The audience is the ...


12

In my experience, a web application would have to be trivially small to not benefit from the organization and decoupling that MVC provides. Perhaps a bit of explanation about the MV* family of architectural patterns is in order. The MV* patterns concern themselves primarily with the User Interface. Their primary purpose is to provide decoupling between ...


0

Terminology I believe it is a big misconception to call a class containing some HTTP-related methods a "controller". Controller is a method that handles request, but not a class containing such methods. So, index(), submit(), logout() are controllers. Class containing that kind of methods is named "controller" just because it constitutes a group of ...


1

Answer is not that obvious Please let me clarify a few things before i will make any answering statements. First of all: What is the controller? Controller is a part of system that controls request - after dispatching. Thus, we can define it as some set of actions related to... what? What is the scope of controller? And thats more or less part when we ...


0

Here are a few rules of thumb: Organise by subject or topic, with the controller name being the topic's name. Remember that the controller's name will appear in the URL, visible to your users, so preferably it should make sense to them. In the situation you mention (authentication) the MVC team has already written the controller for you. Open Visual ...


0

I see two antagonistic design "forces" (which are not exclusive to controllers): cohesiveness - controllers should group related actions simplicity - controllers should be as small as possible to manage their complexity From cohesiveness point of view, all three actions (login, logout, registration) are related, but login & logout much more than ...


1

Controllers are usually created for a certain resource (an entity class, a table in the database), but can also be created to group together actions that are responsible with a certain part of the application. In your examples, that would be a a controller that handles the security for the application: class SecurityController { // can handle both the ...


0

It still belongs in a model, just not a view model. Since MVC assumes you are working in the UI they omit a "V"... View-Model View Controller, VMVC does not have the same ring to it. If your application is trivial, your view model and business model can be the same thing, and that's okay. But it sounds like you application is past that point. public class ...



Top 50 recent answers are included