Contents [0/10] |
Video [1/10] |
How to write code [2/10] |
Work in pieces [3/10] |
Start in the middle [4/10] |
Principled debugging [5/10] |
Homework [6/10] |
Familiarity and Understanding [7/10] |
Once is not enough [8/10] |
Everyone can program [9/10] |
Why is programming fun? [10/10] |
(Click here for one slide per page)
Video [1/10] |
I like this TED talk from Eduardo Briceno:
How to write code [2/10] |
The amount of time spent on a function does not amount to much.
If you are not working effectively, you can spend months on a single function and never get it correct.
So how do you work efficiently? Key things:
Work out lots of examples before you try to code.
Work on paper before you write any code.
Write automated tests to tell you whether you got it right.
Work in pieces
Work in pieces [3/10] |
Don't code everything at once.
Pick an example
Work through the example on paper
Type in a test
Type in the code
Repeat until your code is correct on all examples
Start in the middle [4/10] |
For any repetitive process, start in the middle!
Middle: Figure out how to make progress
End: Figure out when to stop
Begining: Figure out what needs to be done to get going
Principled debugging [5/10] |
When your code does something unexpected:
Make sure you understand why
Before you change your code
Don't play wack-a-mole with bugs
Homework [6/10] |
Getting the homework correct is not enough
The first time you solve something it could take days, and may require help
First, try to make your code as simple as possible
Then, create a copy of the homework and erase your solutions
Repeat this process until you can write each single function correctly in five minutes or less
Invent a variant of the problem
Familiarity and Understanding [7/10] |
From the Chronicle of Higher Education:
People often mistake familiarity for understanding.
They open the textbook after getting home from a lecture, and they recognize the material.
They think: I get this.
Then they take a test -- and bomb it.
Once is not enough [8/10] |
You need to learn patterns of thought
You need to learn patterns of coding
Imagine you are learning tennis
Everyone can program [9/10] |
Don't be afraid of making mistakes
Don't tell yourself I can't
Don't tell yourself I just don't get
Don't be afraid of asking for help
Learn to be independent
Why is programming fun? [10/10] |
An extract from The Mythical Man-Month Fred Brooks, edited slightly:
Why is programming fun? What delights may its practioner expect as their reward?
First is the sheer joy of making things. As the child delights in their mud pie, so the adult enjoys building things, especially things of their own design. I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.
Second is the pleasure of making things that are useful to other people. Deep within, we want others to use our work and to find it helpful. In this respect the programming system is not essentially different from the child's first clay pencil holder "for a parent's office."
Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subtle cycles, playing out the consequences of principles built in from the beginning. The programmed computer has all the fascination of the pinball machine or the jukebox mechanism, carried to the ultimate.
Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. In one way or another the problem is ever new, and its solver learns something: sometimes practical, sometimes theoretical, and sometimes both.
Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. They build their castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. ...
Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separately from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.
Programming then is fun because it gratifies creative longings built deep within us and delights sensibilities we have in common with all people.
Revised: 2008/03/17 13:01