










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











































Lecture 44
During the last lecture we discussed Graphics & Animation
Images in JavaScript
Image Preloading
Animated Gifs
Today’s Goals (Programming Methodology)
programming
methodology?
10
good A methodology that enables the lowest-cost and on- schedule development of programs that are correct, easy to maintain & enhance
11
A program with correct syntax & semantics
13
swapFlag = true ;
while ( swapFlag == true ) {
swapFlag = false ; for ( k = 0 ; k < ht.length - 1 ; k++ ) { if ( ht[ k ] < ht[ k + 1 ] ) { temp = ht[ k + 1 ] ; ht[ k + 1 ] = ht[ k ] ; ht[ k ] = temp ; swapFlag = true ; } }
}
How can we make it more readable? What is its most complex aspect?
Bubble Sort
14
for ( j = 0 ; j < 100000 ; j++ ) {
for ( k = 0 ; k < ht.length - 1 ; k++ ) { if ( ht[ k ] < ht[ k + 1 ] ) { temp = ht[ k + 1 ] ; ht[ k + 1 ] = ht[ k ] ; ht[ k ] = temp ;
} Docsity.com
guidelines
Design Guidelines
Comments let the
code speak for
itself!
No: Get it Else assume it. State it explicitly