« Ara Abrahamian on edit/compile/debug/startup in J2EE | Main | The XML family of specs »

Code is not text

Incoherence

   int outletNumber = 25;
   Outlet myOutlet = new Outlet(outletNumber);
   ConnectionListener myListener = new SMTPListener();

Now, what do you all think of this alternative:

int outletNumber = 25;
Outlet myOutlet = new Outlet(outletNumber);
ConnectionListener myListener = new SMTPListener();

Much more readable, right?

Not for me.


December 12, 2002 02:44 AM

Comments

Charles Miller
(December 12, 2002 03:19 AM #)

Me neither. Your eye has to wander across wide expanses of whitespace to line everything up. It's not a natural way to read.

The spread-out way makes the vertical relationships of the block (e.g int-Outlet-ConnectionListener) more visually important than the horizontal declarations. This runs totally counter to the way we wish to read and understand the code. You get little out of reading "int-Outlet-ConnectionListener", you get everything out of "int outletNumber = 25;"

Or at least that's how I read it. I was going to post something like that on my blog, but I already did a coding conventions post last week, and I wouldn't want to look obsessive. ;)

Trackback Pings

TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/838