Lesson 1: Fundamentals of Programming

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Computer Programming Mr. José A. Ortiz Morris. Computer Language  Languages that the computer understands.  They are low level languages. (BINARY 1.
Microsoft® Small Basic
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
Selection (decision) control structure Learning objective
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Conditional Statements Introduction to Computing Science and Programming I.
Modules and Objects Introduction to Computing Science and Programming I.
Python (yay!) November 16, Unit 7. Recap We can store values in variables using an assignment statement >>>x = We can get input from the user using.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
Programming – Touch Sensors Intro to Robotics. The Limit Switch When designing robotic arms there is always the chance the arm will move too far up or.
An Introduction to Textual Programming
In.  This presentation will only make sense if you view it in presentation mode (hit F5). If you don’t do that there will be multiple slides that are.
Introduction to Programming. What is a Program  Set of Instructions that tells the computer what to Do.  Driving force behind the computer  Without.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
What does a computer program look like: a general overview.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
More Python!. Lists, Variables with more than one value Variables can point to more than one value at a time. The simplest way to do this is with a List.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #003 (February 14, 2015)
SELECTION CONTROL STRUCTURE Prepared by: Careene McCallum-Rodney.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
All materials copyright UMBC unless otherwise noted CMSC201 Computer Science I for Majors Lecture 02 – Algorithmic Thinking.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
Last Class We Covered Decision structures One-way (using if)
FOP: While Loops.
Introduction to Computing Science and Programming I
CMSC201 Computer Science I for Majors Lecture 02 – Algorithmic Thinking Prof. Katherine Gibson Based on slides by Shawn Lupoli and Max Morawski at UMBC.
A Playful Introduction to Programming by Jason R. Briggs
A basic tutorial for fundamental concepts
Matlab Training Session 4: Control, Flow and Functions
WELCOME to….. The If Statement.
EGR 2261 Unit 4 Control Structures I: Selection
Debugging and Random Numbers
IF statements.
Programming 101 Programming for non-programmers.
Simple Control Structures
Lesson 9: "if-else-if" and Conditional Logic
Incrementing ITP © Ron Poet Lecture 8.
CS 240 – Lecture 11 Pseudocode.
Programming – Touch Sensors
Lesson 2: Building Blocks of Programming
elppa legoog erawdrah erawtfos margorp Cisab llams Apple Google
Lesson 8: Boolean Expressions and "if" Statements
Problem-Solving and Control Structures By Faith Brenner
Learning to Program in Python
Conditions and Ifs BIS1523 – Lecture 8.
Exploring Computer Science Lesson 6-2
Introduction to pseudocode
Lesson 4: Overall Review and Assessment
Algorithms & Pseudocode
Computational Thinking in Learning
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
HAPPY NEW YEAR! Lesson 7: If-statements unplugged
Programming in JavaScript
Introduction to Primitive Data types
Coding Concepts (Basics)
Computers in the real world Objectives
Java Programming Control Structures Part 1
Computer Science Testing.
Selection Statements.
Algorithm and Ambiguity
Problem-Solving and Control Structures By Faith Brenner
Programming in JavaScript
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
SSEA Computer Science: Track A
An Introduction to Linux
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Introduction to Primitive Data types
Presentation transcript:

Lesson 1: Fundamentals of Programming Fe Maidens Programming 2017-2018 Welcome Everyone!

What is Programming? When you write code, you tell a computer what to do. Those directions are then carried out by the computer, and create action. Code is written in different languages, or different ways for humans to interface with computers.

How is programming used? Programming is used almost everywhere, from the business world to science and beyond. Here are some examples: Programming has been used to create prosthetics controlled by the mind of a wearer This is Margaret Hamilton. Her code got people on the moon! IBM’s Watson, an Artificial Intelligence, recently won Jeopardy

How does the FeMaidens use programming? Programming is what gives the brain to the physical robot. Using the Java language, as well as libraries provided by FIRST, we are able to write code that makes different parts of the robot perform different actions. For example, we can code our robot to drive autonomously by programming 4 motors, or connect these motors to input from controllers. This picture shows the robot we built last year. Using code, we were able to climb, score gears, and of course, drive!

Thinking Like a Programmer: Programmers have to think a certain way in order to write code that does exactly what we want it to do. Computers and robots may be smart, but only because we teach them to be. For example, if we tell a robot to make a peanut butter and jelly sandwich, it won’t automatically know what to do. We need to instruct it step by step.

Thinking Like a Programmer: Let’s think about what we have to do in order to make a PB&J sandwich: We lay out the bread. But where did we get the bread from? Let’s try that again. We get the bread from the refrigerator. How did we get into the refrigerator? We open the refrigerator. What naturally comes to us involves a lot of complicated steps for robots. The process of laying out these steps before writing actual code is called writing pseudocode. } From here you can see that our digital computers pretty much read things line-by-line.

Thinking Like a Programmer: Exercises Watch the robot shoot. What are the actions that a robot has to take to shoot a ball? Write pseudocode below.

Congratulations! You just wrote your first method. Methods are what we call lists of steps in programming. Methods help us make our code easier to write and understand, so that we don’t have to write out all the steps every time we want to do something. We’ll go into further depth about methods next week.

Robot Code Here’s the real code we used to make the robot shoot the ball. Do you see any similarities to your steps? What does each line do? Robot.cannon.spinWheels(-v, -v); if (RobotMap.turningCam == true) { Robot.cannon.turnCam(); RobotMap.turningCam = false; }

What if we want to control when the cannon shoots? Let’s say we only want the cannon to shoot the ball if the cannon is lined up with the goal. That way, the ball will go in every time! In programming, this is a way that we use logic.

How do we use logic in programming? To program, we will need to think logically. Let’s start with a simple example. If (3 > 4) { Print “Math is hard.” } Would this piece of code print something? Since 3 is not greater than 4, the code inside the statement wouldn’t run. This process of evaluating if something is true or false is called a conditional.

Conditionals Let’s look at another example: If it’s raining, we need an umbrella. Otherwise, we don’t. Makes sense, right? Let’s see what this looks like in pseudocode. If (raining == true) { Bring an umbrella }

Conditionals cont. When the condition is false, the code will either do nothing, or progress to something called an else statement. Say it’s not raining, so we will wear flip flops. To add this into our code, we insert “else”: If (raining == true){ Bring an umbrella } Else { We will wear flip flops The code in the else statement is only executed if the condition in the first statement isn’t true. Otherwise, the code will completely skip the else. Say something about else if, and even if the else if condition is true, the code would not run

Introduction to Booleans In our pseudocode, we would only do actions if something was true. Whether things are true or false are a big part of logic. Let’s see if the following problems are true or false. 3 > 4 0 == 0 10 > 7 Booleans are things that store a true or false value. Previously, the booleans we used were “raining” and “hungry”.

Any Questions? Conclusions Here’s what we learned today: What programming is How programming is used How to think like a programmer How to think logically Conditionals and booleans Any Questions?

What’s next: Our next meeting will be October 11th, right here after SGI. Next week we’ll begin to go into specific components of programming! Some things you might be familiar with already (and might not know it) like variables. Other things might be completely new, like classes and methods, which we’ll go into a lot more depth about. You can do some research about these if you’d like, but it’s not necessary. See you guys next week!