473,498 Members | 310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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


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
3 1629
In article <ga*****************************@news.veawb.coop >,
galathaea <ga*******@veawb.coopwrote:
[...]

How about an example for the short bus?

--
Michael Press
Jun 27 '08 #2

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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
17113
by: Tyron | last post by:
I need to know if the Left Button of the Mouse is clicked in the WM_NCMOUSEMOVE Notification but this Message doesnt contain the Mouse Button States as WM_MOUSEMOVE does. So how can I get them? ...
3
2966
by: KJ | last post by:
I first had a problem with events on firing with my custom control. When I click a button on my control the event will not fire. So then I tried everything accept recode it again and then I...
9
3230
by: AndersBj | last post by:
Hi all, I have a web application that uses State Server for session handling. The web application randomly loses all session variables. The sessions are not always lost, sometimes I can use the...
5
548
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know...
4
4364
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
3
8690
by: Nathan Sokalski | last post by:
I am recieving the following error on the second postback of a page I have written: The state information is invalid for this page and might be corrupted Stack Trace: ...
8
11197
by: rahulnag22 | last post by:
I have created a button widget with a button click binding. The button initially has a state=disabled. I can see the greyed out version of the button in the GUI. But If I click on the button it...
6
2145
by: pcrepieux | last post by:
Hi, I recently meet a problem while "playing" with the state pattern. I was wondering if each of the member function dedicated to handle events open(), close(), ack() could be change to...
0
1062
by: kirk | last post by:
I have three events that I have created and manage with timers. Two of the timer event handlers, the last two in the code below, need to reset state management data, if the first event handler...
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.