background preloader

Standards

Facebook Twitter

Best Practices for ASP.NET MVC - ASP.NET and Web Tools Developer Content Team. Blog - CopyPasteKiller - Free Code Similarity Finder. Documentation / JavaScript Style Guide. Coding and naming convention style guidelines not only make your code clearer and easier to read, but they can also actually improve performance.

Documentation / JavaScript Style Guide

Although you can use any convention that makes sense for you, the guidelines described here are based on years of experience from SproutCore developers in writing understandable and maintainable code. The SproutCore coding and naming convention style guidelines are based on the Cocoa style guide from CocoaDevCentral. Being a framework that is based on JavaScript, not everything in the aforementioned style guide applies completely.

However, since SproutCore has a lot of conceptual similarities with Objective-C, it is useful to align the coding styles somewhat. It not only allows for the similar concepts to be described in the same way, but also it makes it easier for developers using both Objective-C and SproutCore to go from one to the other. Defining Classes. ASP.NET MVC View Best Practices – Keep logic out of your views. When it comes to views in ASP.NET MVC, you won’t be short of options how you decide how to create them.

ASP.NET MVC View Best Practices – Keep logic out of your views

One of the easiest mistakes is to implement logic in their views. It’s no surprise developers such as Rob Conery have advised against having conditional code in ASP.NET MVC views. Before you know it a view that was simple and easy to understand becomes a complex monster intertwined with html and logic. The code used in this post can be downloaded here. The fact is ASP.NET MVC views which contain logic will ultimately end up being a nightmare to maintain and test. Here is an example of what I mean.

This could be implemented by creating the view like this Because there is logic in the ASP.NET MVC view, you have to go through the laborious process of creating front end tests or creating a product, setting the number in stock and then checking the correct class is used by viewing the page source for each condition. Use Optional Parameters to Minimize Method Overloads. Var wasted = Type.Missing; var wordApp = new Microsoft.Office.Interop.Word.Application(); wordApp.Visible = true; Documents docs = wordApp.Documents; Document doc = docs.Add(ref wasted, ref wasted, ref wasted, ref wasted); Range range = doc.Range(0, 0); range.InsertAfter("Testing, testing, testing.

Use Optional Parameters to Minimize Method Overloads

Has anybody published any C# 4 coding standards / guidelines / style guides. Email Standards Project. NHibernate Best Practices with ASP.NET, 1.2nd Ed. Author's note added June 11, 2008 - Announcement of S#arp Architecture Thankfully, technologies evolve over the years.

NHibernate Best Practices with ASP.NET, 1.2nd Ed.

Accordingly, Microsoft has introduced ASP.NET MVC as an alternative to classic ASP.NET. I have developed a new architecture which uses many of the design principles of this article for this newer platform called S#arp Architecture. Although this article is still the recommended background reading material for S#arp Architecture, you'll find the new architecture to be simpler and more maintainable while still leveraging the best of what NHibernate has to offer. Preface to the 1.2nd Edition In March of 2006 I published my initial thoughts on NHibernate best practices with ASP.NET, generics and unit tests.

Quite simply, NHibernate is awesome. A quick thanks goes out to those who have implemented my ideas in their own work and have given plenty of ideas for improvement and consideration! Article Contents Introduction Why Use an ORM? Goals and Overview of Article. Chris O'Brien: My favorite SharePoint 2007 development techniques (with an eye on SP2010) As we home in on the release of SharePoint 2010, I wanted to write down a couple of thoughts for posterity on SharePoint 2007 development, mainly for my benefit.

Chris O'Brien: My favorite SharePoint 2007 development techniques (with an eye on SP2010)

One of the reasons for doing this is because I’ve been working with the SP2010/VS2010 Tech Previews recently, and whilst I’ve not done a full “compare and contrast” exercise, I can certainly see that in the future I will want to reference back to how I liked to handle something in the SharePoint 2007 world, and more importantly, why. My experience is that transitioning to a new platform brings on a certain amnesia, where for some reason it’s difficult to remember just how the equivalent thing worked in the last version (CMS2002 anyone?) – undoubtedly we need to avoid restricting our thinking with irrelevant practices and constraints, but sometimes the old way is definitely useful as a reference point. Visual Studio solution/project structure SharePoint coding tidbits. Database Mirroring Best Practices and Performance Considerations. Published: March 10, 2006 SQL Server Technical Article Writer: Sanjay Mishra, Microsoft Corp.

Database Mirroring Best Practices and Performance Considerations

Technical Reviewers: Brian Goldstein, Microsoft Corp.