Dan Newcome on technology

I'm bringing cyber back

Archive for March 2009

VirtualBox pause feature

leave a comment »

I just found that VirtualBox has the ability to instantly pause a running VM. Under VMWare server you had to suspend the instance if you wanted to free up your CPU. I think that Microsoft Virtual PC may have this instant pause feature as well. This is pretty cool for us laptop users that are on battery a lot.  I have a lot of ram, so I don’t really mind `parking’ an instance and time (not to mention battery life) is precious.  It doesn’t sound like a big deal, but waiting several minutes to fire up a VM instance that you just need for a second is a real workflow killer.

Written by newcome

March 27, 2009 at 1:10 pm

Posted in Uncategorized

Database connection anti-patterns

leave a comment »

I was looking back at some older code in our codebase, and found one class that created a database connection for its own internal use. This is a Windows service, and we are creating a database connection in the OnStart event handler of the service:

        protected override void OnStart(string[] args) {
            ms_logger.Info( "OnStart(): Service started" );
            try {
                ms_logger.Info( "OnStart(): Connected to database" );
            catch( Exception ex ) {
                ms_logger.Error( "OnStart(): Error connecting to database: ", ex);

At first blush this may seem reasonable. We want to connect to the database when the service starts.  However there are several code smells in the implementation:

        * Create a sql connection and open it. Depends on app.config settings
        private void DatabaseConnect() {
            m_sqlConnection = new SqlConnection();
            m_sqlConnection.ConnectionString = ConfigurationManager.AppSettings["keyConn"];

First, this is sort of a black box method. It mutates the class state by setting a private member, which is not evident by looking at the method signature. Also, we directly access some implicit configuration information via System.Configuration.ConfigurationManager here. Thirdly, we open the database connection as soon as we create it, another thing that is not evident to callers by looking at the method interface. And finally we are explicitly using SqlConnection, where it may be better to return IDbConnection so that we could change the underlying database without affecting the callers.

The refactored method might look like this:

        private IDbConnection CreateDatabaseConnection( string in_connectionString ) {
            return new SqlConnection( in_connectionString );

I know this is very simple, but seeing this in my own code later on makes me realize that we all have habits that we can improve. If you don’t see things in your old code that you could do better, maybe you aren’t improving much as a programmer.

Written by newcome

March 26, 2009 at 4:37 pm

Posted in Uncategorized

Accidental market segmentation

leave a comment »

I’ve been thinking more critically about how Ubernote fits into the online note-taking market recently as a result of our LaunchBox application.  Before you can start thinking about how your product fits into a market, you have to think about how that market is defined, and how it is segmented.  From a pure business standpoint, a market is defined purely by customer need.  The best definition that I found is something like this:

A market is the set of all actual and potential buyers of a product or service. source

This definition is so broad that it is only useful as a starting point.  In order to figure out how we can position our product, we need to segment this market.  Common variables used for market segmentation include demographic variables such as age and gender, geographic variables such as country or region, psychographic variables such as values and attitudes, and so on. source:
The problem is, the typical variables used to segment a market don’t seem particularly useful to me.  Looking at Ubernote’s usage statistics I can see that we already have users from around the world, and although it’s possible that many of our users fit specific demographic profiles, I wouldn’t think that Ubernote’s appeal would be limited to any particular demographic.  For advertising campaigns, demographic information could be useful, but I doubt it is good to segment our target market based on these variables.

Another question in my mind is that our actual market is limited by the platforms that we support.  This is way outside of the definition of the business definition of a market and is not touched on by the Wikipedia article.  Is this an example of `accidental’ market segmentation?  Surely a business that is after a certain market segment would want to offer a solution that would appeal to all of the potential customers in that market.  Or, maybe not, in the case of serving a market niche like Mac users or Linux users.  Is defining a market segment this way legitimate in a business sense? Or only in a practical sense for business execution?  Would defining your market segment as `word smashing for Linux users’ be legitimate from a pure business standpoint?

I expected to clarify my thoughts on this, but I ended up with more questions than answers.

Written by newcome

March 26, 2009 at 1:27 pm

Posted in Uncategorized