Are there any common strategies or design patterns for designing applications that have either the ability to add custom fields to data objects, or for creating your own custom definition of objects. For example, I am thinking of products such as SalesForce, where you can have your own types of information,frameworks such as Expression Engine and the way it handles channels and channel field groups (Example), or How CMSes Like wordpress have the ability to add fields to custom post types.

Of note: Oracle is going around suing the pants off of everyone that implements this in a particular (from what I understand, common) way. I'd take a peek at that as well.
–
Steve EversMay 14 '12 at 15:23

4 Answers
4

You wouldn't have the first application that had a table with: UDF1, UDF2, UDF3... The other suggestions (EVA or NoSQL) are much better.

Depending on the RDBMS (SQL Server offers this), you could break out of normalization and have a field that holds the data in an XML format or just plain text. You'll have to rely on code to manage this.

Martin Fowler gave a nice description how to model dynamic properties (which is essentially what you are asking for) in his book "Analysis patterns". Most of the content is available online for free as PDF articles, the one you are looking for is this one:

In addtion to the EAV table that @Oded describes, people use nosql datbase for this type of information. Remember there is no reason why your application can't use a relational database for the parts that make sense with the relational model and a nosql database for the information that doesn't.

A third possibility is to add several columns for the customer-added fields (Customerfield1, customerfield2, etc) and then have the customer define what they mean. This only works for the number of customer comnfiguarble fields you add though, so it is fine if you only expect they will need two or three but won't work at all if you will need hundreds.