Introduction to Programming Concepts (for True Beginners!)
A few quick announcements
Upcoming Events
Introduction to Javascript & jQuery
Saturday, July 26, 2014
Simple Energy
Welcome!
Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.
Some "rules"
- We are here for you!
- Every question is important
- Help each other
- Have fun
Your instructors
- Teri Charles
- Jen Skiendzielewski
Computer Programs
- Computer programs are everywhere.
- Run parts of your car.
- Let you check your email.
- Underlie that favorite app on your smartphone.
- But what are they, really?
What is a Computer Program?
- At its core, a computer program is a way of getting something done.
Programming Languages
- A programming language is basically a set of strings (letters, numbers, commands) that is changed into machine code that the computer can understand.
Programming Languages
- To develop websites, you might use HTML, JavaScript, Python, Java, PHP.
- To create databases and move information in and out of them, you might use MySQL, SQL, Dbase.
- To write applications like Microsoft Word or Adobe Acrobat, you might use C++, Java, Visual Basic
Important to Remember
- One of the most important things to remember is that when programming, you are doing something for people, and that the computer and the program mediate that. ~Michael Bolton (Software Tester extraordinaire)
Computers are dumb
- Computers can only do what they have instructions for-- and they take those instructions VERY literally.
Memory
- A computer doesn’t have a memory like we do. Sure, a computer has “memory”-- In fact it has a couple of kinds...
Kinds of Memory - ROM
-
ROM or Read-only memory is the more permanent kind.
Kinds of Memory - Storage
- More permanent, more long term memory.
Kinds of Memory - RAM
-
RAM or Random-access memory is less permanent.
Programming structures
- No matter what programming language you use, the structures that are available are fairly similar.
- Variables
- Logical structures:
Variables
- A variable is essentially a storage container for information.
- Examples:
- There are different kinds of variables based on the information that you want to store.
Integer Variables
- Integer variables are used to store positive or negative whole numbers.
String Variables
- String variables are used to store text.
Numbers as strings
- You can store a number as a string variable.
- If you store a number as a string variable, you can’t use it in any math calculations.
Boolean Variables
- Boolean variables are used to store the value TRUE or FALSE (yes or no).
Logical structures
- Now that you can store data, you probably want to do something with it.
Operators
- Operators are words or symbols that let you compare, combine, or evaulate something to produce an output.
- A few xamples:
- = (equal to)
- > (greater than)
- < (less than)
- >= (greater than or equal to)
- < = (less than or equal to)
- != (not equal)
- and
- or
If/Then/Else
- If/Then/Else statements evaluate a condition and take actions based on the result.
Let's Do Some If/Then/Else! (1/4)
If/Then/Else Excercises (2/4)
- For this excercise, we're using Ruby.
- Go to repl.it, which is an online terminal to practice writing code.
- Choose 'Ruby'.
IF Excercise (3/4)
cart_total = 8
if cart_total > 2
print "You get free shipping!"
end
="html">
- Change the numbers to see what happens.
- Change the operators (greater than, less than, etc.)
IF/THEN/ELSE Excercise (4/4)
cart_total = 8
if cart_total > 2
print "You get free shipping!"
else
print "You'll have to pay for shipping."
end
="html">
- Change the numbers to see what happens.
- Change the operators (greater than, less than, etc.)
- Change the string statements.
Loops
- A loop is a list of instructions that repeats until a certain condition is reached.
Let's Do Some Loops! (1/4)
Loop Excercise (2/4)
- For this excercise, we're using Python.
- Go to repl.it, which is an online terminal to practice writing code.
- Choose 'Python'.
Loop (while) Excercise (3/4)
papers_to_deliver = 65
while papers_to_deliver > 0:
print papers_to_deliver
papers_to_deliver = papers_to_deliver - 1
print 'Out of papers! Go home!';
="html">
- Change the numbers to see what happens.
- Change the operators (greater than, less than, etc.)
- Change the string statements.
- See the next slide that will explain what is happening in the loop (via a diagram).
Beware the Infinite Loop!
- An infinite loop is a loop that will never meet the condition to stop. It will keep going until it's used up all your computer's (or server's) memory (RAM). This is bad!
- Example: In the While loop:
- If the "papers_to_deliver = papers_to_deliver - 1" line was missing, it would keep looping because 65 is always greater than 0!
- If "papers_to_deliver = papers_to_deliver - 1" was changed to "+ 1", it would keep adding 1 to 65 forever!
Project Implementation Example
- When companies implement a new program, they take various things into consideration:
Possible languages to use:
- Python: computer program
- SQL: manage the data
- HTML/CSS: web development to share on the Internet
Programming structures:
- Variables: place to store the information such as, colors, amounts, etc.
- Detailed steps to tell the computer what to do.
- Loops: Instructions that keeps repeating as neccessary.
Coding Classes Resources (most are free) and Books
Introduction to Programming Concepts (for True Beginners!) ♥ Girl Develop It Boulder