SlideShare a Scribd company logo
UNTANGLING THE WEB
FALL 2017 WEEK 8 – PROJECT 2, DEEPER INTO DATABASES, ASYNCHRONOUS
JAVASCRIPT, NOTES ABOUT NODE
AGENDA
• Project 2 presentations
• Asynchronous javascript
• Promises
• Async/await
• Databases – SQL vs. NoSQL
• Looking more at NodeJS
• Routes and views
• How to render to the client
• A more detailed look at Cloudant programming
• Getting ready for project 3
PROJECT 2 PRESENTATIONS
• Keep it under 5 minutes
• Show off all the functionality in your front end
• Talk about the business model, including value proposition (pains and gains)
• Make sure you have emailed me
• A link to github
• A link to the running website
• SEO, business model canvas, value proposition canvas links
REVIEW OF FUNCTIONS
• A block of named code able to be called from other places
• Variables in js are untyped, so they can hold function references
• Parameters to a function can also be functions
• Anonymous function – a function that is not given a name but is rather just passed to another function
A FEW UTILITY FUNCTIONS WE’LL RUN INTO TODAY
• setTimeout(function, delay in ms) – delay and then call a function
• Math.random – generate a random number
• Math.ceil – round up
ASYNCHRONOUS JAVASCRIPT
• What’s a callback? You’ve used them before! In the maps example
• What’s a promise?
• What’s a promise chain?
• Anyone come across async/await?
CALLBACK EXAMPLE
• https://jsfiddle.net/3cew460a/
• https://www.youtube.com/watch?v=QqiNn3GfTMc
PROMISE EXAMPLE
• https://jsfiddle.net/s3m4xv1o/
• https://www.youtube.com/watch?v=VmMDG6h-bVQ
PROMISE CHAINING EXAMPLE
• https://jsfiddle.net/8Lf4zof3/
• https://www.youtube.com/watch?v=a1cTkiNuEwM
ASYNC/AWAIT
• It is an ES7 feature, so will have to use babel as a transpiler if we want to use it
• https://www.youtube.com/watch?v=COKdtOgopWQ
DATABASES
• SQL versus noSQL
• Flavours of SQL and noSQL
• Why use a database at all?
• Advanced database topics
• Schema design
• Replication
• Transactions
SQL VERSUS NOSQL
• SQL – Structured Query Language
• Relational database
• Use when you need multiple tables and
when you need to construct queries that
span those tables
• More functional than flat databases, but
also slower and more complex
• Can exist in either client or server
flavours
 NoSQL databases – anything that isn’t relational!
 MongoDB is a popular server-based flavor
 Redis is a local memory-mapped flavor
 Cloudant, couchDB, etc. there are many, many
types
 All are good for rapid, flat table access
 Avoid the complexities of relational databases
while still preserving the benefits
LOCAL SQL EXAMPLE – CARS DATABASE
• https://jsfiddle.net/m5rh3a83/1/
• (for more details see here: https://www.tutorialspoint.com/html5/html5_web_sql.htm)
MORE REALISTIC SQL EXAMPLE
• http://sqlfiddle.com/#!9/1d643/23
• (video help here: https://www.youtube.com/watch?v=DDVOMRvyAS4)
SQLZOO
• http://sqlzoo.net/
• Go do some exercises!
• (https://www.sqlteaching.com is an alternative if you want some more exercises)
MULTIPLE TABLES
• You will usually have more than one table
• If you have only one table, it is time to consider a NoSQL database
• Look on SQLZoo for the JOINS sections and make sense of that
• http://sqlzoo.net/wiki/The_JOIN_operation
• If you want more complex examples on a real database you can play here:
• http://data.stackexchange.com/stackoverflow/queries
• More about joins
• https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/
POSTGRESSQL ON BLUEMIX
• Here’s a decent started project: https://github.com/IBM-Bluemix/compose-postgresql-helloworld-
nodejs
FOR PROJECT 3
• You’ll have to decide whether to use a flat database, like the cloudant example we walked through last
week, or a relational database like postgresSQL
• How do you make that decision?
• Complexity of your data
• Performance requirements
• Development difficulty
NODEJS
• We’ll look through:
• Package.json (review)
• App.js (the webserver)
• Routes and views
CONCEPTS (ALSO TO BE COVERED IN MORE DETAIL
NEXT WEEK)
• JSON and how to parse it
• http get, put, post, delete, etc. (reminder about CRUD pattern)
• Nodejs
• Require statement
• App.js
HOMEWORK 8 (DUE START OF CLASS NOV 1ST)
• Submit a github link with a file containing the query and results for each question
• Using the stackoverflow database here: http://data.stackexchange.com/stackoverflow/queries
• List the oldest 10 Victoria, BC users and order them by age.
• List the top 10 highest reputation users in Victoria that have answered questions with the tag javascript.
• List the top 5 Victoria developers by accepted answer percentage
• List the top 10 Victoria developers by accepted answer percentage on questions with the tag javascript
PROJECT 3
• If anyone needs to change groups get it figured out this week
• You’ll need to implement a database backend for your project and a chatbot
• Database should have new item, search, and delete (optionally edit) from the ui
• You’ll need to host your project on bluemix
• You’ll need to show a working demo of project 2 hooked up to these backend services

More Related Content

PPTX
Untangling - fall2017 - week 7
PPTX
Untangling - fall2017 - week 9
PPTX
Untangling spring week11
PPTX
Untangling spring week12
PPTX
Untangling - fall2017 - week 10
PPTX
Untangling11
PPTX
Untangling spring week10
PPTX
Untangling fall2017 week1
Untangling - fall2017 - week 7
Untangling - fall2017 - week 9
Untangling spring week11
Untangling spring week12
Untangling - fall2017 - week 10
Untangling11
Untangling spring week10
Untangling fall2017 week1

What's hot (20)

PPTX
Untangling spring week6
PPTX
Untangling the web week 2 - SEO
PPTX
Untangling spring week5
PPTX
Untangling spring week9
PPTX
Untangling the web11
PPTX
Untangling fall2017 week2
PPTX
Untangling spring week4
PPTX
Untangling spring week8
PPTX
Untangling spring week2
PDF
Engage 2019: The good, the bad and the ugly: a not so objective view on front...
PDF
Modern javascript
PPTX
Untangling the web - fall2017 - class 4
PPTX
Untangling - fall2017 - week6
PDF
Why use Go for web development?
PDF
Engage 2019: Modernising Your Domino and XPages Applications
PPTX
How NOT to get lost in the current JavaScript landscape
PDF
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
PPTX
Engage 2019 Software documentation is fun if you have the right tools: Introd...
PDF
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
PPTX
A Personal Journey
Untangling spring week6
Untangling the web week 2 - SEO
Untangling spring week5
Untangling spring week9
Untangling the web11
Untangling fall2017 week2
Untangling spring week4
Untangling spring week8
Untangling spring week2
Engage 2019: The good, the bad and the ugly: a not so objective view on front...
Modern javascript
Untangling the web - fall2017 - class 4
Untangling - fall2017 - week6
Why use Go for web development?
Engage 2019: Modernising Your Domino and XPages Applications
How NOT to get lost in the current JavaScript landscape
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
Engage 2019 Software documentation is fun if you have the right tools: Introd...
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
A Personal Journey
Ad

Similar to Untangling - fall2017 - week 8 (20)

PPTX
Untangling the web9
PDF
Learning Nodejs For Net Developers Harry Cummings
PDF
Download full ebook of Learning Node Shelley Powers instant download pdf
PDF
Full Stack Developer Course | Infinite Graphix Technologies
PPTX
Intro to node and mongodb 1
PPT
Java script
PPTX
Untangling6
PDF
Node js projects
PDF
Learn backend java script
PDF
Node.js
PPTX
Monster JavaScript Course - 50+ projects and applications
PDF
PDF
Node.js #digpen presentation
PPT
Introduction to mean and mern || Event by DSC UNIDEB
PPTX
JavaScript: Creative Coding for Browsers
KEY
SSJS, NoSQL, GAE and AppengineJS
PDF
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
PPTX
Intro To Node.js
PPTX
NodeJS
PDF
Node.JS briefly introduced
Untangling the web9
Learning Nodejs For Net Developers Harry Cummings
Download full ebook of Learning Node Shelley Powers instant download pdf
Full Stack Developer Course | Infinite Graphix Technologies
Intro to node and mongodb 1
Java script
Untangling6
Node js projects
Learn backend java script
Node.js
Monster JavaScript Course - 50+ projects and applications
Node.js #digpen presentation
Introduction to mean and mern || Event by DSC UNIDEB
JavaScript: Creative Coding for Browsers
SSJS, NoSQL, GAE and AppengineJS
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Intro To Node.js
NodeJS
Node.JS briefly introduced
Ad

More from Derek Jacoby (10)

PPTX
Untangling - fall2017 - week5
PPTX
Untangling the web fall2017 class 3
PPTX
Untangling fall2017 week2_try2
PPTX
Untangling spring week7
PPTX
Untangling spring week3
PPTX
Untangling spring week1
PPTX
Untangling the web10
PPTX
Untangling8
PPTX
Untangling7
PPTX
Untangling4
Untangling - fall2017 - week5
Untangling the web fall2017 class 3
Untangling fall2017 week2_try2
Untangling spring week7
Untangling spring week3
Untangling spring week1
Untangling the web10
Untangling8
Untangling7
Untangling4

Recently uploaded (20)

PDF
Insiders guide to clinical Medicine.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Pharma ospi slides which help in ospi learning
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPH.pptx obstetrics and gynecology in nursing
Insiders guide to clinical Medicine.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Renaissance Architecture: A Journey from Faith to Humanism
O7-L3 Supply Chain Operations - ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Week 4 Term 3 Study Techniques revisited.pptx
RMMM.pdf make it easy to upload and study
Final Presentation General Medicine 03-08-2024.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pharmacology of Heart Failure /Pharmacotherapy of CHF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Pharma ospi slides which help in ospi learning
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Microbial disease of the cardiovascular and lymphatic systems
Cell Types and Its function , kingdom of life
PPH.pptx obstetrics and gynecology in nursing

Untangling - fall2017 - week 8

  • 1. UNTANGLING THE WEB FALL 2017 WEEK 8 – PROJECT 2, DEEPER INTO DATABASES, ASYNCHRONOUS JAVASCRIPT, NOTES ABOUT NODE
  • 2. AGENDA • Project 2 presentations • Asynchronous javascript • Promises • Async/await • Databases – SQL vs. NoSQL • Looking more at NodeJS • Routes and views • How to render to the client • A more detailed look at Cloudant programming • Getting ready for project 3
  • 3. PROJECT 2 PRESENTATIONS • Keep it under 5 minutes • Show off all the functionality in your front end • Talk about the business model, including value proposition (pains and gains) • Make sure you have emailed me • A link to github • A link to the running website • SEO, business model canvas, value proposition canvas links
  • 4. REVIEW OF FUNCTIONS • A block of named code able to be called from other places • Variables in js are untyped, so they can hold function references • Parameters to a function can also be functions • Anonymous function – a function that is not given a name but is rather just passed to another function
  • 5. A FEW UTILITY FUNCTIONS WE’LL RUN INTO TODAY • setTimeout(function, delay in ms) – delay and then call a function • Math.random – generate a random number • Math.ceil – round up
  • 6. ASYNCHRONOUS JAVASCRIPT • What’s a callback? You’ve used them before! In the maps example • What’s a promise? • What’s a promise chain? • Anyone come across async/await?
  • 7. CALLBACK EXAMPLE • https://jsfiddle.net/3cew460a/ • https://www.youtube.com/watch?v=QqiNn3GfTMc
  • 8. PROMISE EXAMPLE • https://jsfiddle.net/s3m4xv1o/ • https://www.youtube.com/watch?v=VmMDG6h-bVQ
  • 9. PROMISE CHAINING EXAMPLE • https://jsfiddle.net/8Lf4zof3/ • https://www.youtube.com/watch?v=a1cTkiNuEwM
  • 10. ASYNC/AWAIT • It is an ES7 feature, so will have to use babel as a transpiler if we want to use it • https://www.youtube.com/watch?v=COKdtOgopWQ
  • 11. DATABASES • SQL versus noSQL • Flavours of SQL and noSQL • Why use a database at all? • Advanced database topics • Schema design • Replication • Transactions
  • 12. SQL VERSUS NOSQL • SQL – Structured Query Language • Relational database • Use when you need multiple tables and when you need to construct queries that span those tables • More functional than flat databases, but also slower and more complex • Can exist in either client or server flavours  NoSQL databases – anything that isn’t relational!  MongoDB is a popular server-based flavor  Redis is a local memory-mapped flavor  Cloudant, couchDB, etc. there are many, many types  All are good for rapid, flat table access  Avoid the complexities of relational databases while still preserving the benefits
  • 13. LOCAL SQL EXAMPLE – CARS DATABASE • https://jsfiddle.net/m5rh3a83/1/ • (for more details see here: https://www.tutorialspoint.com/html5/html5_web_sql.htm)
  • 14. MORE REALISTIC SQL EXAMPLE • http://sqlfiddle.com/#!9/1d643/23 • (video help here: https://www.youtube.com/watch?v=DDVOMRvyAS4)
  • 15. SQLZOO • http://sqlzoo.net/ • Go do some exercises! • (https://www.sqlteaching.com is an alternative if you want some more exercises)
  • 16. MULTIPLE TABLES • You will usually have more than one table • If you have only one table, it is time to consider a NoSQL database • Look on SQLZoo for the JOINS sections and make sense of that • http://sqlzoo.net/wiki/The_JOIN_operation • If you want more complex examples on a real database you can play here: • http://data.stackexchange.com/stackoverflow/queries • More about joins • https://blog.codinghorror.com/a-visual-explanation-of-sql-joins/
  • 17. POSTGRESSQL ON BLUEMIX • Here’s a decent started project: https://github.com/IBM-Bluemix/compose-postgresql-helloworld- nodejs
  • 18. FOR PROJECT 3 • You’ll have to decide whether to use a flat database, like the cloudant example we walked through last week, or a relational database like postgresSQL • How do you make that decision? • Complexity of your data • Performance requirements • Development difficulty
  • 19. NODEJS • We’ll look through: • Package.json (review) • App.js (the webserver) • Routes and views
  • 20. CONCEPTS (ALSO TO BE COVERED IN MORE DETAIL NEXT WEEK) • JSON and how to parse it • http get, put, post, delete, etc. (reminder about CRUD pattern) • Nodejs • Require statement • App.js
  • 21. HOMEWORK 8 (DUE START OF CLASS NOV 1ST) • Submit a github link with a file containing the query and results for each question • Using the stackoverflow database here: http://data.stackexchange.com/stackoverflow/queries • List the oldest 10 Victoria, BC users and order them by age. • List the top 10 highest reputation users in Victoria that have answered questions with the tag javascript. • List the top 5 Victoria developers by accepted answer percentage • List the top 10 Victoria developers by accepted answer percentage on questions with the tag javascript
  • 22. PROJECT 3 • If anyone needs to change groups get it figured out this week • You’ll need to implement a database backend for your project and a chatbot • Database should have new item, search, and delete (optionally edit) from the ui • You’ll need to host your project on bluemix • You’ll need to show a working demo of project 2 hooked up to these backend services