in reply to Re: Help with ADT
in thread Help with ADT

Objects aren't a magic wand that just make your problems go away. You still have the same potential problems if you are going to use an object. Don't forget, Perl makes you implement the objects yourself. All you have is a single reference, and you have to store all your instance data there. Guess what, then you are facing exactly the same problems! After all, the post is about storing data in a reference.... You still have to write your accessors.

Abigail

Replies are listed 'Best First'.
Re: Re: Help with ADT
by dragonchild (Archbishop) on Jul 25, 2002 at 14:10 UTC
    Yes, you are absolutely correct. I should have been more specific in my post.

    What I was driving at was that he wasn't quite sure how the ADT was going to be specified. In fact, he says that the ADT's definition is constantly changing. This implies, to me, that he's using this thing. By creating some API, he is able to deal with the ADT in some abstract manner within the client. He gets to figure out what exactly he wants this thing's behavior to be.

    Then, and only then, does he have enough information to be able to actually design the darn thing. He's trying to put the cart before the horse.

    For example, I only skimmed the original post, but I'm pretty sure that he doesn't need one ADT, but a composition of ADT's.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

      Well, you wrote:
      The client only does stuff through the accessors, so you don't have the coercion issues.
      which sounds specific enough to me, and that was what I argued against.

      You are right about that it's good to do the design first (if only all programmers would). It's also good to have an API, but that's already implied if you are using an ADT, because it wouldn't be much of an ADT if you'd poke around in the datastructure outside of defined set of functions. However, you do not need objects to be able to deal with ADTs. Your password file can be seen as an ADT which you access via the *pwent set of functions.

      Abigail

        dimmesdale wrote:
        $info->{subdirectory}->{file}->[measurement] = INDEX; $info->{subdirectory}->{file} = PARSER; $info->[measurement]->{name} = NAME;

        That looks very much like "pok(ing) around in the datastructure ..." *shrugs*

        Design, especially before coding, is good.

        Creating mockups in search of knowledge to help design is good.

        Poking around in complex data structures is bad.

        Creating API's to encapsulate complexity is good.

        (I'm starting to feel like a Mastercard commercial.)

        ------
        We are the carpenters and bricklayers of the Information Age.

        Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.