Contents [0/10] |
How to write code [1/10] |
Work in pieces [2/10] |
Start in the middle [3/10] |
Principled debugging [4/10] |
Homework [5/10] |
Familiarity != Understanding [6/10] |
Once is not enough [7/10] |
Everyone can program [8/10] |
Why is programming fun? [9/10] |
Some Inspiration [10/10] |
(Click here for one slide per page)
How to write code [1/10] |
The amount of time spent on a function does not amount to much.
Understand the problem!
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.
Break the problem down into pieces -- work incrementally.
Work in pieces [2/10] |
Don't code everything at once.
Pick an example
Work through the example on paper
Test first approach: type in a test before you code.
Type in the code
Repeat until your code is correct on all examples
Start in the middle [3/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 [4/10] |
When your code does something unexpected:
Make sure you understand why
Before you change your code
Don't play Whack-a-Mole with bugs
99 little bugs in the code,
99 little bugs,
Take one down,
Patch it around,
...127 little bugs in the code!
Homework [5/10] |
Getting the homework correct is not enough! You must internalize the solution.
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 != Understanding [6/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 [7/10] |
You need to learn patterns of thought.
You need to learn patterns of programming.
This course is for learning patterns of thought involved in programming.
Imagine you are learning to play piano...
Everyone can program [8/10] |
Think about programming as a play
experience.
Don't be afraid of making mistakes.
Don't tell yourself I can't
You can. You need to learn to think in a different way.
Don't tell yourself I just don't get it
Don't be afraid of asking for help
Learn to be independent
The only way to become a good programmer is to do it!
Why is programming fun? [9/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.
Some Inspiration [10/10] |
I like this TED talk from Eduardo Briceno: