Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I like to keep my lines of code under 80 characters because:

  • I don't have to do any horizontal scrolling;
  • I know the line is probably too complicated if it exceeds this limit; and
  • it prints out nicely on paper.

Concerning the latter, I've met only a few who actually print out code to look at (I'm one of them). So how common is it to print out code?

share|improve this question

closed as too broad by MichaelT, Bart van Ingen Schenau, gnat, GlenH7, Martijn Pieters Dec 16 '13 at 1:37

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I think the question is why do you print out code on paper? –  Anon. Jan 10 '11 at 20:45
14  
I can't speak for how common it is to print out code, but unless the printer is a relic from a long-forgotten time, it can print out more than 80 characters per line. 80 characters is used to foster readability and historically because many terminals were only 80 columns wide, not because of printers. –  user8 Jan 10 '11 at 20:47
12  
@Mark Actually 80 characters comes from when code was written on punch cards which were 80 characters wide. And the first 6 were for control codes and line numbers. That's why FORTRAN code has to start at column 7. –  ChrisF Jan 10 '11 at 20:51
3  
@Aaron - that's probably good on Programmers' –  ChrisF Jan 10 '11 at 20:52
5  
@Aaron - Programmers' is meant for the more subjective (but still constructive) questions that surround our profession. –  ChrisF Jan 10 '11 at 21:23

30 Answers 30

In the last 10 years or so, I only recall printing out code, so I can use highlighter pens on it, to mark up sections that have something in common before planning how to refractor the code.

I do however sometimes miss being able to print out onto wide continuous paper, as laying the code out on the floor, could give a good overview, mostly along with coloured highlighter pens and postit notes. A4 printed pagers are no better then what a reasonable monitor gives.

Monitors have got a lot better and bigger while printers are worse for code then they used to be.

share|improve this answer

Sometimes I print it to read on the train and make notes. When I get stuck, I like to spread it out over a table in a quiet conference room. Not sure if it really helps, but it's a nice change of pace.

Another One: Found some old code that was a multi-nested If/Then statement that wouldn't fit on the screen. They should have fired the former programmer who wrote that, but then I'd be out of a job ;)

share|improve this answer
4  
+1 for a change of scene. Sometimes just seeing something in a different context makes you think about it differently. –  Jon Hopkins Jan 11 '11 at 9:15
3  
+1 You can put more pages side-by-side on a large conference table than on the computer screen. And you don't get distracted by Twitter or email –  Alexandre Jasmin Aug 28 '11 at 20:00

I used to print out code fairly often, but do so less now that I have multiple monitors on my desk -- I will often keep one part of a listing which I am using as a reference on my right monitor (which is somewhat off to the side), and my current work in front of me.

If I do print out ode, it is almost always code from someone or somewhere else (library) that I want to study, and need to flip pages back and forth.

I almost always print out code in landscape mode, because of the tendancy to use long lines.

share|improve this answer

I print out my code all the time, but only because I'm a student who needs to do it to turn it in to the instructor.

However, because I have access to multiple monitors (like any good developer), I haven't had many situations where I need to print out source code for reference. I once printed out one of the scripts I used to populate a database so that I can see the schema at a glance, but I don't seem to use it much.

share|improve this answer

These days, never. I have the support of multiple monitors if I need to reference some particularly difficult code. Modern hard drives aren't going to blink at me storing code that's even several thousand lines long. Printing code IMHO is wasteful and generally useless but that's just me.

That said when I was first learning up to develop/program I thought nothing of printing 20 pages of code, so I suppose there might be a time and a place for it but I just find these days there isn't much use for it.

share|improve this answer

At my last job I would print out code for code reviews. It's nice to be able to highlight/mark up a bit of code when sitting around doing a code review so you have a good reference for any issues that were brought up during the review.

Also, when I had to refactor (ended up being a re-write) a particularly gnarled and twisted bit of code, I actually printed out the source code, taped the printouts up on the wall, then used bits of string to show how the logic was weaved together.

share|improve this answer

Not anymore. I used to do it all the time in the pre-IDE days, back when dot-matrix with continuous feed was the norm. You could spread those printouts out and flip through them quite easily. Modern sheet-fed laser/inkjet printers are a huge step backwards. Stapling them together doesn't flow as well, and not stapling results in loose sheets that get mixed up. Modern IDEs with automatic highlighting and method navigators also eliminate whole classes of errors that were caught by examining printouts.

share|improve this answer

I find it easier to figure out large modules if I can print them out and quickly see various sections. I could probably do something similar with multiple monitors, but if I have more than 2-3 places in the code to look at, it's quicker to have it all spread out in one place than to keep scrolling and keeping track of bookmarks. I also like to mark up printouts with changes rather than make them in the editor, because I can see the old code and the new code side-by-side. Sure, I could comment out the old code in the editor, but if you're replacing more than a few lines then you wind up scrolling the old code off the monitor, so you're no better off.

That said, I almost never print code anymore. It was great on fanfold paper, where the whole listing was continuous and you had plenty of space for notes in the margins, but printing everything out on individual letter-size pages is almost as bad as just keeping it on-screen. Especially when your editor insists on putting headers and footers in 1" margins. Fortunately, modern IDEs offer a lot of tools that reduce the need to print things out.

share|improve this answer

I print hairy code on occasion to try and figure it out. I've also printed disassembly when debugging something "weird".

share|improve this answer

Almost Never

I've thought really hard to remember a time when I've either printed code, or have seen code printed. And I can honestly say I don't recall a single time (barring Pseudo code).

I'm not suggesting there are no legitimate reasons to print code.

share|improve this answer

The new tools support me better and allow me to navigate fast and they deliver many types of summaries and views. Therefore I do not print as often as before. But sequential reading of printouts is still easier. My personal main reason to print is psychological: It prevents me from continuing to search and while the printer prints I start thinking! Also the beneficial effect of standing up and walking to the printer should not be underestimated :)

share|improve this answer

Printing code has become obsolete somewhere between 1975 and 1982, except for special reasons:

  • code to read it during a commute
  • old code that goes into the specification of a new project that shall replace it
  • to deal with blatant errors; it's safer to pummel a coworker with a stack of paper than a monitor
share|improve this answer
1  
Pummeling is underrated. –  Keith Layne Aug 28 '11 at 19:51

You bet. But remember printing in landscape allowed 132 characters.

alt text

At Uni, I used to regularly print my code on green bar paper, it is amazing how well you get a physical sense of how deep and convoluted your code is when you look at it on paper. We're (at least as of today) still mentally imprinted from our Elementary school days on reading pages and how much each page can represent. It puts a good complexity metaphor to computer code.

alt text

share|improve this answer
1  
If I had a pound for every ream of continuous green-bar paper I have used in my life, I could take quite a while off work. –  Orbling Jan 11 '11 at 2:27

Back in the days when US laws didn't allow export of strong cryptography, US-based open source developers used to print code and snail-mail them outside US, where they were scanned by volounteers. But I'm not sure if this answers your question ;)

share|improve this answer

When I was in my teens attending high school (21 now) I didn't have an internet connection at home. So I would frequently print off code samples and various API documentation to take home with me.

Side note: it's amazing how much more work you can do without an internet connection, provided that you have the information you need already.

share|improve this answer

A slightly different answer to the above ones.

I'm a student, and I find myself printing out code for various coursework hand-ins, but not for every unit where I have to write code.

In my first year most units required a hard-copy in addition to either an electronic upload, or a copy burnt to CD (yes, a CD for a 5 Mb zip file...) [Lecturer's choice]

I'm currently in my second year and so far we've had one electronic only upload, and one Hardcopy + CD hand-in.

Considering we have Moodle which allows electronic submission of coursework, quite why we don't always upload code is beyond me - we have to pay to print things out on the University Printers, and there is not a single CD burner on any of the PC's that I know of. Of course, the lecturers don't like Moodle - but that's another question entirely.

BTW, I'm a UK University Student, and not at a small, unknown one. Mine was in the top 10 of Uni's according to The Times / Guardian when I last looked.

share|improve this answer

I never printed my source code. I never had to do that. The only source code I saw outside a computer screen was in books.

I used my printers for something else.

alt text

share|improve this answer
1  
Now I feel old :D –  wildpeaks Jan 10 '11 at 22:42

Well I print code on paper infrequently now, but used to do it all the time back in the day.

The usual reasons these days are to sit down somewhere quiet and explain code to a junior, or if a long method is really bugged and needs some very through pen and paper work. Screens do not always suffice, especially when you want notes and highlighting everywhere.

I almost always keep to the 80-character limit, as I'm inclined to make quick amends to bugs via SSH in emergencies and do not like to have wide terminals. Also, horizontal scrolling is the devil.

share|improve this answer
4  
+1 "horizontal scrolling is the devil". I was just telling someone that same exact thing last week. –  morganpdx Jan 10 '11 at 22:46

I don't print anything for myself, and I only print for others when I can't get out of it. I hate receiving printouts as well. They clutter up my desk and then I'm responsible for them (save it? file it? shred it? use it as scrap?)

Mind you I work near someone who's been doing mainframe coding for a few decades and has a foot-high pile of code printouts beside him.

Do what works for you I guess. Just don't leave your printouts at my desk, thank you.

share|improve this answer

Our intellectual property lawyers require a "hardcopy" for copyright filing.

I don't know if they actually print it on paper. I send them a PDF that they can print or include in the copyright filing.

share|improve this answer

I print code so I can do a side-by-side comparison (my monitors at work are not widescreen). At home, I have a wide-screen so I can comfortably view two documents side by side.

share|improve this answer

So how common is it to print out code?

It was common many years ago in the times of the DOS programming, 80 characters were precisely filling a printed page. We had matrix printers then so the limitation was probably on the hardware side. It was also the limit on a console screen.

Nowadays people hardly print code at all, the only exception being little code snippets printed as test examples for job interviews.

People mostly work with large monitors these days, Full HD and more. I typically stretch to 150-200 characters without thinking of any printing side effects.

When it is a time to discuss in a team, somebody usually grabs a laptop and connects it to a projector. Again, nobody prints the code.

Last time I printed code was about 8 years ago for my university diploma which I'm pretty sure nobody read - the code I mean :-). Never had to since.

share|improve this answer

I print the code sometimes to try to make sense of thorny multi-page problems.

share|improve this answer

occasionally you may need to have a close look at some code (usually new to you) where you essentially need to see a lot at the same time. Then a printout can be invaluable for you to be able to look at the whole thing at one time.

Combined with a highlighter and a red and a gren pen it really helps getting the overview. The notes you put down on paper is then later added in some form to the code.

Note, with modern day color printers, you can get syntax colouring on paper too. That is really a great help and is highly recommended.

(I also print out specifications for reading - that is for putting notes in the margin)

share|improve this answer
6  
+1 When someone hands me a mess to refactor, I usually print it out and go spend some quality time in a nice sunny place. –  Sharpie Jan 10 '11 at 21:11

I only print out code in order to do a peer review of the code. Doing the review offline is in my opinion more efficient than doing it on a computer with all the disturbing (yet sometimes helpful) IDE stuff.

If you have one (or two or more) reasonably wide monitors, you can easily open two source files vertically split in full screen mode and don't have to obey any too restrictive line-width regulations.

And in some cases, I don't need to see the whole line content (i.e. the lines printing out debug messages or such) and therefore it doesn't matter if the line is chopped on the right.

But to answer your question: in my opinion it's no longer that common to print out code on paper.

share|improve this answer

I print out code when both of my monitors are filled and I need to constantly reference something. A sheet of paper on the desk is a poor mans additional monitor.

share|improve this answer

I still very occasionally print out code - but only if it's a particularly knotty problem.

It usually indicates that the code is too complicated and needs refactoring, so in the first instance having something to scribble on helps find and fix the problem and then it helps work out where the code should be split.

In an ideal world of SOLID and DRY principles you should be able to see the whole of a method on a single screen. However, we don't work in an ideal world...

share|improve this answer
4  
+1 for "[needing to look at printed code] usually indicates that the code is too complicated and needs refactoring..." –  Bill Jan 10 '11 at 23:27
4  
@rperetti: Printing things like stack traces is very different than printing code. Don't compare them side by side, though--find a window (the glass type, not the Microsoft type.) Put the two printouts on top of each other on the glass and discrepancies stand out. (Obviously, only in daylight.) –  Loren Pechtel Jan 11 '11 at 4:21
3  
Wouldn't it be easier to just compare them with a diff tool? –  Jeanne Pindar May 22 '12 at 15:12

I only print out the code that comes together with a scientific article. Because this code frequently provides the implementation of an algorithm (a complex one I'd say), and you need a couple of hours to process it.
I doubt I would print out the code that contains SQL statements, or some GUI programming.

share|improve this answer

I print out my code on paper very occasionally and only when I want to do some serious offline debugging or get acquainted with someone else's code - so it might be worth doing just out of courtesy.

Also, I'd probably be more apt to print a database schema out on paper than code.

I think the horizontal scrolling issue is a bigger annoyance and reason to keep to < 120 chars or so.

share|improve this answer
1  
@Craige kinda depends on your font size and DPI though as well as how much junk you've got on either side of your screen (if you're in an IDE). I've started using XTerm instead of the standard Gnome Terminal when coding via SSH for this reason - not that I couldn't have just changed the font. –  Peter Turner Jan 10 '11 at 21:01

I sometimes print my code because I am on a smallish (15") single monitor. I sometimes need to combine two programs and it is very hard to switch back and forth between them. I don't do this often though, only when necessary.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.