Re: Modelling an OO data structure
- From: "Alvin Ryder" <alvin321@xxxxxxxxxxx>
- Date: 15 Mar 2006 14:08:41 -0800
John D Salt wrote:
Phlip <phlip2005@xxxxxxxxx> wrote in
news:bwkRf.6255$%m4.5043@xxxxxxxxxxxxxxxxxxxxxxxxxx:
John D Salt wrote:
There may be good reasons for representing a graph as an
adjacency list, or an adjacency table, but they don't
strike me as especially O-O representations.
The choice of algorithm affects the representation.
Indeed, and if you have a thumping good algorithm for whatever it
is you want to do with Bayesian graphs, that might be one of the
"good reasons" I mentioned. But starting with the algorithm
strikes me as unlikely to be an O-O approach, especially if it is
an algorithm that requires a "God's-eye view" of the entire
graph.
OO does not mean "make every noun an object".
No, but the concreteness of the representation influences its
understandability, and O-O programming is an exercise in
extending the programming language into the problem domain (a
saying of Tim Ottinger's I liked so much I stole). Nodes and
edges are essential ideas in graph theory; adjacency lists are
not.
OO generally means "leverage virtual functions where
needed".
That may possibly be what you take it to mean, but it isn't a
definition of O-O that matches any other I have met these past
fifteen years, nor is one that strikes me as very useful.
Actually I thought that definition of OO was pretty good, it's concise
and powerful ;-)
James Coplien provides a similar statement in "Advanced C++ ..." pp 205
"Public inheritance, information hiding, and virtual functions are the
pillars of object-oriented programming"
Maybe you have seen something more formal like this:
"Object-oriented programming is a method of implementation in which
programs are organized as cooperative collections of objects, each of
which represents an instance of some class, and whose classes are all
members of a hierarchy of classes united via inheritance relationships"
- Booch OOA and D with applications 2/e pp 38
I wonder which definition communicates more to a newbie? I'm guessing
Phlip's "leverage virtual functions where needed" will win that race.
You can also say "leverage polymorphism..." or "leverage inheritence"
....
I also like the "where needed" and "leverage" parts because they
discourage unprofitable usage of those mechanisms, which many newbies
are tempted to pursue. I know I did, I thought I had to inherit
everything and build frameworks all the time - what a waste.
Cheers.
.
- Follow-Ups:
- Re: Modelling an OO data structure
- From: John D Salt
- Re: Modelling an OO data structure
- From: Phlip
- Re: Modelling an OO data structure
- References:
- Modelling an OO data structure
- From: nelson
- Re: Modelling an OO data structure
- From: John D Salt
- Re: Modelling an OO data structure
- From: Phlip
- Re: Modelling an OO data structure
- From: John D Salt
- Modelling an OO data structure
- Prev by Date: Re: With Agile methods, we are measuring the right things
- Next by Date: Re: Modelling an OO data structure
- Previous by thread: Re: Modelling an OO data structure
- Next by thread: Re: Modelling an OO data structure
- Index(es):
Relevant Pages
|