|Just another Perl shrine|
normal objects?by mkmcconn (Chaplain)
|on Jan 25, 2001 at 00:28 UTC ( #54113=perlquestion: print w/replies, xml )||Need Help??|
mkmcconn has asked for the wisdom of the Perl Monks concerning the following question:
I hope this is the right place to post this.
As new as I am to Perl, I am almost as new to databases. But, two ideas that I picked up from working with a database were 1) the "normal form", and 2) the "primary key". As I began to absorb these concepts, the light began to dawn for me, how a database can be used to describe many different views of the same thing, if the designer has been careful to distinguish one thing from another: called "normal form". This enabled me to design queries which produce the various views that are usually requested from a database.
Any of the aspects of the data in multiple rows of a normal form table can be abstracted out for reference in a new relationship, by using the idea of a primary key. I can join the data of two tables together, selecting only the parts that I want to see. This new selection itself can (and should) be "normal form", describing a unique entity on each line and therefore, in turn, adaptable to other uses by applying a primary key to each line of the product of an ad-hoc query.
Now I've come to Perl and my question - actually, to Perl only in a general sense, as a programming language that is adaptable to the "object-oriented" paradigm. I had the idea that in the programming paradigm called "object- oriented", there must be something like a relational database's ability to create various views of an object - "Bessie" viewed as "ground beef". I would expect multiple views to be such that "Bessie" can be followed from calf to cow (one instance of cow becoming another kind of cow), to patties(a cow with all of its cow-methods removed), still identifiable through all these changes, as a specific instance of "cow". But in the end, Bessie now "tastes yummy" and the "speak" and "eat" method is an irrecoverably inapplicable or radically redefined attribute.
It is often the case that a real world object, while retaining some key element of identity, is of interest because it is being made into something else. As the process matures, the beefness of Bessie becomes more important than her cowness. But, it seems to me that a programming object is simply a "cow" or it is not. A "Cow::" cannot become "Beef::" without losing its identity entirely: however, in the real world very many "cows" become "beef". It seems that there is more certainty built into a programming object, than a real-world object. Consequently, there is a limitation built in to how exactly this paradigm can map to the real world.
Brethren, I apologize for how impractical this question is. Maybe I'm missing something really obvious, and 'thinking sophomorically'. But, I'm looking for every handle I can find, so that programming will make more sense to me - and here is a handle that I thought would be there, but seems to be missing. How wrong am I?
Back to Seekers of Perl Wisdom