views:

154

answers:

3

I'm evaluating the idea of building a set of generic database tables that will persist user input. There will then be a secondary process to kick off a workflow and process the input.

The idea is that the notion of saving the initial user input is separate from processing and putting it into the structured schema for a particular application.

An example might be some sort of job application or quiz with open-ended questions. The raw answers will not be super valuable to us for aggregate reporting without some human classification. But, we do want to store the raw input as a historical record.

We may also want the user to be able to partially fill out some information and have it persisted until he returns.

Processing all the input to the point where we can put it into our application-specific data schema may not be possible until we have ALL the data.

Two initial questions:

  1. Assuming this concept has a name, what is it?
  2. Is this a reasonable approach? Why or why not?

Update:

Here's another way to state the idea. The user is sequentially populating fields in a DTO. I (think I) want to save the DTO to disk even in a partially-complete state. Once the user has completed populating the fields, I want to pull out the DTO and process it for structured saving into a table which represents the specific DTO. I can't, however, save a partially complete or (worse) a temporarily incorrect set of input since some of the input really shouldn't be stored as part of the structured record.

My idea is to create some generic way to save any type of DTO and then pull them out for processing in a specific app as needed. So maybe this generic DTO table stores data relating to customer satisfaction surveys right next to questions answered in a new account setup wizard.

A: 

You might be speaking about Workflow. You might want to check out Windows Workflow.

The concepts of Workflow are that they mirror the processes of real life. That is to say, you make complete a document, but the document is not complete until it has been approved. In your case, that would be 'Data is entered' but unclassified, so it is stored in the database (dehydrated) and a flag is sent up for whoever needs to deal with the issue. It can persist in this state for as long as necessary. Once someone is able to deal with it, the workflow is kicked off again (hydrated) and continues to the next steps.

Here are some SO questions regarding workflows:

This question: "Is it better to have one big workflow or several smaller specific ones?" clears up some of the ways that workflow can be used, and also highlights some issues with it.

John Saunders has a very good breakdown of what workflow is good for in this question.

How is the WPF or Workflow link helpful? The two topics are unrelated.
Davy8
@Davy, It was an example of a user describing a situation in which workflow would be useful. I found more link which cover that issue better. The question wasn't related to WPF at all, and I don't get to choose the names of questions =D
A: 

Sounds like you're initially storing the data in a normalized form(generic), and once you have the complete set you are denormalizing it(structured schema).

Charlie
I don't think it's quite an issue of normalization vs. denormalization. The structured schema may very well be normalized.
Larsenal
+1  A: 

You stated:

My idea is to create some generic way to save any type of DTO and then pull them out for processing in a specific app as needed.

I think you're one level-of-abstration off. I would argue that the entire database is fulfilling the role you want a limited set of tables to perform. You could create some kind of complicated storage schema that wouldn't represent the data in any way, and then (slowly and painfully, from the DBMS's perspective) merge and render a view of the data ... but I would suggest that this is an over-engineered solution.

I've written several applications where, because of custom user requirements, a (sometimes significant) portion of the application is dynamic - constructed by the user, from the schema to the business rules. The ones that manufactured their storage schemas by executing statements like CREATE TABLE and ALTER TABLE were, surprisingly, the ones easiest to maintain. They also allow users to create reports in a very straightforward, expected way.

overslacked