Friday, November 25, 2005

This is the start of the Baltimore Marathon 2005. They moved the starting line this year closer to Raven's Stadium. It was a much better place for the start than futher north. It was not as crowded and everyone was able to get a good view. Posted by Picasa
Doesn't Jonathan look like a nice young man? I don't remember why he was all dressed up. Posted by Picasa





Halloween 2005 Posted by Picasa

Sunday, November 20, 2005

Wednesday, November 09, 2005

DevConnections Blog - Day

Day 2 at DevConnections

Wow, today's session was sooooo much better than yesterday.

I attended the following sessions today:

  • Changes in Winforms 2.0 by Billy Holis
  • Custom DataBound Business Objects and Collection by Brian Noyes
  • Tracing and Profiling in Visual Studio 2005 by Katheen Dollard
  • Building Applications, Next Generation: MSBuild by Don Kiely
  • Declarative Unit Testing by Kathleen Dollard

The following is a summary of what I heard that is interesting and my comments. I have to say I really enjoyed hearing Kathleen Dollard as you will see by some of my comments:

Changes in Winforms 2.0 by Billy Holis
  • High control of spacing and auto layout via the FlowlayoutPanel and TableLayoutPanel
  • The splitter sucked in 1.1, now there is a container which makes it easier
  • Padding and margins are controlled as extender propeties on each control
  • Tab order determines the order of the controls in a flowlayout
  • DataGridView - much easier than the DataGrid.
  • Billy recommends third party grids for ultimate control
  • Although, he does recommend the DataGridView for small to medium complexity
  • Web Browser control
  • MaskedEdit control
  • SerialPort control
  • BackgroundWorker control - easy notification updates to WinForm (avoid the threading issues)
  • Minimize and Maximize properites on all controls. Important for use in table and flowlayout.
  • Textbox and Combobox auto-completion (AutoCompleteMode, AutoCompleteCollection, AutoCompletionSource)
  • Must set AutoCompleteSource to custom to use the collection in the AutoCompleteCollection
  • new OwnerDraw capabilities on TabStrip and Tree controls
  • Set DrawMode - OwnerDrawMode, Code in DrawItem event.
  • AutoScaleMode replaces AutoScale and AutoScaleBaseSize - the original scaling was based on Font. The new properties can be target based for absolute layout, Font, DPI or it can inherit from the parent.
  • New options for Label text wrapping - basically just use the LayoutPanels

Custom DataBound Business Objects and Collection by Brian Noyes
  • WinForm focus
  • Bug - when a properity is set and then modified in the accessor code, the binding control will not see the change. Rocky found this and it is documented on his blog with workarounds.
  • IBindingList<T> implements most of the functionality except sorting and filtering. Use it!
  • It appears as if many of the CSLA collection base functionality is now implemented in standard data binding interfaces.

Tracing and Profiling in Visual Studio 2005 by Katheen Dollard
  • System.Exception now contains a key/value pair so you don't necessarly need to create new exceptions to pass other data back.
  • This seems really bad if you need to catch a specific exception. What's the point of adding additional data unless a caller is going to examine it? If the caller is going to examine it then they should be testing for a specific exception with strongly typed properties for that data. Hmmmm.
  • She says don't put security information into exceptions. Well, how do you deal with Microsoft's internal database classes that are holding this data. This is what the enterprise block Exception block deals with.
  • FxCop barks at you if you do not implement all 4 constructors on Exception objects. Kathleen is saying that this is bad and wrong. She claims that within her team she setup rules about what data was going to be placed into the exception and the way they use it. But I think it would be important follow the standard so a configuration driven exception handling layer (exception handling block) can wrap or replace that exception. This layer is going to expect to be able to use these 4 standard constructors. Why didn't the .Net framework place these into an interface if they deemed them to be so important?
  • Ok, now we are looking at code... TraceSource.TraceData, supplies EventType, id and data (object) The data should not have been a object but a KeyValueCollection.
  • TraceSwitch is gone.
  • TraceEvent and TraceData
  • Dev groups should coordinate on TraceID. The traceID more or less represents the operation type. She recommends encapsulating in a shared Enum using TraceSupport.TraceEnumOffset as the base on the first Enum value. (None)
  • where and what data is traced is written is configurable.
  • LineNumber is an option for tracing!
  • Don't use Debug, use Tracepoints
  • She pontificated on how it is bad to use Assert. She redeemed herself when she said if it was important enough for the programmer that it should be not be lost in a deployed application. Invalid Null's params should be checked and exceptions thrown in all situations.

Building Applications, Next Generation: MSBuild by Don Kiely
  • This was a very informative introduction to the MSBuild tool and the integration in within VS05
  • The .csproj file is an MSBuild file.
  • difference between NAnt is the Item are input/output parameters to the target.
  • Items can not be changed after the build starts. They are popluated on startup
  • All of the standard VS build process is in standard target include files.
  • There are standard targets for VS Source Code Control

Declarative Unit Testing by Kathleen Dollard
  • The talk is about Team Test
  • The generated test is a 1:1 with the method. Sometimes you need 1:*
  • The test class can be generated and it gets you up and running quickly
  • protected and internal member testing is a problem. It supports testing these private accesors.
  • She says there are times when you need to test these privates. Her argument is that sometimes you will have major functionality in a private that you need to test as a unit. It seems as if this argument is flawed. Why is there that much functionality in that method in the first place! Perhaps functionality needs to be refactored into smaller testable units.
  • An accessor wrapper class is created to access the protected and internal methods and properties using reflection.
  • TDD recommends that you build a test that only tests one feature. This way you can easily identify the failure. She mentioned that you should consider if it makes sense to combine your tests to minimize resource startup/teardown. Of course you will need your failures to more correctly identify what failed since there will be many functionality units that could fail.
  • You can create Test Lists to organize large number of tests. Possibly the tests should be broken up by how long it takes the tests to run for senarios where you don't want to run the long running tests.
  • Assert class is use to compare things.
  • TestContext supports logging, timing functions, other testing info
  • Datasets can be accessed on the TestContext to data drive tests. It allows the method to be called for each row in the dataset. An attribute is added to the test with the database connection string.
  • She showed adding xml comments to a function, generating the xml documentation, transformating it via xslt into a unit test class. This would be able to test simple input / output senario.
  • Also showed a declarative way to test the exceptions.
  • declarative use of the Xml comments is very interesting. It does become very hard to apply attributes to accomplish the same functionality. Also, this testing metadata would be included in the assembly where the comments are just an artifact of build that produces futher tests.
  • One question was asked about how you would go about creating a complex object to pass as a parameter to a method. My thought was that you should not be trying to do this because implicitly you would have to use this object in the test and therefor be testing the object passed. I think the best approach is to make sure you use interface based programming, set all dependencies during contruction, and use mock objects. This way you could define the object to be constructed and automatically mock it in the code generation.

Kathleen is looking for people to help contribute to the declarative approach and code gen of unit testing. I'm very interested in this project.