Your SlideShare is downloading. ×
DIG1108 Lesson 8
DIG1108 Lesson 8
DIG1108 Lesson 8
DIG1108 Lesson 8
DIG1108 Lesson 8
DIG1108 Lesson 8
DIG1108 Lesson 8
DIG1108 Lesson 8
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

DIG1108 Lesson 8

207

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
207
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. INTRO TO SERVER SIDE DEVELOPMENT Week Eight Thursday, October 24, 13
  • 2. Concept Review Functions Conditionals Loops Thursday, October 24, 13
  • 3. Keywords A keyword is a word or identifier that has a particular meaning in a programming language In many languages keywords are reserved words that identify a syntactic form.They cannot be used as the names of variables or functions. Words used in control flow, like if/then/else are keywords. Operators: + - == <= and or Conditionals: if elseif else Looping: while do for foreach as Functions: function return Thursday, October 24, 13
  • 4. Keyword Examples /** * Reduce any integer to an arbitrary number between 1 and 5 * @param integer $argument greater than 0 * @return integer between 1 and 5 */ function reduce( $argument ) { if ( $argument >= 0 and $argument < 5 ) return $argument + 1; if ( $argument > 5 and $argument <= 10 ) return $argument - 5; if ( $argument == 5 ) return $argument; } Thursday, October 24, 13 return reduce( (integer) $argument / 2 );
  • 5. Rules of the Code Dojo Pair Programming: Pilot-Copilot One person is the pilot and does the typing One person is the copilot and tries to talk the solution out Everyone else is passengers (quiet while flying!) Timed for X minutes, then: The pilot becomes a passenger, the copilot becomes the pilot, a passenger becomes the new copilot Repeat until the problem is solved, everyone has been pilot and copilot, or we run out of time Thursday, October 24, 13
  • 6. Rules of the Dojo cont. Test Driven Development: Red-Green-Refactor Red: the pilot cannot write any production code until there is at least one failing test Green: the pilot should only write production code that attempts to satisfy the current failing tests, save and rerun frequently Refactor: Once all tests are passing, look for opportunities to simplify or improve readability before moving on Don't talk while Red: Only the pair can talk while the timer is running Allow the pair time to figure out the next steps on their own Thursday, October 24, 13
  • 7. Dojo Assignment Write a set of functions that all accept exactly two parameters and provide the functionality of a basic calculator: addition, subtraction, multiplication and division. Use simple assertion tests to develop in a test driven manner: assert( 'add(1,1) == 2' ); assert( 'sub(4,2) == 2' ); Ensure that your test covers positive and negative numbers for all operations and multiplication or division by zero. The program should never produce a Fatal Error, so handle error conditions internally Thursday, October 24, 13
  • 8. Retrospective What did we do well that we should try to do again? What did we do poorly that we should try to correct? Did we achieve our goals and why or why not? Thursday, October 24, 13

×