storing a function as data
The context for this question comes from an idea I got from A Universal Person and Organization Data Model.
The author contends that while people can and often do have various components to their name (middle initial, first name, etc), it is pointless and frustrating to anticipate how to store them all, unless you have a clear search requirement to do so. Instead, he says to make one attribute mandatory, the Surname, and store everything else in the "RestOfName".
Whether you like the idea or not, the question I have here is about the PK NameFunction in the model开发者_如何学JAVA below (the image quality is poor, I know). I am guessing, since it isn't discussed, that it is a way to format and parse the RestOfName.
Have you ever stored a function, literally? I can see how it makes sense in the object model, but I can't picture it a data.
How would you store a function as data?
Cheers,
Berrylp.s. extra credit if you can figure out what that last attribute is. I would say Salutation although that seems to be contrary to the author's point
Some languages can evaluate code at runtime; therefore, you could store the code to pass to an eval function.
This dynamic implementation could be quite risky exposing security, integrity, and functional danger.
You misunderstood the article. It does, in fact, tell you exactly what NameFunction means.
Each Party Name has a specific function, such as a legal name or professional name or other alias . . .
Also, not every person has a surname. See, for example, Falsehoods Programmers Believe About Names.
精彩评论