



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of software, its types, programming languages, types of programming, and basic concepts of programming. It covers machine language, assembly language, high-level languages, data types, variables, operations, instructions, control structures, and functions. The focus is on javascript, with examples and explanations of sequential, conditional, and repetition control structures, as well as arrays and functions.
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Programming, JavaScript
Software
Software “does something”
Software models aspects of reality
Examples:
Types of Software
Application programs (e.g., PowerPoint)
Compilers and interpreters
Operating system (e.g., Windows XP)
Embedded software (e.g., TiVO)
Programming Languages
Software “does something”
Special purpose: geared towards specific tasks
General purpose: able to accomplish anything
Types of Programming
Machine language
Assembly language
High-level languages
Visual programming languages
Types of Languages
Hardware
Machine Language
Assembly Language
C Java Pascal COBOL …
Machine Language
Everything is a binary number
For instance
Assembly Language
One level up from machine language
For instance
Assembly code is directly translatable into machine language
ADD 21, 86, R
High-Level Languages
Instructions represent higher-level constructs
Programming: Overview
A program consists of a sequence of instructions
Basic concepts:
Structures for controlling how instructions are executed:
Programming: Foundations
Data types = things that you can operate on
Variables hold values of a particular data type
Operations = things that you can do
Basic Instructions
Assignment = store the result of an operation
In JavaScript, var declares a variable
In JavaScript, all instructions end with a semicolon (;)
Functions
Reusable code for doing a single task
A function takes in one or more parameters and returns one value
Calling Functions
When you “call” a function, you invoke the set of instructions it represents
More Examples
var f = 60; c = convertToCelsius(f);
r = weirdAddition(2, 4);
var a = 2; var b = 3; r = weirdAddition(a, b);
Programming Paradigms
Procedural Programming
Object oriented programming
Algorithms
Derived from the name of the Persian mathematician Al-Khwarizmi
A sequence of well-defined instructions designed to accomplish a certain task
Programming for the Web
Common Gateway Interface (CGI) [Server-side]
JavaScript [Client-side, interpreted]
Java applets [Client-side, compiled]
Where is the JavaScript?
JavaScript is usually kept in the section of an HTML document
…
Handling Events
When does code actually get executed?
Events:
Event handlers are used to respond to events
onMouseover: the mouse moved over an object onMouseout: the mouse moved off an object onClick: the user clicked on an object
Input and Output
How do you get information to/from the user?
In HTML
Please enter a number:
The sum of all numbers up to the number above is
JavaScript code var num = eval(document.input.number.value); document.output.number.value = 10;
Reads in a value eval function turns it into a number
Changes the value in the textbox
JavaScript Resources
Google “javascript”
Books
Programming Tips
Details are everything!
Write a little bit of code at a time
Debug by outputting the state of the program