Re: Modelling an OO data structure



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.

.



Relevant Pages

  • Re: Modelling an OO data structure
    ... strike me as especially O-O representations. ... The choice of algorithm affects the representation. ... nor is one that strikes me as very useful. ...
    (comp.object)
  • Re: Theodore Adorno, a prophet of data systems design
    ... > correct algorithm proof is a rarity. ... > to hinge on how one reads the bit about actual programming experience. ... > Perhaps Mr Nilges doesn't read those threads ... >> to people as a way of asserting authority easily. ...
    (comp.programming)
  • Re: No Set Contains Every Computable Natural (was Church-Turing compared to Zuse-Fredkin thesis)
    ... Russell is right about Turing saying this, ... You might not want to call this an algorithm which has ... decimal representation of x digit by digit. ...
    (comp.theory)
  • Re: Theodore Adorno, a prophet of data systems design
    ... with the idea of "proving" an algorithm to be correct. ... Perhaps Mr Nilges doesn't read those threads ... this newsgroup isn't about "asserting authority". ... since (in the context of a programming discussion) colour only ...
    (comp.programming)
  • Re: Computer Programming Career
    ... a great image-recognition algorithm won't be ... >> evidence I offer the vast stretches of extant crap C code publically ... This problem is not limited to C, of course, but that's the language ... Arithmetic is a fundamental programming concept. ...
    (comp.programming)