Think like a programmer

Learn how to programmatically create and problem solve using Scratch as a visual tool. This class introduces basic programming principles.

Prep

CPNT-262 Course High Level Overview

  • Objectives:
    • to learn fundamentals about computer programming
    • to be able to build websites using modern technologies
    • to create a foundation for your future in tech
    • Client and server programming
    • Javascript syntax and patterns
  • How to be successful at programming:
    • focus on problem solving
    • spending enough time practicing to understand concepts
    • collaborate with others
    • avoid comparing yourself to others
    • don’t copy/paste code without understanding how it works
  • Scrum Teams
    • Scrum Standup Sessions will take place at the beginning of open lab
    • You’ll have 1 team for days 1-10 and another for 11-20
    • Scrum Standup Sessions shouldn’t last more than 15 minutes
    • Answer the following:
      • what I did yesterday
      • what I’m doing today
      • am I blocked by anything
class intro slide

Computational Thinking

Lecture Slides

computational thinking slides

Key Takeaways

  • Words, images, numbers… everything that we see on computers are representations of binary values
  • Programming logic can be viewed in flowcharts
  • Variables are “buckets” that hold values
  • When we think programmatically, we are breaking complex tasks down into small steps and dictating the results at each given step

Flow Charts

Slides - Flowcharts

Activity: Algorithms in Everyday Life (30 minutes)

Focus: Anything goes! (within a sharable school context)

  1. Create a flowchart of something that you enjoy doing using the instructions linked below (15 minutes)
  2. Briefly discuss your findings:
    • What activity did you document? What step(s) did you break down into micro steps?
    • Walk each other through your steps
    • When broken into micro steps, did you underestimate how complex the activity actually was?

Instructions Link

activity qr code

Pseudo Code

  • Pseudocode is used to think through the steps of an algorithm
    • it exists between the flowcharting and code implementation phases
    • normally pseudocode is written in comments in your actual code
    • when pseudocoding, you move from how a human thinks to how a computer thinks
      • your pseudocode will look like a number of things along this spectrum
  • Geeks for Geeks Article

Activity: Program an Intersection

Each scrum team will get a part of the intersection to program. The options are:
  • Vehicles
  • Traffic lights
  • Intersection
  • General Rules
Your goal is to figure out and document the following of your section:
  • relevant variables (ie: in this example, a passenger is not an important factor)
  • control flow logic (are there actions that are repeated? if/else conditional choices to be made? - these need to be mapped out)
  • rules that cannot be broken
Presentation

Each team will get a chance to discuss their part of the program, and each member of each team must present a part of the information.

  • explain the problems that you identified and needed to solve
    • outline variables and their properties
    • describe control flow logic
    • explain rules, their conditions, and outcomes
  • Note that we will be following up with this tomorrow where the different parts of the program will be put together

Brief Introduction to Scratch

Scratch is a visual programming language. While mostly used to teach kids to code, it serves as a brilliant way to familiarize with the fundamental elements of programming. We will do one small assignment using scratch, the objective of this assignment is to build with programming concepts like: variables, conditional logic, iterative logic (aka: loops), and functions

Scratch is mostly used to create small video games and animations/short animated movies. But you can do quite a bit with it.

Workflow

this applies to pretty much any programming, but is great to practice with scratch in particular.

  1. Plan out what your program is going to do (or a part of it if you’ve already broken it down)
  2. Break the program out into parts and think about what parts are dependant on the others (this will help you decide what to do first)
  3. Plan the logic for the part that makes sense to start with
  4. Do one of the following:
    • code the logic for that part
    • plan out the logic for the other parts
  5. Do the other task from step 4
  6. Test, evaluate, document results
  7. Solve bugs
  8. Clean up code and repeat

Today's Achievement

Graded Activity 1: Program in Scratch

  • Due:: Sunday February 11th
  • Weight: 10%
  • Objective: Learn about core programming concepts using a visual programming language