From owner-freebsd-questions@FreeBSD.ORG Sat Jan 14 09:51:02 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 018D91065672 for ; Sat, 14 Jan 2012 09:51:02 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id BC6558FC15 for ; Sat, 14 Jan 2012 09:51:01 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q0E9sOgM037468; Sat, 14 Jan 2012 03:54:24 -0600 (CST) Date: Sat, 14 Jan 2012 03:54:24 -0600 (CST) From: Robert Bonomi Message-Id: <201201140954.q0E9sOgM037468@mail.r-bonomi.com> To: freebsd@edvax.de In-Reply-To: <20120114092821.adfc43eb.freebsd@edvax.de> Cc: freebsd-questions@freebsd.org Subject: Re: access(FULLPATH, xxx); X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 09:51:02 -0000 > From owner-freebsd-questions@freebsd.org Sat Jan 14 02:32:15 2012 > Date: Sat, 14 Jan 2012 09:28:21 +0100 > From: Polytropon > To: Robert Bonomi > Cc: freebsd-questions@freebsd.org > Subject: Re: access(FULLPATH, xxx); > > On Sat, 14 Jan 2012 02:00:12 -0600 (CST), Robert Bonomi wrote: > > To repeat some advice from one of my Computer Science professors, many years > > ago, whenever I asked 'how does it work' questions: "Try it and find out." > > I bet my professor can beat up your professor. :-) > > Mine used to say several times: "Trial and error is NOT > a programming concept!" As far as writing applications goes, that is _somewhat_ correct. However, 'trial and error' is _not_ the same thing as 'try it and find out'. See the entire subject area of 'benchmarking'. And, the only way to definitively establish if an alternate approach is 'better' -- i.e. 'faster', or 'smaller', or 'more efficient', etc. -- *IS* to run a trial. Your professor undoubtedly would not of approved when I wrote bubble-sort code that _out-performed_ any other sorting technique -- up to the limits of memory. Or when I re-wrote an application that used binary searches of records, with a new version that used a brute-force linear search. I thought I could 'do it better/faster' than the existing code, but the only way to "definitively" find out was to 'try it'. And the 'trial' proved out -- the replacement code was 'merely' somewhat over 100 times faster. *grin* As far as 'doing it once' for the purpose of answering a 'how does it work' question -- where one has _not_ read the documentation, *OR* the existing documentation is _not_clear_, then simple experimentation -- to get *the* authoritative answer -- is entirly justified. When I got the 'try it and find out' advice, I was asking questions about situations where the language _specification_ was unclear -- there were two 'reasonable interpretations' of what the language inthe speciication said, and I just wanted to know which one was the proper interpretation. Now, given that the language in the specification _was_ abiguous and both interpretations were reasonsble, different compiler builders could have implemented differently, and 'try it and find out' was _necessary_ to establish what that particular implementation did.