Bill Burris

An Electronics Engineering Technologist, who has been writing software since 1980. My web site http://www.componentsnotebook.com, is about developing software using Components.

My interests are ExtremeProgramming, ReFactoring, TestDrivenDevelopment, Graphics, AI, Data Acquisition, & Laboratory Automation.

Two things happened which has sent me in new directions. First was learning C# and second was reading ExtremeProgrammingExplainedEmbraceChange. C# and .NET has given me a powerful, easy to use environment for creating component based software. Learning about ReFactoring and UnitTesting has given me the confidence to create applications without getting lost in a mess of code. In the past I have spent many days stepping through my code in the debugger, or sitting staring at the screen. Now I know that, I will never get stuck again, because I can work my way out of a mess by applying UnitTesting, FunctionalTesting and ReFactoring.

I had blamed a lot of my troubles on C++ & MFC. When I first switched to C#, many things were easier. My GUI code was much more modular, because .NET Windows Forms classes are much better designed then MFC. Other complexity that disappeared after switching to C# was working with XML, and distributed applications. It is also very easy to call my legacy C++ code from C#. But in the end, I was still getting bogged down in complexity. UnitTesting, FunctionalTesting, ReFactoring and DesignPatterns are the answer to managing that complexity.


My recommended starting point for working in C#

In Windows explorer create a directory for your solution. Inside this directory create other directories called UnitTest and FunctionalTest.

In Visual Studio, create an exe project (Console or Windows Forms) inside your solution directory. This project will only contain a class with Main to launch your application. All other code will go in class libraries.

Add a class library to your project. This is where you will start creating your application.

Create class libraries in your UnitTest directory and start writing tests which work in NUnit 2.

As you refactor your code, consider adding additional class libraries to your solution. Organize the classes in the class libraries according to their domain, (database, user interface, business logic). For larger applications and families of applications, you will also want to create additional domain libraries, (accounting, shipping, equities, bonds).

Create various test applications in the functional test directory.

If you have legacy C++ code that you want to reuse or convert to C#, add a Managed C++ class library to your solution. Add your legacy C++ code to the Managed C++ library. Before doing this make sure that it compiles as native C++ in the version of Visual Studio that you are using. It works best if your code does not make use of ATL or MFC. It's been a couple of years since I removed all the MFC from my code, so I don't remember what you have to do to get it to work with your Managed C++ code.


CategoryHomePage

EditText of this page (last edited July 22, 2012) or FindPage with title or text search