SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
Intro To Server Side Programming 
Lesson Three
Recap - What Have We Found? 
• Literals 
• boolean - True/False 
• integer 
• float - decimal numbers 
• string - text 
• array - ordered key/value pairs 
• object - literal within class 
• Null - no value
Recap Continued 
• Operators 
• Arithmetic - $newvalue = $oldvalue + 1; 
• Assignment - $newervalue = 10; 
• Comparison - $newvalue != $oldvalue; 
• String Operators 
var_dump('foo' . 'bar'); 
$a = 'foo'; a .= 'bar'; 
var_dump($a);
Order of Operations 
• PHP (and most languages) follows Operator Precedence 
rules 
• These allow for unambiguous statements 
• Parentheses can be used to override default Operator 
Precedence or to add visual clarity 
$taxable_income = $wages + $earnings - $deductions; 
$taxable_income = $wages + ( $earnings - $deductions );
Programming Blocks 
• Blocks are sections of code grouped together 
• Blocks consist of declarations and statements 
• PHP organizes statements into blocks with { } 
• Conventions dictate indentation for readability 
{$foo=$bar+$bat;echo $foo;} 
{ 
$foo = $bar + $bat; 
echo $foo; 
}
Coding Conventions 
• A set of guidelines for a specific programming language of 
recommended styles, practices & methods for each 
aspect of a program 
• Covers things like file organization, indentation, 
comments, declarations, statements, white space, 
naming conventions, practices & principles 
• This improves the readability of code and makes software 
maintenance easier. 
• Conventions enforced by humans, not compilers
Ease of Reading/Ease of Use 
• $UP=6;DN=19;$x=0; 
while(++$x<=24){echo "hour $x: "; if($x>+$UP&&$X<+$DN); 
echo "sun is up"; else echo "sun is down": echo "n"; } 
• define( 'SUNRISE', 6 ); 
define( 'SUNSET', 19 ); 
$hours = range( 1, 24); 
foreach ( $hours as $hour ) { 
// ternary operation 
$up_or_down = ( ( 
$hour >= SUNRISE and 
$hour <= SUNSET 
) ? 'up' : 'down' ); 
echo "hour {$hour}: ", 
"sun is {$up_or_down}", 
"n"; 
}
Assignment 3.1 
Good Code, Bad Code
Good Code, Bad Code 
• Log in to Github 
• Look through your forked projects for a block (~100) lines of 
code that are either very hard or very easy to read based on 
the coding style 
• Copy & paste into a file named assignment-3.1.md 
• Make a list with your partner of ways that the code style could 
be improved in each of your examples 
• Save files to share with the class. Push to Github? (https:// 
help.github.com/articles/create-a-repo)
Git and Github - Here to Help 
• Git is your robot friend that remembers what you tell it to remember, 
and only that 
• This robot recognizes when things have changed 
• It knows how to remember, just not when 
• Git can tell you what changed and when, you use comments to tell it 
(and yourself) why 
• If you ask nicely (-h or --help) the robot will help 
• This robot is well organized and can track branches of changed 
code
Basic git Commands 
• git branch - what branches are there & which am I on? 
• git status - what files have I changed or created? 
• git add (files) - consider this stuff for remembering 
• git commit (files) - I really want you to remember what I've considered via git add 
• git push [remote [branch] ] - tell the robot named "remote" (default is "origin") about 
my changes in "branch" (default is "master") 
• git fetch [remote] - ask the robot named "remote" for changes or branches that you 
don't know about yet 
• git merge [branch] - attempt to combine changes in "branch"

Más contenido relacionado

La actualidad más candente

Xslate sv perl-2013-7-11
Xslate sv perl-2013-7-11Xslate sv perl-2013-7-11
Xslate sv perl-2013-7-11
Goro Fuji
 

La actualidad más candente (20)

Xslate sv perl-2013-7-11
Xslate sv perl-2013-7-11Xslate sv perl-2013-7-11
Xslate sv perl-2013-7-11
 
4.2 PHP Function
4.2 PHP Function4.2 PHP Function
4.2 PHP Function
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
 
DIG1108 Lesson 6
DIG1108 Lesson 6DIG1108 Lesson 6
DIG1108 Lesson 6
 
Developing applications for performance
Developing applications for performanceDeveloping applications for performance
Developing applications for performance
 
PHP for hacks
PHP for hacksPHP for hacks
PHP for hacks
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
Introduction in php
Introduction in phpIntroduction in php
Introduction in php
 
PHP 5.4 New Features
PHP 5.4 New FeaturesPHP 5.4 New Features
PHP 5.4 New Features
 
Introduction To Php For Wit2009
Introduction To Php For Wit2009Introduction To Php For Wit2009
Introduction To Php For Wit2009
 
Php workshop L04 database
Php workshop L04 databasePhp workshop L04 database
Php workshop L04 database
 
Object-Oriented Programming with PHP (part 1)
Object-Oriented Programming with PHP (part 1)Object-Oriented Programming with PHP (part 1)
Object-Oriented Programming with PHP (part 1)
 
Introduction in php part 2
Introduction in php part 2Introduction in php part 2
Introduction in php part 2
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
 
Overview changes in PHP 5.4
Overview changes in PHP 5.4Overview changes in PHP 5.4
Overview changes in PHP 5.4
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Arrays &amp; functions in php
Arrays &amp; functions in phpArrays &amp; functions in php
Arrays &amp; functions in php
 
Functions in php
Functions in phpFunctions in php
Functions in php
 
05php
05php05php
05php
 
PHP - Introduction to PHP Functions
PHP -  Introduction to PHP FunctionsPHP -  Introduction to PHP Functions
PHP - Introduction to PHP Functions
 

Similar a DIG1108C Lesson3 Fall 2014

MIND sweeping introduction to PHP
MIND sweeping introduction to PHPMIND sweeping introduction to PHP
MIND sweeping introduction to PHP
BUDNET
 
Php introduction with history of php
Php introduction with history of phpPhp introduction with history of php
Php introduction with history of php
pooja bhandari
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World Domination
cPanel
 

Similar a DIG1108C Lesson3 Fall 2014 (20)

Synapseindia reviews on array php
Synapseindia reviews on array phpSynapseindia reviews on array php
Synapseindia reviews on array php
 
05php
05php05php
05php
 
05php
05php05php
05php
 
rtwerewr
rtwerewrrtwerewr
rtwerewr
 
MIND sweeping introduction to PHP
MIND sweeping introduction to PHPMIND sweeping introduction to PHP
MIND sweeping introduction to PHP
 
php fundamental
php fundamentalphp fundamental
php fundamental
 
Php introduction with history of php
Php introduction with history of phpPhp introduction with history of php
Php introduction with history of php
 
php
phpphp
php
 
PHP - Introduction to PHP
PHP -  Introduction to PHPPHP -  Introduction to PHP
PHP - Introduction to PHP
 
MongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkMongoDB's New Aggregation framework
MongoDB's New Aggregation framework
 
Class 2 - Introduction to PHP
Class 2 - Introduction to PHPClass 2 - Introduction to PHP
Class 2 - Introduction to PHP
 
Php Introduction nikul
Php Introduction nikulPhp Introduction nikul
Php Introduction nikul
 
DIG1108C Lesson 6 - Fall 2014
DIG1108C Lesson 6 - Fall 2014DIG1108C Lesson 6 - Fall 2014
DIG1108C Lesson 6 - Fall 2014
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbai
 
Refactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and PatternsRefactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and Patterns
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World Domination
 
Introduction to Programming (well, kind of.)
Introduction to Programming (well, kind of.)Introduction to Programming (well, kind of.)
Introduction to Programming (well, kind of.)
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQL
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 

Más de David Wolfpaw

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

Más de David Wolfpaw (17)

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!
 
Hooks, Actions, and Filters Oh My!
Hooks, Actions, and Filters Oh My!Hooks, Actions, and Filters Oh My!
Hooks, Actions, and Filters Oh My!
 
DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 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 4 Fall 2014
DIG1108C Lesson 4 Fall 2014DIG1108C Lesson 4 Fall 2014
DIG1108C Lesson 4 Fall 2014
 
DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014
 
Dig1108C Lesson 1 Fall 2014
Dig1108C Lesson 1 Fall 2014Dig1108C Lesson 1 Fall 2014
Dig1108C Lesson 1 Fall 2014
 
Spring Cleaning on Your Site
Spring Cleaning on Your SiteSpring Cleaning on Your Site
Spring Cleaning on Your Site
 
Becoming a Respected WordPress Developer
Becoming a Respected WordPress DeveloperBecoming a Respected WordPress Developer
Becoming a Respected WordPress Developer
 
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
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

DIG1108C Lesson3 Fall 2014

  • 1. Intro To Server Side Programming Lesson Three
  • 2. Recap - What Have We Found? • Literals • boolean - True/False • integer • float - decimal numbers • string - text • array - ordered key/value pairs • object - literal within class • Null - no value
  • 3. Recap Continued • Operators • Arithmetic - $newvalue = $oldvalue + 1; • Assignment - $newervalue = 10; • Comparison - $newvalue != $oldvalue; • String Operators var_dump('foo' . 'bar'); $a = 'foo'; a .= 'bar'; var_dump($a);
  • 4. Order of Operations • PHP (and most languages) follows Operator Precedence rules • These allow for unambiguous statements • Parentheses can be used to override default Operator Precedence or to add visual clarity $taxable_income = $wages + $earnings - $deductions; $taxable_income = $wages + ( $earnings - $deductions );
  • 5. Programming Blocks • Blocks are sections of code grouped together • Blocks consist of declarations and statements • PHP organizes statements into blocks with { } • Conventions dictate indentation for readability {$foo=$bar+$bat;echo $foo;} { $foo = $bar + $bat; echo $foo; }
  • 6. Coding Conventions • A set of guidelines for a specific programming language of recommended styles, practices & methods for each aspect of a program • Covers things like file organization, indentation, comments, declarations, statements, white space, naming conventions, practices & principles • This improves the readability of code and makes software maintenance easier. • Conventions enforced by humans, not compilers
  • 7. Ease of Reading/Ease of Use • $UP=6;DN=19;$x=0; while(++$x<=24){echo "hour $x: "; if($x>+$UP&&$X<+$DN); echo "sun is up"; else echo "sun is down": echo "n"; } • define( 'SUNRISE', 6 ); define( 'SUNSET', 19 ); $hours = range( 1, 24); foreach ( $hours as $hour ) { // ternary operation $up_or_down = ( ( $hour >= SUNRISE and $hour <= SUNSET ) ? 'up' : 'down' ); echo "hour {$hour}: ", "sun is {$up_or_down}", "n"; }
  • 8. Assignment 3.1 Good Code, Bad Code
  • 9. Good Code, Bad Code • Log in to Github • Look through your forked projects for a block (~100) lines of code that are either very hard or very easy to read based on the coding style • Copy & paste into a file named assignment-3.1.md • Make a list with your partner of ways that the code style could be improved in each of your examples • Save files to share with the class. Push to Github? (https:// help.github.com/articles/create-a-repo)
  • 10. Git and Github - Here to Help • Git is your robot friend that remembers what you tell it to remember, and only that • This robot recognizes when things have changed • It knows how to remember, just not when • Git can tell you what changed and when, you use comments to tell it (and yourself) why • If you ask nicely (-h or --help) the robot will help • This robot is well organized and can track branches of changed code
  • 11. Basic git Commands • git branch - what branches are there & which am I on? • git status - what files have I changed or created? • git add (files) - consider this stuff for remembering • git commit (files) - I really want you to remember what I've considered via git add • git push [remote [branch] ] - tell the robot named "remote" (default is "origin") about my changes in "branch" (default is "master") • git fetch [remote] - ask the robot named "remote" for changes or branches that you don't know about yet • git merge [branch] - attempt to combine changes in "branch"