230 likes | 413 Views
V2012.13. Agenda. Old Business Delete Files New Business Week 14 Topics : Upcoming Meeting Topics Intro to HTML/CSS Starts Next Week! Linux Scripts Review Introduction to Programming. Upcoming Meeting Topics. Introduction to Programming Arduino /Raspberry Pi/Embedded Projects
E N D
Agenda • Old Business • Delete Files • New Business • Week 14 Topics: • Upcoming Meeting Topics • Intro to HTML/CSS • Starts Next Week! • Linux Scripts Review • Introduction to Programming
Upcoming Meeting Topics • Introduction to Programming • Arduino/Raspberry Pi/Embedded Projects • Building a PC • Configuring a Server • Introduction to Web Development
Intro to HTML/CSS • First Session Starts Next Week • Nine Weeks • Exercises, Assignments • What You’ll Learn • HTML Basics • CSS • We’ll Use Code Academy • http://www.codecademy.com/learn • http://www.codecademy.com/tracks/afterschool-semester1
Scripting Review • Intro to Linux Review • Scripts/scripting
Create Your First Script • Open a text editor • Menu->Accessories->gedit • Scripts always begin with: #! /bin/bash • Save your script (date.sh) • Make the script executable $ chmod +x date.sh • Run your script $ ./date.sh
Create Your First Script • Output $ ./date.sh Fri Mar 8 13:27:05 EST 2013
Create Your First Script • Your Challenge: • Let’s add some features • Display only the date • Display the Day
Create Your First Script (date.sh) • Output $ ./date.sh Today's date is: March 8 The day of the week is: Friday The year is: 2013 The complete date is: Friday, March 8, 2013
Create Your First Script (date.sh) #!/bin/sh echo -n "Today's date is: "; date +"%B %-d" echo -n "The day of the week is: "; date +"%A" echo -n "The year is: "; date +"%Y" echo -n "The complete date is: "; date +"%A, %B %-d, %Y"
Script to Display Memory (mem.sh) #! /bin/bash # Total memory space details echo "Memory Space Details" free -t -m | grep "Total" | awk '{ print "Total Memory space : "$2 " MB"; print "Used Memory Space : "$3" MB"; print "Free Memory : "$4" MB"; }' echo "Swap memory Details" free -t -m | grep "Swap" | awk '{ print "Total Swap space : "$2 " MB"; print "Used Swap Space : "$3" MB"; print "Free Swap : "$4" MB";
Introduction to Programming • Key Concepts • Terms • How do I get started?
So, what is a program? A computer is a tool for solving problems with data. A program is a sequence of instructions that tell a computer how to PERFORM a task.
THINK OF A PROGRAM AS A RECIPE! DATA RECIPE FLOW TASKS • INGREDIENTS • MIX/STIR • BAKE • SERVE OUTCOME
PROGRAMS … Deal with data from various sources (user input, file, the internet) Determine a course of action (based on this data) Perform the appropriate action
WHAT IS A PROGRAMMING LANGUAGE? designed to communicate instructions to a computer Used to create programs provide a better interface between us (programmers) and the computer
Types of Programming languages HIGH-LEVEL LANGUAGES CLOSER TO NATURAL LANGUAGES ... Dynamic languages PROVIDES ABSTRACTION (JAVA) LOW-LEVEL LANGUAGES CLOSEST TO MACHINE CODE (ASSEMBLY LANGUAGE)
Execution models … COMPILED STORES PROGRAMS IN MACHINE CODE … BINARY (MACHINE CODE IS 1’S AND 0’S … IN WINDOWS .EXE) INTERPRETED STORES PROGRAMS IN ‘HUMAN READABLE’ FORM (only a small number of instructions exist as machine code)
HOW DO I BEGIN … tools 1. Text editor Windows: notepad, linux: gedit, many editors available IDE (integrated development environment) Netbeans, eclipse, visual studio ($) … man y more 2. Ambition
HOW DO I BEGIN … requirements 1. Identify the problem: What problem does your program solve? If you can't clearly state what your program does, you won't know how to design it. 2. Identify the user: Who's going to use your program?
HOW DO I BEGIN … requirements 3. Determine the target platform Is it a Windows computer, Mac, Linux, mobile, etc. 4. What skills will you need to develop Are you going to write the entire thing yourself or get help from others? If you're going to get others to help you, which parts of the program are they going to write?