Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Will this break your program?

by little (Curate)
on Apr 28, 2001 at 00:49 UTC ( [id://76265]=note: print w/replies, xml ) Need Help??


in reply to Will this break your program?
in thread threaded display of replies

well, each node should be represented by a node_id in a DB or whatever file U use and this should know (store) the id of its parent, so you can't mess up things. And btw, there is no need to let anode know if it has children or not. If there are children THEY WILL KNOW their parent. Keep it simple: stupid. :-)
btw BmeCat works this way and made it to a standard.

Have a nice day
All decision is left to your taste

Replies are listed 'Best First'.
(bbfu) (parents' children) Re(2): Will this break your program?
by bbfu (Curate) on Apr 28, 2001 at 01:15 UTC

    so said little:

      And btw, there is no need to let anode [sic] know if it has children or not. If there are children THEY WILL KNOW their parent.

    Unless, of course, you want to find all the children of a particular node without doing an exhaustive search of the DB. While not strictly necessary, it can make life simpler in some cases. I think this application might qualify as one of those cases (see Masem's reply). :-)

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.

      But that blows up your DB to an expensive amount, when you store the children node id's to a node. Remeber, you will never know how many children a node will have. But a child node always has only one parent.
      Have a nice day
      All decision is left to your taste

        Well, I was figuring you would only store children's node id, and only one deep (ie, immediate children). Unless each node in your application is expected to have an extreme amout of immediate children, I don't see that it would be a problem.

        Let's see... Generously, 4 bytes to store a node id and 100 immediate children on avg. gives only 400 extra bytes per node. That's not a huge amount and most nodes on PM have far less than 100 immediate children. I don't recall any I've seen with greater than 30. That's only 120 extra bytes per node.

        Not sure how many, if any, DB's support variable length data-arrays but you could always use a blob and pack it yourself. A little more work, but not as much as an exhaustive search of the DB for every node with a parent ID of xx.

        Don't get me wrong, I understand your point and I know that it might not be worth it in some cases. I just don't think that most cases (and this one in particular) would be that hurt by the cost and I think the benefit would outway the small cost of extra size. 'Tis, of course, the Implementator's call; and the point is moot in this case unless we feel like submitting a patch to EveryDevl.com. :-)

        Disclaimer: It is quite possible (likely?) that I am mistaken and/or am relying on an invalid assumption. I don't know a great amount about the Everything engine, nor even the general implementation of such systems. Therefore, I provide no warranty for this post, expressed or implied, for fitness of use or merchantability or anything else. I disavow all knowledge of my own actions and assume no responsibility for anything. ;-)

        bbfu
        Seasons don't fear The Reaper.
        Nor do the wind, the sun, and the rain.
        We can be like they are.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://76265]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2025-07-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.