Google Web

mewsings, a blog


Sunday, February 05, 2006

The Model Behind the interFace

An interface is the face that computer software shows to a person, other software, or possibly hardware devices. While data models are often discussed related to databases and storing data, this mewsing is about data models behind software interfaces in general and user interfaces in particular.

Example UML class diagram for web page data

Let's take an example of a browser-based UI page with three text fields one of which requires an integer value, one single selection drop-down, two multi-selection drop-downs, one text area, one radio button, and one date entry via a free-form text field. Using all the creativity I can muster right now, I'll name them as indicated in the UML class shown here.

Developing software is a process of modeling data and behavior. One set of data we can model is that which will be entered by the user. This single page of data could be backed by a view/schema modeled with this single UML box. We could use XML or JSON, for example, within the software to define and work with this view of data.

Similarly if not working with a UI, but a data exchange interface, such as one using web services, we could use this same data model. This could be the model for a single "record" of data. For this example I'll include some sample values. I'll use an xml-ish format (because I wish XML had arrays like this) to model this view. [Note: I'll start the array index at 1, but I'm noting that I'm doing that just to retain my credentials in the real-programmers-start-counting-at-zero world.]

<MyExchange> <text1>elephant</text1> <text2>ears</text2> <text3>2</text3> <singleSelect>mouse</singleSelect> <multiSelect1> <multiSelect1[1]>grey</multiSelect1[1]> <multiSelect1[2]>pink</multiSelect1[2]> <multiSelect1[3]>ivory</multiSelect1[3]> </multiSelect1> <multiSelect2 /> <textArea>These are the times that try men's souls</textArea> <dateText>01JAN06</dateText> </MyExchange>
An arbitrary web page cannot have an SQL view as a data model.

An arbitrary web page cannot have an SQL view as a data model. While views need not be in 3rd or 5th normal form or BCNF, you cannot define a SQL view that is not in 1NF. Using my favorite definition of a SQL view being a stored query, we see that while we can get a lot of different result sets in an SQL query, we cannot get a single web page of data if said data includes lists. Lists or arrays are very common in user interfaces as well as throughout the rest of software development. SQL-DBMS advocates have been known to say things like "You can use reporting tools to represent the view in whatever form you like--that is a representation issue". You might recall from a previous blog that the RM is all about representation, however.

The inability to get a view that is not normalized is a failure of SQL-DBMS tools, while the current state of the RM has made accomodations by redefining 1NF. I suspect I'll bring that up in a future blog, but for now I'll just make the point that even with some new variations on the RM that permit relation-valued attributes, ordered lists are still not included in the model.

Now that we have our UI or web services interface modeled, what might we want to do with data that are hosted by this model? We might want to select, project, join… basically we might want to do anything we otherwise do with data. These data need not come from a disk, they could come from a web page or pages, a web service or other interface, or a process that generates data and stores it in memory, for example.

Are there any of these statements with which you disagree?

  1. Data modeling is required for all interfaces and, therefore, throughout the process of software development.
  2. When data values are provided in data models related to a UI or any other interface, there might be a requirement to do any type of manipulation of or queries against this data.
  3. When working with a UI data model, it is not possible to work exclusively with normalized data.
Therefore, it is not just important, but necessary, to have models of data other than the RM.

Therefore, it is not just important, but necessary, to have models of data other than the RM. Whatever the other data model, it has the same requirements for manipulating and querying the data as data models that are specific to DBMS tools. Data in these models must be projected, inspected, dejected, neglected, and selected (apologies to Arlo Guthrie and Alice's Restaurant).

Before we turn our attention to the face of the database, are you with me in understanding that even if we decide to make changes to whatever data model we use for the UI when we work with large shared data banks, we cannot make the RM the data model across the board in software development? We must have ordered lists, for example. The User simply requires a more full-featured model behind the Interface.


Post a Comment

<< Home

Litter Box

Atom feed

Add to Google

Some of this is worth pawing through.