Docsity

CSIS 110 - Lecture 7: Improving Programming Techniques - Prof. Brian F. Hanks, Study notes of Javascript programming

Toggle sidebar
bg1
CSIS 110 โ€“ Lecture 7
A reminder - my lecture notes are on the course web site. They are not a substitute for
coming to class, and they can be much abbreviated at times.
Most of you have turned in the first programming assignment, and I have graded them
already.
A comment: Not turning in programming assignments is an excellent way of doing
poorly in this class. This is a programming class, and you won't learn programming if you
don't write the programs!
Now, I'd like to look at an example of one of the SumAndAverage programs. Now, there
is nothing really wrong with this program, but it could still be improved.
1) good, complete header comment
2) Perhaps too much commenting between lines
3) Let's look at the variable declarations. This was a common way of writing the
program - I'm not picking on the authors of this one, because lots of you did it this
way. You don't need to declare a new variable for every thing you do - use the
ones that you already have!
Compare SumAndAverage.java with SumAndAverage2.java
Note use of variables, and comments that describe bigger chunks.
Now, let's look at the quiz review - the slides are on O: if you want to follow along.

Partial preview of the text

Download CSIS 110 - Lecture 7: Improving Programming Techniques - Prof. Brian F. Hanks and more Study notes Javascript programming in PDF only on Docsity!

CSIS 110 โ€“ Lecture 7

A reminder - my lecture notes are on the course web site. They are not a substitute for coming to class, and they can be much abbreviated at times. Most of you have turned in the first programming assignment, and I have graded them already. A comment: Not turning in programming assignments is an excellent way of doing poorly in this class. This is a programming class, and you won't learn programming if you don't write the programs! Now, I'd like to look at an example of one of the SumAndAverage programs. Now, there is nothing really wrong with this program, but it could still be improved.

  1. good, complete header comment
  2. Perhaps too much commenting between lines
  3. Let's look at the variable declarations. This was a common way of writing the program - I'm not picking on the authors of this one, because lots of you did it this way. You don't need to declare a new variable for every thing you do - use the ones that you already have! Compare SumAndAverage.java with SumAndAverage2.java Note use of variables, and comments that describe bigger chunks. Now, let's look at the quiz review - the slides are on O: if you want to follow along.