From owner-freebsd-chat@FreeBSD.ORG Fri Apr 25 14:59:30 2003 Return-Path: Delivered-To: freebsd-chat@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6CDC37B401 for ; Fri, 25 Apr 2003 14:59:30 -0700 (PDT) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 510FE43FB1 for ; Fri, 25 Apr 2003 14:59:30 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0134.cvx40-bradley.dialup.earthlink.net ([216.244.42.134] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 199BAU-0006R3-00; Fri, 25 Apr 2003 14:55:43 -0700 Message-ID: <3EA9AE92.7D721BD9@mindspring.com> Date: Fri, 25 Apr 2003 14:54:26 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Jonathon McKitrick References: <20030422132906.GB64101@dogma.freebsd-uk.eu.org> <3EA591C1.AE00376A@mindspring.com> <20030425043813.GE81840@dogma.freebsd-uk.eu.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a476f7c8e56f53506ce00cd7638cb06e13666fa475841a1c7a350badd9bab72f9c350badd9bab72f9c cc: freebsd-chat@freebsd.org Subject: Re: Code layout and debugging time X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2003 21:59:31 -0000 Jonathon McKitrick wrote: > : So offseting discrete logic blocks that are intended to achive > : specific goals makes it easier for the programmer to hold in > : their head both the idea of what the code is intended to do, and > : what their own logic dictates to them that the code actually > : does. > > Do you feel your code does that, or are you one of the 'dense' style > programmers, subconsciously trying to avoid wasted space? It depends on the problem being solved. If it's not well understood, then I will be very careful to make the code as readable as possible. If it's new code, I tend to document the crap out of it, on general principles: I'd like it to be possible for someone else to maintain, if necessary. I also like my assumptions going in and out to be known. I tend to try for single-entry and single-exit in most functions, which is about the only way to deal with locking issues without introducing logic bombs for the unwary who follow you. For most things, I try to match the style of the existing code in the area, so that there's not a radical change of style in the middle of the code; nothing makes code more unreadable than to change style in the middle of it. It's one of the reasons I disliked the ANSI C switch-over to prototype-style declarations: you ended up with mixed code styles in kernel sources, damaging readability. I never put comments like "you are not expected to understand this" in my code; if that were ever actually true, then I've failed at my job (IMO). -- Terry