Intro to Coding

What is computer programming?

Computer Programming

  • A set of commands a computer understands - like a recipe

 

  • Patterns for creating solutions to everyday problems.

 

  • Computer programs
    • cure diseases
    • interstellar travel
    • drive cars
    • create video games
    • make animated movies
    • build websites

Why learn to code?

  • Gives you a new angle on how to tackle problems.
  • Get a better understanding of technology.
  • Automation of tasks.
  • The possiblity to create pretty much anything you want.

Describe how to make a sandwich.

Sandwich 101

  1. Gather materials
  2. Grab loaf of bread.
  3. Grab 1 slice of bread
  4. Grab butter knife.
  5. Dip butter knife into mayo.
  6. Scoop mayo with knife.
  7. Apply mayo to slice of bread.
  8. Repeat steps 3-8 for other slice.
  9. Clean mayo off butter knife
  10. Close mayo
  11. ...
  12. ...
  13. ...
  14. Make love to sandwich with mouth

What is a programming language?

  • Set of rules that provides a way of instructing computers.
    • What operations to perform.
    • Receive an input and generate an output.
  • Describing a computation problem in a machine-readable form.
  • Like human spoken languages, programming languages:
    • Have words, symbols, grammatical rules.
    • Each language has its own rules.

C++

Python

JavaScript

Why do they have so many languages?

There are thousands of programming languages. Newer languages try to fill in the gaps older languages left.

 

Most languages are used only for certain things like:

 

  • Web development
  • Desktop apps
  • Math problems
  • Aritifical intelligence

What happens when you run a program?

  1. The code is translated into intermediary languages (high-mid-low level).
  2. That code is translated into machine code (0's and 1's)

 

 

 3. Magic

What is an algorithm?

They are just techniques used to make computers do things. No more, no less.

Find Tony Montana in a phone book

Algorithm #1

Flip through book 1 page at a time until we find Tony Montoya

Algorithm #2

Flip through book 2 pages at a time until we find Montoya. If we pass Montoya, go back a page.

Algorithm #3

Open the book to the middle, decide if Montoya is left or right and repeat.

Efficiency

Pseudocode

pick up phone book
open to middle of phone book
look at names
if Smith is among names
    call Mike
else if Smith is earlier in book
    open to middle of left half of book
    go back to step 2
else if Smith is later in book
    open to middle of right half of book
    go back to step 2
else
    quit

Programming Concepts

  • Functions
  • Conditions
  • Boolean expressions
  • Loops/Cycles

How does the internet work?

What happens when you enter google.com into your address bar?

Intro to Coding

By Nifled -

Intro to Coding

  • 114