RE: [NF]The best code is "No Code At All"
> 1. RE: [NF]The best code is "No Code At All" (Stephen the Cook) > Message: 1 > Date: Sat, 2 Jun 2007 09:00:25 -0500 > From: "Stephen the Cook" <[EMAIL PROTECTED]> > Subject: RE: [NF]The best code is "No Code At All" > To: [EMAIL PROTECTED] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii" > > Derek Kalweit <> wrote: > > > A function of half a dozen lines is sometimes far > > easier to read than one of 5 lines. I try to code to make things > > clearly readable and explicit and only shorten/compress the code if > > needed for optimization. If I feel the optimized code is too hard to > > read, I leave the non-optimized code in comments as well. > > Was that 6 lines was easy to read and 5 was difficult? > I'd like to point out this article again: http://msvfp.advisorguide.com/doc/17440 Using it, you can take a "formula" or snippet and replace placeholders with field names. This allows you to reuse simple or complex formulae and document them as completely as you want, while making them maintainable in a single place and keeping the speed almost as high as if it was coded manually. It's not "no code at all" which cannot be of any use to anyone, it's "only one piece of code" - which is what we really should have. The code is a blueprint. There should only be single copies of the blueprints. You have 6 spark plugs in the engine (at runtime), but they are all derived from 1 blueprint (at design time). PADR(ALLTRIM(<>) + IIF(EMPTY(<>) AND EMPTY(<>),"",", ") + ALLTRIM(<>),<>) becomes PADR(ALLTRIM(cSurname) + IIF(EMPTY(cSurname) AND EMPTY(cFirstName),"",", ") + ALLTRIM(cFirstName),50) I have used it in crosstabs so instead of typing 12 copies of a potentially complex formula I create the crosstab query more like this: TEXT TO lcSQL SELECT <> as Amount1, <> as Amount2, <> as Amount3, <> as Amount4, <> as Amount5, <> as Amount6, ENDTEXT Mike ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: [NF]The best code is "No Code At All"
Derek Kalweit <> wrote: > A function of half a dozen lines is sometimes far > easier to read than one of 5 lines. I try to code to make things > clearly readable and explicit and only shorten/compress the code if > needed for optimization. If I feel the optimized code is too hard to > read, I leave the non-optimized code in comments as well. Was that 6 lines was easy to read and 5 was difficult? Bad Steve! Stephen Russell DBA / .Net Developer Memphis TN 38115 901.246-0159 "A good way to judge people is by observing how they treat those who can do them absolutely no good." ---Unknown http://spaces.msn.com/members/srussell/ No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.6/828 - Release Date: 6/1/2007 11:22 AM ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: [NF]The best code is "No Code At All"
> Well said, Ted. Computers can crunch a ton of stuff, and especially > with today's remarkable processing power, the guy is perhaps focused on > the wrong aspect. My POV: Always write code that others can maintain, > because even if that's you, you don't want to be cursing it (or > yourself) years down the line when things need to change. Agreed. Brevity isn't always maintainability, and as Ted points out, his example isn't even as correct as the IsNullOrEmpty comparison others suggested . A function of half a dozen lines is sometimes far easier to read than one of 5 lines. I try to code to make things clearly readable and explicit and only shorten/compress the code if needed for optimization. If I feel the optimized code is too hard to read, I leave the non-optimized code in comments as well. -- Derek ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: [NF]The best code is "No Code At All"
Aida I. Rivera-Benítez wrote: > This bring back memories. > > This remind me of a pseudocode one of my fellow > students wrote back in the 80s, ok don't calculate > my age now ok... it did the job but had more than > 300 statements and the longest so far was 30 statements > and the smallest 12, so the professor gave him an F > he told him he won't even read it, it was too long and > he didn't care if it did the job or not. He dropped and > was never seen again. > > LOL! He must have been that ass-of-an-author in the back of ComputerWorld magazine that I read years and years ago who said that programmers should get paid for the number of lines of code writtenwhat a total dipshit! From the archives when I mentioned it YEARS ago: http://leafe.com/archives/showMsg/2498 (Wow, has ProFox really been around for nearly 9+ years!!!???!?) -- Michael J. Babcock, MCP MB Software Solutions, LLC http://mbsoftwaresolutions.com http://fabmate.com "Work smarter, not harder, with MBSS custom software solutions!" ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: [NF]The best code is "No Code At All"
Ted Roche wrote: > On 6/1/07, Dave Crozier <[EMAIL PROTECTED]> wrote: > >> An interesting discussion on the benefits of writing as little code as >> possible. Also, the comments make good reading. >> > > I think the original poster missed the mark. > > if (s == String.Empty) > if (s == "") > > ".. It seems obvious to me that the latter case is better because it's > just plain smaller..." > > And how would you compare this to code that checks to see if s is the > single character double-quote by wrapping that literal in single quote > characters. Or a single space (i.e., s ==SPACE(1)) The first example > is explicit, it might even be Unicode-compatible, and it is easier for > the programmer to read. To heck with what's easier for the computer, > buy more hardware, but the time and cost of a programmer maintaining > and understanding code is the expensive part of the system. Brevity at > the expense of understandability is a false savings. > > Well said, Ted. Computers can crunch a ton of stuff, and especially with today's remarkable processing power, the guy is perhaps focused on the wrong aspect. My POV: Always write code that others can maintain, because even if that's you, you don't want to be cursing it (or yourself) years down the line when things need to change. -- Michael J. Babcock, MCP MB Software Solutions, LLC http://mbsoftwaresolutions.com http://fabmate.com "Work smarter, not harder, with MBSS custom software solutions!" ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: [NF]The best code is "No Code At All"
On 6/1/07, Dave Crozier <[EMAIL PROTECTED]> wrote: > An interesting discussion on the benefits of writing as little code as > possible. Also, the comments make good reading. I think the original poster missed the mark. if (s == String.Empty) if (s == "") ".. It seems obvious to me that the latter case is better because it's just plain smaller..." And how would you compare this to code that checks to see if s is the single character double-quote by wrapping that literal in single quote characters. Or a single space (i.e., s ==SPACE(1)) The first example is explicit, it might even be Unicode-compatible, and it is easier for the programmer to read. To heck with what's easier for the computer, buy more hardware, but the time and cost of a programmer maintaining and understanding code is the expensive part of the system. Brevity at the expense of understandability is a false savings. -- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: [NF]The best code is "No Code At All"
This bring back memories. This remind me of a pseudocode one of my fellow students wrote back in the 80s, ok don't calculate my age now ok... it did the job but had more than 300 statements and the longest so far was 30 statements and the smallest 12, so the professor gave him an F he told him he won't even read it, it was too long and he didn't care if it did the job or not. He dropped and was never seen again. AiR Aida I. Rivera-Benítez, MSMIS AiR Information Systems, Inc. Medical Billing Software & Clearinghouse P.O. Box 270152 San Juan PR 00927-0152 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Crozier Sent: Friday, June 01, 2007 5:28 AM To: 'ProFox Email List' Subject: RE: [NF]The best code is "No Code At All" Sorry about the link, I sent HTML Format. It should have been: http://www.codinghorror.com/blog/archives/000878.html or http://tinyurl.com/33vuuy Dave Crozier ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: [NF]The best code is "No Code At All"
Sorry about the link, I sent HTML Format. It should have been: http://www.codinghorror.com/blog/archives/000878.html or http://tinyurl.com/33vuuy Dave Crozier -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Crozier Sent: 01 June 2007 10:13 To: 'ProFox Email List' Subject: [NF]The best code is "No Code At All" An interesting discussion on the benefits of writing as little code as possible. Also, the comments make good reading. HYPERLINK "http://www.codinghorror.com/blog/archives/000878.html"http://www.codinghorr or.com/blog/archives/000878.html Dave Crozier No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.5/826 - Release Date: 31/05/2007 16:51 --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
[NF]The best code is "No Code At All"
An interesting discussion on the benefits of writing as little code as possible. Also, the comments make good reading. HYPERLINK "http://www.codinghorror.com/blog/archives/000878.html"http://www.codinghorr or.com/blog/archives/000878.html Dave Crozier No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.5/826 - Release Date: 31/05/2007 16:51 --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.