Last November, we detailed the 4 Best Practices for Microsoft .NET Framework and Application. Now we’ve scoured online .NET resources and found that the most valuable tricks of the trade for .NET developers are more like guidelines than code snippets. Below are seven of the best tips we found.
1. Use appropriate debugging
Debugging is mandatory, that’s a given. However, it’s important to find the debugging method most appropriate for the situation. For example, using a device emulator is great for mobile development and the DebuggerStepThroughAttribute class is ideal for existing, rock-solid code. However, neither of these debugging strategies would be appropriate if you’re working on a brand new software solution for desktop computers.
2. Utilize all available resources
You don’t have to reinvent the wheel. The developer community is huge, and chances are that someone else out there not only has experienced the same problem you’re struggling with now, but also posted the resolution online. A simple Internet search can save hours of developer frustration. Also check out other resources that can aid in troubleshooting, such as online forums, developer groups or these ASP.NET troubleshooting resources.
3. View both sides at once
Split screen may stink for Halo, but being able to see the output display and source code at the same time is a huge timesaver for developers. Using dual monitors is one approach, of course, but other methods, like VS.NET’s Vertical and Horizontal Splits setting, can also be quite effective.
4. Apply self-documenting practices
Call it like it is. The use of self-describing naming and structure conventions, like using “Customer_Input_Form” instead of “Form1,” tops our .NET best practices list for a reason. It’s like freeing up your brain’s RAM. This technique not only helps others to understand source code faster, it also speeds reassimilation when maintenance is needed.
5. Automate documentation
More, more, we want more. Using common-sense naming (see tip #4) and XML comments on each function aren’t enough these days. The latest developer requirement is to provide documentation that can be easily digested without requiring reading through lines of code. However, since documentation must be updated as often as the code it documents, save yourself the time and energy by using tools, plug-ins and apps that do the work for you, such as GhostDoc and SandCastle.
6. Leverage compare tools
Ever push a change only to realize — usually because of the influx of errors — that you didn’t have the latest version of that environment? Finding the source once required hours, sometimes days, of manual comparison between lines of code, databases and sometimes even server configurations. However, there are now many comparison tools, like Beyond Compare and Red Gate, which can help save you the hassle.
7. Stay informed
There is no standing still in development. It is imperative to always be aware of what’s going on in the industry. Take time to catch up on trending news by skimming through Mashable's Tech section. For more specialized articles, check out Daily .NET Tips. Don’t have time to read? Try listening to DotNetRocks, a talk show geared towards .NET developers.
There are enough .NET development tips and tricks to write a book (no, seriously, there really is a book). However, implementing fundamental processes while programming builds a firm foundation for the .NET framework.
Are there any habits you’ve proven effective while programming using .NET? Let us know in the comments section. Have an interview lined up for a .NET developer job? These sample questions can help you prepare.