[Tutor] Sorting a dictionary in one line?

Carl Kreider ckreider@gte.net
Tue Jan 21 13:01:02 2003


On Mon, Jan 20, 2003 at 11:53:21AM +0100, Magnus Lycka wrote:
> 
> (snip)
> I guess the typical thing that you learn in school is to
> put each thing on a line and preferably spice the code with
> plenty of comments. If you have something, as in most simple
> school examples, that could be written in 3 compact lines, it
> might be easier to understand (for a beginner at least) if
> you write it in 12 lines instead, but if you have a 20 line
> function that fits well on the screen, I doubt that people
> will understand it better if it grows to 80 lines and won't
> even fit on one page if you print it out. At least for me,
> code gets much harder to understand if I can't keep all the
> relevant parts in my primary field of vision at the same
> time. Maybe it's just my poor memory?

I don't think it is your memory. I find the same thing. One
of my syle rules is that a function has to fit on one page.
I maintain a lot of code that I have written and work on
code others have written. One thing I observe is that comments
often do not match the code because code (even with good
design practices) tends to evolve, if for no other reason
than the users needs/wants evolve. I prefer to write code
that is obvious and eliminage the comments a smuch as
possible.

-- 
Carl Kreider
 aka
  ckreider@acm.org ckreider@gte.net ckreider@doctordesign.com
=============================================================
You may now return to bashing UNIX and its smug complacent users. We in
return will return to our smug complacency -- after all, we don't have any
machines to disinfect this weekend.
	-- Jim Hill
=============================================================