Re: Programming style...
- From: "David Craig" <NoOne@xxxxxxxxxxx>
- Date: Tue, 31 May 2005 11:16:15 -0700
If you are coding if blocks within if blocks more than three or so levels
deep, you need to reconsider your algorithms and design. It is not
necessary. It leads to bad results since the code becomes far more
difficult to debug, understand, and maintain. Most bad code can be fixed
with better algorithms and a redesign. That 'do once' block helps limit the
depth to which you must nest 'if' statements. Version 1.0 of most programs
and drivers can and should be discarded for a better design later.
Commercial pressures make most of us keep the old code, so then you just
have to improve it block at a time as you have the time or you need to
modify or fix a particular area.
"Wan-Hi" <WanHi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:837701A9-C56D-43B6-90AD-8414314E84D8@xxxxxxxxxxxxxxxx
>i understand your point of viewas a professional, but you should consider
>the
> possibility that there are some amateurs among the professional majority.
> i
> for myself deal with the field of device io just for fun and know no
> senior
> programmer i can ask.
>
> coding in a clean style is not the problem. what bothers me are cases like
> if blocks in if blocks in if blocks and so on, just because the api
> function
> i call *might* return a failure code (i assume in some cases this could
> only
> happen if i passed a nullpointer for example). but for the sake of
> robustness
> i live with the thousand ifs in ifs because i can never be sure if a
> different circumstance causes a failure.
>
> i think it's good to hear different point of views from the pros to weight
> the arguments and find an own way how to deal with things.
>
> "David J. Craig" wrote:
>
>> ... If you can't code it clean and easy to follow, you need to go back to
>> school
>> or find something other than a programming job. No one will live
>> forever,
>> much less stay in the same job, so be nice to those who follow and write
>> maintainable code.
>> ...
.
- References:
- Programming style...
- From: Wan-Hi
- Re: Programming style...
- From: Robert Marquardt
- Re: Programming style...
- From: David J. Craig
- Re: Programming style...
- From: Wan-Hi
- Programming style...
- Prev by Date: Re: Correct group for WDM development??
- Next by Date: Re: question about OID_802_11_ADD_KEY
- Previous by thread: Re: Programming style...
- Next by thread: Re: Programming style...
- Index(es):
Relevant Pages
|