RSS
 

Author Archive

Connect with your Kinect Slides and Code

09 Oct

I had the pleasure of presenting the expanded version of my “Connect with your Kinect” presentation at both the C# Special Interest Group and the Ft Worth .NET User Group this month.   I’ve really been enjoying both speaking on Kinect and developing with the peripheral.  I promised code and slides so here they are!

The code can be pulled from BitBucket here. Slides are available here

I also just learned I get to do this one more time at SMU. The SMU Computer Science Department has invited me to give the talk again on Oct 27th to students.  The talk is open to everyone so if you are interested in attending look here for more information later this month.

 
No Comments

Posted in Kinect, Talks

 

Dallas TechFest 2011 (Kinect code and slides soon)

21 Aug

I had a lot of fun at Dallas TechFest this year as both a speaker and a participant.  This was my first year to speak at Dallas TechFest and I was both humbled and honored to be selected.  Much thanks to the event organizers for putting together such an excellent event.

I find Techfest exciting for many reasons, one of which is that it takes place at the University of Texas at Dallas.   Due to this my audience was a mix of personalities from freshman students to PhDs to professional developers. 

The code focused talk I gave was entitled “Connect with your Kinect”.  On a technical level the talk demoed broad API functionality found in the beta SDK of Microsoft Kinect.  On a deeper level I sought to inspire developers on the potential of this device and get their interests perked.

I was happy with the reaction to this talk.  I think the audience left enthused and I felt some real energy in the room.

I promised to post some code here, but I have been asked to expand the talk and give it again at the Dallas C# SIG group in about two weeks.  Because of this, I’m going to do some code cleanup and post it shortly there after.  Stay tuned!

 
No Comments

Posted in Kinect, Talks

 

Video of my Silverlight Testing Talk Now Available

25 Jun

A little over two months ago I gave I gave a talk at the user group I manage, the North Texas Silverlight User Group on Silverlight testing.

The talk divided into two sections.  The first part was about unit testing Silverlight.  I started out with some hard to test code and worked it into easier to test code.  I also demonstrated the Silverlight unit test runner. The second part was about automating functional testing using Telerik’s WebUI Test Studio .  Everyone was impressed by Telerik’s tooling and their automated testing experience.

Shawn Weisfeld, one of our most stalwart community members, was there and recorded the talk and has made it available on his recently launched media site usergroup.tv.  If you are interested you can check it out here.   This was one of my favorite meetings we’ve had because people really got involved in the discussion of testing.  FYI this lead to some long pauses in the video, so be ready to skip past those.

 
 

Code and Slides from my C# Influences Talk

09 Apr

This morning I gave a talk at the North Texas PC user group on influences to C#.  This group is steadily going through the teach yourself C# in 24 hours book.  This talk gave a glimpse of things to come for that group.

It’s hard to believe that C# and the .NET framework are decagenerians.  Over that time C# has been influences by  academia, innovations in other languages, and the evolution of hardware platforms.  This has made C# a very big language with lots of varied paradigms at work.

This talk discusses some of those influences and ties them back to specific language features and innovations.

 
No Comments

Posted in C#, Talks

 

Slides from my SMU Consulting Career Talk

12 Mar

A couple of students asked me to post slides from my SMU presentation on careers in consulting. My slides tend to be more visual than text so I thought I’d break it down a bit as well.

I had two purposes to this talk.  Chris Harper (HR Manager at Sogeti) asked me to talk about the Velocity project and the work we did at Broadlane from a technical perspective to explain what a consulting project looks like.  I also wanted to try and convey some of the benefits I get from being a consultant and working at Sogeti.

Velocity was an excellent project built by an extraordinary team.  Not every project is going to be a Velocity.  Yet the more agile methods taking hold in the industry, the more Velocities I think we’ll all have a chance to participate in.

The first couple slides show Velocity.  I then moved on to talk a bit about agile methods.  Then I discussed some of the core technologies that made up Velocity.  I concludes with some reasons to look at consulting as a career and some book recommendations.

I enjoyed giving this talk and meeting some of the impressive teachers and students at SMU.

 
No Comments

Posted in Talks

 

From PRISM to Caliburn Micro: Event Aggregation

08 Mar

My team is in the process of transitioning our Silverlight development from Prism to Caliburn Micro.  I’ve had questions about how common PRISM scenarios map to Caliburn Micro.

One feature found in most MVVM frameworks is an Event Aggregator.  Martin Fowler describes this in his “Further Patterns of Enterprise Architecture”.  According to Fowler, the purpose of the Event Aggregator is to simplify event registration by “channeling events from multiple objects into a single object”.

Event Aggregators are most relevant to rich client development, where multiple bits of a composite interface need to share common state.  For example, a toolbar, a status bar, a screen, and a notification icon may all need to be synchronized with some common theme that cross cuts the view model approach to state management.  Event Aggregators simplify registration and publication of events between objects to some subset of the M * N unique registrations that would be required otherwise.

Event Aggregation in PRISM

In Prism, an event is declare by inheriting from a CompositePresentationEvent<T> where T is the message payload.

public class FooEvent : CompositePresentationEvent<FooEventArgs> { }

 

The actual aggregator is called an EventAggregator.  It has a single method, GetEvent<T> which gets an instance of the event type T.

Firing an aggregate event from PRISM is simple.

myEventAggregator.GetEvent<FooEvent>().Publish(fooEventArgs);
 

Subscribing is another matter entirely.  Subscribing has up to five parameters including whether to hold a strong or weak reference to the subscriber, which thread to call subscribers on, a filter to determine if the subscriber gets the event, and the delegate to invoke.

The defaults work for most situations and the overloads may create problems. Supporting both strong and weak referencing can lead to confusion.

myEventAggregator.GetEvent<FooEvent>().Subscribe(OnFoo);
 

Event Aggregation in Caliburn Micro

Event Aggregation in Caliburn Micro is simple.  In Caliburn Micro, events are plain old CLR objects (poCo).  The event argument payload, if needed, is declared in the event as one or more simple properties.

public class FooEvent { public string myProp; }

 

To subscribe events of interest, subscribers implements IHandle<T> where T is the event of interest.  The actual subscription wiring occurs by having interest subscribers pass themselves as an argument to the event aggregator’s subscribe method:

    public class Foo : IHandle<FooEvent>
    {
        private IEventAggregator myEventAggregator;

        public Foo()
        {
            myEventAggregator.Subscribe(this);
        }

        public void Handle(FooEvent message)
        {

        }
    }
 

This IHandle<T> approach makes explicit and clear at a glance the relationship between interested subscribers and their subscribed events.

Publication is very straightforward:

myEventAggregator.Publish<FooEvent>(new FooEvent());
 

Caliburn Micro’s publish model isn’t as powerful as its PRISM counter part.  Yet it prevents you from shooting yourself in the foot with good, opinionated defaults;  It holds weak references in the event aggregator and  executes events on the UI thread.

While some PRISM event scenarios cannot be implemented using the event aggregator in Caliburn Micro, this lack of choice isn’t a deficit.  It welcomes us all into the “pit of success.”

 
 

I’m loving the data dude

01 Mar

I have an existing database project I’m working with from around 2002. The database is for a restaurant point of sale system I wrote called BravoPOS.  One of my original customers (ok.. my only customer) is now opening another restaurant and is interested in deploying BravoPOS at this location also.

The system has been running fine since 2002. But with the new restaurant, I’ll be maintaining two, maybe even three or four systems if my restaurant point of sale monopoly takes off!

This is going to introduce some complexity.

At the moment there is no “official” copy of the database save what’s on the server at the restaurant.  If I ever had a large POS customer base, I would absolutely need an easy way to maintain multiple versions of the database.  I need to be able to roll forward and backward and I want to know at what point of time and for which deployments a specific schema of the database applies.

Second, I’ve changed my mind on a couple things and would like to rename or “refactor” them without breaking my existing installation.  I was one of those guys who in 2002 applied Hungarian notation to my database. I prefaced every table with “tb” and every string column with ‘s’, stored procedures with usp.  I would like to simplify things.

Rather than abandon the old system, I want to gracefully change these variables without causing a mistake.

There’s a bigger picture too

Database pain extends beyond my self inflicted side project into my real job where I work on an agile team.  Due in part to the company’s culture, our projects have a differentiation between “those who code” (devs) and “those who do databases” (BI). This leads to a couple pain points where BI meets dev.

There is pain when keeping BI in sync with the project’s version control. Even with the most disciplined of BI resources, databases are hard to correctly version. Versioning is done with script files and checking those scripts into source control.  It’s easy to forget to keep a script up to date.

Second, there’s pain when planning schema migration from the developer state to the deployment state. Even if you have a good versioning system, there’s no guarantee that someone hasn’t made optimizations to the production database. I would expect most admins are actively changing the production database in some way for performance.

Finally, there’s the issue of unit testing. Developer resources are well versed in the benefits of unit testing, but unit testing at the database level is typically not done. Since developer unit tests should not touch the database, short of an integration test how do you validate the expected behavior of the database?

Data Dude to the Rescue

The Visual Studio 2010 SQL Server Database Project type or as everyone outside of Microsoft’s marketing arm calls it “the data dude” can help ease some of this pain.  It’s available if you have access to the Professional or greater SKU of Visual Studio.

To start with, I recommend using the wizard when creating a new database project:

New Project (3)

This will make important an existing database schema a breeze.  Once your done, open the Schema view to see everything data dude has created for you.  Oh, and check it into source control!

Refactoring in your database

Want to rename a table or a column?  You’ll be tempted to double click on a schema item and start renaming it like you would in SQL Server.  Don’t!  You want to use the built in refactoring commands.  With the exception of dynamic SQL and any external dependencies it will kindly take care of renaming detected dependencies for you.

Rename - [dbo].[tbDepartments] (2)

Here I’m renaming a table from tbDepartments to Departments.  Notice the preview changes button.  This let’s you see the affected objects and what will change.

Preview Changes - Rename

The number of affected items above is a good reason why to use a refactoring tool like data dude.  Departments are used in lots of reporting procedures.  Changing this by hand could be messy and error prone.

Comparing Schemas

Using data dude, you can compare schemas between database projects or compare your current project to a database.  It will give you an idea of what will need to be done to get one database to match the other.  There’s an issue though if you look at what it wants to do to my Departments table:

image

According to Microsoft on a thread here, schema compare doesn’t understand the “refactor log” which it uses at deployment time. Because of this I don’t focus on schema view except as a diff tool and I don’t use scripts from it.

Getting a real schema diff

When your are interested in getting some useful scripts out of data dude, you will need to use the deploy option.  By default deploy “deploys” a SQL script file to a bin that you can run at your leisure.

There’s something really important to understand about the deployment option.  Whether your script is created to generate a new database or to generate an update script to an existing database depends on  on what you have specified as your deployment target under deployment options.  To get a real diff between your deployment target and your refactoring, you need to specify it as your deployment target in the project properties Deployment tab:

Untitled-8

Unit Testing… databases?

The term unit test is getting overloaded and its meaning ambiguous.  My definition is that a unit test is a small bit of code whose purpose is to validate that the behavior of some other bit of code is behaving as designed.  This means that the result of a unit test must be deterministic, not stochastic.

This is difficult to guarantee with a database since data changes the output of functions (stored procedures).  To make a database unit testable, you must make it predictable.  Data dude can help.  It allows you to create a database on demand, populate it with test data and execute a series of unit tests against it

You can get all the gritty details on how to setup unit testing for databases here.  What I thought was exceptional was the actual designer for creating database unit tests shown below:

Untitled-5

The T-SQL to be executed goes into the box at the top.  Test conditions are created at the bottom.  The built in conditions are:

  • Data Checksum:  Verify that a hash of an output set matches a previously generated hash. You get a little window to execute your SQL from which computes a checksum for you.  This then goes into the equals condition for the test.
  • Empty ResultSet  Verify no rows returned
  • Not Empty Result set: Verify some rows returned.
  • Row Count:  Verify that X rows are returned where X is the number of rows.
  • Execution Time:  Must execute in less than hh:mm:ss.
  • Inconclusive: The default condition
  • Schema Comparison: Similar to a checksum but for schema.  Allows you to execute a bit of SQL and set that as the target schema to match as a result set’s schema.
  • Scalar value:  Verify that a scalar value in a specific column / row matches another value.  If you want to test a scalar such as a return value or output value, you will need to put it into a Select as shown in the Select @RC as RC example.

 

If the built in conditions do not meet your needs, there is extensibility support to create your own conditions.  More on that here.

As you might guess, unit tests are configured to use MSTest.  More flexibility here would be nice.

To sum up, Visual Studio SQL Server Database Projects can help manage the pain points where BI and dev come together such as with version control.  It can help teams harden database designs with unit testing.  Who knew such an awesome tool was hiding deep inside Visual Studio.

 
No Comments

Posted in Tools

 

GDI+ Architect is Finally Open Source!

26 Feb

I’ve been meaning to tackle this for awhile. GDI+ Architect is a designer I created for GDI+ code under the DBA name (The Modern Renaissance Group (Mrgsoft). It lets you draw objects on a canvas and generate SVG or GDI+ source code. I had moved it a while back from .NET 1.1 to 2.0, but there was a proprietary icon set which prevented me from releasing the source.  I decided to just remove the icons and keep my ugly ones I created in instead.

logoMy reason for open sourcing it is want to make sure if anyone had legacy code from the .NET 1.1 time frame that used this product, they could still get at it. While I don’t expect a lot of new development on this project, if you need help with it please contact me. It’s also interesting code you ever need to do anything with snapping, drawing, text wrapping, or anything of that sort regardless of your target platform. Even though this code is geared toward .NET GDI+, the concepts are universal. Warning though – it’s in VB.NET instead of C# as this was once my primary language.

It’s rough to look at your own code from 8 years ago. It’s missing clear separations of concerns. It’s got some “mammoth methods” that need to be torn apart and refactored. It’s littered with somewhat useless comments because I thought code wasn’t “done” until it was commented ad nauseam. Also since it’s from the 1.1 timeframe there is no use of generics, Linq, etc. In fact checking it into BitBucket today was the first time it ever saw a source control repository! My how things change.

All that aside, it shipped, was fairly bug free, and made me a decent return on investment and received positive feedback from customers.

If you are interested, you can get the source from BitBucket.

 
No Comments

Posted in Blogging

 

Where the code lives

24 Feb

Since the ALT.NET movement a couple years ago, Microsoft developers have, to varying degrees, embraced open source technology.  Many of us can’t imagine planning a project or designing an architecture without leveraging at least some open source tools.  What surprised me is where the source for these tools live.

Here’s the skinny:

image

A couple note on my data. 

First, there are excellent open source project from Microsoft including Unity, MEF, the Silverlight toolkit, and more hosted on CodePlex, but I have excluded these since they are not community open source projects.

Second, some of these projects are not on created on the .NET stack but I believe they are still relevant to .NET developers so I have included them. Other projects I have left off because they are not relevant to developers, rather consumers.

Finally, this is my subjective list of projects. I’m sure I forgot some.

Based on this data, it’s GitHub by a landslide.  The truth is almost every important C# based open source project lives there.  And amazingly, Git is only sort of supported on Windows using Cygwin. What’s going on?

It turns out that GitHub has turned open source collaboration into a social experience.  Contributors can gain status and recognition for participating in GitHub.  Projects rank against each other in a fun, competitive manner.  It’s easy to search projects by language and to collaborate.  In other words, GitHub really is “cool”.

GitHub also revolves around Git which is distributed version control.  For SVN or TFS users, this is a completely new and liberating experience.  I recently worked on an SVN project where certain folders were only committable by one individual, effectively stopping collaboration.  Nothing like this happens with a Git based project.  You are encouraged to fork and you can always commit against your own repository, 

If you haven’t used Git, there are some good resource to help you get started.  I think the best is Rob Conery’s series on TekPub called Mastering Git.  It’s not free, but it’s really good and it shows using Git from windows.

Last May my friend Shawn Weisfeld recorded a quality presentation by David O’Hara presenting at the North Dallas .NET User Group on Git.  You can see that presentation here.

For me, I think Mercurial is the better distributed version control system for Windows users.  It doesn’t require Cygwin and there is a nice Tortoise and command line client.  You can also play nice with GitHub using this plugin.

My data set below.

Project Where it Lives
Autofac GitHub
Automapper GitHub
Caliburn MIcro CodePlex
Castle GitHub
CouchDB SourceForge
CruiseControl.NET SourceForge
Farseer Physics CodePlex
Fluent NHibernate GitHub
FluentMigrator GitHub
Fubu MVC GitHub
GitSharp GitHub
JQuery GitHub
Kayak  GitHub
Knockout GitHub
Log4net Apache
Manos de Mono GitHub
Mass Transit GitHub
MongoDB GitHub
Mono GitHub
Moq Google Code
MVVM Light CodePlex
NANT SourceForge
NCQRS GitHub
NHibernate GitHub
Ninject GitHub
NSeviceBus GitHub
Nunit Launchpad
OpenRasta GitHub
Owin GitHub
Raven GitHub
RestSharp GitHub
Rhino Mock GitHub
Sparkle View Engine GitHub
SpecFlow GitHub
Spring.Net SourceForge
StructureMap GitHub
Subsonic GitHub
Voldemort GitHub
 
No Comments

Posted in Blogging

 

Comic #7

22 Feb

strip7

 
No Comments

Posted in Comics