SlideShare a Scribd company logo
1 of 13
Download to read offline
Intro to Server Side Programming 
Week Four
Basic Git Workflow Review 
• Save and test your work often. 
• If it tests ok, add then commit your work (git add & git commit 
respectively) 
• Need to work alone? Work on a branch (git branch & git checkout or git 
checkout -b for short) 
• Done or need to share your work? Send your work to remote (git push) 
• Back to work? Get the latest code (git fetch), then include it (git merge or 
git rebase) 
• Need to make a whole project your own? Copy it (git clone), then add it 
as remote and (git pull)
Conditional Logic 
If This, Then That
• Conditional Logic - In computer science, conditional statements, 
conditional expressions and conditional constructs are 
features of a programming language which perform different 
computations or actions depending on whether a 
programmer-specified boolean condition evaluates to true or 
false. Apart from the case of branch predication, this is always 
achieved by selectively altering the control flow based on some 
condition. 
• Computer Science depends heavily on Boolean Algebra for 
conditional logic. 
• "If this thing is true, then do this. If not, do that."
Guarding Expressions 
• Guarding - In computer programming, a guard is a boolean expression that must 
evaluate to true if the program execution is to continue in the branch in 
question.Boolean expressions in conditional statements usually also fit this definition of 
a guard although they are called conditions. 
if( ! isset($something) ) $something = 'some value'; 
do_something_with($something); 
$something = ( isset($something) ? $something : 'default' ); 
$something = do_something_important() or die('error message'); 
use_the_variable($something); 
$something = do_something_important(); 
if ( $something == false ) die('error message');
Can I go to the Park? 
• Boolean values can be combined with logical operators 
• The order in which conditionals are evaluated matters 
$permission_from_mom = $mom->request('go_to_park');$permission_from_dad = 
$dad->request('go_to_park'); 
$permisson_from_both = ( 
$permission_from_mom and $permission_from_dad 
); 
$permisson_from_either = ( 
$permission_from_mom or $permission_from_dad 
); 
$permisson_from_one = ( 
$permission_from_mom xor $permission_from_dad 
);
Workflow Diagrams & Truth Tables
Nested Conditionals 
• Conditionals can also be nested: 
if ( empty($handedness) ) { 
if ( test_lefty() and test_righty() ) 
$handedness = 'Ambidextrous'; 
else if ( test_lefty() ) 
$handedness = 'Left Handed'; 
else if ( test_righty() ) 
$handedness = 'Right Handed'; 
else $handedness = 'You Have No Hands!'; 
} 
echo $handedness;
Nested More! 
• Nested conditionals can be written multiple ways: 
if ( empty($handedness) ) { 
if ( test_lefty() ) { 
if( test_righty() ) 
$handedness = 'Ambidextrous'; 
else $handedness = ' Left Handed'; 
} 
else if ( test_righty() ) 
$handedness = 'Right Handed'; 
else $handedness = 'You Have No Hands!'; 
} 
echo $handedness;
Assignment 4.1 
Diagramming Conditional Logic
Diagramming Logic 
• Partner up and find a project with some if-then-else logic to examine, 
particularly nested logic 
• Individually, sketch a simple workflow diagram of the logic and assemble a truth 
table. Discuss any differences that you may have together when done 
• Collaborate to make one workflow diagram and truth table to show and explain 
to the class
Assignment 4.2 
Branching Logic in WordPress

More Related Content

Similar to DIG1108C Lesson 4 Fall 2014

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
Jarod Ferguson
 

Similar to DIG1108C Lesson 4 Fall 2014 (20)

PHP Unit Testing
PHP Unit TestingPHP Unit Testing
PHP Unit Testing
 
DIG1108C Lesson3 Fall 2014
DIG1108C Lesson3 Fall 2014DIG1108C Lesson3 Fall 2014
DIG1108C Lesson3 Fall 2014
 
Refactoring at Large
Refactoring at LargeRefactoring at Large
Refactoring at Large
 
Php Inspections (EA Extended): if-conditions optimization
Php Inspections (EA Extended): if-conditions optimizationPhp Inspections (EA Extended): if-conditions optimization
Php Inspections (EA Extended): if-conditions optimization
 
Django Pro ORM
Django Pro ORMDjango Pro ORM
Django Pro ORM
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
 
Google guava
Google guavaGoogle guava
Google guava
 
Php Chapter 1 Training
Php Chapter 1 TrainingPhp Chapter 1 Training
Php Chapter 1 Training
 
Jedi Mind Tricks in Git
Jedi Mind Tricks in GitJedi Mind Tricks in Git
Jedi Mind Tricks in Git
 
JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by example
 
Developer testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing FanaticDeveloper testing 101: Become a Testing Fanatic
Developer testing 101: Become a Testing Fanatic
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
Testing the Untestable
Testing the UntestableTesting the Untestable
Testing the Untestable
 
Defensive Apex Programming
Defensive Apex ProgrammingDefensive Apex Programming
Defensive Apex Programming
 

More from David Wolfpaw

DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014
David Wolfpaw
 

More from David Wolfpaw (13)

Running Your Service Business on WordPress
Running Your Service Business on WordPressRunning Your Service Business on WordPress
Running Your Service Business on WordPress
 
Stop the Green Light Panic - Lisa Melegari
Stop the Green Light Panic - Lisa MelegariStop the Green Light Panic - Lisa Melegari
Stop the Green Light Panic - Lisa Melegari
 
php[world] Hooks, Actions and Filters Oh My!
php[world] Hooks, Actions and Filters Oh My!php[world] Hooks, Actions and Filters Oh My!
php[world] Hooks, Actions and Filters Oh My!
 
DIG1108C Lesson 6 - Fall 2014
DIG1108C Lesson 6 - Fall 2014DIG1108C Lesson 6 - Fall 2014
DIG1108C Lesson 6 - Fall 2014
 
WordPress as a Minimum Viable Product - WordCamp Tampa 2014
WordPress as a Minimum Viable Product - WordCamp Tampa 2014WordPress as a Minimum Viable Product - WordCamp Tampa 2014
WordPress as a Minimum Viable Product - WordCamp Tampa 2014
 
DIG1108C Lesson 5 Fall 2014
DIG1108C Lesson 5 Fall 2014DIG1108C Lesson 5 Fall 2014
DIG1108C Lesson 5 Fall 2014
 
DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014
 
Spring Cleaning on Your Site
Spring Cleaning on Your SiteSpring Cleaning on Your Site
Spring Cleaning on Your Site
 
Beginner Workshop WCMIA
Beginner Workshop WCMIABeginner Workshop WCMIA
Beginner Workshop WCMIA
 
Basic word press development
Basic word press developmentBasic word press development
Basic word press development
 
Geekaboo presentation 2013 - Brett Napoli
Geekaboo presentation 2013 - Brett NapoliGeekaboo presentation 2013 - Brett Napoli
Geekaboo presentation 2013 - Brett Napoli
 
Organization methods in word press
Organization methods in word pressOrganization methods in word press
Organization methods in word press
 
WordPress tools and plugins
WordPress tools and pluginsWordPress tools and plugins
WordPress tools and plugins
 

Recently uploaded

Recently uploaded (20)

Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

DIG1108C Lesson 4 Fall 2014

  • 1. Intro to Server Side Programming Week Four
  • 2. Basic Git Workflow Review • Save and test your work often. • If it tests ok, add then commit your work (git add & git commit respectively) • Need to work alone? Work on a branch (git branch & git checkout or git checkout -b for short) • Done or need to share your work? Send your work to remote (git push) • Back to work? Get the latest code (git fetch), then include it (git merge or git rebase) • Need to make a whole project your own? Copy it (git clone), then add it as remote and (git pull)
  • 3. Conditional Logic If This, Then That
  • 4.
  • 5. • Conditional Logic - In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. Apart from the case of branch predication, this is always achieved by selectively altering the control flow based on some condition. • Computer Science depends heavily on Boolean Algebra for conditional logic. • "If this thing is true, then do this. If not, do that."
  • 6. Guarding Expressions • Guarding - In computer programming, a guard is a boolean expression that must evaluate to true if the program execution is to continue in the branch in question.Boolean expressions in conditional statements usually also fit this definition of a guard although they are called conditions. if( ! isset($something) ) $something = 'some value'; do_something_with($something); $something = ( isset($something) ? $something : 'default' ); $something = do_something_important() or die('error message'); use_the_variable($something); $something = do_something_important(); if ( $something == false ) die('error message');
  • 7. Can I go to the Park? • Boolean values can be combined with logical operators • The order in which conditionals are evaluated matters $permission_from_mom = $mom->request('go_to_park');$permission_from_dad = $dad->request('go_to_park'); $permisson_from_both = ( $permission_from_mom and $permission_from_dad ); $permisson_from_either = ( $permission_from_mom or $permission_from_dad ); $permisson_from_one = ( $permission_from_mom xor $permission_from_dad );
  • 8. Workflow Diagrams & Truth Tables
  • 9. Nested Conditionals • Conditionals can also be nested: if ( empty($handedness) ) { if ( test_lefty() and test_righty() ) $handedness = 'Ambidextrous'; else if ( test_lefty() ) $handedness = 'Left Handed'; else if ( test_righty() ) $handedness = 'Right Handed'; else $handedness = 'You Have No Hands!'; } echo $handedness;
  • 10. Nested More! • Nested conditionals can be written multiple ways: if ( empty($handedness) ) { if ( test_lefty() ) { if( test_righty() ) $handedness = 'Ambidextrous'; else $handedness = ' Left Handed'; } else if ( test_righty() ) $handedness = 'Right Handed'; else $handedness = 'You Have No Hands!'; } echo $handedness;
  • 11. Assignment 4.1 Diagramming Conditional Logic
  • 12. Diagramming Logic • Partner up and find a project with some if-then-else logic to examine, particularly nested logic • Individually, sketch a simple workflow diagram of the logic and assemble a truth table. Discuss any differences that you may have together when done • Collaborate to make one workflow diagram and truth table to show and explain to the class
  • 13. Assignment 4.2 Branching Logic in WordPress