Practice
Development Practice
xUnit.net 1.0, just released, is an update to NUnit 2.0 that encodes some unit testing best practices and leverages .NET 2.0 technologies like generics. Intro here and download here.
If you don't have Visual Studio Team Developer Edition, consider using xUnit.net for your development project unit testing.
It is common to use SQL Scripts to create or initialize a DB from a setup program. For example TS DB Pro integrates with SQLCMD variable syntax.
One issue with this is that an MSI may need access to SQLCMD.exe. I've picked up the bits from a local SQL Server 2005 installation, but you don't have to do that. Feature Pack for Microsoft SQL Server 2005 provides a redistributable package for just SQLCMD:
Microsoft SQL Server 2005 Command Line Query Utility
The SQLCMD utility allows users to connect, send Transact-SQL batches, and output rowset information from SQL Server 7.0, SQL Server 2000, and SQL Server 2005 instances. SQLCMD is a replacement for ISQL and OSQL, but can coexist with installations that have ISQL or OSQL installed.
Note: Microsoft SQL Server 2005 Command Line Query Utility requires Microsoft SQL Server Native Client, also available on this page.
Audience(s): Customer, Partner, Developer
Assume everything is implicit unless you are told otherwise.
I generally consider it bad practice to have encoded fields in tables and implicit rules in objects. You should generally make your rules explicit by creating calculated columns, views, & etc for databases and creating properties for classes that encode the rules.
Example:
public bool IsBest { get { return rating >= 3; } }
With the release of Visual Studio 2008 and TFS 2008, there is now even less of a reason to place any revision comments in the code base. Once upon a time all reputable source control systems had a keyword expansion feature that included the revision comments for all revisions in the source file.
Version control managers de-emphasize this feature because users should use the repository for getting comments, which is tooling accessible and if readers rely on the code base for the revision comments, developers are less likely to provide good revision comments.
The keywords feature is totally removed from TFS. I think this is a mistake (though welcome because keyword support is a pain). I have heard that there are some compliance requirements that comments for code changes must appear in the code base. Of course the requirement itself is from the dark ages, but nonetheless, it should be supported.
Apart from those that must support the above requirement, some development teams prefer inline revision comments (i.e., // RKK 03/02/98: Fixed bug 2937 ) so that they know that a certain area of code has been "touched," since, as we all know, fixing one bug begets another and finding who touched a line of code in a version control system usually requires a binary search of diff'ing to find the offender.
TFS 2008 and VS2008 fix this problem. The new annotations feature permits one to easily see exactly who updated each line of code with a quick link to revision comments.
This feature has been provided with the TFS Power Tools for a while now. However with its integration into the IDE, it is a simple case for version control managers to make to prohibit the use of file header and inline revision comments.
Buck Hodges shares how to solve these five issues in this very useful post.
- Issue #1: Team Build service account does not have the required SQL Server permissions or cannot connect to SQL Server
- Issue #2: Values for TargetDatabase, TargetConnectionString, or DefaultDataPath are missing or incorrect
- Issue #3: The New Build Definition dialog does not provide a “Default” configuration option
- Issue #4: The Deploy target is not invoked when built via Team Build
- Issue #5: Database Unit Tests cannot find database project files, data generation plans, or the database instance(s) to be used for running tests when run via Team Build
IDesign has updated their C# Coding Guidelines. (download). A previous version can be found in Juval Lowy's Programming .NET Components.
Having worked on many rewrites, I often use The Roast was Too Big for the Pan analogy to explain why we need to understand why the code was written the way it was rather than parroting the system we are rewriting.
It's not necessarily safer to copy existing algorithms, because there are often interdependencies (read: kludges) between different steps of a long chain of calculations or transformations.
You need to make a conceptual model of the current system and then abstract the total effect of all the variables to really understand what is going on. This is a process called rationalization.
Take the time to really understand the algorithms and you will be much further along the road of both ending up with a working system and having a new system that is far more maintainable than the previous one.
I had forgotten my Sam Guckenheimer book Software Engineering with Microsoft Visual Studio Team System that has an excellent list of Qualities of Service (QoS) categories to consider for a project.
Fortunately someone has the list in a blog post. Thanks, Salvador Patuel, for including the list in this posting.
A co-worker of Sam's, Randy Miller, added a nice way to format QoS requirements: Context, Stimulus, Response. He also has a few more pointers. Please reference this post for the details.
You can find it in the team build targets file, but no one seems to tell you, so I will. Run the team build project file locally on your box (using MSBuild) with the IsDesktopBuild property set to true:
C:\MyTeamProjectFolder\TeamBuildTypes\MyTeamBuildType>MSBuild TFSBuild.proj /p:IsDesktopBuild=true /v:diag > msbuild.log
I got bit recently and squandered time because I didn't know that the VS2005 setup projects have adequate support for ASP.NET applications. Scott Guthrie has a post that shows you how and how to to avoid some pitfalls.
Microsoft has published a new roadmap for delivery of Visual Studio Team System technologies. The road map includes a detailed features list of several technologies and the following dates for Orcas:
Projected Availability:
- Beta 1 - 2nd Quarter, CY 2007
- Beta 2 - Mid-year CY 2007
- RTM - TBA
Solutions Configuration Management
n. The soup-to-nuts configuration management of Software Systems through SDLC and into product deployment in an enterprise data center. It is more encompasing than Software Configuration Management, becuase it includes the provisioning, configuration, and customization of shared enteprise resources in the data center. It also prescribes a Configuration Management workflow based on Solutions Management rather than individual applications.
Update:
Note that this does not cover Production Change Management, but, rather Change Management during development.
Visual Studio Team Edition (VSTE) for Developers only gives you a flat list of tests for a project. This can be a problem on very large lists. You would have to buy Team Suite to get the Test version that has a hierarchical list. That’s a lot of money.
The Ecobit Test Manager gives you the functionality for $90/head.
Just as Team Explorer natively integrates with MS Project and Excel, Personify Design has a beta for TeamSpec, a product that integrates Team System Work Items and Word documents. Basically, it allows you to put in live forms in your Word document for work items.
Screenshot
Quick Description
If you work on a KVM or a server farm and use Remote Desktop (Terminal Services) a lot, you may often get confused as what machine you are seeing. The BGInfo utility will put system information on the desktop so it's harder to confuse which machine you are on.
Andrew Dugdell has used it for virtual machines to show the virtualization server the VM is running on. Very nice. Thanks Andrew.
For someone wanting to find out where we are headed in the Enterprise using virtualization, I highly recommend the Channel 9 "Going Deep" episode on Virtualization(video).
The episode host, not the techs, was making it clear that this will be core OS architecture in the future. The techs, however, confirmed this by saying that that was the reason that they are position as a Kernel group. Concepts discussed included:
- Legacy OS support
- Server Consolidation
- App Isolation
- Implications for Disaster Recovery
- Hypervisor technology
- Enlightened Guest OSs
- Dynamic, autonomous VM management, a kind of self managing VMotion.
However, the techs' vision went way beyond these to the point where different subsystems core can live on their own VM. The example given was an IP Phone stack that could keep running even if the host OS blue-screened. That's isolation with n the OS itself.
One big thing from a practice perspective, one tech mentioned a built in "undo" that virtual server has to move a VM back to a starting configuration. I need to investigate that further for integration machines.
Scott Guthrie shares Douglas Rolm's article on using MSBuild to enhance managing web project deployments. The article includes a MSBuild task that creates date-based build numbers. Scott shares how they use date based build numbers in building .NET itself.
This seems like a great practice, and reminds me of how states now use mile post numbers for highway exits rather than sequential numbers.
Hullo! I'm back. It's been quite a while. I've been a designing/coding maniac on a really fun project for half a year but I'm back in the Senior Application Architect seat. Hope to have a great time and share my experiences with .NET 2.0, Team System, and EntLib 2.0.
Brian Button of the EntLib team, mentioned the use of the InternalsVisibleToAttribute in VSTS test projects in his blog entry on TDD with VSTS. As this C# Programming Guide article explains, InternalsVisibleToAttribute is an assembly attribute that allows a specified assembly to see all non private members of the assembly that uses the attribute. This permits two scenarios. The first is directly testing important internal members and classes. In my recent project the entire data structure tree for calc engine was internal to allow expected future modification during the optimization phase. The second is to permit back door access to internal structures to test integrity or other state that you want to remain hidden but exposed to the test tool.
I used CodeWright years back and very much enjoyed a little feature that put a rule line on the right margin to tell you where to stop typing across the page. In my opinion setting a maximum line length in your coding style guide lines is essential to being able to read everyone's code consistently on the screen or on paper.
Craig Andrea shares a little know registry setting that will do the same for Visual Studio. Use it!
One of the sleepers at the EBC was the “annoucement” that MSF Formal became MSF for CMMI. It was shared that support for CMMI was actully announced in March. Where was I?
My current client is using MSF 3.1, so I was checking around for more info on MSF for CMMI. I found David Anderson's blog entry on the announcement. It has a good overview of the gist of MSF for CMMI. Tidbit here is that they're supporting level 3 in this release and will shoot for level 5 in a future release. The big news however is the attempt to apply agile concepts to formal development. Given the input he's had be SEI, he actually may be able to pull it off.
David is a PM on Team System and has a great blog. Read it here.
Unfortunately I haven't found any details on whether anything from MSF 3.0 was preserved. Given the “Ground up” approach they seem to be taking, I think not.