Why SPA (Single Page App)?
Asked Answered
P

4

8

Inspired by John Papa's video at Pluralsight, I started learning SPA. It appears pretty interesting. However, before I fully jump in, I'd like to clarify some of my questions.

  1. From what I learnt, SPA is a lean server, fat client app. I think this should work well for small apps like what John Para demonstrated. Does it scale? How big it can be? Anybody has experience with this?

  2. In SPA, you seem to code all the business logic in JavaScript. Is this a good idea at all? How do you hide the business "secret"?

With my background primarily in C#/WPF/.NET, moving to JavaScript seems to be very difficult (well, I learnt a little JavaScript more than 10 years ago - I hated it and never touched it again). With my limited knowledge, I ran into several problems. Debugging JavaScript seems to be a nightmare to me. The highly praised component Breezejs seems to be still in its early stage (e.g. it doesn't support UOW, doesn't support CascadeDelete, doesn't support enums). So, I'm wondering this is good time to jump in?

Peabody answered 25/7, 2013 at 22:45 Comment(4)
Also why do you say it doesn't support the Unit of Work? I have a few examples of it supporting it outright.Revolving
it's a lot more efficient to have 1008 CPUs working on supporting 1000 clients than it is to have 8 CPUs supporting the same crowd...Killer
@kadumel, how do you make it work? I watched John's first video, which uses UOW, but not Breeze. Then, in another video, he uses Breeze, but not UOW. I googled and found this page #15114304.Peabody
Just expose metadata to the controller. Route all your calls through the unit of work. Save changes to the uow. Its all the same.Revolving
U
8

Directly to your questions:

  1. Since the server logic is thin you can use some kind of cloud services and they scale pretty good. The most of the logic will be handled by the browsers of your users.
  2. You should be careful if you depend on client. HTTP protocol can be easily manipulated. Don't forget that you should always do the validation logic both on client and server side! Also the "hidden" validation and other "secret" logic should be located only on the server.

Debugging JavaScript isn't so bad at all. You can use the built-in tools (Inspect element in Chrome and FireBug in Firefox, etc.) Also there are a lot of useful third party tools that will help you with the debugging.

If you start a new project just for your own use then I advice you to try the SPA approach. If you are writing production code you should become an expert in this area and then try to use these technologies.

Uella answered 25/7, 2013 at 22:53 Comment(0)
R
3

Regarding UoW, take a look at the TempHire sample. It demonstrates using the UoW pattern on the client as well as the server.

https://github.com/IdeaBlade/Breeze/tree/master/Samples/TempHire

Rolle answered 26/7, 2013 at 0:36 Comment(0)
I
1

I believe SPA's provide a better framework for Business Intensive Applications as well as simpler application workflows such as that of Facebook. I have worked with Multi Page Applications for banking application with complex workflows and it get daunting to handle every thing and still keep up the application performance.

But I do think Knockout Alone wont be able to handle large applications as it is to connected in nature. I would recommend something like Backbone Marionete or Angular for that venture.

I am building a framework for large scale SPA development for the opensource community so I do believe it is the right direction.

Interested parties can go to my demo page at http:\saqibshakil.github.io I have demonstrated some of my work there.

Illegible answered 17/9, 2013 at 13:5 Comment(0)
D
0

i have been looking into it for months. My conclusion is to use Knockout with a light path.js or sammy.js for your url. I use json with a standard Visual Studio MVC ( which can return Json) as the backend. I am still not done with the project but so far so good. It's lightning fast, elequent and lightweight. Stay away from the frameworks. Get a look at the standard libraries: how they are written; You can learn a lot of JavaScript that way. Finally debug with chrome or explorer developer tools. Good luck

Delative answered 26/7, 2013 at 2:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.