Post by Ed ProchakWe think a lot alike because we've both have done this a long time.
Long lost brother? <raises eyebrows> Tell me, do you, too, have
that extra thumb on your left hand?? :>
Post by Ed ProchakPost by Don YPost by Ed ProchakPost by Don Y[E.g., if you had to construct an arbitrary regex, could you do so
with the knowledge you have committed to memory? Would a reference
answer all of the questions you *might* have about your particular
pattern?]
Yes.
When I have done a lot of regex work I kept a quick reference card handy.
The qualifier on that last statement is the issue. What about
when you HAVEN'T done work with a tool for some period of time?
Will you admit to yourself that you likely need a "refresher"?
Or, will you stumble along and *hope* it "comes back to you"?
Error-free?
Personally, Yes, I admit to my own limitations.
There are two issues potentially at play, here.
One is "vanity/pride/overestimation of your abilities".
The other is simply not *knowing* that you don't really know what
you need to know (or, that you know "enough" that the "rest" is
insignificant)
[Recall, we also have to address newcomers to the codebase
who may be seeing these techniques for the first time and
convince themselves that they *think* they know what it does]
Post by Ed ProchakPost by Don YE.g., are multidimensional arrays stored in row or column major order?
There are too many "little details" like this that only stay fresh
in your mind with "frequent refreshing".
True, but that is a different issue that the selection of the tool in the first place.
I'm just commenting on "little details" that are too easy to "forget to
remember" -- like the nonbreaking hyphen, below. In my defense, I
*know* that the nonbreaking hyphen exists, why/where it should
be used AND HOW *EASILY* I CAN REFRESH MY MEMORY (by opening the
"shortcuts" manual). So, the fact that I keep forgetting the
shortcut doesn't bother me.
But, some of the FSM tools are overly cryptic in how they try
to encode different "machine aspects" into the definition of
the machine. How likely would a "stale" developer be to
remember what all of those are and how they are used/invoked?
Would he be humble/practical enough to admit his need for a
refresher? Would he have the *time* to do so (perceived or
otherwise)?
Post by Ed ProchakPost by Don YPost by Ed ProchakPost by Don YInstead (IMO), you want something that lets a developer use a technology
without reliance on a particular tool (that may not be well-supported
or may have latent bugs that haven't yet been tickled).
Being tool agnostic is an ideal goal. In a practice, you must pick some
specific tools to get the work done within schedule, budget, and quality constraints.
If you want portability of design then that should be an explicit fourth constraint.
Most projects select tools with the additional LONG TERM constraint of
support throughout the life of the product or product line.
I've made a lot of money addressing the needs of clients who banked on
a set of tools, only to discover that they were "no longer supported"
(e.g., doesn't run unde new version of OS, requires hardware that PCs no
longer include, etc.)
Yes a lot of projects don't follow due diligence. Hence my phrase
earlier about "good management and teams" was used deliberately.
This is the crux of our difference. Ed, you (appear to be) optimistic
about what you can expect from other developers and managers. I'm
highly (HIGHLY!) jaded/cynical. I expect people to be lazy (why crack
open a reference?) as well as over-estimate their abilities.
I've personally seen products released with KNOWN bugs, rationalizing
that they aren't "that important" (isn't the customer/end user the one
who is supposed to make that decision?). Or, that they'll be fixed in an
upcoming release -- that never comes (because there are other issues
that preempt it in the queue).
Even the simplest/easiest of tasks often get overlooked or ignored.
I have been trying to get a copy of my medical record under HIPPA.
This is a CIVIL RIGHT (!) I filled out the APPROVED form. HAND
DELIVERED to the office (so no need to rely on the mail for prompt
delivery). "It can take up to 30 days" (because a third party has to
fulfill the request)
Sit back and *patiently* wait. Don't pester them cuz they've already
told you "up to 30 days". And, maybe a few more in case it got mailed
on the 30th day!
Day 35, time to call and see what's going on. "Press 3 for Records
and Referrals" 10 rings. Voicemail. OK, its possible the person
is away from their desk. Leave message, name, reason for calling,
callback number.
Next day, still no callback. Try again. Same result. Leave ANOTHER
message.
Lather, rinse, repeat for a total of 5 days!
OK, they've obviously got a problem with their "Records and Referrals"
person! Escalate to office manager. Don't accept their offer to "send
me to her voicemail" as we've done that for 5 days, already, with the
records flunky.
Office manager will track down the records person (why isn't she
at work? at 9:30AM? Office opens at 8!) and get back to me.
Don't pester later that day -- give them time, you're not the only
thing that they need to deal with.
Or, the next.
Two days later, call again and office manager avoids the call relying
on someone else to give me a message: A third party "records" firm
is processing my request (Duh, we knew that when I dropped off the
request ~6 weeks earlier!). "When can I expect it from THEM?" Dunno.
"Who can I call for more information?" (cuz you folks have been really
tedious to deal with). Dunno.
Eventually, get office manager on the phone. She's got their phone
number and a "request ID" used to identify the request initiated on
my behalf.
Call third party. Automated "Your request is being processed. Call
back in 7 days." (we're well beyond that 30 day initial limit).
Out of curiosity, call back and talk to a human. Who repeats the
same 7 day message. "Why is it taking so long? I requested these
40+ days ago!"
"We just got the request YESTERDAY."
Ah, so now I know that the "office" never filed my request.
They just lost it (or it was still sitting in the Records person's
inbox).
Long story. But, the point is, all the Records person had to do was
pass the request on to the third party, initially. Insert in FAX machine
(or document scanner) and press "SEND". Yet, this was beyond their
abilities!
And, thereafter (had they done their job originally), all they
would have had to do to address my followups was to give me the phone
number and identifier for me to contact the third party!
Instead, they try to hide the fact that they didn't do their
job (office manager didn't say, "Gee, Don, we're really sorry
but your request got lost, somehow. We only just recently
submitted it to the third party (AFTER YOU PESTERED US). We'll
try to EXPEDITE it for you (so YOU don't have to deal with
*OUR* problem)"
[What would have happened had I been in need of a REFERRAL and the
"Records and Referrals" person been just as negligent? Would I
have been letting the clock run out on a potentially serious
medical condition?]
Back to the topic at hand...
Ask developers why their code is buggy and they'll tell you
it's because their *boss* doesn't give them time to do proper
testing, or doesn't have good design practices in place, etc.
AS IF *they* would do much better in the absence of those
nasty, ignorant managers and corporate culture.
Yet, look at FOSS products -- no boss, no deadlines, put
whatever design practices *you* want in place (after all,
it's !your! name that will be on the "product"; you won't
be some anonymous employee/developer) and you still see
the same /ad hoc/ practices at play.
Or, *you* WITNESSED a particular bug while testing your code.
Yet, you weren't able to (easily) reproduce it. So, you
DISMISS it (as a fluke) -- despite KNOWING that it happened
and you haven't done anything DELIBERATE to eliminate it.
Really? What's your defense? You'll address it when
some user encounters it? Or, you'll hope some other user
finds and fixes it?
<frown> No, I don't expect developers to "do the right thing"
any more than I expect managers to put in place the right practices.
There's always a rationalization...
Jaded.
Post by Ed ProchakPost by Don YPost by Ed ProchakPost by Don YAs such, understanding the technique is more important than finding a tool
that may )or may not) address your needs. ("I want to write in Eiffel.
Does your tool output Eiffel source?" Next week it may be some other
/langue du jour/)
Exactly why an abstracting tool that is more focused on the design is better than
a specific tool.
What better than a human brain?
I was focusing on documenting the design. I've tried to leave projects
with enough clear design so that I can be replaced.
My arguments have been towards "tools that do this code generation"
(pozz/roland's upthread comments). To do so, they have to have more
information encoded in the representation.
A classic state diagram is conceptually simple. You don't have special
symbols to reference timed transitions, history, nested machines, etc.
Yet, even a small number of states can quickly have too many transitions
to easily represent on a sheet of paper.
This is a small (hardware) FSM. Poor quality because it was *hand*
drawn (straight edge, lead holder and lettering guide) on a *D*-size
sheet of paper, reduced to B size and then scanned at 1200dpi (in an
attempt to preserve as much detail as possible)!
<https://mega.nz/file/A3x03aAA#YNsJhdikiucjU6aKGWKL2eTu4D0i95sqjcLuzIhz7ys>
8 state variables (Moore type so they also represent the outputs). About
35 states. And, it is highly regular (as evidenced by the symmetry in
the presentation. Imagine an embedded system (software) that has all
sorts of "exceptions" to take into consideration (transtion vectors
crisscrossing willy-nilly)
All this machine does is act as mediator between an internal FIFO
(controlled by another FSM) and a "swappable hardware interface".
It allows that interface to present dots (foreground/background),
lines (essentially "line feeds") and pages to a marking engine.
It prioritizes multiple concurrent requests and acknowledges each
(interlocking REQ-ACK handshake). The "work" it does is sorting out
how to accumulate dots to deliver to the FIFO as packed bytes,
pad out lines that have not specified enough dots to fill the
width of the line, etc. I.e., it is *trivial*. Yet, a visual mess.
Post by Ed ProchakPost by Don YThe tool just automates binding the design to a particular implementaion.
Ideally it should do both, act as a design recording medium and
output the implementation.
But, again, if what you're trying to codify (in the drawing) has
too many subtleties, how likely will you be to draw it correctly?
How often will you "test your knowledge" just by seeing if it
(the code) *appears* to do what you want?
[Have a look at all of the subtlety in Harel state charts. They
try to encode *everything* in the drawing -- which is what you'd
need to do if you were going to generate code FROM that drawing.
I contend that someone using them day in, day out, *could* likely
be very effective with them. But, someone just using them for
part of a project would perpetually be uncertain of the actions
they're taking wrt them. Like trying to create an arbitrary
regex after months of not using them]
Documents should *enhance* your understanding of a product
(or its behavior). They shouldn't become challenges in and of
themselves (because they try to be equivalences for the actual code!)
Each "node" in my current design operates in several "major states".
It can be:
- powered down (by the system)
- powering up (at the behest of the system, running POST, acquiring OS image)
- running diagnostics (taken out of service due to a fault)
- powered up but "cold" (ready to receive application code, known to be
in a reliable hardware state to deliver its potential functionality)
- powered up and actively providing services
- powered up but only serving compute resources (field is powered off)
- powering down (shedding load to other nodes at the behest of the system)
- faulted (failure detected so trying to recover)
etc.
It's really just a handful of different *major* states. Yet, the state
diagram is a mess, just indicating how a node can move from one of
these states to another (ignoring all of the "details" involved). And,
it ignores the many states *within* a major state (to manage complexity)
If you think about *applications*, in detail, you quickly discover that there
are lots of states that need to be visible -- IF YOU WANT TO MODEL THE ENTIRE
APPLICATION as a FSM).
Instead, use state diagrams to explain portions of the design in
more intuitive/visual ways -- without requiring them to be "complete
enough" to generate code (via some other tool). Let the developer look
elsewhere for more detail -- expressed in a medium that is better
suited to THAT task.
Post by Ed ProchakPost by Don YPost by Ed ProchakBTW, lots of your earlier comments match closely to what I would have posted.
This one just struck me are being a little too idealistic.
Have you looked at Harel charts? For *complex*/layered machines?
I suspect revisiting one that you managed to *coax* together at
the start of a project a year or two later (maintenance) would
leave you wondering what all of the cryptic notation means.
Haven't used Harel charts. That's part of UML and no place that
I worked at has needed a tool set that complex. KISS
Taking a quick look, [again!] I can see why it may not be a good choice.
But that shouldn't rule out using state diagrams *or* state
machines. Harel just seems to think "if a little is good, a lot
will be better!"
I've implemented (software) state machines in probably a few dozen
*different* ways -- each an "experiment" to see if some tweek of an
earlier approach can give me better "app coverage" (without jeopardizing
the project's design). My conclusion: there is no *best* way. So,
adopting *an* approach (dictated by a tool) seems like a straight-jacket.
The important thing is to have a visible structure to the design
that is reasonably easy to grasp -- without wading through pages
of case/switch statements with interspersed code fragments.
Post by Ed ProchakPost by Don YWould you admit ignorance and "play it safe" -- and expect to have
time to refamiliarize yourself with it BEFORE trying to make
changes? Or, would you proceed with a false set of confidence
and *hope* you don't break anything along the way?
If it is the design, then it better be clear enough to just read through
and be understandable and complete.
Does it really need to be complete for you to grok intent?
Do I really care how the code detects a power failure to
understand how it *reacts* to one? Use good abstractions
and the next guy won't *have* to understand ALL of it.
Post by Ed ProchakIf it is the implementation, then I never assume I am familiar with
the code (even it I wrote it).
Wise man! :> Also, a testament to writing what needs to
be written, instead of trying to be clever!
I had to modify some of my baking Rxs do to egg shortages.
Being reasonably good with arithmetic, I can scale recipes
in my head. So, just jot down the actual quantities that
I used (after scaling).
Now, going back to clean up the little scraps of paper that
I used (is this a universal truth? I always see folks with
Rxs on oddball slips of paper -- the back of cash register
receipts, envelopes, etc. I think the only folks who use
those nice printed index cards are folks who don't bake! :<),
I find some quantities that obviously aren't in the correct
scaled proportions evident in the *other* quantities.
As it's unlikely that I "figured wrong", there must have been
a reason for my instituting that change... yet I've neglected
to commit it to paper so I'm now at risk of having to make a
similar change, in the future, and not realizing it until after
the fact! :<