I just finished the pluralsight class "Parent-Child Data with EF, MVC, Knockout, Ajax, and Validation". While it's a good class and the author has some great insights on how to cleanly implement a web application that uses knockout on the client, I was struck by how many hoops we jump through here to get data from database to client and how many times we convert the data along the way:
- Get data from SQL Server.
- Entity Framework (or another ORM) maps the data to an entity data model.
- Convert the entity data model to a view model.
- Convert view model to a JSON object that knockout can use.
Or, in terms of how we represent the data:
- Row in SQL Server
- C# Object (Entity Framework)
- C# Object (POCO)
- JSON object
...and we do the reverse when the user posts data to our controller. This just seems crazy. We're converting back and forth without good reason. The result is methods like "CreateSalesOrderViewModelFromSalesOrder".
Meteor does have its downsides, but the principles "One Language" and "Database Everywhere" are a step in the right direction.