Wednesday, June 24, 2009

Keep Swimming or You Die

shark
Some shark species must keep swimming to create a flow of water through its gills, or they will suffocate. Our aquatic friends of the deep can teach us something about software development.
Last night I stuck up a conversation with someone at my daughter's athletic event. Come to find out, he was an underemployed software developer. He was ruing the fact that for eight years he kept his head down and simply created java applications for his employer. He didn't investigate developing apps for this wacky internet web-thingy which is quite popular with the younger crowd. When he was laid-off, he found his excellent java application skills not much in demand in a sparse job market. Admirably he is going back to school and getting the skills needed for today's web-connected world.
The lesson from the fishies: Keep learning or your career will die.

Saturday, June 20, 2009

Roxio Creator 2009 not starting

I am rebuilding my home windows xp system after a disk crash. While reinstalling Roxio Creator 2009 I encountered an interesting problem. Roxio would not start. I looked in the event viewer ("Start/Programs/Administrator Tools/Event Viewer") and found the following error message:

EventType clr20r3, P1 roxiocentralfx.exe, P2 4.12.0.0, P3 48a05348, P4 roxiocentralfx,
P5 0.0.0.0, P6 48a05348, P7 17e, P8 12, P9 system.dllnotfoundexception, P10 NIL.

(The event log messages are really more like a Greek Oracles, something you only really understand, at your peril, afterwards).

I tried to install .Net 3.5 because another error hinted that a .Net library was missing. During the .Net 3.5 install I got the following less helpful error which did not have an event clue.


error

So I was stuck. Roxio won't start because of a missing .Net library and I can't install .Net because of a "Setup Error".

Realizing that Roxio Creator 2009 is only a shell over all these other programs, I tried to launch a sub-program, "Creator Classic", directly (Start/Programs/Roxio Creator 2009/Applications/Creator Classic". It did run and immediately asked to download patches from the mother ship. After those patches were installed I tried lauching the main Roxio Creator again - and it worked.
No rhyme or reason or understanding here, just trying random things, but that's what often works with Windows.

Friday, June 12, 2009

How to Slim Down a Word Document

For some bizarre reason, one of our important Word documents ballooned from 600K to 80 Megabytes. The document would compress nicely to an 8Meg zip file, but was taking up way too much space. I opened the document, selected all with Ctl-a, and pasted it into a new document. The new document was back to 600K. Go figure.

The Toyota Way

bookI just finished listening to "The Toyota Way" while commuting in my Camry as a way to get an introduction to Lean Software Methodology. A few things that struck me in the book (in no particular order):
  1. Counter Intuitive. Many of the ideas just don't sound right like stopping production if a problem is spotted on the line, or not using machines to their capacity. Although the ideas sound crazy at times, you can't argue with the success of Toyota.
  2. Set Based Solutions. Don't just create one solution to a problem, create several solutions and discuss the merits of each with many people. Implement swiftly.
  3. Continuous Improvement - "Kaizen". The production process should always be improving. People need to be committed to adapting to change and initiating change.
  4. Commitment to Training. Employees should be trained well. I was amazed at the amount of training that Toyota offers its people.
  5. Flow. Don't just optimize parts of the process - optimize the total system.
  6. Fix the Process, "Pokayoke". When something does not perform as expected, don't just fix it, find out why it failed. Pokayoke means to find the root problem and take action so the problem does not occur again.
  7. Easy to Copy Badly. The Toyota Production System is easy to copy badly with disastrous results. The example given was the magic chord that any employee can pull to stop the entire line when she discovers a defect in the process. Some plants tried to copy this method, but found it not to work well. In the Toyota plants pulling the chord doesn't immediately stop the line, but gives the team leaders some time to resolve the situation before stopping the complete line.
  8. Focus on "Standard Work". Each step of production has written steps on how to do the work. The employees should be doing the process exactly as written. When defects in the line occur, the line managers focus on how the defect occured. Was the standard work followed? If not, why not? If it was followed, the standard work needs to be changed. Standard Work is the first step to continuous improvement. You cannot effectively improve an ad hoc process.
  9. Eliminate Waste, "Muda". "anything other than the minimum amount of equipment, materials, parts, and workers (working time) which are absolutely essential to production" is waste. Seven classes of waste: overproduction, delay, transportation, processing, inventory, wasted motion, and defective parts. In software development I see a lot of inventory - written and tested software which has not been released because it's hard to install mission critical software.
  10. Visual Displays, "Andon". It's important for everyone to see progress, so Toyota emphasizes big signs where everyone can see problems and production.
  11. Hands-On Approach, Genchi Gengustu "Go see the problem". Management must visit the factory floor and see for themselves the problems.

Thursday, June 11, 2009

Using HTTPS in the Microsoft World

Using https on the server is fairly easy for internal testing in the Microsoft world. Since this is a self-signed certificate the users will get a warning that the certificate is untrusted. Using a self-signed certificate is not appropriate for sites used by the general public, but is good enough for internal sites and testing.

Here's some tips on how to do it:

*How to create a self-signed certificate. Change "mydomain.com" below, but everything else is OK.
makecert -r -pe -n "CN=mydomain.com" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12


*How to install the newly created certificate
Open "Internet Information Services", right click on "Default Web Site", select the "Directory Security" tab, select the "Server Certificate..." button.

*How to apply it to a virtual directory
Open IIS, right-click on the virtual directory, select the "Directory Security" tab. Under "Secure communications", select "Edit..." then check "Require secure channel (SSL)".

Saturday, May 30, 2009

Unit Test Presentation

[This is the outline of a presentation I gave recently at our company on unit testing. Permanent link is here.]

What is Unit Testing?


Take the smallest reasonable piece of code, isolate it from the rest of the application, and programatically query it to ensure the results are what is expected.


  1. Bad Things about Unit Testing:
    1. Unit Tests are expensive to write and very expensive to maintain.
    2. You can test too much.


      Bell Curve


      (Vertical axis is return on investment)
    3. You can test the wrong things.
    4. You can easily develop a false sense of security when all your unit tests pass.
    5. Having 100% code coverage doesn't mean your application is error-free.


      graphics.
    6. When all your unit tests pass, it doesn't mean your application is error-free.


      graphics.
    7. When all your unit tests pass, it doesn't mean your application is error-free. [sic]

  2. Why Do Unit Testing?

    1. Encourages better software design - less coupling, smaller, simpler methods

      Instead of tightly interlocked code like this:




      Tangled Web


      Unit testing encourages code more like this, easy little blocks that can be replaced easily:


      Tangled Web

    2. Allows you to make deep changes in the software later with confidence
    3. Produces better quality software
    4. Gives you a framework for performance testing
    5. Finds errors in single components early, instead of finding multiple errors in multiple components which is exponentially more difficult.
    6. Easier to catch threading issues in unit tests
    7. The tests themselves are documentation
    8. It's more fun - really.


  3. The Process of Unit Testing

    1. Write the test before creating any logic in your target method
    2. The first run of the test should prove it fails

      Red Test
    3. Write the simplest code in the target method to pass the test

      Green Test
    4. Refactor as needed.
    5. Repeat
    6. Red, Green, Refactor


  4. Notes Unit Testing

    1. Don't confuse Unit Tests with integration tests or system tests.
    2. Unit tests should be independent of each other.
    3. Unit tests should not typically hit external entities like a database. The test should use a mock instead. This requires external object access to be done through an interface, not a concrete class. This improves your design.
    4. Unit tests do not obviate the need for human testing of the system
    5. Unit tests allow you to throw exceptions easily in code. It's hard to simulate some network faults, but with a mock object it's easy.
    6. Many Unit test frameworks are available. We use NUnit.
    7. Unit Testing is critical to Agile software development.
    8. Where to put unit tests? In the object itself? In same assemble? In other assemble?
    9. Unit tests should be fast, less than a minute. To make them faster, move integration tests to separate suite, don't talk to the database, skip some on your local test box my using categories, and only run those on the build server, e.g., CruiseControl.Net.
    10. Each unit test should create it's own data, and delete it when it's finished. Integration tests should start with a clean database, add needed schema and data, then end with a clean database.
    11. When you find a bug, write a test that exposes that bug, and make sure it fails. Fix the bug, then run the test.


  5. Interesting Attributes in NUnit:

    1. [TestFixture]
    2. [Test]
    3. [ExpectedException]
    4. [Ignore]
    5. [Explicit]


  6. Our Dojo exercise:

    Build a case-insensitive ordered string set class. We will implement, Add(string), Count(), Contains(string), Remove(string), and GetEnumerator()



    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using NUnit.Framework;

    namespace Utilities {
    // Case Insensitive Ordered String Set class
    public class CiosSet {
    public CiosSet()
    {
    }

    public void Add(string mystring)
    {

    }

    public int Count()
    {
    return 0;
    }
    }
    [TestFixture]
    public class CiosSetTest
    {
    [Test]
    public void Should_add_a_string_and_get_count_of_one() {
    Console.WriteLine(MethodBase.GetCurrentMethod());
    //Arrange
    var set = new CiosSet();
    //Act
    set.Add("abc");
    //Assert
    Assert.IsTrue(set.Count() == 1);
    }
    }

    }

Thursday, May 28, 2009

Lifehack: Water Alarms

Every home should have water alarms where water is used. They are very cheap. I changed the batteries in ours today. We have benefited from them once, when water came pouring out of our washer machine connections. We heard the alarm go off and it saved us from a lot of water damage. You can get them from Amazon.