Importance Of Variable Names
August 10, 2010 Leave a comment
Can anyone see the problem with this bit of code?
public class InterfaceKitDigitalOutputCollection
{
// Fields
private IntPtr phid;
// Methods
internal InterfaceKitDigitalOutputCollection(InterfaceKit phid)
{
this.phid = phid.phidgetDeviceHandle;
}
I changed the local parameter
// Methods
internal InterfaceKitDigitalOutputCollection(InterfaceKit interfaceKit)
{
this.phid = interfaceKit.phidgetDeviceHandle;
}
And suddenly the code is more consistent and readable. A small change to be sure, but I lost 5 minutes assuming that variable names were unique in the class.