SlideShare a Scribd company logo
INTRO TO SERVER SIDE DEVELOPMENT
Week Eight

Thursday, October 24, 13
Concept Review

Functions
Conditionals
Loops

Thursday, October 24, 13
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
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 );
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
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
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
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

More Related Content

DOC
Cis 170 c ilab 5 of 7 arrays and strings
DOC
Devry cis 170 c i lab 5 of 7 arrays and strings
PDF
Devry cis 170 c i lab 5 of 7 arrays and strings
PPTX
Algorithm and pseudo codes
PPT
Programing Fundamental
PDF
Fundamentals of programming)
Cis 170 c ilab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and strings
Algorithm and pseudo codes
Programing Fundamental
Fundamentals of programming)

What's hot (18)

PDF
A tutorial on C++ Programming
PPTX
C++ ppt
PDF
Functional Programming in Python
PPTX
scope of python
PPTX
Introduction to C programming
PDF
Python algorithm
PPTX
Functions in c
PPTX
Algorithm and psuedocode
PPTX
Domain specific languages - progressive f sharp tutorials nyc 2012
PDF
Refactoring 101
PDF
Refactoring PHP
PPS
Learn C
DOCX
Programming Global variable
PDF
Internal domain-specific languages
PPT
Basic structure of C++ program
PPTX
Functional Alchemy
PDF
Algorithm and c language
A tutorial on C++ Programming
C++ ppt
Functional Programming in Python
scope of python
Introduction to C programming
Python algorithm
Functions in c
Algorithm and psuedocode
Domain specific languages - progressive f sharp tutorials nyc 2012
Refactoring 101
Refactoring PHP
Learn C
Programming Global variable
Internal domain-specific languages
Basic structure of C++ program
Functional Alchemy
Algorithm and c language
Ad

Viewers also liked (9)

PDF
Dig1108 c lesson1
PDF
DIG1108 Lesson 5
PPTX
Spanish verbs friends
PDF
DIG1108 Lesson 4
PDF
DIG1108 Lesson 6
PDF
Dig1108 Lesson 3
DOCX
Separata protoracionalismo
PDF
Live virtual machine migration based on future prediction of resource require...
PDF
Dig1108C Lesson 2
Dig1108 c lesson1
DIG1108 Lesson 5
Spanish verbs friends
DIG1108 Lesson 4
DIG1108 Lesson 6
Dig1108 Lesson 3
Separata protoracionalismo
Live virtual machine migration based on future prediction of resource require...
Dig1108C Lesson 2
Ad

Similar to DIG1108 Lesson 8 (20)

PDF
DIG1108 Lesson 7
PDF
Dutch PHP Conference 2013: Distilled
PPTX
Building high productivity applications
PDF
Effective PHP. Part 5
PDF
Testing practicies not only in scala
PPTX
Web tech: lecture 5
PDF
learn basic to advance C Programming Notes
PPT
Webinar: Whats New in Java 8 with Develop Intelligence
PPTX
542996051-Program-Logic-Formulation.pptx
PDF
4. programing 101
PPT
Agile development with Ruby
PDF
Introduction to functional programming
PPT
Software development slides
PPSX
Complete C++ programming Language Course
PPT
Verilog Tasks and functions
PPTX
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
KEY
A-Z Intro To Rails
PDF
A Z Introduction To Ruby On Rails
PDF
Continuous Security Testing
DIG1108 Lesson 7
Dutch PHP Conference 2013: Distilled
Building high productivity applications
Effective PHP. Part 5
Testing practicies not only in scala
Web tech: lecture 5
learn basic to advance C Programming Notes
Webinar: Whats New in Java 8 with Develop Intelligence
542996051-Program-Logic-Formulation.pptx
4. programing 101
Agile development with Ruby
Introduction to functional programming
Software development slides
Complete C++ programming Language Course
Verilog Tasks and functions
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
A-Z Intro To Rails
A Z Introduction To Ruby On Rails
Continuous Security Testing

Recently uploaded (20)

PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
project resource management chapter-09.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Hybrid model detection and classification of lung cancer
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
A Presentation on Artificial Intelligence
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
A Presentation on Touch Screen Technology
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
Web App vs Mobile App What Should You Build First.pdf
Tartificialntelligence_presentation.pptx
A comparative analysis of optical character recognition models for extracting...
project resource management chapter-09.pdf
A comparative study of natural language inference in Swahili using monolingua...
Hybrid model detection and classification of lung cancer
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Zenith AI: Advanced Artificial Intelligence
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
WOOl fibre morphology and structure.pdf for textiles
A Presentation on Artificial Intelligence
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A Presentation on Touch Screen Technology
TLE Review Electricity (Electricity).pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
DP Operators-handbook-extract for the Mautical Institute
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Enhancing emotion recognition model for a student engagement use case through...
Group 1 Presentation -Planning and Decision Making .pptx

DIG1108 Lesson 8

  • 1. INTRO TO SERVER SIDE DEVELOPMENT Week Eight 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