CSC/ECE 517 Fall 2007/wiki2 9 kk: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
''Principle of Least Astonishment. Write a guide to the Web pages on the Principle of Least Astonishment. Which should the reader look at for easy-to-understand examples? Which give a feel for where the principle should be used? Is this principle present in fields other than programming? Is the term used consistently in other disciplines?''
= Principle of Least Astonishment =
= Principle of Least Astonishment =
The principle of least astonishment states that when you are presented with a different outcomes one should always pick the one of least ambiguity or suprise. The principle has applications in a lot of fields. This wiki serves as a guide for the reader to understand more about this principle. The principle of least astonishment goes by different names depending on the field of application like element of least suprise, Occam's Razor etc.
The principle of least astonishment states that when you are presented with different outcomes, one should always pick the outcome of least ambiguity or surprise. The principle has applications in a lot of fields. This wiki serves as a guide for the reader to understand more about this principle on the web. The principle of least astonishment goes by different names depending on the field of application and is not consistant across all fields with respect to how it is called.
 
Other names for the principle of least astonishment include:
 
1. The element of least surprise
 
2. Occam's Razor


3. The principle of parsimony


== Examples ==
4. The principle of minimum suprise
 
It is important to remember that, when scouring the web for information on the principle of least astonishment, all of the above mentioned terms mean the same.
 
 
 
== Example ==
The simplest example is in programming  where the name of a function does not indicate its functionality.
The simplest example is in programming  where the name of a function does not indicate its functionality.


Line 13: Line 28:
</pre>
</pre>


The function above is supposed to add two numbers but actualy returns the sum of squares of the two numbers which would suprise the programmer who is using the function.
The function above is supposed to add two numbers and return the sum but actually returns the sum of squares of the two numbers which would surprise the programmer who is using it.
Applying the principle of least astonishment, we can either rename the function to indicate its functionality or we can rewrite the functionality itself to correspond to its name.
Applying the principle of least astonishment, we can either rename the function to indicate its functionality or we can rewrite the functionality itself to correspond to its name.


Line 22: Line 37:
}
}
</pre>
</pre>
 
or
<pre>
<pre>
int add(int a, int b)
int add(int a, int b)
Line 30: Line 45:
</pre>
</pre>


== Application in Programming ==
The above example gives a feel for the principle of least astonishment. As this wiki is more about writing a guide to webpages on the principle of least astonishment, the rest of this wiki talks about the applications of this principle, both in programming and in other fields by providing links to other pages on the web.
=== User interface design ===


The principle of least astonishment is used a lot in user interface design. [http://www.joelonsoftware.com/uibook/chapters/fog0000000057.html Joel Spolsky] has an article introducing user interface design using the principle of least astonishment. The article looks at a lot of examples of using the element of least suprise by comparing user interface design in Windows and Macintoshes.
== Applications in Programming ==


A more general introduction to the  application of  the principle of least astonishment to UI design can be found [http://www.faqs.org/docs/artu/ch11s01.html here].
=== General Software Design ===
[http://www.ddj.com/blog/cppblog/archives/2007/10/the_principle_o.html DDJ] has an article which introduces the user to applying the principle of least surprise to general software design by using an example of using arrays in language called APL. A very basic introduction and some examples can also be found [http://c2.com/cgi/wiki?PrincipleOfLeastAstonishment here].  Ken Thompson's [http://www.faqs.org/docs/artu/ch01s06.html Basics of Unix Philosophy] gives a feel for applying the principle of least astonishment in operating system design.


=== API Design ===
=== API Design ===
The principle of least astonishment also plays an important role in API or library design. For example, when designing libraries or API's we want meaningful function names which does what the function name implies. A very basic introduction and some examples can be found [http://c2.com/cgi/wiki?PrincipleOfLeastAstonishment here]. [http://www.atalasoft.com/cs/blogs/stevehawley/archive/2006/02/27/9590.aspx Steven's Tech Talk] has a very good introduction to proper API design using the principle of least astonishment.
The principle of least astonishment also plays an important role in API or library design. For example, when designing libraries or API's we want functions which does what the function name implies it will do. [http://www.atalasoft.com/cs/blogs/stevehawley/archive/2006/02/27/9590.aspx Steven's Tech Talk] has a very good introduction to proper API design using the principle of least astonishment. [http://blogs.sun.com/swinger/entry/simple_kisses_and_surprises Antonio Vierio] looks at what makes an api a good api by applying the principle of least astonishment.
 
=== User interface design ===
The principle of least astonishment is used a lot in user interface design. [http://www.joelonsoftware.com/uibook/chapters/fog0000000057.html Joel Spolsky] has an article introducing user interface design using the principle of least astonishment. The article looks at a lot of examples of using the element of least surprise by comparing user interface design in Windows and Mac OS X.
 
A more general introduction to the  application of  the principle of least astonishment to UI design can be found [http://www.faqs.org/docs/artu/ch11s01.html here].


=== Webpage Design ===
=== Webpage Design ===
Webpage design like UI design also finds the application of the principle of least astonishment. [http://www.ibm.com/developerworks/web/library/us-cranky10.html IBM] has an excellent article on how this can be done.
Webpage design like UI design also finds the application of the principle of least astonishment. [http://www.ibm.com/developerworks/web/library/us-cranky10.html IBM] has an excellent article on how this can be done.


== Applications in Other Fields ==
The principle of least astonishment also finds a lot of applications in other fields.


=== General Software Design ===
1. Occam's Razor is one of the most popular use of the principle of least astonishment. [http://en.wikipedia.org/wiki/Occam's_razor Occam's Razor] is commonly used to explain phenonmena in such a way that the explanation makes the fewest assumptions possible. In other words, it can be paraphrased as "With all things being equal, the simplest solution tends to be the right one". The [http://skepdic.com/occam.html Skeptic's Dictionary] has a more critical look at this principle. The [http://www.utm.edu/research/iep/o/ockham.htm Internet Encyclopedia of Philosophy] has some interesting applications of Occam's Razor.
[http://www.ddj.com/blog/cppblog/archives/2007/10/the_principle_o.html DDJ] has an article which introduces the user to applying the principle of least suprise to general software design by using an example of arrays in language called APL.
 
 
 
== Applications in Other Fields ==
The principle of least astonishment also finds a lot of applications in other fields though it might be called by a different name.


1. [http://en.wikipedia.org/wiki/Occam's_razor Occam's Razor] is commonly used to explain phenonmena in such a way that it makes the fewest assumptions possible. In other words it can be paraphrased as "All things being equal, the simplest solution tends to be the right one."
2. [http://portal.acm.org/citation.cfm?id=1233682 This] paper looks at applying the principle of least astonishment to the verification of digital circuits.


2. [http://portal.acm.org/citation.cfm?id=1233682 Pape] looks at applying the principle of least astonishment to verification of digital circuits.
3. [http://www.mile43.com/peterson/Safety%20First.html This] page looks at applying the principle of least astonishment to riding bicycles in traffic.


3. [http://www.mile43.com/peterson/Safety%20First.html This] page looks at applying the principle of least astonishment to desigining traffic rules.
4. [http://en.wikipedia.org/wiki/Wikipedia:Guide_to_writing_better_articles#Principle_of_least_astonishment Wikipedia] has some information on applying the principle of least astonishment to writing articles.


== Other Links ==
This section has links which do not fit in with the links already provided in the other sections.


[http://en.wikipedia.org/wiki/Principle_of_least_astonishment Wikipedia entry on the principle of least astonishment]


[http://www.canonical.org/~kragen/tao-of-programming.html#book4 Tao of Programming]


== Bibliography ==
[http://jooto.com/blog/index.php/2006/06/06/principle-of-least-astonishment/ Principle of Least Astonishment in Ruby]

Latest revision as of 06:39, 28 October 2007

Principle of Least Astonishment. Write a guide to the Web pages on the Principle of Least Astonishment. Which should the reader look at for easy-to-understand examples? Which give a feel for where the principle should be used? Is this principle present in fields other than programming? Is the term used consistently in other disciplines?

Principle of Least Astonishment

The principle of least astonishment states that when you are presented with different outcomes, one should always pick the outcome of least ambiguity or surprise. The principle has applications in a lot of fields. This wiki serves as a guide for the reader to understand more about this principle on the web. The principle of least astonishment goes by different names depending on the field of application and is not consistant across all fields with respect to how it is called.

Other names for the principle of least astonishment include:

1. The element of least surprise

2. Occam's Razor

3. The principle of parsimony

4. The principle of minimum suprise

It is important to remember that, when scouring the web for information on the principle of least astonishment, all of the above mentioned terms mean the same.


Example

The simplest example is in programming where the name of a function does not indicate its functionality.

int add(int a, int b)
{
   return (a*a+b*b);
}

The function above is supposed to add two numbers and return the sum but actually returns the sum of squares of the two numbers which would surprise the programmer who is using it. Applying the principle of least astonishment, we can either rename the function to indicate its functionality or we can rewrite the functionality itself to correspond to its name.

int sum_of_squares(int a, int b)
{
   return (a*a+b*b);
}

or

int add(int a, int b)
{
   return a+b
}

The above example gives a feel for the principle of least astonishment. As this wiki is more about writing a guide to webpages on the principle of least astonishment, the rest of this wiki talks about the applications of this principle, both in programming and in other fields by providing links to other pages on the web.

Applications in Programming

General Software Design

DDJ has an article which introduces the user to applying the principle of least surprise to general software design by using an example of using arrays in language called APL. A very basic introduction and some examples can also be found here. Ken Thompson's Basics of Unix Philosophy gives a feel for applying the principle of least astonishment in operating system design.

API Design

The principle of least astonishment also plays an important role in API or library design. For example, when designing libraries or API's we want functions which does what the function name implies it will do. Steven's Tech Talk has a very good introduction to proper API design using the principle of least astonishment. Antonio Vierio looks at what makes an api a good api by applying the principle of least astonishment.

User interface design

The principle of least astonishment is used a lot in user interface design. Joel Spolsky has an article introducing user interface design using the principle of least astonishment. The article looks at a lot of examples of using the element of least surprise by comparing user interface design in Windows and Mac OS X.

A more general introduction to the application of the principle of least astonishment to UI design can be found here.

Webpage Design

Webpage design like UI design also finds the application of the principle of least astonishment. IBM has an excellent article on how this can be done.

Applications in Other Fields

The principle of least astonishment also finds a lot of applications in other fields.

1. Occam's Razor is one of the most popular use of the principle of least astonishment. Occam's Razor is commonly used to explain phenonmena in such a way that the explanation makes the fewest assumptions possible. In other words, it can be paraphrased as "With all things being equal, the simplest solution tends to be the right one". The Skeptic's Dictionary has a more critical look at this principle. The Internet Encyclopedia of Philosophy has some interesting applications of Occam's Razor.

2. This paper looks at applying the principle of least astonishment to the verification of digital circuits.

3. This page looks at applying the principle of least astonishment to riding bicycles in traffic.

4. Wikipedia has some information on applying the principle of least astonishment to writing articles.

Other Links

This section has links which do not fit in with the links already provided in the other sections.

Wikipedia entry on the principle of least astonishment

Tao of Programming

Principle of Least Astonishment in Ruby