Please send questions to st10@humboldt.edu .

*   random "white-board projections" for 
    CIS 130 - Week 3 Lecture, 01-29-07

*   a few tidbits from the in-lecture exercise...

    def cube_me (num) :
        return num * num * num

    *   if in a file lect03.py, then to import it:
  
        from lect03 import *

    *   cube_me(2) 

*   design recipe: one way to bring some order to
    the chaos that is designing a program...

*   [HtDP packet, Section 2.5] - design recipe is
    "a step by step prescription of what we should
    do and [a suggested] order in which we [can]
    do those things"

    *   PHASE 1: understand the function's purpose
        *   develop a CONTRACT
        *   develop a function header
        *   develop a purpose statement
    *   PHASE 2: develop/make up function examples
    *   PHASE 3: formulate/develop the function's
        body
    *   PHASE 4: testing the resulting function

*   SO: step 1 in phase 1: develop a contract

    *   what's a contract?
  
    *   # contract: function_name : types of inputs   
        #           -> type returned

        *   SO: figure out a good, descriptive name
            for your function (that follows the
            syntax for a Python identifier)

        *   figure out HOW MANY and WHAT KINDS of
            information your function NEEDS to do
            its task

        *   figure out WHAT KIND of data the function
            produces

*   and step 2 in phase 1: develop the function
    header

    *   only new info: coming up with DESCRIPTIVE
        parameter names for EACH input type in
        your contract

    *   (and write them using proper Python function
        header syntax)

*   and step 3 in phase 1: develop the purpose
    statement
    *   a brief comment about the purpose of the
        function - about what it does! ---
        INCLUDING the parameter names appropriately

    *   (it will be a COURSE STYLE STANDARD 
        that parameter names be included;)

*   next is PHASE 2 - coming up with EXAMPLES

    *   EXPLICIT examples --- if I call

        rect_area(3, 5), what should it return?

    *   EXAMPLES section, after the purpose:

        # examples: rect_area(3, 5) should return 15

*   THEN come up with the function BODY --

    (yes, this is the most....interesting step;)

    we will ADD ideas to how to address this
    step as we proceed;

*   then, testing....

    ...which, at a minimum, should include
    running those examples!

    *   suggest: it is ideal to WRITE these out
        so they can be run automatically ("baby"
        test cases)

    *   A NEW PYTHON STATEMENT

        print expr

        causes the value of expr to be printed to
        the screen.

        (doesn't actually RETURN anything... it
        has a SIDE EFFECT, that of writing stuff
        to the screen...)

        and note that a CHARACTER STRING literal
        is ANYTHING inside single or double quotes

     *  I could add the following after my function:

        # Tests
        print "Testing rect_area"
        print rect_area(3, 5)
	print "   should return 15"