0

I'm planning the creation of a webapp with a dedicated mobile web interface and a dedicated desktop/tablet interface.

I am considering ASP.NET MVC, but it is clear to me that MVC is for separation of concerns as explained here, anyway in my case i'd like to minimize the code and to support elegantly phones and desktop (may be landscape tablet can be "desktop" too).

So is MVC a wise choice in this case or which is the 1st stop for this kind of xdevice web app?

closed as primarily opinion-based by gnat, Dynamic, ChrisF Dec 21 '13 at 14:04

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • what are your other choices? – bobek Dec 6 '13 at 14:44
  • I am not sure since i am researching, but if i am not going to use .net i could try some js MVC framework and write a HMTL5/css/js app. In that case MVC too. To my understanding MVC helps to avoid to keep 2 techstacks to develop the same app for 2 devices. What sounds strange to me is that MVC is always praised for "separation of concerns" and "ease of testing" and not for "multidevice developemeent" so I want to be sure it is for this too and that i didn't do a wrong assumption. – user193655 Dec 6 '13 at 14:53
  • You could use MVC and build the front end with a responsive design so that it will look good on any size screen. This way you don't need different interfaces. You can just serve one page for all devices. – DFord Dec 6 '13 at 15:13
  • 1
    In any MVC app, the html is served by the server along wiht any CSS and Javascript files included. You have to build the CSS files and Javascript files to change the layout based on the window size. CSS and Javascript are served from the server, but are run at the client. – DFord Dec 6 '13 at 15:55
  • 1
    DFord, stop referring to ASP.NET MVC as "MVC". "In any MVC app", HTML is not necessarily "served". Remember, the Apple Mac OS X operating system's desktop applications written in Objective-C are all written in MVC. MVC is an application design pattern that has been in use since the 1970s. Indeed, when building OS X desktop apps, MVC is the primary recommended pattern. Now you're not dealing with Mac OS, you're dealing with web/mobile devices, but that doesn't mean you can't organize your code with the application pattern and strategy of Model-View-Controller. That said, user5396, sure why not. – stimpy77 Dec 6 '13 at 18:40
4
+25

Yes MVC architecture is definitely a wise choice. AND you are considering ASP.net MVC for your solution. ASP.net MVC4 is a good option if you wish to develop one website and one mobile site for your business.

Suppose I want to develop a business solution where my devices varies as per business requirement from time to time. But the business logic behind would stay same for all devices. In that case I will go for ASP.net web API where it simply exposes API (methods to get and set data from your database) on web which any devices can consume. The data transfer between API and devices can use XML or JSON (which is configurable). Now, the view part can be written any language depending upon your devices.

Here you can have multiple views consuming the same web API on your server. This way you can save lot of code.

1

We have developed couple of apps successfully using Asp.Net Mvc that run on multiple devices.

Actually, MVC would structure the presentation layer nicely. Depending on the type of application you may also like to Business and Data layer to it.

Regarding rendering on different devices, you will have to create style sheets in CSS, which will make UI responsive and render it accordingly, depending on the type of device from which request is coming.

1

A pattern is very useful until it's not a constraint. Split your application in different components, decide how to connect them before and then program them. If you fully decouple the control part to the UI then is very easy to reuse the code for both the web application and the desktop application. In the end you have to deal with 3 components:

  • The UI (web interface or GUI)
  • The control part (which is the part that does the data crunching)
  • The "storage" part (on file or database, depends from your application)

Is this MVC? I don't know but it's probably what you are going to do.

Patterns are guidelines, not boundaries! ;)

1

MVC is a design pattern with aim to reduce coupling and increase cohesion of the UI, there are many different flavors from it such as MVP and MVVM.

Currently the trend is not to build a dedicated interface for each device platform, but to use something called responsive design (ex: bootstrap); this was possible after the release of CSS3 media queries, allowing your interface to adapt to the device it is being used on, also you can use bootstrap which is a very good UI framework that provide you with out-of-the-box responsive behavior CSS.

So bottom line (options using MVC):

  1. responsive design: you'll be returning the same view allows and the CSS3 HTML5 will be responsible to adapt to device type.

  2. controller device detection and multi views serving: your controller will detect the browser type and device;accordingly you'll be served a view that address you need - example if you open from desktop index will serve you IndexDesktop, if mobile the same model will be created the same item but will return IndexMobile. (to detect the mobile device and stuff go and download c# code)

  3. dedicated sites: which is not what i recommend because you'll be repeating your self in every move and would duplicate the amount of work.

Is MVC a wise choice in this case or which is the 1st stop for this kind of xdevice web app?

Personally I would recommend you go with a solid MV* framework; which one this is totally your call, you can go to MVC and it'll help you select one, I personally recommend using angularJS backbonejs or emberjs, they are all really nice and solid to work with, ASP.net MVC is a real nice framework but the problem is when it come to client side work, the framework will start to become problematic.

EDIT: Why ASP.Net MVC is a bit problematic when it come to client side?!

I personally use MVC4 for web development, and the number of things that you can do using it, is amazing; stuff like web API, testing, dependency injection, the out-of-the-box stuff like asp.net identity, but when it come to internal page routing, caching, handling internal page ajax, you'll need to use something other than razor.

sometimes you need to relay on the client browser for the app to work as desired, stuff like single page apps, and fat client apps (example gmail). you need to relay then on technologies that leverage client side behaviors like HTML5\CSS3\JavaScript.

most of the time i use MVC .net with some client side framework for optimum behavior, the result become something like a hybrid solution which the best from both sides.

Check this website out Hot towel - angular

  • Thanks for the answer, could you be more specific about "ASP.net MVC is a real nice framework but the problem is when it come to client side work, the framework will start to become problematic." ? – user193655 Dec 11 '13 at 8:21
  • You welcome :) I've edited my original post to address your comment. – omarqa Dec 11 '13 at 15:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.