August 2005 Entries

I have been developing web applications for almost a decade now.  In latter half of my career I discovered a very interesting topic called “usability” or “human factors engineering”.  This has been a fascinating topic but very half and half between logical and subjective as well. Today the subject came up again whether or not to collect a user’s phone number utilizing 1 text field or utilizing 3 text fields.

 

I personally suggest using 1 text field to my clients and for the following reasons:

  • The majority of people that utilize web sites are not experienced typist so they immediately see the request for a phone number and then look down to peck in the right numbers.  Only to realize that after typing the whole number only the area code was entered.
  • Some sites try to resolve the above issue with auto tabbing after the user types the correct number or digits.  The issue with this is when a user mistypes the last digit of their area code and it auto tabs to the next then the user either needs to “Alt – Tab” back or take their hand off the keyboard to move and click the mouse back to the field.
  • Three fields can not be easily internationalized because there are nations with phone number formats like “xx xx xx xx xx”.

 

Plus, I think users should be able to enter phone numbers in whatever format they like.   For me, it is pretty easy in code to strip out all alpha characters leaving only digits then validate against just the digits.  Then if I need to format it in 1 standard format I can do the format before submitting to the database or before displaying the value back to the user.  Either way, it should make any difference to me if the user likes to enter their phone number like: 222-555-1212 or 222.555.1212 or 2225551212 or (222)555-1212 and etc.

 

I also, believe the above rules can and should be applied for inputs such as a date value.

 

From my development perspective, I think all the extra JavaScript and the need to create a custom validator for a 3 text field phone number control is a whole lot more complexity that does not add any real value to justify the costs.

 

Simple is better!

Sounds like the Microsoft Patterns and Practices group are close to getting the Enterprise Library ready for Whibey!

http://blogs.msdn.com/scottdensmore/archive/2005/08/01/446190.aspx

A while back I was working on a project with Microsoft when we had a visit from someone on the Microsoft .net CLR product team.  This person coded examples and when he defined his variables he used “Int32” vs. “int” and “String” vs. “string”.  I had remembered seeing this style in other example code from Microsoft.  So, I did some research and found that everyone says that there is no difference between the “Int32” and “int” except for syntax coloring.  In fact, I found a lot of material suggesting you use “Int32” to make your code more readable.  So, I adopted the style.

 

The other day I did find a difference!  The compiler doesn’t allow you to type enum using the “Int32” but it does when you use “int”.  Don’t ask me why because I don’t know yet.

 

Example:

public  enum MyEnum : Int32

{

    AEnum = 0

}

 

This works.

 

public enum MyEnum : int

{

    AEnum = 0

}