Below is a method in a controller that access the database using the EF and updates the model object. If we require some values from the database and those values are not provided by the existing model class then we may directly put the data access code in the controller. This is an example of an antipattern known as the Cut-and-Paste Programming. If we reuse functionality across controllers and models by copying code then we duplicate code. If we are using some functionality in the controller and want to reuse that functionality across the controllers then one approach that we are tempted to take is to copy the code across the different controllers. This is unlike ASP.NET Web Forms where we have to run the request pipeline to test a single web form.īut as we start to develop applications specially large enterprise applications we may use anti patterns which may negate the benefits of the MVC architecture. Unit Testing Because the requests directly invokes the action methods in our controllers ,so we can easily test the functionality in the controllers without invoking the request pipeline. Because of this separation of concerns we can very easily change one component without effecting the rest of the application as there is a loose coupling between the components. Separation of Concerns In MVC application consists of separate components with different responsibilities. MVC provides a solution to the above problems Doesn’t allow us to work directly with the HTTP protocol because of abstractions such as server controls and view state.Unit testing is difficult because of dependency among different components.Difficult to maintain and change because of tight coupling between different application components.Though above are the obvious advantages but there are few problems in this traditional approach It provides server controls and other utilities using which we can develop web applications in a relatively short time.Ībstraction over HTTP Webforms provides an abstraction over the HTTP protocol which makes our experience of developing web applications just like windows application development. ![]() Rapid application development WebForms allows us to develop web applications very quickly. It allows us to develop web applications using the same event handling model as the traditional desktop applications.This provides certain advantages such as: ![]() Webforms is the traditional way to develop web applications. We can follow two different approaches for building web applications in ASP.NET
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |