Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Single line vs multiple lines assignment
Message
From
08/02/2011 23:05:38
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01499222
Message ID:
01499311
Views:
57
>I think this is a perfect example of why readability is a false argument when deciding a coding practice, as I (and other posters in the same small thread) found the first option more readable than the second one and others (you included) find the other way around more readable, so which one is more readable is not an answerable question in my opinion, thus looking into other advantages each option has should be the deciding factor, never readability (of course using common sense, if someone finds more readable writing the whole program in only one line...)
>
>For example, what if you in the future need to change the value of some of the assignments? You will need to break the line and use one or more extra lines and in the extreme case (not for your Boolean example thou) you will end up with one line per assignment anyways (each assignment with a different value). Furthermore you are more likely to make more mistakes by splitting the line than by just changing the assignment of the properties you need to change if they were in their own line.
>
>Of course, sometimes STORE is the best answer for you can assign to a variable dynamically (ie. Store {value} to ({variable}), but then again, we are not discussing readability any longer.

Steve McConnell I believe said variable declarations should be separate lines. I'm sure he wasn't talking Fox. I'm with you. Each line is a separate line. There'd have to be thousands of vars to justify using a single line to speed things up, or a function called many many times.
Previous
Reply
Map
View

Click here to load this message in the networking platform