Does anyone have an insight into ASP.NET WebFormsMVP? - asp.net

Recently I ran into this open source project ASP.NET WebformsMVP.
It seems like an alternative to asp.net mvc and also a quick way to introduce testability into an existing webforms applications. (without having to go through the pain of rewriting a bunch of code to make it work for asp.net mvc)
Of couse community support and open-source projects abandonment is always a concern when trying new things, but moving on from those fears, has anyone giving it a serious try at this framework? If so, can you share some insight into its pros/cons and if it's really worth trying it?
Thanks a lot!

WebformsMVP is included in DotNetNuke now, so we have started using it indirectly as part of custom module development within DNN.
I don't think we're fully utilizing everything the framework is capable of, but have had no problems to date. The implementation is very clean and simple to implement, and retrofitting existing webforms code is fairly straightforward. For us the learning curve has been minimal.
We have run into a number of cases where we aren't certain of the "right" way to do things, and have found pretty limited guidance online. (Try as I might to avoid it, sometimes I just have to poke some stuff into the ViewState.) But, with it being used by the DNN team, we feel pretty confident that it will not fade away soon, and a growing number of examples should appear online.
Of course I encourage its use, even if only for the selfish reason of wanting to see the community grow.

Related

Microsoft WebMatrix: what is it?

I'm a little confused about new Microsoft products.
I'm a classic webform Asp.Net developer. I know exists also Asp.Net MVC with a different approach based on Mvc pattern.
Now, i know exists also WebMatrix that uses new Razor "notation".
Can someone explain me what are the main difference between that "technology" ? When use WebMatrix, when WebForm ?
Thanks!
Webmatrix is a platform that integrates a variety of recently released technologies such as IIS Express, Asp.Net Webforms, Razor, SQL Express etc. I guess from what I have been reading it's a way that eases the barrier to entry, for non-MS developers, into the MS world. In addition you can also use code your site in PHP and use a variety of open source tools for developing web sites. To directly answer your question, in you planning on creating a complex web application, WebMatrix may not be the solution you're looking for.
As a reference, I suggest reading through Scott Gu's Introduction to Webmatrix
WebMatrix will be able to take
advantage of these technologies to
facilitate a simplified web
development workload that is useful
beyond professional development
scenarios – and which enables even
more developers to be able to learn
and take advantage of ASP.NET for a
wider variety of scenarios on the web.
If you are a professional developer
who has spent years with .NET you will
likely look at the below steps and
think – this scenario is so basic -
you need to understand so much more
than just this to build a “real”
application. What about encapsulated
business logic, data access layers,
ORMs, etc? Well, if you are building
a critical business application that
you want to be maintainable for years
then you do need to understand and
think about these scenarios.
Imagine, though, that you are trying
to teach a friend or one of your
children how to build their first
simple application – and they are new
to programming. Variables,
if-statements, loops, and plain old
HTML are still concepts they are
likely grappling with. Classes and
objects are concepts they haven’t even
heard of yet. Helping them get a
scenario like below up and running
quickly (without requiring them to
master lots of new concepts and steps)
will make it much more likely that
they’ll be successful – and hopefully
cause them to want to continue to
learn more.
One of the things we are trying to-do
with WebMatrix is reach an audience
who might eventually be able to be
advanced VS/.NET developers – but who
find the first learning step today too
daunting, and who struggle to get
started.
If someone is still interested: a pretty good lessons here http://habrahabr.ru/company/microsoft/blog/136004/ . This link is for those, who understand russian.
Shortly speaking WebMatrix allows you to conveniently mix up C# server code and html (this mixing is provided by simple Razor sytax). Also in WbeMatrix 2.0(beta version now) is provided full IntelliSense for html/css/c# code.

Is Ruby on rails something for me to learn?

I'm mostly a asp.net developer (and currently work as one), but I'm thinking about expanding my skillset or to learn something else. I'm thinking about learning Ruby on rails. What's the pros and cons with these (preferably from a asp.net (mostly version 2.0) perspective). Anyone
who has any insights?
I think it is easy to learn - and worth a try.
From ASP.NET MVC perspective it's easy to learn. ASP.NET MVC is close to rails - but rails has some more features.
For plain ASP.NET it's a bit harder.
Pro:
easy to learn
good to keep on learning new things
excellent linux/apache integration
Cons:
learning something new instead of extending existing asp.net knowledge
Integration in Windows (not good enough from my point of view)
why not? Variety is the spice of life and learning how to perceive code and data in multiple ways should flex your mind to create creative solutions no matter what the problem. There are things that .NET that are fantastic, while other things that RoR and other frameworks do better. No way to understand that until you do it.
Pro:
Exposure to another stack of tools which could be useful if you want to get into mixed environments. Seeing a different paradigm in going to a weak typed language.
Con:
There may be many areas closer to ASP.Net that you could choose to take instead including Azure, database development like MS-SQL or Oracle or Javascript frameworks like jQuery or mobile ASP.Net stuff for sites on smartphones or other things that may be closer to what you are doing now. WCF or WPF may also be options to consider that would be staying within the Microsoft stack in a sense.
While the Pro is certainly a valid one, I would think carefully about what other options are out there that may also be worth doing as well as considering what kind of stuff would you want to do later in your career.
Yes, if you're learning because you're curious. There's no reason why not. Ruby's a great language and learning any new language is interesting, since it can change the way you think about code.
Yes. if you're learning for job skills. RoR and Ruby skills are in good demand, as it's the highest profile web framework.
Personally, I like Python and Django. You might check out Django as the above logic applies to it as well.

Learning Web Development starting with ASP.NET MVC

I have been working with C# for past four years at the enterprise level. Now, I have taken a decision of moving to Web side of the things. Since I am well versed with C# and WCF I naturally zeroed in on ASP.NET as I need not learn a new Programming language. Learning just the Web Framework will suffice.
I have read a lot regarding MVC, so starting out with MVC 2.
My Question is Will I face any roadblocks if I learn MVC without learning Web Forms? Keeping in mind that this is my first foray into Web Development?
Looking forward to some good suggestions.
I was in your exact same position. The only problems you may have is wrapping your head around postbacks and what tha means. Having said that, MVC2 will teach you how to write better code instead of the typical spaghetti that comes asociated with webforms.
If you're new to MVC2 I'd recommend buying Wrox Professional ASP.NET MVC2 from writer Scott Hanselman.
Learning web development these days is hard as you need to be an expert on so many different things!
You need to learn HTML/CSS/JavaScript(ie, JQuery)/Json regardless of the server side framework you are using if you are creating “rich” web applications.
I would say starting with ASP.NET MVC is not a bad option before moving onto ASP.NET Web Forms. You are likely to hit both going forward, but as ASP.NET MVC does not hide what’s going on so much, I think it may be a better start.
However if you just wish to create simple forms on the web, it is hard to beat ASP.NET Web Forms, but as soon as you wish to do something more advanced, the Web Forms complex page cycle will give you pain.
If you're looking to apply your web skills to enterprise environments, you'd probably find a lot of environments still leveraging Web Forms. Outside of that, I can't imagine it would really hurt you that much.
The bigger thing about web development is getting familiar with HTML/CSS/JavaScript(ie, JQuery). The skills learned there are applicable to either environment. You'd probably be able so switch back end frameworks rather painlessly as long as you're used to c# and all the web stuff previously mentioned.
I think it depends on what type of applications you are going to be developing. I believe web forms would be easier for you to learn with the background you already have in WCF. But it might not be worth it if the applications you are developing are better suited for MVC rather than web forms.
My recommendation would be to determine what type of applications you are going to be developing and then look at the strengths and weakness's of each and then determine which one you are going to focus on.
You most probably won't. There are some concepts that belong to the web-application environment (session, caching, etc) that are common but you'd have to learn about them anyway. They are two separate frameworks so nothing very specific about one of them could help you with the other.
You will undoubtedly run into issues when knowing a "new" way of doing things without having been brought up in the "old" way of doing things. It's unavoidable, really. I'd suggest learning the basics of WebForms code if possible, if for no other reason than to be able to trudge through it when necessary. Of course, if you find yourself in the position of having to support a WebForms application, you'll learn by doing just like anything else.
This question reminds me of my early days in .NET (which were the very early days of .NET in general) and trying to find assistance with various issues. I was an entry level developer, hitting up forums and such with questions. Everywhere I went, people weren't really adopting .NET just yet. They were all old Windows platform developers, whereas .NET was my first Windows development (I was all UNIX/Linux in school). Invariably, nearly every question I asked was answered with something suggesting that I "just use COM." Of course, I wasn't familiar with this. It was "the old way" and I was using "the new way."
It was difficult to work past that, and you'll likely face the same issue here. Basically, when people have made a career out of doing something the one single way they know how, they tend to expect everyone else to know it as well and will cling tightly to it as their bread and butter. You can be better than that, but it'll require patience :)
I assume that your development experience included Windows Forms. In terms of the transition from Windows Forms to ASP.NET WebForms, there's no doubt that would be an easier transition. Whether that would be the best transition is another question. And I believe the answer is without a doubt, no.
MVC allows you to gain an understanding of the way the Web works. Understanding GET and POST, Requests and Responses, not to mention HTML, CSS, JavaScript, et al.
I would not hesitate to recommend MVC.
I don't understand why you don't want to learn Web Forms. Learning Web Forms is just like learning abc's. You'll learn it as you go along with MVC. My suggestion is, Just go with the flow in your learning of MVC and you'll be surprise that you're already learning Web Forms.

How can I restructure my site without a conversion to MVC/WCSF?

I have a portfolio made in C#/ASP.NET which started off small but, as it is selling myself, it has grown in size very quickly.
I started off with using ASP.NET webforms model but this has meant that some of my code is in class libraries (.dlls) and some in page codebehind.
I want to fix this (no defined stucture), but without the overhead of migrating to ASP.NET MVC or WCSF.
How could I address these problems? I am thinking of moving all logic to WCF services and calling them from page codebehind. Is there a better way?
EDIT: The current problem is codebehind (used only as the site was small at the start but now it gets a lot of attention from me with updates). I want to seperate this all out so it's easy to test (what MVC addresses), and the coupling is generally low. Is it enough to use WCF to achieve this? What other techniques could I employ? Maintainability is another concern because maintaining a codebase split between .dlls is awkward (when debugging, as I noticed and mentioned in some previous threads).
Thanks
Unfortunately, traditional web forms applications are damn near impossible to test. WCF won't be of much help because it's a communications technology that will help you to get the data to codebehind classes but won't help you to render or test pages.
Due to this complexity, there are very few test automation tools, and the few there are are commercial paid-for products. One such tool I have heard of, but have not used personally, is Ivonna. You can also test using browser automation. Two great tools to help with this purpose are watin and WebAii.
This is, of course, dependent on whether you still want to keep the original code lying around. What I take in when I read your post is that you want all of the benefits of MVC. Unfortunately, it may be best to take the plunge and rewrite the application. It's painful, I know, but the sheer amount of hackery to make WebForms ape MVC concepts is overwhelming, to say the least.
I cant fully imagine what you need, but consider URL redirection / slug

Should I build my next web app in ASP.NET MVC?

My team is considering building our next web app using the ASP.NET MVC framework. I am slightly hesitant, as are some others, because it is still only in beta. I really want to dive in because it seems to be a great way of providing clear separation of concerns and improving testability.
Should I take the plunge now, while MVC is still in beta, or hold off for a release candidate?
From some of the responses, I think I need to clarify my question a bit. My primary concern is whether to go with a product that's still in beta, not webforms vs. mvc. The concern is mainly because of the fear that we end up using some functionality in the beta version that gets changed / deprecated / not supported in the final release.
However, I do appreciate the perspective on webforms vs. mvc. It just doesn't get at the heart of my question.
It's a pretty simple decision tree, really.
Choose ASP.NET MVC if you...
Care deeply about URLs
Care deeply about your HTML
Want true separation of concerns
Want testability through and through
Want flexibility of view engines (ASPX, NVelocity, NHaml, etc)
Choose WebForms if you...
Enjoy the stateful abstraction of WebForms (ViewState)
Don't mind PostBack model
Prefer components that you can "drag & drop" on a page
For me, the answer will 99% be ASP.NET MVC, because I think it is a much better match for the web. I think the ajax story is much cleaner as well, and I have complete control over my HTML & URLs. On top of all of that, I can test-drive my website (controllers) quite easily.
Yes, I know you can achieve clean URLs in WebForms, and you can have clean(er) HTML through Control Adapters, and you can achieve a level of testability with the MVP pattern in WebForms, but these are all off-the-beaten path approaches. With ASP.NET MVC this stuff is core. That's just the way you do it.
And don't worry about the preview/beta status. The team has always maintained that you don't need a go-live license to deploy it (even though they now offer one). It's purely additive on the existing ASP.NET Runtime.
It's like automatic vs. manual transmission. Pick one that makes you happy and run with it.
I prefer ASP.NET MVC to WebForms, so I would choose that, but you need to work out as a team where your core skill set is and whether or not choosing MVC will:
Create a better product.
Get you to market quicker.
Don't just choose it because it's new. WebForms is still a great choice, and you can write code for WebForms that's both testable and has clear seperation of concerns.
So far Mvc looks good, however I m a castle advocate I have used monorail in many production sites and it got me into learning about IoC and AR
Cheack out castleproject.org
I'd recommend giving it a shot.
We just recently released an e-commerce platform with MVC running the front end, and while there are some gotchas that you may stumble upon (Say, resolving Url's with anonymous types is currently far slower than using a RouteValueDictionary, was a surprise to me), it certainly feels like it was a lot easier to build a manageable system in MVC compared to our older WebForms apps.
If you have the luxury of choosing, then you should definitely have a closer look. The bugs that have shown up while we worked on it have all been fixed fairly promptly, and most things work well now, and it's starting to feel pretty complete.
But in the end, it's always a risk to take on an early beta product. :)
Unless your app is super simple, it's likely that MVC will be released before you go to production. That hardly matters though. I have been building on MVC since Preview 2. Each new version has contained breaking changes; however, they have not been very hard to track down and fix. It's very unlikely that by 1.0 you could create a mountain of code that would be toppled over by some breaking changes. Simply budget a few person hours to apply each new version.
If you don't have to put your app in production soon, yes write it in MVC.
Here, we have a team working with MVC and planning to put it on prodution at jan/2009.
If it's not mission critical and you and your team have the time to learn it, why not?

Resources