Re: what does "serialization" mean?
From: Programmer Dude (Chris_at_Sonnack.com)
Date: 06/28/04
- Next message: Programmer Dude: "Re: what does "serialization" mean?"
- Previous message: Nikos Bogiatzoglou: "Re: Links for software engineering and UML introductions - guides needed"
- In reply to: Edward G. Nilges: "Re: what does "serialization" mean?"
- Next in thread: Corey Murtagh: "Re: what does "serialization" mean?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jun 2004 14:48:59 -0500
Edward G. Nilges writes:
>> Subject to change, at this point, VB.Net doesn't interest me (for
>> resource reasons).
>>
> You can get the framework and the compiler (minus the GUI) for
> absolute free from Microsoft.
[grin] The resource in question is time, not money. I have plenty of
money--I lack time.
>> What your student may have been expressing is that, if J*8 is KNOWN to
>> be constant, you are being--in effect--dishonest in your code. Code
>> expresses intent (as do most other forms of text writing) and as with
>> other forms of writing saying what you really mean to say is a writing
>> skill that must be acquired.
>
> This response, while very intelligent, is a misinterpretation of
> Kernighan's law: code what you mean.
Ed, you are already throwing down the glove here by naming one view of
things as a "misinterpretation" and another--always yours--as proper.
My general inclination at this point is to go back to calling you a
goddamn jackass, but let's see if early prevention is worthwhile...
No, it is not a MISinterpretation, it is an interpretation. More than
one can exist and more than one can be valid.
> That is because you assume that in
>
> For i = 1 to j*8
> bnoog
> Next i
>
> you have assumed that the reader will assume, in turn, that the scope
> of the For is from the F, so to speak to the end.
Yes, that is, in fact, exactly the assumption, and it is a highly
defensible assumption, regardless of...
> Whereas many intelligent programmers know that the For line includes
> one-time code, including the calculation and stacking of j*8.
Understood, however this depends on specific knowledge of how a given
language works. Worse, in VB's case, this knowledge can only come from
experimenting or reverse-engineering. And in the absense of a published
spec, can one count on the behavior remaining constant from, say, VB6
SP3 to VB6 SP4?
Simply put, the behavior is not guarenteed. Code that relied on it
would not be as robust as possible.
>Therefore I do not think it any clearer to code
>
> Dim k
> .
> .
> .
> k = j*8
> For i = 1 to k
>
> In fact I think it to be regressive and clumsy for it introduces
> an unneeded variable k,...
I can appreciate the feeling! One thing that helped get me over that
feeling was the understanding that the variable is created under the
hood anyway. VB needs SOMEPLACE to stash the j*8 result, and the
actual mechanics don't differ much from a declared variable.
I've also found the intermediate variables very helpful in debugging,
as you can inspect their values conveniently.
>> Saying "j*8" implies a reason saying it thus, and that reason hints
>> that j may change and thus the expression is worth evaluating each time.
>
> That would be part of its connotation but that is in the mind of the
> reader.
True, but isn't it a particularly valid assumption to make?
> To reason that the mere appearance of a variable in an
> expression hints, implies, connotes "may change" means that
> expressions shouldn't contain constants either and this is nonsense.
Because you've misstated it. It isn't the appearance of a variable
in an expression. It is the appearance of an *expression* in a loop
condition.
If you consider all loop forms of all languages, I'm quite sure the
bulk of them (by far) evaluate their loop conditional each time
through the loop. Thus, treating that as "Default Behavior" is not
at all unreasonable and not putting unnecessary expressions in such
a place is, I think, a good heuristic.
It's not unlike always signaling your car turns regardless of whether
there is anyone in view to signal. Good practice that might save you
in a stressful situation.
>>> Another issue for me is the definition in C# and C++ of iterators as
>>> objects. Have you seen this practice and does it make any sense to
>>> you?
>>
>> Absolutely. Love'm! [...snip...]
>
> I see no problem with this practice and shall adopt it ASAP. [...]
>
> However, one problem is that the concept of "iterator" doesn't
> parallel any concepts from formal logic outside programming and that
> is a danger sign.
Whyso?
> Perhaps what one SHOULD do in place of defining, for all or most new
> objects, an iterator, is defining a set-of that would expose
> iteration.
Having done both... I prefer the encapsulation of iterators. They also
have the advantage that each maintains their own state, you can have
multiple iterations existing simultaneously. You can't do that with an
exposed "iteration" API.
> The problem is that the cleanest way to implement this would be
> through multiple inheritance which VB.Net doesn't support.
>
> Define the concrete class BunnyRabbit. Have available the abstract
> class set. A set-of Bunny Rabbits would have to be-a set and inherit
> collectively all the capabilities of Bunny Rabbits. It would have to
> Inherit Set and BunnyRabbit.
No,.... doesn't sound right to me.
> Seriously, a danger with iteration is that it captures only part of
> the more meaningful concept that "my object may exist, meaningfully,
> in a collective or set of objects"....
You went off into outer space or left field here. I lack the time to
follow... scattered points...
> for ( intIndex1 = 0:
> intIndex1 < numberOfBeings:
> intIndex1++ )
> if ( Man(x) ) assert( Mortal(x) );
>
> This loop "breaks" if run in real time, for if during its execution a
> child is born, numberOfBeings would change. This would be handled in
> the above C example but not in a Visual Basic For loop, which would
> take the numberOfBeings applicable on entry to the For.
(Which, incidentally, is why I consider the VB For/Next less favorably
than I do loop forms that reevaluate the condition.)
> But the loop still assumes that the numbering scheme for the Ten
> Thousand Things does not change, therefore for each is cleaner:
>
> For Each being b
> If Man(b) Then Assert b & " is mortal"
> End
I don't see how. Under the hood, much the same thing is happening, and
the same issues and problems apply.
-- Somewhere in the Midwest... Chris Sonnack <Chris@Sonnack.com> in Training... http://www.Sonnack.com/
- Next message: Programmer Dude: "Re: what does "serialization" mean?"
- Previous message: Nikos Bogiatzoglou: "Re: Links for software engineering and UML introductions - guides needed"
- In reply to: Edward G. Nilges: "Re: what does "serialization" mean?"
- Next in thread: Corey Murtagh: "Re: what does "serialization" mean?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|