Date: Mon, 17 May 2010 22:55:42 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Alternative for "goto" in do loop
In-Reply-To: <FE10F31634E7F34B87AA143D59608541552F0176@EX-CMS01.westat.com>
Content-Type: text/plain; charset="iso-8859-1"
Sig,
I remember in a book called I believe "The Design Of Every Day Things", what you are describing is called good mental mapping. WHen I wrote my paper over Macro Design, it was one of the points I made when talking specifically about Parameters. IF we mentally map the code in such away that most people would get what we are doing and why we have done our job. I doubt anyone who has programmed awhile will say that you can make code completely understandable by everyone. I try to shoot for the average begginer or intermediate programmer, who has at least a descent in my opinion knowledge of Base SAS.
Toby Dunn
"Don't bail. The best gold is at the bottom of barrels of crap."
Randy Pausch
"Be prepared. Luck is where preparation meets opportunity."
Randy Pausch
> Date: Mon, 17 May 2010 18:49:39 -0400
> From: HERMANS1@WESTAT.COM
> Subject: Re: Alternative for "goto" in do loop
> To: SAS-L@LISTSERV.UGA.EDU
>
> I prefer intuitive programs. By that I mean programs that require minimal explanation and documentation. Successful applications of computer technologies evoke an analogy that people understand: Windows icons, dialogs, and folders; Google search strings and "Do you mean ..." interactions; HTML url Web links; worksheets; etc.
>
> The "principle of least astonishment" seems to me to be a retread of the longstanding scientific principle: extraordinary claims require extraordinary evidence. In that sense, I agree that a program that seems intuitive gives the user a sense of familiar context.
> S
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jack Hamilton
> Sent: Sunday, May 16, 2010 1:04 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Alternative for "goto" in do loop
>
> "Intuitive" is one of those words that has both a general meaning and
> several domain-specific meanings. And since it is not always clear,
> even in context, which of those meanings is intended, "intuitive" may
> not be the best word to use.
>
> I suspect that the intended meaning in software is something like the
> "principle of least surprise" - the behavior is whatever surprises an
> experienced user of the language (or interface) the least.
>
> See:
>
> http://en.wikipedia.org/wiki/Principle_of_least_astonishment
>
> http://www.economicexpert.com/a/Principle:of:least:astonishment.html
>
> The creator of Ruby had an interesting comment:
>
> Everyone has an individual background. Someone may come
> from Python, someone else may come from Perl, and they
> may be surprised by different aspects of the language.
> Then they come up to me and say, 'I was surprised by
> this feature of the language, so Ruby violates the
> principle of least surprise.' Wait. Wait. The principle
> of least surprise is not for you only. The principle of
> least surprise means principle of least *my* surprise.
> And it means the principle of least surprise after you
> learn Ruby very well. For example, I was a C++
> programmer before I started designing Ruby. I programmed
> in C++ exclusively for two or three years. And after
> two years of C++ programming, it still surprises me.
>
> http://en.wikipedia.org/wiki/Ruby_(programming_language)
>
>
> Joe Whitehurst wrote:
> > Sid,
> >
> > I did not experience any irritation whatsoever at your use of the word
> > "intuitive", and I applaud your efforts to understand SAS code. Keep up
> > your efforts. I think you will find your efforts will pay off. I apologize
> > if my statements make you experience any unease at all. I have an entirely
> > different agenda and my attention to your use of "intuitive" was merely a
> > pretext to help me pose the questions I did. So, let me withdraw my
> > questions to you. I still hope that others in SAS-L-Dom will offers some
> > answers to the two questions I posed to you.
> >
> > Joe
> >
> > On Sun, May 16, 2010 at 3:16 AM, Sid N <nsid31@gmail.com> wrote:
> >
> >> Joe,
> >>
> >> First, I did not intend to irritate any one when I said that the
> >> alternative
> >> code suggested to my question in using the GOTO loops was more intuitive.
> >> What I meant to say was that my understanding of the (original) code was
> >> not
> >> spontaneous when I first came across that sequence of GOTO statements. As
> >> Arthur put it, the code did not provide the "quick insight." Does it make
> >> it
> >> an attribute of the code? I don't actually know. When I looked at some of
> >> the other code submitted by SAS-Lers, I could make out immediately what the
> >> code is aiming for, and I could at least think of what the output would be
> >> like. This has more to do with the limited data step coding experience, and
> >> more familiarity with some of the SAS functions that I have had in the
> >> past.
> >>
> >> I am not a native English speaker. Therefore, I am not completely sure if
> >> "intuitive" is the right word to mean what I described above. May be the
> >> usage of the word was just superfluous. However, I did not quite understand
> >> your persistence in knowing what I actually meant when I used the term
> >> "intuitive." I am interested in knowing why it is annoying when someone
> >> uses
> >> the word "intuitive"? When is it actually acceptable to use that word?
> >> Couldn't a block of code be termed intuitive in nature?
> >>
> >> Sid
> >>
> >>
> >> On Sat, May 15, 2010 at 7:35 PM, Joe Whitehurst <joewhitehurst@gmail.com
> >>> wrote:
> >>> Dear SAS-Lers,
> >>>
> >>> Sid N has not answered the questions I put to him regarding his use of
> >> the
> >>> pesky adjective "intuitive" and one of the finest minds in all of
> >> SAS-L-Dum
> >>> admits he has "nothing
> >>> interesting or intelligent to say on the subject". Yet, we all see this
> >>> pesky adjective applied not only in marketing super-hype but in many
> >> serious
> >>> discussions about software including coding practices within the SAS
> >> System.
> >>> Can and will any SAS-Lers venture answers to the two simple questions I
> >> put
> >>> to Sid N? The whole nation (in Colbert's terms) is awaiting the answers.
> >>>
> >>> Joe
> >>>
> >>>
> >>> On Fri, May 14, 2010 at 11:46 AM, Joe Whitehurst <
> >> joewhitehurst@gmail.com>wrote:
> >>>> Sid,
> >>>>
> >>>> Your use of the word "intuitive" prompts me to ask: "Just specifically
> >>>> what do you mean by intuitive"? Are you asserting that "intuitive" is
> >> an
> >>>> attribute of the code?
> >>>>
> >>>> Joe Whitehurst
> >>>> Personal Construct Psychologist
> >>>>
> >>>> To learn more about this 21st century psychological science click any of
> >>>> the following links:
> >>>>
> >>>> By George Kelly Himself:
> >>>>
> >>>> A Brief Introduction to Personal Construct Psychology<
> >> http://70.88.183.165/A%20Brief%20Introduction%20to%20PCP.pdf>
> >>>> Ontological Acceleration<
> >> http://70.88.183.165/Ontological_Acceleration.pdf> (superb
> >>>> ideas, marginal quality media)
> >>>>
> >>>> By others:
> >>>>
> >>>> Introduction to PCP <http://pages.cpsc.ucalgary.ca/~gaines/pcp/>
> >>>>
> >>>> Constructivist Psychology Network <http://www.constructivistpsych.org/>
> >>>>
> >>>> Cognitive Mapping Tools<
> >> http://www.coachingnetwork.org.uk/ResourceCentre/ProductsAndServices/RepGrid.htm
> >>>> BUDDHIST MEDITATION AND PERSONAL CONSTRUCT PSYCHOLOGY<
> >> http://serendip.brynmawr.edu/bb/Pilou.html>
> >>>> THE INTERNET ENCYCLOPAEDIA OF PERSONAL CONSTRUCT PSYCHOLOGY<
> >> http://www.pcp-net.org/encyclopaedia/main.html>
> >>>>
> >>>>
> >>>> On Fri, May 14, 2010 at 11:31 AM, Sid N <nsid31@gmail.com> wrote:
> >>>>
> >>>>> I have never thought such an innocuous post (as the original) would
> >>>>> elicit
> >>>>> so much discussion. Thank you everyone for sharing his/her inputs.
> >> That's
> >>>>> what I like the most about SAS-L -- not just answering the question,
> >> but
> >>>>> also providing some amazing perspective and background. So much here to
> >>>>> learn!
> >>>>>
> >>>>> Personally, I have not felt comfortable working with the original code
> >>>>> with
> >>>>> that sequence of GOTO statements. I have tried other alternatives
> >>>>> suggested
> >>>>> in this thread; they are easily understandable and much more intuitive.
> >>>>>
> >>>>> Sid
> >>>>>
> >>>>> On Fri, May 14, 2010 at 9:24 AM, toby dunn <tobydunn@hotmail.com>
> >> wrote:
> >>>>>> Ahhh well we will have to agree to disagree on this. I am a stright
> >> up
> >>>>>> GOTO hater. Can't help myself I guess, I beleive that if you have to
> >>>>> write
> >>>>>> a GOTO statement (other than in extreme rare circumstances), you need
> >>>>> to go
> >>>>>> back and redesign your code. There is almost always a better
> >> approach
> >>>>> than
> >>>>>> to use a GOTO. Thats just my opinion on the subject so take it for
> >>>>> what
> >>>>>> ever it is worth.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> Reminds me of Macro Arrays. Yeah we should teach people about them,
> >> so
> >>>>>> that when they come across them they can rewrite the suckers in to
> >>>>> either
> >>>>>> Macro list processing or one of couple oter methods that are easier
> >> and
> >>>>> more
> >>>>>> efficient.
> >>>>>>
> >>>>>> Toby Dunn
> >>>>>>
> >>>>>> "Don't bail. The best gold is at the bottom of barrels of crap."
> >>>>>> Randy Pausch
> >>>>>>
> >>>>>> "Be prepared. Luck is where preparation meets opportunity."
> >>>>>> Randy Pausch
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Date: Fri, 14 May 2010 00:59:24 -0400
> >>>>>>> From: s.lassen@POST.TELE.DK
> >>>>>>> Subject: Re: Alternative for "goto" in do loop
> >>>>>>> To: SAS-L@LISTSERV.UGA.EDU
> >>>>>>>
> >>>>>>> Toby,
> >>>>>>> In terms of pure efficiency, gotos are sometimes needed, as long as
> >>>>> SAS
> >>>>>>> does not have a statement to leave an outer loop. (could possibly
> >> be
> >>>>>>> implemented as "leave <n>" where n is the number of levels you want
> >>>>> to
> >>>>>>> escape, 1 being the default).
> >>>>>>>
> >>>>>>> Even when efficiency is not paramount, I think gotos sometimes
> >>>>>>> make programs easier to write, read and maintain.
> >>>>>>>
> >>>>>>> Regards,
> >>>>>>> Søren
> >>>>>>> On Thu, 13 May 2010 16:11:10 +0000, toby dunn <
> >> tobydunn@HOTMAIL.COM>
> >>>>>> wrote:
> >>>>>>>> Søren,
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Yes in general GOTO's are never needed. Proper loop construction,
> >>>>>> haveing
> >>>>>>> no more than 3 levels of nesting, using proper branching, and in
> >> SAS
> >>>>>> coding
> >>>>>>> the proper exit condtion at the beggining of the loop. SAS does
> >> have
> >>>>>> Leave
> >>>>>>> and Continue statements. These aren't bad so long as the level of
> >>>>> nesting
> >>>>>>> and Looping is relatively simple. Th more omplex the Do-Loop the
> >> less
> >>>>> one
> >>>>>>> wants to use these as they just add unneeded code complexity.
> >>>>>>>> Toby Dunn
> >>>>>>>>
> >>>>>>>> "Don't bail. The best gold is at the bottom of barrels of crap."
> >>>>>>>> Randy Pausch
> >>>>>>>>
> >>>>>>>> "Be prepared. Luck is where preparation meets opportunity."
> >>>>>>>> Randy Pausch
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Date: Thu, 13 May 2010 12:05:57 -0400
> >>>>>>>>> From: s.lassen@POST.TELE.DK
> >>>>>>>>> Subject: Re: Alternative for "goto" in do loop
> >>>>>>>>> To: SAS-L@LISTSERV.UGA.EDU
> >>>>>>>>>
> >>>>>>>>> Perusing Knuths execellent paper
> >>>>>>>>> http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf
> >>>>>>>>> (Thank you, Michael!), I stumbled upon this little gem:
> >>>>>>>>>
> >>>>>>>>> "Of course, event indicators are not the only decent
> >> alternatives
> >>>>> to
> >>>>>> go
> >>>>>>> to
> >>>>>>>>> statements that have been proposed. Many authors have suggested
> >>>>>> language
> >>>>>>>>> features which provide roughly equivalent facilities, but which
> >>>>> are
> >>>>>>>>> expressed in terms of exit, jumpout, break, or leave statements.
> >>>>>> Kosaraju
> >>>>>>>>> [57] has proved that such statements are sufficient to express
> >> all
> >>>>>>> programs
> >>>>>>>>> without go to's and without any extra computation, but only if
> >> an
> >>>>> exit
> >>>>>>> from
> >>>>>>>>> arbitrarily many levels of control is permitted."
> >>>>>>>>>
> >>>>>>>>> Which seems to vindicate my personal GOTO policy quite
> >> adequately,
> >>>>>> namely
> >>>>>>>>> that GOTOs can be used instead of LEAVE when you need to break
> >> out
> >>>>> of
> >>>>>>> several
> >>>>>>>>> levels of nested loops, and (in SAS) STOP or DELETE(/RETURN) is
> >>>>> too
> >>>>>>> drastic.
> >>>>>>>>> Thanks to you all for an entertaining and enlightening
> >> discussion!
> >>>>>>>>> Søren
> >>>>>>>> _________________________________________________________________
> >>>>>>>> Hotmail is redefining busy with tools for the New Busy. Get more
> >>>>> from
> >>>>>> your
> >>>>>>> inbox.
> >>>>>>>> http://www.windowslive.com/campaign/thenewbusy?
> >>>>>>> ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
> >>>>>> _________________________________________________________________
> >>>>>> Hotmail is redefining busy with tools for the New Busy. Get more from
> >>>>> your
> >>>>>> inbox.
> >>>>>>
> >>>>>>
> >> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
> >>>>
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4 |