Re: On what column do you wrap your code?
by Old_Gray_Bear (Bishop) on Feb 08, 2006 at 17:41 UTC
|
There is an option missing:
- 71 -- For historical continuity
----
I Go Back to Sleep, Now.
OGB
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by swampyankee (Parson) on Feb 08, 2006 at 17:56 UTC
|
Ideally, 72, because I'm old enough to remember punched cards and, much worse, old enough to need to use large fonts.
emc
" When in doubt, use brute force." — Ken Thompson
| [reply] [Watch: Dir/Any] |
|
Punched card, you lucky fellow. I had to start on coding sheets, hand in to ops to punch to card.
Then I found the terminal room and learnt how to send jobs direct, not long after found interactive compiler and that really sped things up. This is Fortran 77 on Honeywell Mainframe, GCOS 4 operating system.
| [reply] [Watch: Dir/Any] |
|
Coding sheets! A luxury! In my day we had to lay out stones in a river bed. Made coding during the rainy season mighty interesting.
| [reply] [Watch: Dir/Any] |
|
|
How about Fortran IV on ICL 1900 under George III with 6-bit bytes so no lower case letters. Also, the editor was single pass so you planned your edits very carefully! I did have a teletype though linked to the mainframe with a 100 baud acoustic coupler. Anyone remember those?
| [reply] [Watch: Dir/Any] |
|
Re: On what column do you wrap your code?
by DrWhy (Chaplain) on Feb 08, 2006 at 17:15 UTC
|
I have a wide screen, so I wrap my functional code at column 80 and place any temporary/debugging code starting at column 82 and do not wrap it. This is made nicer by the fact that the editor I use, UltraEdit, can place a vertical line at any column. I have it set to column 80.
--DrWhy
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."
| [reply] [Watch: Dir/Any] |
|
OT: I love UltraEdit when I'm forced to use Windows. On my native Mac OS, I use BBEdit.
| [reply] [Watch: Dir/Any] |
|
I use UltraEdit also and I have a vertical column set at column 78. I don't always wrap there, but in general I attempt to not go too far past it.
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
View menu->Set Column Markers (set marker 1 to 80), View menu->Show Column Marker 1
--DrWhy
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by grinder (Bishop) on Feb 08, 2006 at 18:12 UTC
|
Interesting question. I pulled up some code and run it through (don't shoot me)
awk '{print length($0)}' * | sort | uniq -c | sort -nk2
... which produced the following output:
504 1
112 2
12 3
(504 blank lines, 112 lines with a single char (probable a closing brace) and so on). I turned that into a scatter plot and I see that I have a fair spread of line lengths all the way out to about 75. From there the number of lines with longer lengths drops off a cliff, but that there is a clearly visible tail of line lengths all the way out to 120 or so.
Which does tend to correspond to the way I code. I like breaking things up, such as named parameters on separate lines, but as I'm either in an xterm or a Putty session, I just make the window as big as it needs to be, and if a certain line of code just looks nicer at 120 characters then I'll let it be.
• another intruder with the mooring in the heart of the Perl
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: On what column do you wrap your code?
by merlyn (Sage) on Feb 08, 2006 at 19:11 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by mirod (Canon) on Feb 08, 2006 at 17:14 UTC
|
Usually around 120, but I just checked, and the biggest gvim window I can get can take 315 chars with the font I use. So I feel I am showing a lot of restraint!
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by ambrus (Abbot) on Feb 08, 2006 at 19:26 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Anonymous Monk on Feb 08, 2006 at 22:50 UTC
|
Over 80 is too far. I wrap whenever it looks like it's too near the edge... | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by beachbum (Beadle) on Feb 08, 2006 at 18:15 UTC
|
I get lost in wrapped code... never use it. I occasionally end up having nested loop lines at 8-10 tab indentions. | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Perl Mouse (Chaplain) on Feb 09, 2006 at 22:47 UTC
|
Wrap code? Why would I? Do I look like a Python programmer to you? I don't need newlines, all they do is eat disk space and make hard disk sellers happy. Death to the newline!
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by herby1620 (Monk) on Feb 10, 2006 at 01:20 UTC
|
Of course, one always wraps on (or before) column 72. If you were really doing it right, the continuation character (other than zero, or blank) would be in column 6 (but I digress). You need to be careful, usually the drum card in the keypunch is set to skip automagically at column 72 anyway, so you need to think about it before that happens. | [reply] [Watch: Dir/Any] |
|
Ah, another soul remembering the days before ed, let alone emacs or vim...
Then, of course, giving the long deck to the operator so he (never "she") could put it into the card reader. Or, depending on how quickly you needed the program's output, dropping the cards on the floor.
There was a reason for those sequence numbers in 73 through 80...
emc
" When in doubt, use brute force." — Ken Thompson
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by jonadab (Parson) on Feb 09, 2006 at 04:23 UTC
|
It depends on the code. HTML for instance tends to get wrapped around
column 80, except where that would break up an entity in an undesirable
way. I tend to wrap elisp around column 120 or so. Perl code gets
wrapped based on semantics, not column numbers. email is not, strictly
speaking, code, but I tend to wrap it around column 70, because although
*my* mailreader can correctly rewrap quoted text, some people with whom
I correspond use lesser mailreaders.
All of this changes in a web forum, where I use the width of the
textarea as a guideline. | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by wolfger (Deacon) on Feb 09, 2006 at 14:50 UTC
|
| [reply] [Watch: Dir/Any] [d/l] |
Missed option
by mtve (Deacon) on Feb 10, 2006 at 08:16 UTC
|
Golf -- wrap at space char or don't wrap at all. | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Albannach (Monsignor) on Feb 09, 2006 at 03:08 UTC
|
I've used 132 columns for years, probably because that's what the VT220 provided.
--
I'd like to be able to assign to an luser
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by tweetiepooh (Hermit) on Feb 09, 2006 at 10:01 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by turo (Friar) on Feb 09, 2006 at 16:29 UTC
|
i've used a long time ago vt100 terminals ... this old heritage, helps me to have a lot of xterms of 80x25 in my screen :-) ... and to be very happy when i use the vterm
perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'
| [reply] [Watch: Dir/Any] [d/l] |
Re: On what column do you wrap your code?
by samizdat (Vicar) on Feb 10, 2006 at 16:54 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by tbone1 (Monsignor) on Feb 09, 2006 at 12:46 UTC
|
What, no option for 2048? vi rawks, DO0D!!1!
*ahem* Excuse me.
--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by pileofrogs (Priest) on Feb 09, 2006 at 19:06 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by poqui (Deacon) on Feb 09, 2006 at 22:31 UTC
|
180, 132 (greenbar), 80, no wrap... I use them all! | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by radiantmatrix (Parson) on Feb 10, 2006 at 21:01 UTC
|
I tend toward 80. Why? Hm, well...
- 72 is much too short when using a 4-char indent level: two levels in and I end up wrapping simple open ... or die "Can't write $filename: $!" calls.
- 78 would be ok, but WHY?
- Anything over 80 seems impolitic; I can always expect that someone can view and edit an 80-column line, but much longer and I fear making a production for someone else to deal with my code.
So, I voted 80, but I'm not strict about it. If I'm maintaining code I try to derive and follow the existing wrapping rules (and other style elements). Some lines just feel like they need to be longer than 80 chars, and I'm willing to let those "break" the wrapping rules.
| [reply] [Watch: Dir/Any] [d/l] |
|
78 would be ok, but WHY?
The usual argument says stuff about terminals not being able to handle characters in the last column correctly (then why the hell HAVE that column?), and 80-2 allowing the text to still be 80 wide after adding "> ", the quotation mark used in email.
However, I wouldn't even use such a terminal, and the quoting argument doesn't hold given replies to replies, when another "> " is added. And I indent all code (a habit I got from POD, and I like it) in mail anyway.
So I think 78 makes no sense at all, and this is one of the guidelines in Perl Best Practices that I choose to ignore. It's 80 for me.
| [reply] [Watch: Dir/Any] |
|
My guess is 78 came about because 'diff' requires two columns for the '< ' and '> '. That seems sensible.
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by lorn (Monk) on Feb 09, 2006 at 12:34 UTC
|
i following tips on "Best Practices" dog book :P
Lorn
-lornlab.no-ip.com-
-www.slackwarezine.com.br-
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by gregor42 (Parson) on Feb 10, 2006 at 15:49 UTC
|
Eclipse has a general preference that lets you show the Print Margin as a vertical line. This defaults to 80, but is configurable. Since it's a setting for all Editors it is reflected in EPIC.
So, barring any VT-xxx sessions, (which are fewer & farther in between as time goes on) I only think about it in terms of printing.
Wait! This isn't a Parachute, this is a Backpack!
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Knom (Beadle) on Feb 11, 2006 at 05:40 UTC
|
... but seriously, personally I like the challenge of WRITING code in less than 80 cols. | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
but seriously, personally I like the challenge of WRITING code in less than 80 cols.
Hm, apparently you don't have to work with the naming standards imposed by our Oracle group. When one regularly sees stuff like GENERIC_PRODUCT_PKG.GET_GENERIC_PRODUCT_GENERIC_ITEM_CROSS_REFERENCE_INDICATOR_FLAG with about ten parameters on the procedure, it's enough to make a sane person move to Detroit.
--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee
| [reply] [Watch: Dir/Any] |
|
Egads!!! Here's my suggestion:
my $FLAG=
GENERIC_PRODUCT_PKG.GET_GENERIC_PRODUCT_GENERIC_ITEM_CROSS_REFERENCE_INDICATOR_FLAG;
my $MESSAGE="GENERIC PRODUCT XREF INDICATOR FLAG EQUALS: ";
$MESSAGE.=$FLAG."\n";
print $MESSAGE;
Of course, it does help if you don't start out with varbind mappings which are > 80 chars...
Isn't cut and paste a wonderful thing?!
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Knom (Beadle) on Feb 11, 2006 at 05:37 UTC
|
80 digit hex numbers... WOW! What bit processors are you folks working on?? 32 bit hex Address plus CMD code and argument plus spaces only take up ~30 cols.
Punch cards and command sheets?? I toggled switches and hit a button. (just kidding) | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by blue_cowdawg (Monsignor) on Feb 13, 2006 at 14:54 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by TedPride (Priest) on Feb 16, 2006 at 13:22 UTC
|
I'm the only one who has to work with the code I write, so I wrap at whatever seems comfortable. Generally 100 characters or less. | [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by QM (Parson) on Feb 18, 2006 at 00:40 UTC
|
You left out "at the window edge" (automatically, by the editor), which I suppose is the same as "not at all".
-QM
--
Quantum Mechanics: The dreams stuff is made of
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Anonymous Monk on Feb 17, 2006 at 12:51 UTC
|
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by PerlingTheUK (Hermit) on Feb 15, 2006 at 18:56 UTC
|
85 is my magic column number. Based on 17" TFT running with two vertically separated buffer frames and Lucida Console font size 8.
| [reply] [Watch: Dir/Any] |
Re: On what column do you wrap your code?
by Paulster2 (Priest) on Feb 16, 2006 at 21:32 UTC
|
Warping the Space/Time Continuum is quite a delicate task, one that could leave you hating life or even ending up in another universe.....OH, You were asking about "wrap" not "warp"....eh....my bad. I was wondering what the numbers were about.
Paulster2 .oO( If only I could think of something perlish to write.... )
| [reply] [Watch: Dir/Any] |