Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In my brief time as a professional programmer I've seen lots of applications written by programmers who's entire education appears to have been reading the first couple of chapters in a .NET 2.0 book.

Heck when I started I wrote most of those applications!

What are the biggest design patterns crucial for writing AWESOME .NET applications?

By awesome I mean on the inside too!

share|improve this question
    
None are crucial. –  kirk.burleson May 11 '11 at 22:21
add comment

2 Answers

up vote 19 down vote accepted

First: Know your basic tools well

  1. Know the ASP.Net event model. You'll get in a mess if you don't.

  2. Understand the mechanics of OO. A surprising number of relatively experienced .Net programmers still seem to think it is 1972.

  3. Start reading Code Complete.

Second: Learn to separate concerns

The most common design-crime I see in ASP.Net development is to stuff all the business logic in the code-behind. I know that all the Microsoft examples do it that way. I know it is justified on small apps. And I know I sometimes do it that way. But really, it is bad design, and is my pet hate for the week.

Third: Learn everything else about design

Most of the poor quality .Net code that I see is the result of poor OO design. Therefore, I'd recommend a good understanding of:

  • SOLID principles
  • GoF Design Patterns
  • MVC (for ASP.Net MVC)

Fourth: Get to know more tools

You know how Microsoft make things easy by providing lots of out-of-the-box tools? Well, you're going to hit their limitations sooner or later. When you do, you're either going to have to bend them to your will or roll your own. Either way, you're going to have to get-down-dirty with some CSS and Javascript.

Finally

Once you've done that lot, you're well on your way to awesome.

[Edit: Fixed-up the sequence for learning this sutff. Apparenty I couldn't count yesterday...]

share|improve this answer
    
"When you do, you're either going to have to bend them to your will or roll your own" Or use something Open Source. +1, nonetheless, good answer –  pdr May 11 '11 at 22:35
    
Thanks.. Really awesome answer :-) but what's all this buzz about mvvm, ioc, mvp, repositories, factories... Insert any other big buzzword here.. what is the current "microsoft blessed" approach to building web apps? –  Daniel Upton May 11 '11 at 22:58
3  
MVVM - (currently) a very WFP/Silverlight-specific design pattern. MVP - a similar pattern to MVC, with some differences in the interactions between classes/layers. Repositories/factories/IOC - should be covered in your reading for "Third" above, they relate to separation of concerns, the DRY principle, and testable design. "Microsoft-blessed" approach - depends what your needs are. The current trend definitely seems to be MVC3, which goes a long way to enabling "good" design with much less fuss, with easy IOC/DI, testable controllers etc. –  mjhilton May 11 '11 at 23:20
3  
@Daniel There are certainly a lot of buzzwords out there. The most important thing you can do is to learn what they are and what types of problems they can help you solve. Don't get caught in the trap of wedging your entire application into a set of design patterns that does not add value in the area of maintainability, or worse - is difficult to understand (sometimes so much so that you can't remember what something does 6 months after you wrote it). Let the applicable patterns help you make complex problems simpler. –  Michael Dean May 11 '11 at 23:39
1  
@Daniel: I really wouldn't worry too much about "Microsoft blessed" approaches. Good design is good design no matter who blesses it. In fact Microsoft often plays catch-up in this area (eg, ASP.Net MVC as a response to other MVC frameworks). That said, you do need to stay aware of Micosoft technology. Great designs have been know to fail because they don't suit the available toolset. –  Kramii May 12 '11 at 7:53
add comment

The variety of points mentioned by Kramii are all well worthwhile, but I'd like to emphasise the mention of working with the SOLID principles. Getting a really good understanding of these will make a big difference, and many of the GoF patterns etc will start to fall out more naturally. Much of this stuff ends up being about separating your concerns and managing your dependencies, so start at the source and everything else will make sense.

If you're anything like I was prior to my recent OO coding course with JP Boodhoo, the single responsibility principle means far more than you think! It is really worth understanding how small a class can be when you stick to this well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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