By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,466 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,466 IT Pros & Developers. It's quick & easy.

state is how you behave to events ++ the first antibodhi law

P: n/a

it surprises me how often engineers confuse states with actions

i think this is the fundamental reification behind procedural statemess
and this mistake infects a lot of great projects with entropising debate

this error is the type of complexity growing belief that changes a simple state transition

o -------o

to clever decompositions into state sequences

o -------o -------o -------o -------o -------o
these clever motherfuckers see their steps and think
commit! commit!
bravely commiting each step a state transition
to databases
persistent files
and external protocols
marching along confidently

but the event handlers at each stage are not really considered
because it is still conceptually the handling of one event
so the alternative paths
(which have now multiplied with every added state)
are mentally excluded

you don't handle events in a state transition
you are handling an event during a state transition

so when they need to rollback at step 4
because a separate transaction has decreased an account below that needed for commit
it's from a bug tracker issued by qa
because they weren't thinking about the alternatives

because there shouldn't be
alternatives

there should be
one point only past which the transaction is committed

for every event

some events don't cause state transitions
that is fine

a system will not always learn to be somewhere new for every event

but there should never be many states linked together from one event
no state "sequences"
no steps committed

after every state transition
you should be able to fully handle all events consistently

this is how solid fault tolerant system are architected
as any antibuddhist would tell you

-+-+-

class State
{ public:
virtual ~State() {}

virtual bs::shared_ptr<Statepush() = 0;
virtual bs::shared_ptr<Statepop() = 0;
};

class YangState;
class YinState : public State
{ public:
virtual bs::shared_ptr<Statepush()
{
++yins_;
return NULL;
}
virtual bs::shared_ptr<Statepop()
{
--yins_;
if (yins_)
return NULL;

return new YangState;
}

private:
bs::integer<bs::positiveyins_;
};
class YangState : public State
{ public:
virtual bs::shared_ptr<Statepush()
{ return new YinState; }
virtual bs::shared_ptr<Statepop()
{ throw bs::exception("pop unexpected"); }
};

class StateMachine
{ public:
void push()
{ transition(currentState_->push()); }
void pop()
{ transition(currentState_->pop()); }

private:
void transition(bs::shared_ptr<StatenewState)
{
if (newState)
currentState_ = newState;
}
bs::shared_ptr<StatecurrentState_;
};

later addition of JungState or other events possible with the evolution of the system

lifetimes occur between events
always

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar
Jun 27 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <ga*****************************@news.veawb.coop >,
galathaea <ga*******@veawb.coopwrote:
[...]

How about an example for the short bus?

--
Michael Press
Jun 27 '08 #2

P: n/a

in many ways
it's a law of efficient programming

as your state machine handles events
event handlers are tied to current state

that is from the definition

so minimising states helps minimise
handlers needing implementation

but it has many other interesting results

look at get requests
(accessor events)

one consistent problem i have seen
from young new hires
is this desire to put local scope data
in the member state of it's object

so get accessors actually can change state
to these new hires
because they store pieces of the calculation in the request
at various stages where they want to "remember"
and they don't worry about it's possible use across events
because they "try to remember to initialise"

this complexity building behavior is not possible
if you follow the first antibodhi law
because you don't expect to change behavior on accessors
and certain classes of assumptions that follow from that expectation
like ordering of access
can cause a certain class of bugs

of course
this is when they get explained the wonders of const correctness
and how to find more resources to study from

--+--

a differently illuminative model is seen in the way
feynman diagrams are usually spoken of in scattering theory

in experiments
we only have entry and exit states
ie. we make measurements pre and post transitions

how the transition occurs is
"implementation defined"
and this is reflected in the feynmann expansion

the external vertices are the "initial conditions"
the "state preserved in every expansion"
and the operators for the internal fields
can be connected up in algebraic expressions
coupling constants
to bare propagators to..
none of which scattering theorists like to call real state

it's "virtual state"
a perturbative expansion viewed as deceptive
for "losing" certain nonperturbative effects
(measurable effects unaccounted)
but still respecting a virtual antibodhi principle
(virtual state is how virtual fields interact)
that provides a calculus to describe a large class of interactions

to many scattering theorists
unless we have external vertices
"measurements"
the veil of mechanism is left to the implementors of the model

the predictive power of any science
of course
requires at least one implementation possible
but if the behavior can possibly be implemented
it can be a scientific model of state change

theorists study implementations to find generalisations
engineers study implementations to find optimisations

sometimes they even match

***^..^$$$$$$$$

this first antibodhi law
provides a different interpretation
of the buddhist description
of arahants and buddhas achieving nibbana

it reveals the ultimate result of this quest

the desire to hasten the endstate
to no longer carry the bondage of being an event handler

as the ariyapariyesana sutta i 167 proclaims:

" then
monks
being myself subject to birth
having understood the danger
in what is subject to birth
seeking the unborn supreme security from bondage
nibbana
i attained the unborn supreme security from bondage nibbana

being myself subject to aging
having understood the danger
in what is subject to aging
seeking the unaging supreme security from bondage
nibbana
i attained the unaging supreme security from bondage nibbana

being myself subject to sickness
having understood the danger
in what is subject to sickness
seeking the unailing supreme security from bondage
nibbana
i attained the unailing supreme security from bondage nibbana

being myself subject to death
having understood the danger
in what is subject to death
seeking the deathless supreme security from bondage
nibbana
i attained the deathless supreme security from bondage nibbana

being myself subject to sorrow
having understood the danger
in what is subject to sorrow
seeking the sorrowless supreme security from bondage
nibbana
i attained the sorrowless supreme security from bondage nibbana

being myself subject to defilement
having understood the danger
in what is subject to defilement
seeking the undefiled supreme security from bondage
nibbana
i attained the undefiled supreme security from bondage nibbana

the knowledge and vision arose in me:

my liberation is unshakeable
this is my last birth
now there is no more renewed existence "

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar
Jun 27 '08 #3

P: n/a

as a law
this can all be formalised in computational semantics

in fact
it has

the classical correspondence morphisms
between denotational and operational semantics
necessarily obey this law

that is the heart of the correspondence between behavior and state

also
when reasoning about agents
it is common to use a language of behaviors
but when reasoning in epistemic or belief logics
the common language is often one of states of affairs

agency logics that take advantage of the is_omorphism
can therefore be fully reflective reasoning systems

this type of reflection is needed
for instance
in belief revision logics
and learning theory

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.