VXCMD local and remote together
Robert Brenstein
rjb at rz.uni-potsdam.de
Thu Feb 19 11:03:07 CST 2004
> >> Okay.
>>>
>>> Function
>>>
>>> Cursor_GetRecordCount()
>>>
>>> Why you must differ it for LOCAL and REMOTE???
>>>
>>> Its logic is the same for all modes.
>>> And name must be the same.
>>>
>>> And this is true for 99% of method IMHO.
>>>
>>> Only BIG difference -- Database object creation.
>>>
>>
>> But, but, but... Ruslan... you talk at a different level now. Kernel
>> functionality is one thing, calling it from Transcript is another.
>
>No I have talk about VXCMD!
But your example is for a kernel function not vxcmd call.
> > Nobody said there should be a difference with syntax of kernel
>> functions. What we talk about is the transcript-level coding. Using
>> your example above:
>>
>> in local mode
>>
> > get Valentina("Cursor_GetRecordCount",cursorRef)
>>
>> in client-server mode
>>
>> get Valentina_Server("Cursor_GetRecordCount",cursorRef)
>
>Robert, and this is wrong.
>
>Doing it in THIS way, you already cannot write SINGLE algorithm
>In VXCMD which will work with ANY cursor LOCAL or REMOTE.
Of course I can. I don't see why having two function names stops me
from using the same algorithm. May be you mean using exactly same,
single code (not algorithm). Then yes. But even that is possible in
transcript
do "get" && valentina & "(" & quote & "Cursor_GetRecordCount" & quote
& comma & cursorRef & ")"
'valentina' here is a global variable containing one or the other
name. Of course, it is a silly way to code in real applications but
possible it is :)
>on print_records()
>
> get Valentina("Cursor_GetRecordCount",cursorRef)
>
> ....
>end
>
>
>If follow to your idea you will MUST to have second algorithm
>
>on print_records()
>
> get Valentina_Server("Cursor_GetRecordCount",cursorRef)
>
> ....
>end
Bad example, Ruslan. With vxcmd, if I want to print all records, I
would use SqlSelectRecords, which is a single call in each case, so a
simple if-else will do.
>
>Robert, this is totally wrong !!!!
>
>Valentina 2.0 must allow write SINGLE algorithm.
>And I can do this.
>
>And this is target of all program languages!
>
> DO NOT MAKE CODE DOUBLE.
>
>Robert, believe me, this is wrong idea.
>
>
>--
>Best regards,
>Ruslan Zasukhin [ I feel the need...the need for speed ]
Hmm, I do not believe in such absolute dogmas when it comes to
coding. And I have never heard that doubling code is totally wrong.
On the contrary. There are instances when doubling the code is
beneficial. For example, if I have an if-else condition in a loop
that runs thousands times, it is usually better to have two loops
with if-else around them. Also, loop unrolling is still a common
technique for numerically-intensive applications. In both cases, the
execution time is drastically reduced. And when I think about any
applications of mine that could use Vserver, I do not see exactly
same functionality for local and remote handling, so your argument of
having the same algorithm might not apply at all. For me
self-documenting coding is a high-priority rule. But may be I am an
odd-ball :)
But don't take this discussion as a request to force you to make two
vxcmd libraries. If a single one can easily achieve supporting both
local and client-server modes, it is fine. But if that proves to be
problematic, I think that having two different calls would work just
fine. At least for vxcmd.
Robert
More information about the Valentina
mailing list