Date: Fri, 25 Apr 2003 14:54:26 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> Cc: freebsd-chat@freebsd.org Subject: Re: Code layout and debugging time Message-ID: <3EA9AE92.7D721BD9@mindspring.com> References: <20030422132906.GB64101@dogma.freebsd-uk.eu.org> <3EA591C1.AE00376A@mindspring.com> <20030425043813.GE81840@dogma.freebsd-uk.eu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EA9AE92.7D721BD9>