Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple statements on a line

223 views
Skip to first unread message

Marc

unread,
Jul 21, 2001, 8:37:20 PM7/21/01
to
I sure hope VFP can support multiple statements on a line.
Your input is appreciated.
Marc
11 months into VFP development of Accounting/Business
System.

Christian Desbourse

unread,
Jul 22, 2001, 12:15:24 PM7/22/01
to
In article <61c101c11246$77527d70$a5e62ecf@tkmsftngxa07>, Marc wrote:
> I sure hope VFP can support multiple statements on a line.
> Your input is appreciated.
>

Fortunately not

Why on earth would you want multiple statements on a line ?
What about code clarity ?

Christian Desbourse (Belgium)

Marc

unread,
Jul 22, 2001, 2:07:12 PM7/22/01
to
Hi Christian,
Exactly, code clarity. Grouping several short related
commands on a line which are related to performing a
simple task looks more structured to (me). It would
reduce vertical clutter, especially in constructs and
loops.

The short-hand iif() statement is an example of multiple
statements on a line.

Marc Desjardins
Vancouver/MR, BC
Canada

>.
>

Fred Taylor

unread,
Jul 22, 2001, 2:54:13 PM7/22/01
to
Sorry, you can't do it. And IMHO, it's not a better way to present things.
That sure sounds like a throw back to QBASIC, and certainly does nothing for
clarity.

--
Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.


"Marc" <itprog...@hotmail.com> wrote in message
news:605901c112d9$21af3be0$a4e62ecf@tkmsftngxa06...

Nancy Folsom

unread,
Jul 22, 2001, 2:56:35 PM7/22/01
to
In article <605901c112d9$21af3be0$a4e62ecf@tkmsftngxa06>,
itprog...@hotmail.com says...

> Hi Christian,
> Exactly, code clarity. Grouping several short related
> commands on a line which are related to performing a
> simple task looks more structured to (me).

> It would
> reduce vertical clutter, especially in constructs and
> loops.

Vertical clutter? Hm. Even though I personally _like_ really tight
constructs and IIF(), there is actually support for the assertion that
this the _wrong_ way to go, and so I have to disagree (not that I'm
likely to give up all my IIF()).

1. What you call vertical clutter is one of the least important reasons
to chose a style because once the routine is written, it should never
be revisited except for maintenance or if a new person on the project
needs to be familiar with the code, in which case what you call clutter
would be self-documenting code, which is a Good Thing (tm).

2. There are studies that support the assertion that single command
lines of code are less prone to have bugs. Another Good Thing (tm).

There is no optimization since the compiler will do that regardless of
any editor style.

There is _a_ case where something is vertically cluttered (I'm quite
enamored of that expression <g>), but the solution isn't to mash the
commands together. That case is when you have a block of commands that
compose a routine that you use in more than one place in you code. In
this case, you would write a function and call that. Vertical clutter
is gone, the code is nicely encapsulated for changes, and self-
describing.

The only time it's nice to be able to mash commands together is when
you have to deal with code blocks, but VFP has other ways of
implementing that concept.

--
Nancy
So that all can benefit from the discussion,
please post all followups to the newsgroup.

Marc

unread,
Jul 22, 2001, 4:02:57 PM7/22/01
to
Hi Fred,
Do you work for the Microsoft VFP development team?
I have worked in commercial software development in
several languages (mostly C/C++) for the last thirteen
years and have had no opportunity to work with BASIC.
Just want to condense some of the high level commands.
Maybey better to call udf's or should I leave it the way
it is and get the job done :)

sele icmaster
dele
skip -1

sele icmaster; dele; skip -1

>.
>

Nancy Folsom

unread,
Jul 22, 2001, 4:15:09 PM7/22/01
to
Mark-

In article <607f01c112e9$4d6020f0$a4e62ecf@tkmsftngxa06>,
itprog...@hotmail.com says...

> Hi Fred,
> Do you work for the Microsoft VFP development team?

Huh? No, Fred's not an MS employee.

> I have worked in commercial software development in
> several languages (mostly C/C++) for the last thirteen
> years and have had no opportunity to work with BASIC.
> Just want to condense some of the high level commands.
> Maybey better to call udf's or should I leave it the way
> it is and get the job done :)

I think leave it the way it is.


>
> sele icmaster
> dele
> skip -1

>
> sele icmaster; dele; skip -1

Less readable. Less extendible. No more optimized. Doesn't even look
pretty. <g> Indeed, if you were a programmer in my shop, I'd insist
you write the commands out in full. Unless you're writing one-off
programs.

C++ isn't VB or VFP or Delphi. There's a whole different mindset that
I'm guessing you might be having a little trouble leaving behind.

Marc

unread,
Jul 22, 2001, 4:59:42 PM7/22/01
to
I will take your advise and leave it alone. I don't know
why I go off on a tangent at times. It's Sunday, and I
have another week VFP development ahead of me. I'm going
to do something out-doors for the rest of the day.
Thank's to everyone for their input.
Marc

>.
>

Nancy Folsom

unread,
Jul 22, 2001, 6:00:04 PM7/22/01
to
In article <63a701c112f1$3aa1dff0$a5e62ecf@tkmsftngxa07>,
itprog...@hotmail.com says...

> I will take your advise and leave it alone. I don't know
> why I go off on a tangent at times.

Hey, what's life without tangents?

> I'm going
> to do something out-doors for the rest of the day.
> Thank's to everyone for their input.

:) Sounds like good advice that I should take, too. If only I can
finish this *(%*#@)@ article. <g>

Stephen & Shelagh Ibbs

unread,
Jul 22, 2001, 5:10:13 PM7/22/01
to
PMFJI but I must say I agree with Nancy and Fred. I have programmed for
years in Delphi - lovely language but that damned semi-colon !

Give me one command per line any day. For that reason I am not keen on IIF,
particularly nested IIFs, even though I use them because they are so handy !

Cheers

Stephen

Anthony Shipley

unread,
Jul 22, 2001, 10:12:12 PM7/22/01
to
Nancy Folsom <nancy_...@hotmail.com> wrote:

>:) Sounds like good advice that I should take, too. If only I can
>finish this *(%*#@)@ article. <g>

Nancy, please keep your expletives to one per line :-)
anthony shipley

<math> 2 + 2 = 5 for sufficiently large values of 2</math>

Nancy Folsom

unread,
Jul 22, 2001, 10:41:55 PM7/22/01
to
In article <8v1nlto984l5h2ku7...@4ax.com>,
ast...@iinet.net.au says...

> Nancy Folsom <nancy_...@hotmail.com> wrote:
>
> >:) Sounds like good advice that I should take, too. If only I can
> >finish this *(%*#@)@ article. <g>
>
> Nancy, please keep your expletives to one per line :-)
> anthony shipley

Oh. It was unclear? Sorry about that. ;-)))

Toylet

unread,
Jul 22, 2001, 11:01:39 PM7/22/01
to
Too bad you were not in the team that developed the MIS in my
current job. The codes suck big timee.
ajoke.txt

Nancy Folsom

unread,
Jul 22, 2001, 11:24:26 PM7/22/01
to
In article <3B5B9393...@hongkong.com>, Toy...@hongkong.com says...

> Too bad you were not in the team that developed the MIS in my
> current job. The codes suck big timee.

I'd rather shoot myself. :-(

You have my sympathy. BTW, interesting factoid, variable names between
9-15 characters lead to higher comprehension. Cite _Code_Complete_.
Procedures probably should be about 15 to 25 characters long to
facilitate comprehension.

Toylet

unread,
Jul 23, 2001, 1:50:38 AM7/23/01
to
This is the system used by a Hongkong company that just went
public in Singapore. It's working, just pray that nothing goes
wrong.


> I'd rather shoot myself. :-(


9-15?? hahaha...(see attachment 2)
That may explain why all the original developers had left the
company.

joke2.txt

Marc

unread,
Jul 23, 2001, 2:02:57 AM7/23/01
to

There goes my self-esteem :)
So instead of allt(), eval() etc. You would write alltrim
(), evaluate() etc. in all your code? Your probably
right. I'll give Microsoft VFP team a call tommorow and
tell them to change all their abbreviated code as per your
advise. :) Just kidding!
Marc

Toylet

unread,
Jul 23, 2001, 2:34:09 AM7/23/01
to
exceptions: SQL statements.

Fred Taylor

unread,
Jul 23, 2001, 3:06:18 AM7/23/01
to
No, I do not work for the VFP development team, but I do have about 17 years
experience with C/C++, 22+ years overall in software. Even though you can
do multiple commands on a single line there, I still don't recommend it.
Just because you *can* do something doesn't mean you *should*. I still find
it hard to decipher code (mine or anyone elses) that's bunched together
instead of using lots of white-space (vertical or otherwise). And the
resultant machine code is no smaller even if you do cram it all together on
one line, so what are you saving besides disk space for the source code?

--
Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.


"Marc" <itprog...@hotmail.com> wrote in message

news:607f01c112e9$4d6020f0$a4e62ecf@tkmsftngxa06...

Fred Taylor

unread,
Jul 23, 2001, 3:18:24 AM7/23/01
to
As a matter of fact, the ONLY command I abbreviate in code is EVAL(). The
only time I abreviate anything is from the command window (MODI COMM, MODI
STRU, etc.). I personally can't stand even looking at code that uses the
abreviated versions. You may like it the other way, but think about the
poor slob that's got to look at and maintain that code months/years down the
line. Clear as mud.

VFP doesn't need to save the space in the source code the way that dBaseIII
and QBASIC needed to, back when each and every byte of space was important.
It's just not worth the savings for the lack of clarity. In fact, in the
compiled p-code, there will be 0 savings, both versions will evaluate to
exactly the same p-code, so why not make the human readable source code as
clear as possible. Do you also leave out comments? ;) (something I've been
accused of in the past)

--
Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.


"Marc" <itprog...@hotmail.com> wrote in message

news:837501c1133d$1eb425e0$19ef2ecf@tkmsftngxa01...

Anthony Shipley

unread,
Jul 23, 2001, 3:30:07 AM7/23/01
to
"Fred Taylor" <fta...@mvps.org> wrote:

>No, I do not work for the VFP development team, but I do have about 17 years
>experience with C/C++, 22+ years overall in software. Even though you can
>do multiple commands on a single line there, I still don't recommend it.
>Just because you *can* do something doesn't mean you *should*. I still find
>it hard to decipher code (mine or anyone elses) that's bunched together
>instead of using lots of white-space (vertical or otherwise). And the
>resultant machine code is no smaller even if you do cram it all together on
>one line, so what are you saving besides disk space for the source code?

One reason for not concatenating several commands onto one line is that it makes
it harder to scan the code when looking for a specific command/word/comment.

Instead of scanning along the left edge of the code, you now have to scan along
each line paying much closer attention.

Nancy Folsom

unread,
Jul 23, 2001, 3:25:19 PM7/23/01
to
In article <837501c1133d$1eb425e0$19ef2ecf@tkmsftngxa01>,
itprog...@hotmail.com says...

>
> There goes my self-esteem :)
> So instead of allt(), eval() etc. You would write alltrim
> (), evaluate() etc. in all your code? Your probably
> right. I'll give Microsoft VFP team a call tommorow and
> tell them to change all their abbreviated code as per your
> advise. :) Just kidding!

<shrug> The shortened names are a holdoever from xBASE days, and
constrained by the length that was allowed then. Not everybody coding
today was around then. I use indoor plumbing, too, instead of an
outhouse. <gd&r>

Seriously, with VFP you can type abbreviations and intellisense fills
in the full name.

Nancy Folsom

unread,
Jul 23, 2001, 3:27:09 PM7/23/01
to
In article <4dQ67.6918$Px1.8...@newsread2.prod.itd.earthlink.net>,
fta...@mvps.org says...

> As a matter of fact, the ONLY command I abbreviate in code is EVAL(). The

Funny. That's the only one I abbreviate, too. I think it's from a
Clipper command that was just EVAL, but I might be remembering
incorrectly.

I usually start out abbreviating MODI COMM, etc in the command window.
1/2 the time tho' it takes longer to remember I can abbr than it takes
to just type it. <g>

Nancy Folsom

unread,
Jul 23, 2001, 3:28:20 PM7/23/01
to
Anthony-

> One reason for not concatenating several commands onto one line is that it makes
> it harder to scan the code when looking for a specific command/word/comment.
>
> Instead of scanning along the left edge of the code, you now have to scan along
> each line paying much closer attention.

Exactly. "If my code was hard to write, it should be hard to read."
<vbg>

Nancy Folsom

unread,
Jul 23, 2001, 3:29:00 PM7/23/01
to
In article <3B5BBB2E...@hongkong.com>, Toy...@hongkong.com says...

> 9-15?? hahaha...(see attachment 2)

> That may explain why all the original developers had left the
> company.

Worked with a guy once who always proclaimed that long variable names
were for people with weak minds. <g>

Marc /k

unread,
Jul 23, 2001, 7:01:59 PM7/23/01
to
Yes, I slipped with my wording. I was trying to say
vertical space or just vertical. Hope I didn't offend
anyone. :)

>.
>

Marc /k

unread,
Jul 23, 2001, 7:29:30 PM7/23/01
to
Yes, I agree with readability. I'm definately not craming
the code. I was only thinking of consolidating a couple
of command lines here and there. Nothing to get too
excited about. :)

>.
>

Fred Taylor

unread,
Jul 23, 2001, 8:18:58 PM7/23/01
to
Hey don't get me wrong, I think it could be a useful feature. Problem is,
some yahoo would think it was a *GREAT IDEA* to write all of their code that
way (and I'd invariably be the lucky one to deal with it later). It would
have it's places, like in the report writer, IIF() is pretty invaluable
there, but it would still probably get abused.

--
Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.


"Marc /k" <itprog...@hotmail.com> wrote in message
news:6b9c01c113cf$528217a0$9ee62ecf@tkmsftngxa05...

Nancy Folsom

unread,
Jul 23, 2001, 9:16:41 PM7/23/01
to
In article <6a2501c113cb$7a4fe630$a5e62ecf@tkmsftngxa07>,
itprog...@hotmail.com says...

> Yes, I slipped with my wording. I was trying to say
> vertical space or just vertical. Hope I didn't offend
> anyone. :)

Heh. No I was serious. I really do like the term "vertical clutter." :)

Nancy Folsom

unread,
Jul 23, 2001, 9:17:22 PM7/23/01
to
In article <6b9c01c113cf$528217a0$9ee62ecf@tkmsftngxa05>,
itprog...@hotmail.com says...

> Yes, I agree with readability. I'm definately not craming
> the code. I was only thinking of consolidating a couple
> of command lines here and there. Nothing to get too
> excited about. :)

Nah. We're just all an opinionated lot. Except for me, of course. ;-)

Toylet

unread,
Jul 24, 2001, 12:07:05 AM7/24/01
to
engineers... mathematicians...definitely not lawyers or Mosses
who are trained to keep promises for centuries.

How could you trace a variable named "CT" in a program during
maintenance.

Marc (k)

unread,
Jul 24, 2001, 2:59:55 AM7/24/01
to
It's really my fault. I didn't really explain my
situation very well :) I'm working on a large scale
project. Readability is vital or I will be visiting a
psychiatrist in the very near future. I don't want to
have to spend time deciphering my own code when I go back
to improve on something I worked on a month ago or even a
few weeks ago.

The two columns in the code fragment below is supposed to
be aligned. Not sure how this messagebox is going to
treat it. Lengthy lines of code are divided up onto
several lines as below. I do this for all lengthy
statements. It's not a big secret ;)

create cursor curArReport (;
cinvno c(10),;
ccustno c(10),;
ccompany c(40),;
dinvoice d,;
ddue d,;
nbalance n(14,4))

if ((condition 1................) or;
(condition 2................) and;
(condition 3................))
&& statements
endif

It shouldn't take any time at all for a programmer to
interpret common abbrev. function calls like allt(), eval
(), tran(), messageb(), etc.

I do abbrev. variables, however they are explicit.
local lcInvno, lcCustno, lnBalance, etc.

I would not work for anyone who wants me to write
lcInvoiceNumber or lcInvoice_number. You could offer me
$1000K and I won't do it :)

Marc (k)
Thanks to everyone for their insight.
Got to go and get some sleep so I can work efficiently
tommorow. See you all again. Take care.

>.
>

Fred Taylor

unread,
Jul 24, 2001, 3:30:32 AM7/24/01
to
I do abbreviate most variables (and CamelCase them, too). I don't
abbreviate VFP commands (and they're UPPERCASE, except for Methods/Events
they're CamelCase and my own .PRG type functions would be lowercase). But
for $1000K, I'll code any way they want to see it! <bg>

--
Fred
Microsoft Visual FoxPro MVP
Please respond only to the newsgroups so that all may benefit.


"Marc (k)" <itprog...@hotmail.com> wrote in message
news:930701c1140e$3ea409c0$9ae62ecf@tkmsftngxa02...

Andrew Howell

unread,
Jul 24, 2001, 8:16:29 AM7/24/01
to
Toylet wrote in message <3B5BBB2E...@hongkong.com>...

>This is the system used by a Hongkong company that just went
>public in Singapore. It's working, just pray that nothing goes
>wrong.
>


Mmmm. We had an outsourced component that was rather like that, "Beautify"
actually made it pretty readable in an instant but I was still stuck with
silly var. names.

Makes you wonder why they didn't abbreiviate REPLICATE to REPL...

--
Andrew Howell


Andrew Howell

unread,
Jul 24, 2001, 8:23:36 AM7/24/01
to
Anthony Shipley wrote in message ...

>"Fred Taylor" <fta...@mvps.org> wrote:
>
>One reason for not concatenating several commands onto one line is that it
makes
>it harder to scan the code when looking for a specific
command/word/comment.
>
>Instead of scanning along the left edge of the code, you now have to scan
along
>each line paying much closer attention.


I'm not advocating the use of multiple-statement lines but I've always used
the search feature to do that.

--
Andrew Howell


Nancy Folsom

unread,
Jul 24, 2001, 1:06:44 PM7/24/01
to
In article <930701c1140e$3ea409c0$9ae62ecf@tkmsftngxa02>, "Marc \(k\)"
<itprog...@hotmail.com> says...

> I would not work for anyone who wants me to write
> lcInvoiceNumber or lcInvoice_number. You could offer me
> $1000K and I won't do it :)

Wow, and most programmers won't even stand up to an employer who asks
them to do unethical things. ;-)

Underscores suck, for sure.

Here's my reasoning for spelling it out.

If you use lcInvoiceNumber (or I have a convention to use No for
Number, there's always exceptions to every rule), and not InvNo, then
you don't have to remember "now, was it InvNo? Or was it InvoiceNo? Or
maybe it was InvNum?"

IOW, abbr. make it harder to remember what your convention is. Or, I
should say, it makes it harder for maintainability, which is, The Great
Turtle willing, the larger part of the project than development, yes?

But, then again, I just type so damned fast and well that Invoice
presents no hardship over Inv. <gd&r>

Tim Witort

unread,
Jul 24, 2001, 6:19:54 PM7/24/01
to
Nancy Folsom seemed to utter in
news:MPG.15c74aff2...@msnews.microsoft.com:

> In article <930701c1140e$3ea409c0$9ae62ecf@tkmsftngxa02>, "Marc \(k\)"
> <itprog...@hotmail.com> says...
>
>> I would not work for anyone who wants me to write
>> lcInvoiceNumber or lcInvoice_number. You could offer me
>> $1000K and I won't do it :)
>
> Wow, and most programmers won't even stand up to an employer who asks
> them to do unethical things. ;-)
>
> Underscores suck, for sure.

Well, there are times when you need those too. Because
some things do not retain case (like field names). Then
using underscores to separate words is about all you have
unless you want the words to run together.



> Here's my reasoning for spelling it out.
>
> If you use lcInvoiceNumber (or I have a convention to use No for
> Number, there's always exceptions to every rule), and not InvNo, then
> you don't have to remember "now, was it InvNo? Or was it InvoiceNo? Or
> maybe it was InvNum?"
>
> IOW, abbr. make it harder to remember what your convention is. Or, I
> should say, it makes it harder for maintainability, which is, The Great
> Turtle willing, the larger part of the project than development, yes?
>
> But, then again, I just type so damned fast and well that Invoice
> presents no hardship over Inv. <gd&r>
>

Same here. I think I am the most verbose programmer that
I know - tons of comments and descriptive method, field,
variable names, etc. I think the code is *much* easier
to read this way.

-- TRW
_______________________________________
My e-mail: t r w 7
@ i x . n e t c o m . c o m
_______________________________________

Marc /k

unread,
Jul 25, 2001, 2:23:10 AM7/25/01
to
Continuation.... This is Fun!!

Underscores and upper case are great for constants.
#define K_ESC 27

#define XOKAY_BX 0 + 48 + 0
#define XYESNO_BX 4 + 48 + 256

local lcInvno, lcCustno, lnBalance, etc.

It was late at night when I wrote the above :)
Should be lcInvNo, lcCustNo, lnBalance

What could lcInvNo possibly mean in the accounts
receivable module? :)

Look at your reports where the number is displayed.
Do they say Invoice Num, Invoice Number or
Invoice No.

Same with the customer number -
Customer Num, Customer Number or
Customer No.

Think about it carefully before you say anything. :)

Yes, from a business point of view, text book coding
conventions is great! Make the code so readable that you
virtually need no commenting! Then replace the
experienced $40.00/hr programmer with a cost efficient
solution. Nothing personal - it's just business. :)

There is no prestige in being a programmer these days.
Everyone is a programmer. Guess who is perpetuating it?
Stoping here. Starting to fly off the handle again.

Marc /k
Thanks again.
I will never do time sheets! Well mabey for $1000K :)
--------------

Nancy Folsom

unread,
Jul 25, 2001, 12:32:07 PM7/25/01
to
> There is no prestige in being a programmer these days.
> Everyone is a programmer. Guess who is perpetuating it?
> Stoping here. Starting to fly off the handle again.

Whew. Marc. I hope you got a good night's sleep last night. <bg>

Marc /k

unread,
Jul 26, 2001, 3:14:35 AM7/26/01
to
Sorry everyone,
I was brain drained when I wrote that message. Too much
coffee and little sleep are having a negative influence on
me. It's addictive as well as an emotional roller
coaster. I'm usually a happy, positive, open minded and
easygoing person. Today, I realized I made a mistake with
that message. I'm going to increase my resting time to 6
hours a day beginning yesterday. I need to remind myself
once in a while that I'm 38 and not still in my swinging
twenties. :)

Thank you for your concern.
Marc /k

>.
>

Nancy Folsom

unread,
Jul 26, 2001, 12:13:29 PM7/26/01
to
In article <769901c115a2$a012b3b0$a4e62ecf@tkmsftngxa06>,
itprog...@hotmail.com says...

> Sorry everyone,
> I was brain drained when I wrote that message. Too much
> coffee and little sleep are having a negative influence on
> me. It's addictive as well as an emotional roller
> coaster. I'm usually a happy, positive, open minded and
> easygoing person. Today, I realized I made a mistake with
> that message. I'm going to increase my resting time to 6
> hours a day beginning yesterday. I need to remind myself
> once in a while that I'm 38 and not still in my swinging
> twenties. :)

Sleep is good.

> Thank you for your concern.

You're welcome. :)

0 new messages