Software Is Hardwork

ISimplicityAffinative: The endless pursuit of anti-complexity.
The technology-centric blog of D. P. Bullington <dpbullington@hotmail.com>...
Blog Archive

Optimal Debug Settings for VS.NET 2008
Monday, March 31, 2008

Out of the box, VS.NET 2008 debugger options cripple you from debugging efficiently and effectively. I have compiled this list of options which will allow a more pleasant debugging experience.

Click the Tools menu and select Options. In the Options dialog box, expand the Debugging node and select General.

[_] Ask before deleting all breakpoints
[X] Break all processes when one process breaks
[_] Break when exceptions cross AppDomain or managed/native boundary
[X] Enable address-level debugging
[_] Show disassembly if source is not available
[X] Enable breakpoint filters
[_] Enable the Exception Assistant
[X] Unwind the call stack on unhandled exceptions
[_] Enable Just My Code (Managed only)
[_] Show all members for non-user objects in variables windows (Visual Basic only)
[X] Warn if no user code on launch
[X] Enable property evaluation and other implicit function calls
[_] Call ToString() on objects in variables windows (C# only)
[_] Enable source server support
[_] Print source server diagnostic messages to the Output window
[_] Highlight entire source line for breakpoints and current statement
[X] Require source files to exactly match the original version
[_] Redirect all Output window text to the Immediate window
[_] Show raw structure of objects in variables windows
[X] Suppress JIT optimization on module load (Managed Only)
[X] Warn if no symbols on launch (Native Only)
[X] Warn if script debugging is disabled on launch

The MSDN documentation mentions an option called "Enable advanced debugging features (can affect stepping performance)"; I have not been able to locate this option anywhere.

VS.NET 2008 Installation Error on Vista/Server2k8 and MS Virtual CD Control Panel
Thursday, March 27, 2008

If you try to install VS.NET 2008 on Vista or Server2k8 by mounting the ISO as a virtual drive using the Virtual CD-ROM Control Panel for Windows XP, you may experiecne an error:

Suite Integration Toolkit Executable has stopped working



The workaround is to copy the files from the virtual drive to your local disk or use another ISO mount utillity.

Crapware Included with Driver Installers
Monday, March 24, 2008

ATI is now including crapware with its Catalyst driver installer. Of course, when Nero started adding crapware to its Burning ROM installer, I knew it was all downhill from there.

I miss the days of crapware-free downloads.

I would love comments on what crapware readers have found in popular software or driver installers.

Usernames Versus Email Addresses for a Login
Friday, March 21, 2008

A login should not be required to be an email address but it should not preclude using an email address if one so chooses. If you forget your password, you enter your username and you get a reset password sent to your email address (stored separately from username). If you forgot your username, you enter your email address (stored separately from username) and you get an email with your username. Usernames should be unique across the system. Depending on system requirements, email address may or may not be unique; if they are not unique, then extra care has to be taken to ensure in the above scenario of “forgot username” that if there are more than one email address is found, that you get the right email address.

Project Phoenix Launch T-Shirt
Thursday, March 20, 2008

Our CEO presented us with a great gift to commemorate the successful launch of a complete rewrite of our core systems; project codename "Phoenix":

(Click images for a larger view.)








Bustin' it 212ยบ baby!

Software Development Miranda Rights
Wednesday, March 19, 2008

You have the right to develop bad code. Anything you code can and will be used against you in a code review. You have the right to release untested code. If you cannot afford sufficient testing and QA, many bugs will be assigned to you.

Do you understand the rights I have just read to you? With these rights in mind, do you wish to share your code with me?

Hack-on-Hack Action™
Sunday, March 16, 2008

You may of heard of girl-on-girl action in adult movies; I have coined the phrase hack-on-hack action in the software development universe. I use it to describe code that is basically hacks built on top of hacks built on top of...well...you get it.

My Bookshelf

Here is my current list of books, many of which are classics and must-haves for any elite developer:

Assembly Language for Intel-Based Computers, Fourth Edition by Kip R. Irvine
The C++ Programming Language, Third Edition by Bjarne Stroustrup
Reversing: Secrets of Reverse Engineering by Eldad Eilam
Rootkits : Subverting the Windows Kernel by Greg Hoglund, Jamie Butler
Programming the Microsoft Windows Driver Model, Second Edition by Walter Oney
Microsoft Windows Internals, Fourth Edition: Microsoft Windows Server(TM) 2003, Windows XP, and Windows 2000 by Mark E. Russinovich
Customizing the Microsoft .NET Framework Common Language Runtime by Steven Pratschner
CLR via C#, Second Edition by Jeffrey Richter
Debugging Applications for Microsoft .NET and Microsoft Windows by John Robbins
Programming Applications for Microsoft Windows, Fourth Edition by Jeffrey Richter
Writing Secure Code, Second Edition by Michael Howard, David C. LeBlanc
Expert .NET 2.0 IL Assembler by Serge Lidin
The Old New Thing: Practical Development Throughout the Evolution of Windows by Raymond Chen
Essential COM by Don Box
Shared Source CLI Essentials by David Stutz
.NET Development Security Solutions by John Paul Mueller
MFC Internals: Inside the Microsoft(c) Foundation Class Architecture by George Shepherd and Scot Wingo
ATL Internals by Brent E. Rector and Chris Sells
Dan Appleman's Developing COM/ActiveX Components With Visual Basic 6 by Dan Appleman
[.net 2.0 interop recipes]
Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, et al.
Patterns of Enterprise Application Architecture by Martin Fowler
Programming WCF Services by Juval Lowy
Debugging Applications by John Robbins
Programming Windows, Fifth Edition by Charles Petzold
Code: The Hidden Language of Computer Hardware and Software by Charles Petzold
Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries by Krzysztof Cwalina, Brad Abrams
Debugging Microsoft .NET 2.0 Applications by John Robbins
Programming Server-Side Applications for Microsoft Windows 2000 by Jeffrey Richter
Essential ASP.NET with Examples in C# by Fritz Onion, Keith Brown
Essential ASP.NET 2.0 by Fritz Onion, Keith Brown
Essential ADO.NET by Bob Beauchemin
JavaScript 2e Pocket Reference
XML 3e Pocket Reference
XSLT 1e Pocket Reference
SQL 2e Pocket Reference
HTTP 1e Pocket Reference
HTML/XHTML 3e Pocket Reference
CSS 2e Pocket Reference.

Chronic Headaches are No Fun
Friday, March 14, 2008

I have been off the grid most of this week. I suffer from chronic headaches; no cause is known. I have had a serious bout with them for the past two weeks so my posts have hit a decline. Luckily a new MRI yesterday came back all clear and as I start to feeling better, more posts will come.

Deployment is like a Banana Peel
Tuesday, March 4, 2008

The last topic in the build management series centers on deployment. Deployment is slippery; like a banana peel on the floor. If you do not approach deployment wisely, you may slip on the peel and break your neck. In the .NET world, deployment usually takes one or more of the following forms: XCopy, VS.NET MSI, ClickOnce, WiX MSI, or third party tool generated MSI. I have found that XCopy (build scripted copy job), WiX, and ClickOnce (manifest generated by MSBuild and Mage) are the best solutions for integrating into an automated build environment. My theory is that deployment is an artifact for of a successful build and as such should be managed in the build system.

Automate the Build

Continuing in the series discussing build management, having a dedicated and automated build system can allow for continuous integration and better introspection into your codebase. The build system should get the latest source code from the source control repository, build the code, and run automated tests with code coverage analysis. It is amazing what you may discover.

Build Scripts to the Rescue

Continuing the build management series, having maintainable build scripts can also be a Godsend. It does not matter what technology you choose to use (NAnt, MSBuild, PowerSehll, Batch, Python, mix-and-match, etc.), as long as the scripts perform the necessary build tasks with as little friction as possible.

Growing Source Trees

Today, I am going to discuss several build management concepts in a series.

Setting up a good source tree layout will save headaches and make development easier. I like the following basic layout which supports branching very nicely as well.



$/ (repository root)
/<SolutionName> (logical project root)
/branches (branch point root)
/branch-v1.0 (discrete branch of trunk)
/branch-v1.5 (discrete branch of trunk)
/trunk (project trunk; branch from here)
<SolutionName>.sln (solution file here)
/bin (binaries for tools)
/cfg (configuration)
/doc (documentation)
/lib (external dependencies)
/pkg (drop location when built)
/res (external resources such as images)
/src (source code)
<SolutionName>.sln (or solution file here; not both)
/<ProjectName0> (individual project root)
ProjectName0.xxproj (individual project file)
/<ProjectName1> (individual project root)
ProjectName1.xxproj (individual project file)
/<ProjectNameN> (individual project root)
ProjectNameN.xxproj (individual project file)

Mixing Transaction Technologies is a Recipe for Disaster
Monday, March 3, 2008

When it comes to database transaction management, you have three choices: ADO.NET data source transactions (IDbTransaction, etc.), SQL transactions (TSQL ‘begin tran’, etc.), and MSDTC transactions (System.Transactions, COM+, etc.). You must choose which technology fits your needs but do not mix technologies; you will pay for it when things go awry.

Application Validation Architecture

Every application has some level of validation. Putting some thought into your validation approach can save headaches down the road. The following is a simple validation architecture based around a separation of concerns goal that I have used successfully with Win Forms, Web Forms, and Model-View-Presenter, and even the evil MS CAB framework.

User Interface Validation

The job of a user interface (UI) is to display data to the user and collect data from the user. The UI should provide data entered by the user as strongly typed as possible to downstream components. UI control validation, generally performed on a “validating” event, should ensure that data entered by the user can be converted or parsed to a strong type. If this validation fails, the “validating” event handler should prevent the user from exiting focus from the control (via a “cancel” flag value if available) until the user either enters a value suitable for conversion or parsing to the necessary strong type, or the user enters a value considered “empty”. A UI control should ALWAYS allow a user to enter the “empty” value and never allow the user to get struck in a validation loop. Many developers optionally choose to place “validators” at the UI view level. This allows instant feedback to the user that something has gone wrong. The main problem with these validations is that many times they incur a duplication of work. I consider this detail of validation just extra frosting on the cake; you can live without it if push comes to shove. No last chance required data entry validation nor domain validation should be performed at the user interface level.

Presentation Validation

The presentation code should only perform validations necessary to facilitate downstream execution. This would be limited to checking that the user entered any required values for the model (data contract, DTO, domain object, etc.) for non-nullable properties. Any business conditional required logic should not be performed in the presentation logic, rather downstream.

Down-Stream (Service, Domain, Persistence) Validation

At the service layer, the underlying domain validation would be performed, but “bundled” up for the complete operation to be performed (e.g. SaveCustomer() may perform many validation for several domain objects). It is also cleaner to have first chance validation available as a separate method (e.g. ValidateForSaveCustomer()) which returns a set of validation failures for a UI to present to the user. Second chance validation would be performed in the actual operation (e.g. SaveCustomer()) but would throw an exception if a non-compensable validation condition occurs; this exception should NOT be used by consuming code as the manner to show said validation failure(s). In the domain model, business validation such as required value checks, range checks, database query checks, etc. would be performed. Depending on the complexity of the persistence layer, there may also be a few persistence specific validations that need to occur. This situation is rare.

I will publish a sample application demonstrating this clean application validation approach.

Blog Archive

© D. P. Bullington, all rights reserved.
Everything posted on this blog is my personal opinion and does not necessarily represent the views of my employer or its clients.