I am focusing on an ASP.Internet project that replaces many existing paper forms. Among the needs would be that the user can help to save the shape in almost any condition, i.e. they might produce a new blank form and immediately save it without any data or with partial data. I am validating for data type on every save but validation for needed fields doesn't happen before the user marks the shape as completed.

I am unsure what a great way is additional requirement within the database and domain model. When I view it, I've two options:

  1. Allow nulls for just about any area that won't have data. This feels as though the "correct" approach however it mandates that nearly every database area allow nulls and I must code around lots of nullable types. Also, once the form is completed no needed fields are enforced within the database.
  2. Populate my company objects with significant default values. In some instances, you will find significant default values for a lot of (although not all) fields which i can use. This method verges on "miracle amounts" making me uncomfortable.

Which approach is better? Or it is possible to third way? I am reluctant to visit extremes, for example splitting the tables.

Edited to include: I needed to grow about this a little since i have recognized an answer. The main reason that I am not thinking about splitting the tables is the fact that when a project is posted, the information around the forms can be used to create data for an additional system that's the machine of record. At that time the initial form data rarely is in modified or employed for confirming.

I do not realise why you won't want to split the tables. I'm not sure what domain you are in however in any I possibly could imagine you will find two classes of individuals:

  • those who have posted the shape
  • individuals who haven't

So that as a company executive I do not worry about the 2nd. However the first I care deeply about, and they have to have their data in properly.

Additionally, it enhances efficiency - much of your doubts about aggregate data is going to be within the first table, not the 2nd. The 2nd table are only employed for index seeks.

If splitting the table(s) (exist several?) isn't a choice, I'd consider creating single table to keep serialisations of objects of incomplete forms, and just commit an application towards the "real" tables once the form is fully posted through the user.

If there is not a smart default, and you won't want to split the information, then nulls are usually the best choice. Re the db not to ensure that they're not null when completed... well, if you won't want to split the table there is not much that you can do (lacking utilizing a CHECK constraint, or perhaps an INSTEAD OF trigger to operate validation). However the DB is not the only place accountable for data validation. Your application logic can perform this too.

You could utilize a brief table with "allow nulls" on every column to keep the shape that contains partial or no data and copy / slowly move the data towards the final table once the user marks the shape as completed. By doing this, you don't rely on default values (that the user may forget to alter), it can save you in almost any condition, but you just possess the validation ultimately.

This can be a situation that cries out for split tables. I understand you stated you won't want to do this, as well as in a comment even stated "this project does not warrant that much cla of effort". but it is truly the best answer.

Setup preliminary table(s) with everything else except your key nullable. Once the user marks the shape complete, also it passes validation, move it towards the final table(s). besides this being The Best Factor To Complete, but it is most likely less effort than "coding around nullable values" whenever using finished forms.

If you want to see all forms, finished or otherwise, create a Union view.

I'd go ahead and take first option but give a column towards the database tables to ensure that once the form is finished this really is flagged. Then for anything while using form data it basically must make sure that the shape continues to be completed.

That's my suggestion for the way for this.