Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: ADSI groups users

by sundialsvc4 (Abbot)
on Mar 04, 2011 at 14:20 UTC ( #891456=note: print w/replies, xml ) Need Help??

in reply to ADSI groups users

I naturally look at such problems with an eye toward so-called finite state machine logic.   While this particular example is trivial, the idea is more-or-less like this:

The algorithm will loop through all of the zero-or-more input records that exist.   As it does so, it will also keep some kind of “recollection of” what it has seen before ... memories of data that might have been gleaned from previous records, and, importantly, “what state we are now in.”   In this example, we might say the states are (say...) SKIPPING_FOR_GROUP_NAME and READING_USER_NAMES.   There is always an “initial state” that is established before the record-reading loop begins.

Each input record is classified both in terms of its content (e.g. “it consists entirely of digits”), and by the current state.   In response, the algorithm (a) decides what to do with this value, and (b) maybe changes the value of “current state.”

There are always activities that must occur both during the reading-loop and then one more time after the loop ends.

As always, writing an actual algorithm in a production setting is a balancing-act between sufficiency, robustness, clarity, simplicity and overkill.

Replies are listed 'Best First'.
Re^2: ADSI groups users
by Anonymous Monk on Mar 04, 2011 at 14:54 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://891456]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2017-12-18 23:06 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (501 votes). Check out past polls.