I wanted to ask a design question on how best to structure a class for objects that I would like to have searchable fields, including fields that are objects - but also modular, in a sense that fields can be added based on new entries in a DB. Let me clarify:
Suppose I have an object type, Car. The car has properties like make, model, color, top speed which can be represented by simple types like strings and doubles, etc.. but it also may contain more complex information, such a property with type CarPowerProfile (a separate object), which holds an equation that describes the power output of the vehicle as a function of throttle. Or perhaps other sub-objects.
My question breaks down to the following:
What is the best way to design such a class, so that I can search a database, not only for simple properties like color, make and model, but for say "find me a car that is blue and has between 70% and 90% power output for 30% throttle"? The problem is, I need to object that performs the calculation to get that information, and the database only stores the coefficients for the equation.
Also, say someone wanted to add a property to the object (in addition to hardcoded "base properties"), how is this best implemented so that the new property is both in the database and the loaded object? And finally, is this problem best suited for a relational or non relational database, keeping in mind that this will be a standalone application that will synchronize with a web service.
I realize I am asking a lot, but I am not looking for code handouts but more for how to design a solution - which is why I am using words and not code to describe the issue. I come from a background of numerical computing, and this type of software design is foreign to me. I am more interested in if there are design patterns for things like this (or similar), or maybe a different approach because I'm tackling the problem incorrectly.
Thanks!