New answers tagged

1

The examples shown is correct, but Zend\Form is not exactly what you want to use in your controllers. I'm talking about Exhibit A, where it shows how much code to create, populate and style a form with two elements. It is tedious to create forms that way. To avoid turning the controller into a form factory, you need to create a factory that will create the ...


1

My view on this is that the model needs to give an array of object that are called ViewModel or viewData encapsulated in a cellConfigurator. the CellConfigurator holds the CellInfo needed to deque it and to configure the cell. it gives the cell some data so the cell can configure its self. this works too with section if you add some SectionConfigurator ...


1

As Robert Harvey commented, MVP (model-view-presenter) is the architectural pattern of choice for Winforms. MVP is really just a flavor of MVC though. Your form (view) should implement an interface defining the public API of the view. FooForm : IFooView, Form And it will expose some of its elements via properties, say maybe a textbox input. public ...


0

Well, lets not mix concepts. In one side... MVC is a software architectural pattern. It can be applied to Desktop apps aswell, where HTTP is not necessarily involved. In the other side... HTTP is a comunication protocol. Like wikipedia say: is an application protocol for distributed, collaborative, hypermedia information systems So, you are asking ...


1

Let's just assume for a minute that it is perfectly fine to skip DI with sknny controllers. Now what about the rest of your application? Dependency Injection as a technique is proven to be immensely useful and valuable. As others have noted, it encourages a more decoupled design which improves testability. These are extremely valuable perks! MVC or no ...


3

Dependency injection is often recommended in MVC projects because it's easy to implement with the pattern and adds a host of potential benefits I would argue that dependency injection is recommended generally in projects (not just MVC) because of the benefits it brings in terms of decoupling and testability. There's nothing specific to an MVC ...


1

Yes there is value because it allows you to unit test your controllers. The business layer and model should know nothing about http so the job of the controller is translating the business layer to a web world. Example: Exception Y was thrown should result in http status 4xx Precondition A was not met. Redirect to Abc So even if the controller is ...


3

Have an abstract base class and two concrete derived classes. You didn't tell us what is different, but only said "their implementations are almost the same with each other". Let's assume the database name is the only difference: abstract class Model_base { public function insert($tableName, $columns, $preds = null) { $db = $this->getDB(); ...


1

I think the root of your problem is that you are not using compositional patterns correctly. Instead of changing the model of these items, create a NEW model, which contains these items. That way the original identity and composition of these items are preserved. This article gives a fairly balanced look at the problem (even though it is targeting ...


1

You actually need to create a Data Access Layer: 1- Create a New Class Library [ProjectName].DataAccess 2- Create a Class Named UserManager. 3- Create a Method called AddUser that takes the User Model as an argument. and inside that method, you write the logic to insert the user to the database. Depending on the Scale of your system, you might want ...


-1

As many are suggested on why and how view & model should have to interact freely in different contexts, but the main reason in iOS for making Controller is the mediator between them is to avoid Model & View dependencies in your code base and allowing us to reuse either model or view according to requirements with the evolving of iOS. As we might ...


-2

Does search logic belong in the controller or the model? Neither and both. In the circumstances that you describe, you actually have a need for several different search algorithms, along with the need to determine which one to use at any given time. This tells me that the model's Search() method needs to take in the algorithm as a dependency. ...


1

The View is responsible for displaying data and accepting input from the user. The Controller is responsible for accepting requests and directing them to the proper method in the model for performing the requested operation, including related operations such as granting or denying security access and form validation. It is also responsible for directing ...


3

200 OK Always returning "200 OK" is a terrible practice. It really kills anyone trying to write a client against the API. REST client frameworks rely on accurate status codes and will break if they receive "200 OK" even when it's not OK. The author of the REST client will have to jump through hoops to make it work correctly. As a case study, I was recently ...


2

In looking at this it seems to me that there are two distinct needs: Design of user interfaces Construction of user interfaces If your team has been getting satisfactory results with the former using drag and drop then it seems to me that the capability is there and that this more a question of practice with the new tools. (I think its a bit more subtle ...


2

UX designers are good at user experince and making attractive look & feel. But many of them have no idea what all these wonderful things means for developers and the work involved beneath There's a real risk at leting UX to take important decitions that could (they will for sure) have several impacts at development time. As mates already pointed out. ...


2

I think that if you have good software developers who can do their job in the server-side code and can do the business rules and architecture and design etc., then let them do what they do best. If some of them would like to take the opportunity to become a great UI designer too, then by all means, take advantage of that, let them take a course or something, ...


1

According to project, I am a back-End Developer but i know CSS and Html well, but that's not mean i can handle everything .. so direct answer see your client requirements and you need to ask yourself some questions. Is it a public site, so you will need a rich and fancy UI or just simple service with basic interface. you need a responsive design or ...



Top 50 recent answers are included