Knockout Mvc: Build Better Rias Faster!
You may ask: so what is so special about it? Let us show it to you on a real example!
Task:
So, lets imagine a task: we want to provide user with the ability to edit some data model. And some data handler logic is hosted on the server (for example, saving to database). So, we want to use ajax to send requests to server in order to avoid page re-load. But using ajax results in the necessity to describe logic on the client side that will be able to update the page based on the response. Besides, it is necessary to describe some part of data model processing on the client side using JavaScript in order to arrange good dynamic user interface.
Standard ASP.NET ways:
Lets see how to solve this without using any library under ASP.NET:
[JavaScript] Describe data model on the client side
[JavaScript] Describe logic of initialization of edit fields
[JavaScript] Describe logic of data model processing on the client side
[JavaScript] Describe logic of data transmission to server (manually collect data from the necessary fields and serialize it)
[C#] Describe data model on the server side
[C#] Describe logic of de-serialization of the client query to the model
[C#] Describe logic of data model processing on the server
[C#] Describe logic of serialization of the model and sending new data back to the client
[JavaScript] Describe logic of de-serialization of the response to the existing model
[JavaScript] Describe logic of updating user interface elements according to new data
If the model quite small, these actions are quite obvious, but if you want to add new property or method to the model you will need to carefully write considerable amount of code.
Using Knockout MVC:
Dont be so sad in advance now you have a new wonderful library! Lets see what will be solution of our task with the use of Knockout MVC.
[C#] Describe data model and logic of its processing on the server
[C#] Specify what data model element corresponds to every interface element
Thats all! The rest of logic will be generated automatically!
Refactoring of such Web application wont differ from refactoring of common C# application. You dont need to remember name of any property or method IntelliSence will help you write its name correctly. And even if there is an error, you will know it on the compilation stage. If some simple logic should be executed on both client side and server side (for example, validation of form fields), it is written in C# just once (then this code will be converted to JavaScript).
Got interested?
Visit us at http://knockoutmvc.com to get deeper into understanding how Knockout MVC can help you spend up your development and improve its quality!
by: Eugene Akinshin
Lifting Gear Hire In Yorkshire & Lancashire Ought To You Use Electric Dog Collars? Utilizing Ace Inhibitors To Combat Hypertension Dentist In Manchester Serves Community For Over 50 Years Selecting The Right Hot Tub Cover History Of South Sea Pearls Are You Experiencing Your Mobile Phone Numbers Yet? New Function From Balll Mill For Ceramic Sand 2012 Is The Outstanding Times For Lime Mill Sweater Styles For Pear-shaped Ladies! Fisher Price For The Best Start In Life Socalwebworx Few Reasons Why You Should Opt For Lg Optimus Sol
www.yloan.com
guest:
register
|
login
|
search
IP(216.73.217.98) California / Rosemead
Processed in 0.011435 second(s), 7 queries
,
Gzip enabled
, discuz 5.5 through PHP 8.3.9 ,
debug code: 48 , 2916, 85,