Re: How is Behavior Specified

From: Leslie Sanford <jabberdabber_at_bitemehotmail.com>
Date: Fri, 4 Apr 2008 12:26:19 -0500
Message-ID: <47f664e3$0$12545$4c368faf_at_roadrunner.com>


"David Cressey" wrote:
> How is behavior specified?
>
> In particular, is the specification expressed as declaratives or as
> imperatives?

I think it would be a mixture of both. At some level you have to write the code that actually implements the algorithms/behavior. Once the implementation is done, the "How" of the matter, you can move up a level in abstraction and use a more declarative approach, the "What" of the matter. So if I do something like this:

class DarkStar
{
public:

    // Stuff...

    void CancelBombDetonation()
    {

        // Code that actually implements the cancel bomb detonation
        // algorithm... have philosophical conversation with bomb
        // to convince it not to blow up...
    }
};

The code for the CancelBombDetonation method is imperative; it determines how the algorithm is carried out. I can now take a more declarive approach:

darkStar.CancelBombDetonation();

At the level where the behavior is invoked, I don't care about how the algorithm is implemented, only that it does *what* I expect.

Does this make sense? Received on Fri Apr 04 2008 - 19:26:19 CEST

Original text of this message