- POP (principles of programming)
- Meet JavaScript
Do coding and programming mean the same thing?
- Coding: writing code
- Programming: designing a list of instructions to get something done (aka algorithm) and then coding such instructions
Last term we learned how to create the visual elements of a Web product (site, page, app etc) using HTML + CSS.
To set things in motion, to have a truly interactive experience, we need another ingredient: JavaScript.
HTML and CSS are coding languages.
JavaScript is a programming language.
Let's pretend I'm a robot and you have to program me.
-
Mission: find an object in the room, pick it up
-
I only understand these commands:
walk(steps)
turn(degrees)
grab(thing)
-
I can hear, but can only say
yes
orno
There are lots of programming languages, and they share the same core principles, and the same building blocks:
- Data → Variables
- Actions → Functions
- Decisions → Logic
Think about the robot game: which variables, functions and logic did we use?
What variables, functions and logic do you use in your everyday life (even if you don't call them so)?
the cat drinks milk
Englishde kat drinkt melk
Dutchdie Katze trinkt Milch
Germanil gatto beve latte
Italian
Can you see a pattern here?
How about this?
cat.drink(milk)
JavaScript (written by an English-speaking human)
Meet the Console
var cat = { ... }
cat.drink = function(beverage) { ... }
...
var milk = ...
...
cat.drink(milk)
- Sign up to Codio
- Create a new project
- Meet jQuery
- quick win: make something appear and disappear from the page
- second quick win: add an event listener to a button, or to the form submit
- get input values
-
Data from the Web
-
Don't care what it looks like, just give me the data (see The interface layer) and I'll make it work and look proper
-
URLs to get and send data, examples
- Facebook (www vs graph)
- Gender-api
- Mashape?
- Edamam
- TODO