5

I have been thinking of doing some development with backbone.js javascript framework and i currently use ASP.NET MVC...

After considering this, it seems the ASP.NET MVC server side part would be redundant...

Backbone.js would contain my models which i would get by calling a REST service on my WCF machine.

My ui would be updated by Backbone / js ...

Any logic would be in backbone.js controllers that is necessary to be executed on the client side.

I would really love some input, because i seemed to have arrived at the assumption that ASP.NET MVC is wiped out by backbone.js..

Anyboyd using both, why? and how?

Thanks in advance

Martin
  • 23,844
  • 55
  • 201
  • 327
  • 1
    backbone.js no longer has `Controller` http://documentcloud.github.com/backbone/#Upgrading. Plus, is none of your logic sensitive? For instance, are you going to handle administration on the client? What would stop a non-administrator from making themselves an administrator when all of your logic is client-side? – Joseph Yaduvanshi Jul 22 '11 at 12:19
  • @JimSchubert permissions and users are in the database. Security is in the database. You dont actaully need a server – Raynos Jul 22 '11 at 12:25
  • 1
    @Raynos: Just because security is in the database, doesn't mean it's done properly. – Joseph Yaduvanshi Jul 22 '11 at 12:56
  • @JimSchubert That's correct, but you don't need server-side code to do it properly. You can also not do the security in the server-side code properly. – Raynos Jul 22 '11 at 12:59
  • You might look into the new Asp.Net WebAPI (http://www.asp.net/web-api) – Dofs Jul 21 '12 at 09:34

3 Answers3

9

I would really love some input, because i seemed to have arrived at the assumption that ASP.NET MVC is wiped out by backbone.js..

No. backbone runs on the client.

There's a difference between what can be run on the client and server.

However it is actually valid to not have your server as middleware and just expose the database over REST.

You will of course need proper login mechanisms and permissions set up on the database for security.

You need the server for closed-source code however.

If you want to use C# / .NET / Massive code-reuse. Massive pattern re-use use the server-side middleman.

The concept of large application with only client & database is un-tested and there's little knowledge about "What's good practice" because those don't exist.

Of course you could server-side javascript like node.js instead and be able to re-use all your backbone models/collections on the server & client. This might be more optimal for you

Raynos
  • 166,823
  • 56
  • 351
  • 396
  • "The concept of large application with only client & database is un-tested and there's little knowledge about "What's good practice" because those don't exist." -- not sure where you were during the late 90s/early 2000s but I can think of a few hundred VBA/SQL apps that did just this. – Wyatt Barnett Jul 22 '11 at 13:17
  • @WyattBarnett And I thought common attitude to VBA/SQL apps is that they are spaghetti and a maintenance nightmare. Although I didn't think about how much information / architecture design can be carried over from those applications to web sector – Raynos Jul 22 '11 at 13:19
6

Funny, I would have actually approached it the other way around: keep MVC instead of WCF. It does not matter if your MVC project will only server "data" rather than "views" to its clients MVC still provides a lot of the plumbing required for web applications.

Hector Correa
  • 26,290
  • 8
  • 57
  • 73
2

Please refer to my answer to a similar question

My short answer is MVC is absolutely not wasted when using client side frameworks. MVC is about so much more than writing views in Razor. You get model-binding, validation, authentication and the ability to to control your URL structure through choice of controllers, actions and routes. 80% of the goodness is useful even without using server-side views.

Community
  • 1
  • 1
Dan Turner
  • 2,233
  • 18
  • 19