Some Lessons - Washington State University

嚜燙ome Lessons

? Often many ways to solve a problem

每 Don*t rush to code first idea that pops into

your head. Think about the design and ask if

there*s a better way to approach the problem

每 Your first task is to find a correct algorithm.

After that, strive for clarity, simplicity,

efficiency, scalability, and elegance

Python Programming, 2/e

1

Some Lessons

? Be the computer

每 Formulate an algorithm by thinking about how

you*d solve the problem

每 This straightforward approach is often simple,

clear, and efficient (enough)



Some Lessons

? Generality is good

每 Consideration of a more general problem can

lead to a better solution for a special case

每 If the max of n program is just as easy to

write as the max of three, write the more

general program because it*s more likely to be

useful in other situations

Python Programming, 2/e

3

Some Lessons

? Don*t reinvent the wheel

每 If the problem you*re trying to solve is one

that lots of other people have encountered,

find out if there*s already a solution for it

每 As you learn to program, designing programs

from scratch is a great experience

每 Expert programmers know when to borrow

? Search through Python functions

? Search the Internet

Python Programming, 2/e

4

? Chapter

?7

?DONE

?

? Suggested

?exercises

?on

?the

?website.

?

?

每 Do

?them

?over

?the

?weekend

?

每 If

?people

?have

?quesBons,

?we*ll

?go

?over

?them

?in

?

class

?next

?Tuesday

?

Python Programming, 2/e

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download