Enough to be Dangerous: 00000110 Things Every Beginner Needs

Download Report

Transcript Enough to be Dangerous: 00000110 Things Every Beginner Needs

Enough to be dangerous:
00000110 things every
librarian needs to know about coding
00000001: What Code Is (& Isn’t)
“code”
=
a computer programming language
=
a system of symbols and syntax which has been
designed to allow humans to more easily give
instructions to computers
“input”
“switch”
“output”
X 35 =
X 1.4 billion =
1+1=2
1+2=3
…
3+3=6
Hello, world
00000010: Important and Popular
Programming Languages
“Compiled” languages
“Interpreted” languages
• C
• Java *
• Visual Basic
•
•
•
•
JavaScript
PHP
Python
Ruby
* Java is a little different – it’s compiled into “byte code” and then more fancy stuff happens.
Why Are There so Many Different
Programming Languages?
#include <stdio.h>
int main(void) {
printf("Hello, World\n");
return 0;
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
<html>
<body>
<script>
document.write("Hello, world!");
</script>
</body>
</html>
<html>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
#!/usr/bin/python
print("Hello, World!")
puts 'Hello, world!'
Visual Basic
00000011: Common Elements
•
•
•
•
•
Variables
Expressions & Statements
Arrays
Functions
Control Flow
variables
float totalCost;
int num_bolts;
$num_bolts;
$name;
var totalCost;
var name;
expressions & statements
false
3.14
num > 0
3 * 5
totalCost = 2.50;
color = '#FF99CC’;
$name = "Jason";
totalCost = 3 * 5;
arrays
$monOutfit = “blue”;
$tuesOutfit = “pink”;
$outfits = array(“blue", “pink",
“red“, “yellow”, “green”);
echo $outfits[0];
functions
open();
f = open("path/to/file.txt")
lines = f.readlines()
f.close()
What the heck is OOP?
Classes & Objects
Classes, Objects, Methods, Properties
var aCat = new Cat();
aCat.mood = “Happy”;
aCat.age = 4;
aCat.meow();
Controlling the flow
if (things > 0){
knock_over(things);
}
else {
nap();
}
while (things > 0){
knock_over(things);
}
for (i = 0; i < 5; i++){
meow(“Nyaa”);
}
00000100: How To Evaluate Code
00000101: Where to Learn More
•
•
•
•
•
•
www.w3schools.com
www.codeacademy.com
exercism.io
tryruby.org
eloquentjavascript.net
www.bento.io/grid
00000110: Why You Should Care
CODING EXERCISE