Wednesday, November 17, 2010

Pain Points

Over at ms-joe Joe has a compiled a list of pain points that developers have suggested typically give concern when trying to stay on top of all the new and exciting stuff that pours out of Redmond and other forges. I don't normally follow Joe's blog and I got there I think from Alvin Ashcraft's Morning Dew. Whatever, I took it upon myself to, tongue somewhat in cheek, respond to the 35 items in the list. Clearly my response didn't pass moderation - it appeared briefly but was pulled almost straight away. Fair enough, I'm not about to take umbrage but I did feel that what I had to say might at least generate some feedback. I didn't save my original response so now I get to do it over. The items are copied from Joe's site and I'm not sure if I'm breaking any copyright rules by posting but I am giving full attribution to Joe for the questions. The responses/opinions are all mine.

1.) Choosing between Web Forms, MVC, WebMatrix or something else entirely.

Real developers use MVC. If, like me, you are presently stuck with legacy Web Forms I feel your pain. MVC is the future and it is a huge improvement over Web Forms. I understand WebMatrix to be targeted at hobbiest devs who might more traditionally have gravitated towards Access.

2.) Choose Windows Forms, WPF, Silverlight or something else for desktop development.

WPF. I make this assertion not from experience with either WPF or Silverlight but long experience with Windows Forms. At this point there is enough of a question mark over Silverlight that I wouldn't go there and it is hampered for the desktop by it's sandboxing. For me the future lies with HTML5 and in particular the mobile space. HTML5, CSS, JavaScript, jQTouch, WebKit provide a natural cross platform environment for mobile development. There are only a couple of cross platform options in this space, it just makes sense.

3.) Choosing a data access method (ADO.NET, LINQ to Objects, LINQ to SQL, Entity Framework, NHibernate, embedded SQL) and how to use that choice in application architecture. What are the good practices, should I use binding? Etc.?

For small projects use LINQ to SQL, for large projects use LINQ to EF. In both cases use DTOs between layer boundaries. There are other players in this space including LightSpeed, SubSonic, NHibernate (stay away from NetTiers). Choosing an ORM is a difficult choice, and there are plenty of good options. If you have a clear separation between your business logic and data access layers then you should at least have some ability to revisit that choice but in reality I haven't seen anyone change ORMs mid-project.

4.) Choosing between ASMX or WCF (When SHOULD I use WCF)

You should always use WCF, WCF is good.

5.) Determining the right practices and patterns for development.

See item 1. I like REST, MVC, and AJAX via jQuery. This stuff works and provides a good separation between your different layers. I'm just now putting the finishing touches to an iPhone app written in HTML5/jQTouch/jQuery that uses JSON to talk to a WCF REST service hosted in IIS with an EF/SQL Server data store. It all seems very natural although I'm sure the Ruby community might have words to say about that claim.

6.) Finding examples of non-trivial applications with great documentation and tutorials.

TekPub. I find I'm fairly constrained in the time I have available to look at new stuff and I like to read so I tend to pick and choose and I rely on StackOverflow if I'm stuck on something specific.

7.) How to build, consume, and manage Reusable Code (Libraries, Frameworks, Controls).

Read Dependency Injection in .Net. I'm supposed to be writing a review for it but those darn time constraints keep getting in the way. I'm about halfway done and despite already having experience with DI/IOC I am learning plenty. Again, the Ruby community have words to share on DI but if you're doing c# you owe it to yourself to read this, it will inform your code and app design.

8.) Microsoft guidance focuses on HOW, but not when and why. Proved “Best Practices”.

See item 7.

9.) Moving from WebForms Controls to JavaScript (jQuery) (How, Why, and When to choose which.)

If you're not familiar with JavaScript you need to spend some time learning the basics. I think TekPub has some good JS stuff and there are a number of good books. For a .Netter JS contains some surprises. Doug Crockford's JavaScript: The Good Parts is a good read that will set you up to avoid some of those traps.

In many ways moving from WebForms to jQuery is going to put you a lot closer to the wire than you might have been used to. I like that, ymmv. I really disliked how the MS tooling in WebForms was all about trying to abstract away the browser. If you followed the prescription then everything was ok, but if you wanted to to something outside that it all seemed to get very hard. There is no question there is a learning curve associated with moving to MVC and jQuery but it will tend to make sense. With Web Forms the learning curve was all about how to get around the limitations of the abstraction.

10.) Show me how to do Grids and all other WeForms control functions in jQuery.

Check out Encosia and working with jQuery templates.

11.) Should I choose jQuery or ASP.NET AJAX (and how do I use jQuery to do all the things that I used to do in ASP.NET AJAX and the Ajax Control Toolkit.

Choose jQuery and refer to item 10.

12.) Deciding whether to use Silverlight in an ASP.Net app.

Avoid Silverlight for the web. Like Flash it is not web friendly, it is not search engine friendly. I know of a bank that is using it for an intranet app and they are pleased with it so it does have a place and being able to use your existing C# skills is a plus.

13.) Complete guidance on REST with samples of working will all major REST APIs (Twitter, Facebook, etc.)

That's a tall order. I haven't looked for REST guidance for a while. There is some good stuff out there and the basics are simple. Use uri's to identify your resources, POST = Create, GET = Read, PUT = Update, DELETE = Delete.

14.) How to do OO Design & Coding with .NET (I never really had to learn)

See item 7.

15.) Changing our development practices to follow more of a TDD model.

Read Uncle Bob's Agile Principles, Patterns, and Practices in C#. Prentice Hall. 2006

16.) Source code management tool options. VSTS and cheaper solutions (CVN)

How big is your shop and how deep are your pockets? SVN (including TortoiseSVN for explorer integration and AnkhSVN for Visual Studio integration) is a good free option, VSTS is also a good option but I think it is still the case that if you want to go over the 5 CALs that come with your MSDN subscription you're in for a hefty bill over and above what you're already paying for MSDN. I haven't used Git but I'm considering it to get my source into an offsite repository. Avoid CVS.

17.) How do implement a true and Abstract DAL

Item 7, use DTOs

18.) How to build a good BLL with validation (required fields, etc...) in front of an Entity Framework DAL.

If you have abstracted your DAL then the fact you're using EF is irrelevant.

19.) I need a complete strategy for SEO. Microsoft has some tools, but no complete story!

Your basic strategy for SEO is to write quality validating HTML that the crawlers can index. Everything else is snake oil.

20.) How do I design and build for high performance and how to I troubleshoot performance problems.

If you're Facebook you've got a team working on this for you. Otherwise design and build using what you already know. If you find there are performance issues, capture timing information by inserting NLog logging statements at suspected bottlenecks. There are other tools available, including a logging tool that can be applied without having to rebuild your app but I've not used it and I can't remember its name right now. There are also code profiling tools that can help but the basics are to start thinking about where the bottleneck might be and trying to prove it by judicious use of logging. Don't assume. Don't make random changes to your application based on where you think the issue might lie.

21.) Understanding stateless application development. WebForms handled “state” for me. MVC and WebMatrix don’t.

I'm not sure I understand the issue here. Is it the remembered state of controls or session state? Either way I don't feel knowledgable enough to give technical guidance but frankly this is web 101 stuff and you're a smart individual, google it.

22.) Building a business case for management to migrate a Classic ASP (VBScript) (90% of app) to ASP.Net MVC instead of ASP.Net WebForms (10% of app).

Don't kid yourself, this is not a migration, it is a rewrite either way. What are the advantages of MVC? For a developer a huge bonus is the testability and if you're rewriting an existing app you really want to make sure you capture those existing business rules in a test suite. Did I mention MVC produces better quality HTML and how, in turn, good quality HTML is better for SEO?

23.) Building a business case for migrating Classic ASP to ASP.Net (Choosing MVC or WebForms)

See item 22 above. Getting off Classic is also about dwindling skill-sets, support costs, and security.

24.) How to understand and get started with ASP.NET MVC. (I’ve been an ASP.NET developer for years and have looked at the MVC samples but it’s too complex and requires advanced OO skills.)

Hello world! Sheesh...

25.) Application deployment is a mess. Which versions of .NET, IIS, SQL ? How to automate deployment? What works side-by-side? How to manage SQL schema updates.

Latest .Net Framework absolutely. Same if possible for IIS and SQL Server. We're past version 1.0 issues with MS. Sure there will be edge cases but on the whole it's a solid platform. For packaging and deployment use the newest options and automate your build using MSBuild and PowerShell. Always automate your build.

26.) Should I use Stored Procedures or not now that we have LINQ and EF? How do I manage versioning of Stored Procs if I use them.

Use Stored Procs when it makes sense to do so, e.g. I recently wrote a SP to use a recursive CTE to flatten hierarchical parent/child relationships in a table - easy for a SP, more complex in code. Otherwise use the ORM, that is what it is for.

27.) I need to understand and use the ASP.Net security model, providers, etc.

Good luck with that. If you just remember that MS tooling is mostly about authenticating users against a MS credential store, i.e AD, you should be OK. Sometimes things aren't what they appear to be.

28.) I need to understand How the .net framework versions work (and don't work) together.

Assume they do, you will probably be correct.

29.) I need detailed guidance about how to make my (web) application multi lingual. Should I use resource files, a SQL Database?

I don't know but I would lean towards resource files unless your requirements are very complex.

30.) ASP.NET Membership and Profile management is far too weak. Show my how to take both to the next level and highly customize them.

If you stop drinking the koolaid you're on your own. Not really,
check codeplex or other OSS, someone has done this already.

31.) My team has major confusion over dataset binding in controls versus lists / listview, use of business objects and all the choices. Which controls are best to use for what user interface types and what is the best way to use data with those controls.

I'm a simple guy, I like to avoid dataset binding and instead use DTOs and lists. I find it makes automated testing that much easier. I'm probably missing out on some convenience but I think I gain in understanding what is happening.

32.) Help me learn how to deal with service binding and endpoint configuration headaches in my ASP.NET application; especially when developing on localhost (http) and deploying to a secure environment (https)... resulting in "works on my machine" syndrome.

I empathize completely.

33.) I need to understand the UpdatePanel (AJAX) and how it affects the page life cycle, security, and interaction between multiple UpdatePanels on same Page. Should I even be using the UpdatePanel? Is it going away? What is Microsoft’s plan for their AJAX stuff which seems to be going away and being replaced by jQuery.

Update panels are going away, ding dong the witch is dead. Use jQuery.

34.) Now that we’re doing more client side coding I need to really understand ViewState. It seems like a black box.

No you don't. Step away from the black box, use MVC and jQuery, there is no ViewState.

35.) How should I keeping up with new releases? How do I decide when to move to new versions.

Always move to new versions. You don't want to be in a situation where your app lags a couple of e.g. VS versions behind. If there is stuff in your app that needs to upgrade you should do that sooner rather than later. Later may mean a lot more effort.

So there you have it, as best as I can recall, somewhat tongue in cheek. I'm open to having my opinions adjusted.

- Posted using BlogPress from my iPad