|
|
|
![]() |
|
|||||||
|
||||||||
| View Poll Results: Who uses white space? | |||
| Yes, i make it so people can read my code |
|
39 | 69.64% |
| Yes, i make it so i think that others can resd it |
|
7 | 12.50% |
| No, only I can read my code |
|
3 | 5.36% |
| I think that only i can read my code |
|
3 | 5.36% |
| I don't understand the question. |
|
4 | 7.14% |
| Voters: 56. You may not vote on this poll | |||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: "White space"
It adds too much weight to the robot. Each space = ~0.0001327 oz. Tabs are either 4 or 8 times that depending on your editor settings. Count up all the white space in your code sometime and calculate how much weight it adds.
![]() |
|
#2
|
||||
|
||||
|
Re: "White space"
for the same reason we usually don't use comments.
|
|
#3
|
||||
|
||||
|
Re: "White space"
I love whitespace! If the OP is trying to argue against it, he's in for a surprise if he ever gets a programming job. Even if you can read non-whitespaced code, nobody else can.
Some kids I've mentored in the past didn't use tabs at all, and it was painful to look at. It was impossible to tell, at a glance, when functions started, the scope of loops, etc. It was all either memorization or bracket-counting. |
|
#4
|
|||||
|
|||||
|
Re: "White space"
This year I found the majority of compilation errors that I helped my students fix were due to mismatched braces (usually with inconsistent indention). Whitespace is good, especially if you want quick help.
Helpful Windriver tip: Select your code and press Ctrl-I to auto indent your code |
|
#5
|
|||
|
|||
|
Re: "White space"
I sincerely hope you're joking. Extra code doesn't add any weight.
|
|
#6
|
|||||
|
|||||
|
Re: "White space"
Right. It's the other way around. The erased state of flash memory is a logic one, so adding code actually removes bits.
![]() |
|
#7
|
|||
|
|||
|
Re: "White space"
Bah, the weight savings of a few electrons in flash are nothing. We added a few vandegraph generators to the bot to remove some real electrons!
|
|
#8
|
||||
|
||||
|
Re: "White space"
Quote:
![]() |
|
#9
|
|||
|
|||
|
Re: "White space"
Ahhh, but the process of writing a "zero" is done by injecting electrons into the float gate. So a programmed device has the mass of these electrons (which is of course negligible).
|
|
#10
|
|||
|
|||
|
Re: "White space"
You are missing an option on that poll:
"I can't even read my own code" |
|
#11
|
|||
|
|||
|
Re: "White space"
Sorry I didn't specify, adding or removing code does not change the weight!!
Anyways, here's some sample code from my joystick for FTC, this is how I like things whitespaced Code:
while (true) { //whitespace after an important conditional or loop
getJoystickSettings(joystick); //single linebreak for basic commands and function calling
setMotors("default"); //double linebreak when another main conditional is about to appear
if (joystick.joy1_y1 > 40 || joystick.joy1_y1 < -40) { //single linebreak for a final conditional in nests
motor[motorD] = joystick.joy1_y1;
}
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Championship Event - Where the "Random" Match Sorting Really "Shines" | Travis Hoffman | Championship Event | 57 | 04-19-2007 08:06 AM |
| New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" | Jessica Boucher | Team Organization | 0 | 08-10-2005 10:55 AM |
| Team 1126 "Crazy Wheels" white paper | Alex Cormier | Technical Discussion | 1 | 10-25-2004 03:54 PM |
| "Thunderbirds" Vs. "Team America" Which one will rule the box office? | Elgin Clock | Chit-Chat | 3 | 09-07-2004 07:53 PM |
| Transcript: "The Space Shuttle Columbia Accident: What's Next?" | DanL | General Forum | 2 | 03-03-2003 09:35 PM |