



Pragmatic Programmers on Designing with Metadata 26
Bill Venners writes "This week I've published the fourth installment of my interview with Andy Hunt and Dave Thomas, the authors of the best-selling book, The Pragmatic Programmer. In this installment, Dave and Andy talk about their recommended approach to design in which details are pulled out of the code and stored as metadata. This installment of the interview really made me think. Their focus on metadata sounded non-intuitive when I read their book, but in actually talking to them about it, I got the feeling they might be on to something. Check out: Abstraction and Detail."
Compiling versus interpretting (Score:1)
Re:Compiling versus interpretting (Score:2)
Article is a load of bull (Score:1)
I am not sure where they got their definition of metadata, but it sure isn't what I mean when I say it. From the article:
Uh. He's t
Re:Article is a load of bull (Score:2)
Well, of course metadata is data. The important thing is to design out as many assumptions as possible so that they are represented by data rather than code. We used to call this "data driven programming".
Example:
Years ago, I had a huge backlog of requests for different data sets out a database. I abstracted out the common aspects of the requests, built an engine that retrieved the data based on a
Re:Article is a load of bull (Score:1)
For a multinational, with outlets all over, different rules, mail order etc, that wouldn't work. Trust me, I've been there.
Re:Article is a load of bull (Score:1)
I think the distinction is between data that's to do with the objects the system models (e.g customers & invoices if it's a billing system) rather than data that makes the system behave in a certain way. The former I would call 'operational', the latter 'configuration'. For me, metadata means schemas and suchlike.
Some have great difficulty eeing the distinction; a rule of thumb is if end users mess with it it's operational, if only specialists/analysts/etc do it's
Re:Article is a load of bull (Score:2)
Right -- a relational schema is metadata for a relational model. A state machine description is also a schema for a state machine model.
But really, I don't see that they're saying anything new, it's all in 'Code Complete' which is v. old now.
Sure, it's an old idea. HOwever it is not one that has been absorbed by nost programmers.
Re:Article is a load of bull (Score:1)
I find it interesting to see discussions about OO and inheritance, components and all the rest of the reuse armoury, when 80% of programmers never learned how to use includes properly.
P.S. I like the sig.
Re:Article is a load of bull (Score:1)
That's kinda metadata, more a function, but it's often hard to tell the difference between data that describes data and a function.
input y is looked up as in input for function sales tax.
list values for y have metadata that says they are possible inputs for sales tax.
sales tax has metadata that says it can be applied to a product and/or a product has metadata that says salestax can be applied to it.
It's important not to hard cod
wow (Score:2)
I think that storing everything possible in XML or a database is a good thing. Perhaps he is referring to the coding style of outputing everything in XML and use XSLT to convert it as required. This is an incredibly flexible and scalable technique with only slightly more initial development time and effort.
For webpages, I can have my application do a SQL select and output the data as XML. The XSLT templat
Re:wow (Score:2)
This isn't about strictly separating code and data, it's about using different tools for different layers of your app to blur this distinction, which is a good thing.
Field dictionaries (Score:1)
It takes a while to hone the usage of such things, especially WRT handling unexpected requirements, but there is a point where they start to pay off handsomely in my experience.
Rules, not metadata (Score:3, Informative)
Maybe I've got the wrong idea from the interview, but what was discussed was rules, not metadata.
Business rules are a well known aspect of enterprise software development, especially in light of the many old(er) custom-build systems in which the rules were hard-coded. A business rule is "sales tax is 7%", or "customer pays a 1.5% surcharge is payment is more than 2 days late".
Metadata is a partner and also an opposite to a business rule. Metadata is quite simply "data about data". The fact that the value "7%" is "sales tax" is metadata; but the fact that the current value of the sales tax is 7% is not. The age-old concept of a "data dictionary" is an embodiment of what metadata is.
A rules engine is (rather simply) a powerful extension of the practice of declaring constants for significant literals (which are or could be subject to change); quite often one which allows runtime modification of the value rather than requiring a recompile. Rules engines also tend to provide mechanisms for evaluating compliance with the rule, or performing calculations based on rules.
Re:Rules, not metadata (Score:1)
You could setup differnet rules in the database, the rules were run as SQL or JavaScript, or a call to an external ActiveX Component.
There were some user configuration parameters and other bits and bobs so that you could configure everything from a whois do domain name registration to complex multi purchase pricing rules.
It made for east site design, maximum code reuse and the ability for an end user to configure their area of the system.
Now, if someone applied that to a
Re:Rules, not metadata (Score:2)
Re:Rules, not metadata (Score:2)
The 'Metadata' should include the sales tax algorithm, not just the percentage.
For instance, the crazy Goods and Services Tax (GST) here in Canada has weird rules in it like: 3 donuts are taxable, but 12 donuts are not. Encoding a plain 7% in the 'metadata' is not sufficient.
--jeff++
Summary (Score:2)
To summarize the article.
Any professional programmer somewhat experienced (i.e. anyone who has run into a respecification of a constant occuring in 52 locations thoughout 30000 lines of
Bad Summary (Score:3, Interesting)
No, that's not what it says. It says do not encode known behavior into the code, but put it in some more easily changed external data source. Also, it might be XML but it can also be in the code, just code structured more like data then code. (I often write code-data like that, writing default keymaps in the language itself, for instance. It's easier then writing a cust
yup, yup (Score:2)
There's an effect that I've named (what else) "Hollan's Law": The liklihood of something changing is directly proportional to the intensity of the argument that it never will.
Thus, when we see something in code that looks like it might need to be maliable, it probably will be.
Looks like these guys have noticed the same thing.
Ultimately, good programming is about finding the clear
Code generation (Score:1)
Re:Code generation (Score:1)
Most programming is still done in low-level programming languages. IMHO, we really need systems/languages in which we can transform high-level specifications into executable code. This kind of tools would allow you to select any of the above techniques based on what suits you best.
Mmmmmm (Score:2)
embedded scripting engine (Score:2)
These kind of approaches inevitably end with the programmer inventing a new, personal language for expressing the rules and writing a small interpreter for it (which he basically did).
The same result and much more can probably be achieved by
Re:embedded scripting engine (Score:1)
regards, treefrog