For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > June 2005 > POE::NFA









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author POE::NFA
Tim Klein

2005-06-09, 4:01 am

In a different thread, Rocco wrote:

>POE::NFA is not well documented. It seems to be the strange cousin of
>POE::Session that people rarely talk about, so time is focused
>elsewhere.


That's certainly true, but it's puzzling to me. POE::NFA is
extremely powerful! It's like POE::Session's big brother, rather
than its strange cousin. I don't know why more people aren't using
it. A Session has events, but an NFA has events and states! An
event can be handled differently depending on what state the NFA is
in when the event arrives. Totally .

POE::Session is great for stateless applications, but it's been my
experience that most applications of any complexity do have states,
even if we don't always think of them that way. POE::NFA enables an
application to be explicit about what state it's currently in, and to
use event handlers specifically "tuned" for that state. And that, in
turn, enables me as an application writer to explicitly divide a
complex application into conceptual "chunks", where each chunk
consists of the event handlers for just one state. It's a powerful
mental tool as well as a powerful programming tool. I think of
POE::NFA as a superset of POE::Session. I'd hate to see it neglected!

Tim Klein
Dallas, Texas

Wiggins d'Anconia

2005-06-09, 4:01 am

Tim Klein wrote:
> In a different thread, Rocco wrote:
>
>
>
> That's certainly true, but it's puzzling to me. POE::NFA is extremely
> powerful! It's like POE::Session's big brother, rather than its strange
> cousin. I don't know why more people aren't using it. A Session has
> events, but an NFA has events and states! An event can be handled
> differently depending on what state the NFA is in when the event
> arrives. Totally .
>
> POE::Session is great for stateless applications, but it's been my
> experience that most applications of any complexity do have states, even
> if we don't always think of them that way. POE::NFA enables an
> application to be explicit about what state it's currently in, and to
> use event handlers specifically "tuned" for that state. And that, in
> turn, enables me as an application writer to explicitly divide a complex
> application into conceptual "chunks", where each chunk consists of the
> event handlers for just one state. It's a powerful mental tool as well
> as a powerful programming tool. I think of POE::NFA as a superset of
> POE::Session. I'd hate to see it neglected!
>
> Tim Klein
> Dallas, Texas
>
>

I haven't messed with POE::NFA much, but from your description of
states, I think the same (or even better) can be accomplished by using
the object wrapped session rather than the inline sessions. By having
every session wrapped by a regular object you can hide the
implementation of the event handling, and essentially you have 100%
control over the extent of a state, since it isn't in a single state, it
is *just an object*, which already inherently knows its own state, etc.

But I have ranted enough here, before, on the use of object sessions
rather than inline ones :-)...

http://danconia.org
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com