Comment First Coding and the Importance of planning wall display

Post on 22-Jul-2015

326 views 0 download

Transcript of Comment First Coding and the Importance of planning wall display

Let’s Plan! Let’s Plan! It’s a simple process:

Let’s Plan! It’s a simple process:

Planning is important

It’s a simple process:

1. Plan your logic—draw flow diagrams, write pseudocode. Planning is important 1. Plan your logic—draw flow diagrams, write pseudocode. Planning is important 2. Turn your pseudocode into code comments. 2. Turn your pseudocode into code comments.

3. Write code between the comments. 3. Write code between the comments.

Imagine what would happen if nobody ever 4. If you find yourself wri&ng lots of code for one comment, you need to Imagine what would happen if nobody ever

planned anything.

4. If you find yourself wri&ng lots of code for one comment, you need to

rethink your logic. planned anything. rethink your logic. planned anything.

Buildings would not stand up under their own

rethink your logic.

Buildings would not stand up under their own

weight, cars would not run and you couldn’t weight, cars would not run and you couldn’t

What is pseudocode?

weight, cars would not run and you couldn’t

watch TV as the satellites would have never What is pseudocode? watch TV as the satellites would have never

le* the ground! A plain En�lish description of the

le* the ground! A plain En�lish description of the

le* the ground!

Not a pre-y sight is it? We plan all function of a pro�ram. It does not Not a pre-y sight is it? We plan all function of a pro�ram. It does not

contain syntax or other kinds of stuff!

contain syntax or other kinds of stuff!

contain syntax or other

implementation details. implementation details.

Now let’s scale it back. Now let’s scale it back. Now let’s scale it back.

Ima0ine you wrote a pro0ram with no plannin0. Ima0ine you wrote a pro0ram with no plannin0.

You’d end up with poorly wri-en code that may You’d end up with poorly wri-en code that may

not even work correctly and will be very difficult not even work correctly and will be very difficult

for anyone, even you, to maintain or work with. for anyone, even you, to maintain or work with.