SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
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"

Contenu connexe

Tendances

Tendances (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
 

Similaire à DIG1108C Lesson3 Fall 2014

Synapseindia reviews on array php
Synapseindia reviews on array phpSynapseindia reviews on array php
Synapseindia reviews on array phpsaritasingh19866
 
MIND sweeping introduction to PHP
MIND sweeping introduction to PHPMIND sweeping introduction to PHP
MIND sweeping introduction to PHPBUDNET
 
php fundamental
php fundamentalphp fundamental
php fundamentalzalatarunk
 
Php introduction with history of php
Php introduction with history of phpPhp introduction with history of php
Php introduction with history of phppooja bhandari
 
MongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkMongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkChris Westin
 
Class 2 - Introduction to PHP
Class 2 - Introduction to PHPClass 2 - Introduction to PHP
Class 2 - Introduction to PHPAhmed Swilam
 
Php Introduction nikul
Php Introduction nikulPhp Introduction nikul
Php Introduction nikulNikul Shah
 
DIG1108C Lesson 6 - Fall 2014
DIG1108C Lesson 6 - Fall 2014DIG1108C Lesson 6 - Fall 2014
DIG1108C Lesson 6 - Fall 2014David Wolfpaw
 
Refactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and PatternsRefactoring @ Mindvalley: Smells, Techniques and Patterns
Refactoring @ Mindvalley: Smells, Techniques and PatternsTristan Gomez
 
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 DeckrICh morrow
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World DominationcPanel
 
Introduction to Programming (well, kind of.)
Introduction to Programming (well, kind of.)Introduction to Programming (well, kind of.)
Introduction to Programming (well, kind of.)Julie Meloni
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQLGrant Fritchey
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
 

Similaire à 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 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 

Plus de David Wolfpaw

Running Your Service Business on WordPress
Running Your Service Business on WordPressRunning Your Service Business on WordPress
Running Your Service Business on WordPressDavid Wolfpaw
 
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 MelegariDavid Wolfpaw
 
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!David Wolfpaw
 
Hooks, Actions, and Filters Oh My!
Hooks, Actions, and Filters Oh My!Hooks, Actions, and Filters Oh My!
Hooks, Actions, and Filters Oh My!David Wolfpaw
 
DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014David Wolfpaw
 
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 2014David Wolfpaw
 
DIG1108C Lesson 5 Fall 2014
DIG1108C Lesson 5 Fall 2014DIG1108C Lesson 5 Fall 2014
DIG1108C Lesson 5 Fall 2014David Wolfpaw
 
DIG1108C Lesson 4 Fall 2014
DIG1108C Lesson 4 Fall 2014DIG1108C Lesson 4 Fall 2014
DIG1108C Lesson 4 Fall 2014David Wolfpaw
 
DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014DIG1108C Lesson 2 Fall 2014
DIG1108C Lesson 2 Fall 2014David Wolfpaw
 
Dig1108C Lesson 1 Fall 2014
Dig1108C Lesson 1 Fall 2014Dig1108C Lesson 1 Fall 2014
Dig1108C Lesson 1 Fall 2014David Wolfpaw
 
Spring Cleaning on Your Site
Spring Cleaning on Your SiteSpring Cleaning on Your Site
Spring Cleaning on Your SiteDavid Wolfpaw
 
Becoming a Respected WordPress Developer
Becoming a Respected WordPress DeveloperBecoming a Respected WordPress Developer
Becoming a Respected WordPress DeveloperDavid Wolfpaw
 
Beginner Workshop WCMIA
Beginner Workshop WCMIABeginner Workshop WCMIA
Beginner Workshop WCMIADavid Wolfpaw
 
Basic word press development
Basic word press developmentBasic word press development
Basic word press developmentDavid Wolfpaw
 
Geekaboo presentation 2013 - Brett Napoli
Geekaboo presentation 2013 - Brett NapoliGeekaboo presentation 2013 - Brett Napoli
Geekaboo presentation 2013 - Brett NapoliDavid Wolfpaw
 
Organization methods in word press
Organization methods in word pressOrganization methods in word press
Organization methods in word pressDavid Wolfpaw
 
WordPress tools and plugins
WordPress tools and pluginsWordPress tools and plugins
WordPress tools and pluginsDavid Wolfpaw
 

Plus 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
 

Dernier

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Dernier (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

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"