A Walk on the Wild Side: Imposing Structure on an Unstructured World
by Jon Stonecash
One definition of programming is the extraction of formal structure from unstructured situations. The "real world" is chaotic. When we develop software, we abstract from this messy maelstrom to build database tables and software objects that are, at least relatively, more structured. But it is impossible to eliminate the mess. Anyone who writes that part of the application that accepts data at the "edge" of the application knows just how messy it can be. There are three ways that the application design can respond to the data entry problem:
- Reduce the complexity of the data entry by requiring the user to parse the data into individual textboxes that are so simple as to be un-interesting. If you build applications this way, turn your head away in shame. Stand tall and say, "I will not make my users do work that the computer software can and should be doing."
- Build logic to parse the mess and extract as much of the meaning from the maelstrom. This is fun, interesting, and useful. There are several ways of doing this and each way leads to lots of opportunities to show you some code.
- Add structure under the covers by using "micro formats". Again, this is a good thing that lends itself to more opportunities to show you some code.
Just so you won't think parsing and micro formats are only for the "fancy folk", we will look at parsing and micro formats to deal with common data entry items such as addresses and phone numbers. These "ordinary data entry problems" can be very difficult to solve in the general case. We will parse these items with regular expressions, programmatic state machines, and formal parsers, noting the wonders and woes of each approach. Once you have struggled with handing the entry of these items, you should be motivated to make it easier for others by tagging your output using "micro formats" that vastly reduce the effort for other programs to accept the output your applications produce.
About the Author
Jon Stonecash is a senior consultant at Magenic, a Microsoft Gold Partner consulting company. Jon Stonecash has worked in software development for much longer than he would like to admit. In that time Jon has had the opportunity to make most of the serious software development mistakes at least once. He has programmed in over a dozen languages including several different assembly languages, Fortran, COBOL, SNOBOL, classic Visual Basic, VB.NET, and C#. He has survived the structured programming revolution and the object-oriented. Jon's software development activities have included the development of operating systems, scientific and engineering applications, and enterprise systems. He has worked in every phase of software development from the initial specification of requirements through to customer support. Along the way, he picked up a BS in Mathematics and an MBA. He still has hopes of finding something that he can be reasonably good at. His long term interests center about databases and the aspects of the application that handle data access and business logic. He is also interested in the tools and processes that assist the development process. Jon can be reached at email@example.com.