ASP.Net MVC VS Javascript UI - javascript

I haven't done any web development for the last 6 years apart from a small silverlight project two years ago.
So 6 years ago I was working on a web project project using ASP.net and I must confess that I never liked Web Forms. Because ASP.Net
was a requirement I and because I was starting to get interested in Restfull web services, I used markup free ASP.Net pages,
each being a controller, and in each there was a big if, which was looking for the method name in xml message being sent from the front-end.
Around that time I started seeing web application using web services for the back-end and javascript only interfaces, which were using Ajax requests.
So for the last 6 years I´ve worked mainly in the Services Layers, with SOA and more recently with Event SOA, so to me I don´t understand the need for ASP.Net MVC,
I am learning it, because it seems to be a requirement everywhere this days, but in the times of SOA why do you need ASP.MVC if you are using just MSFT stack?
Say I want to build a new system, with a web front-end, and I built it in Layers, like the example bellow:
DAL -> SOA Services -> Web API (WCF) -> Front-End (JavaScript only)
Would it be better if a built it using ASP.NET MVC? I mean don't take me wrong but I just don´t see it fit anything but small non-layered projects.
ASP.Net MVC is a huge improvement over Web Forms, and I was hoping you guys could give me some insights on this; I am not trying to be cynical here, I've been
away from Web Developmental for a long, time and I just need to know why people seem to prefer ASP.Net MVC over plain JavaScript front-ends.
Thanks a lot.

This will get closed as you're really asking for opinions.
But the reasons include:
Purely javascript front-ends are still extremely hard to do well. Extremely.
ASP.net MVC came out a couple of years before you could really do that anyway
Code reuse is much easier in a server-side framework still
WCF webservice vs ASP.Net MVC is personal preference. Both have their weird black magic quirks that shows MS still doesn't quite get HTTP, HTML or javascript. They did just bring out a Web API for MVC, though it's still not clear why they did as it seems to adds very little.

I understand that major question is "where to build views and UI logic - on server side or client side" Shortly speaking - it depends on priorities. If you need quick results - use server side language to generate views and only plug in javascript into your pages. If you need to have responsive design with many dependences between components on the same page - probably javascript is your only choice.

Related

AngularJS applications imply single page applications?

So I just spent the past 5 hours reading up on Angular JS. It seems like a lot of people are heavily associating this framework to single page applications especially when accommodated with a back-end MVC framework with nice API usage like Ruby on Rails or Laravel.
I have 2 main questions that have been boggling me:
How do you initialize such apps considering that the content is
dynamic in nature. When using something like RoR/Laravel, I'd prepare
the HTML with the dynamic data at the back-end and then serve the
initial pages. It seems like most people using Angular serve up a
basic skeleton of the HTML and then do a round trip to web server
again for some data. Is this really how its done? if not, please
suggest a the right way.
Secondly, I dont think I am about to embark on a project with a
single paged application in mind. Does that mean it would be overkill
to use AngularJS for my project. Does anyone have a use case that
they think is appropriate that would require AngularJS with non
single page application that jQuery cant handle easily?

AngularJS Website - Full or Partial

I would like to build a new web site using AngularJS. The idea is to build a server side API with Ruby on Rails that serve Json to a front-end AngularJS.
My question is: Is it better to create a full AngluarJS front-end or a standard ruby on rails front-end with some Angular ?
I know Angular can handle routing so a full application is possible but it looks like the default behavior is for single page app.
For example I wonder if it's not a problem to make some change in an angular page 1 that should modify a page 2. This page 2 will not be updated until an action is taken on the page or the user reload the page.
Is there something wrong in my approach ? What do you advise ?
Thanks for reading.
I have personally done variations of a number of angular apps, varying from SPA with 50K+ views to simply using angular as an extension of basic javascript for useful testing and modularization.
The answer to your question isn't actually all that technical but more has to do with the nature of your application and team (You're essentially trying to pick what type of screwdriver to use). As what you're trying to do is feasible on both the client and server side.
Important questions to ask:
Is your team more comfortable in Rails or Angular
How dynamic are your web pages expected to be
What browsers are you supporting
Is there a requirement for data latency and communication with the server
Are you also going to be reusing the server API for other applications
These questions will drive you towards use of Angular or Rails or the combination of the technologies to find the balance.
The routing mechanism in angular is only within a single window object.
If you have two windows you will have two angular applications. If you want to communicate between the windows object angular does not provide any special mechanism further than standard HTML and javascript.
I don't know what is the better approach for you, that depends in your business requirements and constraints.

Is using AngularJS and WebApi good for large complex systems? Questions also

We currently have an asp.net webforms web application, which needs updating in terms of look and speed. I think its time to redevelop it and was thinking about creating a webApi and change the website to asp mvc. But then i started using AngularJS and loved it, now i am thinking about redeveloping our site using AngularJs and a webApi.
Am i right in thinking that using AngularJs + ASP MVC is pointless, as they are nearly the same thing (although 1 is clientside and 1 is server side)
Also i have a couple questions about using angularJs on a website.
On the mobile apps that i have used angularJS i have used the routeProvider and stateProvider to change the page. This adds #/SOMETHING to the url and angular loads the correct content accordingly. Does this work ok with search engines like google?
Should the whole web application be 1 app within angular, or should it be broken down into app modules and each be a separate "app", even though it is 1 website? I am wondering about performance. Say i have a website where the user can look at companies, contacts, projects. Each module may have 10 different pages, can angular handle this? In our app we would have over 20 modules, each with maybe 10 pages+.
Is this something i should avoid? Would ASP MVC + webApi be better?
Any other views and opinions are greatly welcome, i want to get as much information as possible before making my decision and developing.
Thanks in advance
Let me try to address some of your concerns.
ASP.Net Partial views can still be used even if you decide to use AngularJS and WebAPI. Have a server view has some advantages. For example if your view has element that are only accessible to authorize users in a specific role, then better to not emit that view content from server, rather than hiding it on client side using AngularJS.
I have not done mobile development using AngularJS so i cannot answer your bullet point 1. But as far as SEO goes every client side framework has the same challenge. Google SEO techniques for Angular and you may find something interesting.
Regarding bullet 2, all depends. Multiple SPA apps can be created if the functionality is tangential. For example user side of app and admin side of the app can be different SPA but they can be a single SPA too. I think it all depends upon on scenario and there is no hard and fast rule.
For bullet 3, this is too broad question. I can only say AngularJS is a very capable framework and can do everything that MVC+ WebApi can achieve. There is a learning curve involved and it takes some time to do stuff the Angular way but i believe it is well worth.

Integrating AngularJs into existing ASP.NET MVC 4 web application

Soon I'll start working on the next version of a website I've built. Basically it's kind of a CRM. Lots of tables, forms, CRUD everywhere. The problem is that it's going to be nearly a rewrite cause of huge requirements for functionality for the up-coming version, and we will need to make the website a bit more interactive, responsive and user friendly.
Currently it's ASP.NET MVC 4, with some jQuery for ajax stuff. MVC 4 application acts as a glue/proxy between client-side and underlying service which provides all the data, so WebApp has no direct communication with database. Also MVC 4 application is where business objects are transformed into ViewModels. We use DataAnnotations Validation for ViewModels.
Now what I was looking for, is to somehow integrate something like AngularJs. The goal is to move closer to SPA, give the client-side some structure, as building more functionality on top of existing jQuery code will just result in a sphagetti. However, writing full-blown SPA is not really an option, as it will require way too much effort and time, as always, is not unlimited.
For start the goal is to move Html forms management to AngularJs. That means I need a way to render MVC partial view with MVC model, and let Angular take over the controll. Posting changes/updating the view should be handled by Angular.
I have been researching Angular + asp.net for a while now, and the problem is that I need MVC models, but Angular also needs a 'model' ($scope). I know about ng-init, but some models will be quite complex. so it does not seem like a good idea.
Also server side validation (DataAnotations with loads of customized stuff) with unobtrusive client-side validation works very well for us, so would like to keep that and somehow make it work with Angular.
I've also looked into AngularJs/BreezeJs/MVC4, but breeze mvc integration is focused on EntityFramework, and it needs model metadata for client-side to be able to save, update and cache entities. And as mentioned earlier, mvc app does not access database directly, nor has a way to generate metadata. Writing by hand is not an option.
I know I'm trying to make some kind of hybrid and would have a lot's of issues having models on server and client sides, so I am looking for an advice which way should I go.
Is this doable?
Maybe I can generate metadata for Breeze js from existing ViewModels on MVC (breeze seems to work with dataanotations and validation works on client-side, at least minimally)?
Maybe this is a nonsense and I should either continue with MVC app, or go full-SPA, and there is no easy way to combine them both.

Do I need (Spring) MVC if I have Javascript/CXF?

I am developing a Java web services application that is (mostly) to be used by other SOA clients. Currently I am planning on using CXF to publish my various web services & methods using SOAP/XML.
I am now being asked to investigate a thin client web-application for this tool. I have been looking into Javascript libraries such as ExtJS and Dojo -- and they seem really straightforward. Given that this is a web application and not a web site, I really don't think I'll be creating very many static HTML pages -- maybe even just one. Mostly I plan on using an XMLHttpRequest object to hit the web services I already have and take the results and modify the DOM.
However, I have never created a browser-based UI before and in the context of a nearly 100% Javascript application I am trying to figure what role, if any, a server side MVC framwork such as Spring MVC will buy me. Is it needed for this? Whats it good for?
If you use the CXF JavaScript client generator and go for a single page JS application, I don't see what a Java MVC framework will give you (apart from extra complexity).
Spring MVC is a web-based module based on servlets and JSPs. If you're writing a JavaScript UI that calls on services directly, I'd say that you don't need Spring MVC.

Categories

Resources