WPF with an Asp.Net MVC Background - asp.net-mvc

As an Asp.Net MVC developer, what is the best starting point to dive into WPF?

WPF is a totally different technology used for a different purpose. You're writing desktop applications rather than web applications.
While there is some cross over in terms of design patterns and both use C# (or VB.NET) as the "code behind", they each need their own approach.
Your best bet is to read and work through some WPF tutorials and then decide on a fairly simple application to write from scratch. Get that working and you'll have a reasonable grounding in the technology.

WPF is a platform for developing Windows Application , while ASP.NET MVC is a platform for developing Web Applications.
If you are into Web apps development, and you want to learning something similar to WPF, you can go for Silverlight.
Silverlight is Rich Internet Application development (RIA) platform that can be used to develop interative web apps. Silverlight is also capable of running on desktop as Out of Browser Application.
I suggested Silverlight because, Silverlight & WPF both share a markup language called XAML to a great extent. Once you are familiar with XAML, you can slowly start with WPF.
WPF consists of wide range of new terminologies and techniques such as :
Routed Events
Data Binding
Commands
Styles and Templates
Some of these are present in Silverlight while some are yet to be introduced in future versions Silverlight.

If you're looking for a framework that helps you apply some 'best practices' in WPF/Silverlight development (similar to MVC helping you in the ASP.Net world), you may want to have a look at caliburn and/or prism (aka. CompositeWPF). However, as others have stated, it's probably a good idea to learn some of the basics of WPF first.

Related

Determining if .NET MVC should be used

I am about to start a new project. I would like some indicators to determine if I should use ASP.NET MVC or not.
(Other than experience with ASP.NET MVC...)
What are some indicators that ASP.NET MVC model should be used when starting a project?
What are some indicators that ASP.NET MVC model should not be used when starting a project?
Hm. I thought better about that question, and I guess it would be acceptable to use WebForms if and only if:
Your team members have no idea of web standards, and they prefer to use Visual Studio for developing pages.
You don't care about TDD.
You don't care about object coupling and other "esoteric" SOLID principles.
You miss developing windows applications, and you want that web development be as close as possible of that experience.
You don't care about maximizing performance, or making session-less web applications.
You wanna make it fast and dirty.
If any of the above statements is false, I would recommend you to forget about WebForms and dive into ASP.NET MVC.
Edit:
There is also another reason for NOT using ASP.NET MVC:
You are somehow commited to WebForms (for instance, spent a lot of money on WebForms components or training).
This would invalidate any of the reasons above, unfortunately.
If you want or need testability, definitely go with MVC. That is pretty much the only area of MVC that is almost impossible in Webforms. Other than that it is totally subjective.
Both frameworks are pretty much equally applicable in most areas. In my opinion it comes down to one thing:
Do you prefer to work with a page and component-based framework (Webforms) or an action-based MVC framework (MVC obviously).
In my view Webforms are getting much more bad press than it deserves, and honestly it seems that it is simply come il faut these days to hate Webforms, and love MVC.
Both are simply a tool to reach your target, choose what you like the most. That's it.
I'd generally run with MVC these days. But webforms isn't that bad, and the 4.0 tweaks brings things much more in line with modern web standards and tools. One place they can really shine is intranet apps -- the disadvantages like poor SEO and viewstate either don't matter or become advantages. Drag-n-drop ajax is nice, many developers still do better using the ajax control toolkit over jquery.
On the testability side, I will agree that MVC is a bit more testable in the UI layer, but the meat of your application should be below that waterline. Moreover, there is a fair bit of black magic and voodoo in MVC (DefaultModelBinder anybody?) too. What you really need in both cases is true UI integration tests and they generally don't care either way.
So do what you know and love.
UI COMPLEXITY
The main limitation of the mvc architecture is the absence of viewstate, it don't provide any integrated solution to manage the state of components of UI.
The asp net webfom provide a integrated solution to manage it.
So if you plan to realize UI with many widgets inside, the webform has a builtin solution to archive the problem (at the cost of a more complexity).

Performance monitoring for ASP.NET MVC2?

I would like to know if there is an equivalent of "New Relic RPM" or "JavaMelody" for ASP.NET MVC2 ? I can't find anything about monitoring on ASP.NET MVC2...
Any idea ? How do you monitor the performances of you ASP.NET MVC2 applications ?
http://www.newrelic.com/
http://code.google.com/p/javamelody/
Thank you
For real world uptime/performance monitoring, we use outside services such as BrowserMob. For internals, an ASP.NET MVC app is just a ASP.NET app as far as IIS is concerned, so your normal ASP.NET/IIS monitoring tools do just fine.
By normal tools I'd start with the performance counters for IIS and ASP.NET. This page is perhaps a good place to start.
I should add the underlying point here is, unlike ruby and some java stuff, you are building on a very solid, instrumented platform here. There is lots of data there, and tools to make it more understandable.
New Relic now supports ASP.NET monitoring (still in beta) :
http://www.newrelic.com/

Is Rapid Development a moot point in ASP.NET MVC?

Since asp.net mvc did away with many controls that were in webforms, does this make rapid application development equal with other environments now? For example, if I have an mvc framework in php, j2ee, etc., and I have asp.net mvc, and the coder knows the given platform, isn't the development advantage gone in visual studio?
If I am wrong about controls being missing please let me know, it was my impression they were (and I couldn't use them when I tried it last.)
I ask because where I work some like Microsoft - a lot, some can live with it, but the ones that like it point to Visual Studio for rapid development. I thought much of that was gone with asp.net mvc 1.0.
EDIT: I guess I am thinking that dragging and dropping controls means Rapid Application Development (again, assuming the coder knows what they are doing everywhere else.)
Rapid application development is just a buzzword. It exists if you develop an application rapidly, not due to any particular tool or technology.
ASP.NET MVC is just a different approach. Some people can work faster when they are closer to the HTML. For me, this means I don't have to deal with the (IMHO) touchy databinding model of WebForms. Instead, I pass my Model directly to my View for rendering. That lets me develop rapidly. You can still develop your own UserControls (or download many of the ones that are available through open source projects), but you can't use anything that has events or ViewState intrinsic to it.
EDIT: RAD is also a subjective term. Is it rapid application development if you can churn out the first iteration in two weeks, but have to push the schedule back two months for the second iteration because the code was not maintainable?
If you are talking about the ability to drag controls onto a page, click them, set some properties, and have a code generated for you, and a working application by basically dragging controls and tools around, yes, MVC removes the ability to do RAD.
MVC exists to solve a different problem. It is for people that want separation of concerns to support unit testing and extensibility. Things that were nearly impossible to get with classically developed asp.net applications.
Web forms was an attempt to be more RAD if you will. However, the emergence of things like MVC, and Dynamic Data and things like Linq and Linq2SQL are pretty darn good evidence that Web Forms alone were not the panacea RAD platform.
From a personal standpoint, one may be faster at Web forms just by experience. That doesn't mean the platform or it's competitors are better or worse at RAD.
A lot of people found that Web Forms took so much control away and had such large event models that it ended up being less RAD than hoped.
I'd say that Rapid Development and ASP.NET MVC are not mutually exclusive per se. however since MVC has the intent of segregation of responsibility to (amongst others) allow testability, it might not be the best choice for Rapid Development-
On the otherside are ASP.NET Webforms where you can do ALOT "visually"/using drag-n-drop (i.e. no code), which to some extent does a very good job of for example preventing testability. But developing is a "no-brainer" - meant in the most positive way :)
Well, I've never considered Visual Studio as a RAD platform. Faster than PHP, sure. Comparable to Netbeans/Eclipse. Not even close to a true RAD platform though (oh Delphi, how I miss thee!).

Do you know of any real life business application made on ASP.NET MVC (commercial)?

Does any one know about any real application built on asp.net MVC framework. I am not
talking about opensource projects as I am pretty much aware of it.
I am more interested in knowing about any commercial website like banking, ecommerce
or any other line of business application that's built on this framework.
EDIT:
Clarification regarding opensource. I am pretty much aware of opensource projects and they are great. What I am looking for is commercial business application that's made on this framework.
If you visit What is ASP.NET MVC? and scroll to the bottom there is a list of sites that use ASP.NET MVC including stackoverflow.com.
Yes, I have built a commercial "line of business" application on ASP.NET MVC 1.0. We started development on the site when the framework was in beta; and released the site this summer. We are completely happy with our technology choice. Unfortunately I really can't say much more, as my employer would not welcome it.
I'm not sure about the OP's intent; do you mean to get validation of the MVC pattern for very large codebases, i.e. 200 kloc or larger codebases? I can't give you that, and I doubt anyone else really can right now, because there simply hasn't been time to develop so large codebases since the release of ASP.NET MVC. I would suggest researching MVC in Java, as this is probably where you'll find most older & large MVC deployments.
My usual counterargument to the 'very large codebase' fear is you simply shouldn't design so large monolithic apps anymore -- break up the responsibilities and use a SOA architecture to reduce complexity for each individual area of responsibility.
For a webapp on the .NET stack I'd select ASP.NET MVC again with complete confidence. That said, there are many other good choices in webapp frameworks these days.
In here you can easily find top 10 web sites that are built with ASP.NET.
http://www.findmyhosts.com/top-10-asp-net-mvc-framework-websites/

Why to move to Asp.NET MVC - why not to move

Simple as it is :
Why to move to Asp.NET MVC & why not to move ( if there is any reason ) ?
Added
Is it a necessity to move ?
Can we say the future belongs to asp.net mvc ?
How many years do you think it can stays on top ?
MVC is much more well constructed, allowes for much better code seperation and control over markup, and is much lighter on the server, that IMHO the only reason not to move is if you have a legacy .NET application (or other) that is working flawlessly, and you're not expected to perform serious adjustments / fixes on it in the near future.
If you do decide to move, you should know that you'll be able to reuse very little of your webforms GUI and user controls, since MVS is built a bit differently. You class libraries you could reuse, if they're written well. In any case, writing stuff in MVC is much faster than in WebForms, even if done from scratch.
also looking at moving at the moment.
the main bonus for me is the complete control over layout. i'm also looking into implementing a restful API which the MVC model works very nicely with because of the path structure.
Josh
If we move for MVC we can add or edit any module so easyly.
So we can add any new module just like a plugin
I patrially disagree with the accepted answer. I have built large applications in both WebForms and MVC and here is my opinion:
ASP.Net Web Forms and ASP.Net MVC are both great frameworks that allow the C#/VB Net developer to build enterprise level applications. Choosing which one to use for your app depends on a few factors. The MVC model has been around for many years, it is well suited if you need more fine-tuned control over the page cycle process and it is also superior when it comes to unit testing etc, because it supports true separation of business logic and presentation layers.
However, do not dismiss Web Forms, the reality is you can continue to use the web forms framework and still have tight control over your page elements be simply moving away from pre-built server controls and integrating HTML5 standard controls. You can take advantage of new JavaScript frameworks like jQuery, you can improve search engine friendliness by using techniques like URL Re-Write, and you can reduce or eliminate post-backs by taking advantage of asynchronous frameworks like jQuery AJAX and SignalR.
The main reason I disagree with the accepted answer is the statement "writing stuff in MVC is much faster than in WebForms" is completely inaccurate. As any developer who has actually built MVC apps will tell you, it's actually much fast to build WebForms apps. The reason is not just learning curve, but the fact that while MVC gives you the benefit of "under-the-hood" access to the page cycle and more direct access to HTML output, is also the reason it takes longer to build MVC apps. Trust me, you will find yourself doing much more "plumbing" work than you ever did with "drag-and-drop" WebForms development.
The fact is, there was a lot of hype when ASP.Net MVC first came out and too many developers assumed it was a replacement for Web Forms. It hasn't. As I stated in the beginningm both frameworks are great, they both have their pros and cons. I would guess that 90% of developers are still building new apps in WebForms.
That's my 2c.

Resources