175
Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

  • View
    230

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Discovering Computers

CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Page 2: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Chapter 13 Objectives

Describe various ways to develop Web pages including HTML, scripting languages, XHTML, XML, WML, and Web page authoring software

Describe various ways to develop Web pages including HTML, scripting languages, XHTML, XML, WML, and Web page authoring software

Differentiate between machine , assembly languages, high-level languages

Differentiate between machine , assembly languages, high-level languages

Identify and discuss the purpose of procedural programming languages

Identify and discuss the purpose of procedural programming languages

Discuss the advantages and uses of visual programming languages

Discuss the advantages and uses of visual programming languages

Identify and discuss the characteristics of object-oriented programming languages

Identify and discuss the characteristics of object-oriented programming languages

Identify the uses of various nonprocedural languages and tools

Identify the uses of various nonprocedural languages and tools

Identify the uses of popular multimedia authoring programs

Identify the uses of popular multimedia authoring programs

List the 6 steps in the program development cycleList the 6 steps in the program development cycle

Differentiate between structured design and object-oriented design

Differentiate between structured design and object-oriented design

Explain the basic control structures used in designing solutions to programming problems

Explain the basic control structures used in designing solutions to programming problems

Page 3: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Dilbert Cartoon: Singularity

Page 4: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Computer Programs & Programming Languages

What is a computer program ? Set of instructions that directs computer to perform

an array of tasks. Programming language: Provides the syntax, rules and

coding needed to write the instructions in a computer program.

Page 5: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Computer Programs & Programming Languages

What are low-level languages and high-level languages?

High-level language

High-level language

Low-levellanguage

Low-levellanguage

Machine-dependentruns only on one type of computer

Machine-dependentruns only on one type of computer Often machine-independent

can run on many different types of computers

Often machine-independentcan run on many different

types of computersMachine and assembly languages

are low-level

Machine and assembly languages are low-level

Page 6: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Low-Level Languages: Machine

What is machine language? Only language computer

directly recognizes Uses a series of binary digits

(1s and 0s) with a combination of numbers and letters that represent binary digits

Page 7: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Low-Level Languages: Assembly

What is assembly language? Instructions made up of

symbolic instruction codes, meaningful abbreviations and codes

Source program contains code to be converted to machine language

Page 8: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

High Level Languages

Procedural Languages: BASIC, BASICA, GWBASIC, QBASIC COBOL FORTRAN PASCAL Object Oriented Languages JAVA Object Oriented C++ Object Oriented SMALLTALK Object Oriented Alice (game programming) Object Oriented (based on Java) VISUAL BASIC .NET Object Based

Page 9: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

The Program Development Cycle: 6 StepsWhat is the program development cycle? Steps programmers use to build computer programs

Programming team—Group of programmers working on program

The Program Development Cycle is Step 4 in the System Development Life Cycle (SDLC)

Page 10: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 1 — Analyze Requirements

What is involved in analyzing the requirements?1. Review requirements2. Meet with systems analyst and users3. Identify input, output, processing, and data

components IPO chart—

Identifies program’s inputs, outputs, and processing steps

IPO chart

Page 11: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Programmer begins with general

design and moves toward detailed design

Step 2 — Design the Solution

What is involved in designing the solution?

Object-oriented design

Structured design, sometimes

called top-down design

Two approaches

Devise solution algorithm, step-by-step procedure to solve problem

Page 12: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 2 — Design the Solution

What is a hierarchy chart? Shows program modules graphically & relationships Also called a Structure Chart or VTOC: Visual Table

of Contents

Page 13: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 2 — Design the Solution

What is object-oriented design (OOD) ? Programmer packages data and

methods (procedures) into a single unit, called an object

Objects are grouped into classes A Class Diagram graphically

represents the hierarchical relationships of classes

Page 14: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Unified Modeling Language (UML)

http://en.wikipedia.org/wiki/Class_diagram

Class Name

Data Attributes

Constructors & Methods

Page 15: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

ITP 120 Java Programming I15

Class #7 – Programming with Objects & ClassesRectangle class UML

Rectangle

--length: double--width: double

+Rectangle ( ) // a constructor+Rectangle (length: double, width: double)+ setLength(double length): void+ getLength( ): double+ setWidth(width:double): void+ getWidth( ): double+ findArea( ): double+ findPerimeter ( ): double+ findDiagonal ( ): double

Page 16: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 3 — Validate the Design

What is involved in validating the design?

p. 13.32

Check program design for accuracy

Logic errordesign flaw that causes

inaccurate results

Test datasample data that

mimics real data that program will process

Programmer checks logic for correctness

and attempts to uncover logic errors

Desk checkprogrammers use test

data to step through logicStructured walkthroughprogrammer explains

logic of algorithm while programming team steps through program logic

Page 17: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 4 — Implement the Design

What is implementation? (Coding,testing,debugging) Writing the code that translates the design into a program

Syntax—rules that specify how to write instructions Comments—program documentation

Extreme Programming (XP)—coding and testing as soon as requirements are defined !!!

Page 18: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 5 — Test the Solution

What is involved in testing the solution?

Ensure program runs correctly and is error free

Debugging—locating and correcting syntax and logic

errors, or bugs

Test copy of program, called beta, sometimes

used to find bugsAlpha & Beta testing:What is the difference ?

Page 19: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Step 6 — Document the Solution

What is involved in documenting the solution? Programmers should perform two activities:

Review program code—remove dead code:

program instructions that the program never

executes (runs)

Review program code—remove dead code:

program instructions that the program never

executes (runs)

Reviewdocumentation

Reviewdocumentation

Page 20: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

In the Computer Age …

Delete Key

Cursor

Some kids may haveused a computer or cell phone before writingwith a pencil !

Computer Nerd

Page 21: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

What is an Algorithm ?

Algorithm: a step-by-step procedure to solve a problem.

The problem to be solved does NOT have to pertain to a computer program.

A procedure to change a flat tire on a car is an algorithm. (Set the parking brake first, loosen lug bolts…)

So is assembling a bicycle or making a cake. Another example: Building a house.

Page 22: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Detecting errors and making

improvements early reduces the overall

time and cost of program

development

Structured Walkthrough

What is a structured walkthrough?

A more formal technique for checking the solution algorithm

The programmer explains the logic of the algorithm while members of the programming team step through the program logic

Purpose is to identify errors in the program logic and check for possible improvements in program design

Page 23: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Coding Computer Programs

What is involved in coding programs?

Two steps:1. Translating the solution algorithm into a programming language2. Entering the programming language code into the computer

Each of the many programming languages has a very specific syntax

p.15.13

Next

Syntax

The set of grammar and rules that

specifies how to write instructions for a solution algorithm

Page 24: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Examples of Syntax Differences

In the COBOL language: COMPUTE REG-PAY = HOURS * WAGE.

regPay = hours * wage; // In the “C” Language /* A series of comments */ REM COMPUTE PAY in the BASIC language

GROSSPAY = HOURS * WAGE

a REM statement is a REMark; It is not executed.

Page 25: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

COBOL is NOT dead (yet) !

COBOL COmmon Business Oriented Language

Factoid:

According to the Micro Focus company, COBOL

programs today process 75% of the world’s business

data and around 90% of all financial transactions.

Object COBOL for UNIX:

http://supportline.microfocus.com/documentation/books/ocds42/oppubb.htm

Page 26: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Documenting Computer Programs

How are programs documented?A programmer should take time to document the program code thoroughly

Comments or remarks are included in a program as documentation

Global comments explain the program’s purpose and identify the program name, its author, and the date written

Internal comments explain the purpose of the code statements within the program

global comments

global comments

internal commentsinternal

comments

Page 27: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Payroll Program Calculations (Example) Read hours; float regularRate = 20.00; float overtimePayRate=30.00;float fedTaxRate = .28; float stTaxRate = .0575; float ovRate = 1.5;if (hours > 80 ) // Biweekly payroll: compute overtime pay regularPay = 80 * regularRate; // Compute regular pay for 80 hours overtimePay = (hours – 80) * ovRate * overtimePayRate;else // This means: hours <= 80 regularPay = hours * regularRate; // Compute regular pay (<= 80 hours) overtimePay = 0;grossPay = regularPay + overtimePay;fedTax = grossPay * fedTaxRate;stateTax = grossPay * stTaxRate;deductions = fedTax + stateTax;netPay = grossPay – deductions;print Name, SSN, regularPay, overtimePay, grossPay, netPay,deductions

Page 28: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Assembly Language Instructions

In a High-Level Language statement:In COBOL: MOVE ZEROS TO OVERTIME-PAY.

overtimePay = 0; // Set overtimePay to zero in C++

Equivalent Assembly Language statements:

LR R1, 0 // Load Register R1 with zeroSR R1, overtimePay // Store zero from R1 into // memory variable overtimePay

Page 29: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Syntax errors Occur when the code violates the syntax, or

grammar, of the programming language

Usually discovered the first time a program code is executed on the

computer

Testing: Removing Syntax & Logic ErrorsWhat is involved in testing programs?

Goal is to ensure the program runs correctly and is error free.

3 types of errors:

Syntax errors

Logic errors

Runtime errors

Logic errors (Semantic errors)

Flaw in the design that generates inaccurate results

Systems analyst develops test data including both valid and invalid input

data

Page 30: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Examples of Logic (Semantic) Errors

F = (9./5.) * C + 32; // Compute Fahrenheit temp Suppose C = 40; // Celsius temperature is 40 Fahrenheit = 72. + 32; Fahrenheit = 104; // So 40 deg C is 104 F

C = (2./9.) * (F – 32); // Logic error in formula ! It runs, but it produces the wrong number for Celsius temp

It should be: C = (5./9.) * ( F -32);

Page 31: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Testing Programs and Run time Errors

What is a run time error?

A program failure occurring while a program is being executed (run).Programmers use test data (good, bad, none) to deliberately cause a run time error in order to test the program.Examples of run time errors: Input file not found Division by zero Array Index out of bounds Buffer overflow General Protection Fault (GPF) (Memory overrun)

Page 32: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Dividing a Number by Zero

G = 1234.56 / .00000000000000000001

(Divisor approaches zero 0 )

(Then, invert and multiply)

Example: x = a / 1/b = ab

G = 1234.56 x 10 ** 320 (G is a very large number)

If it is too large, it will overflow its data register.

Infinity symbol

Page 33: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Debugging Computer Programs

What is debugging?The process of locating

and correcting the syntax and logic errors in a program

Errors themselves are the bugs

The first bug was said to be a moth lodged in a computer's electronic relay components during the development of the COBOL language (1959)

Page 34: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Dr. Grace Hopper: COBOL Inventor

http://www.sdsc.edu/ScienceWomen/hopper.html

Page 35: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Debug Utilities

What is a debug utility (debugger)?Computer software:

called a debugger

Available with most compilers

Allows you to identify syntax errors and to find logic errors

Programmer can examine program values while the program runs in slow motion

p.15.14

Next

Millennium Bug

Also called the Y2K bug

Took effect when the computer date rolled

over to January 1, 2000

Non Y2K compliant computers read the

date as 01/01/00

Page 36: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Y2K Computation (Example of error)

currentYear = 00; // Using a 2-digit value for yearyearOfBirth = 1990;Age = currentYear – yearOfBirth;

Age = 0 – 1990Age = -1990 // Ridiculous value for Age !

currentYear = 2012; // Correct 4-digit yearAge = 2012 – 1990Age = 22 // Correct agehttp://www.y2ktimebomb.com/

Page 38: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Year 2038 Unix Y2K Bug

http://en.wikipedia.org/wiki/Year_2038_problem The year 2038 problem (also known as the Unix Millennium

Bug, Y2K38, Y2.038K, or S2G by analogy to the Y2K problem) may cause some computer software to fail at some point near the year 2038.

The problem affects all software and systems that both store system time as a signed 32-bit integer, and interpret this number as the number of seconds since 00:00:00 UTC on Thursday, 1 January 1970.

Times beyond this moment will "wrap around" and be stored internally as a negative number, which these systems will interpret as a date in 1901 rather than 2038.

Page 39: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Y2K Problem Examples

Visit: http://en.wikipedia.org/wiki/Y2KIn the C programming language, the standard library function to get the current year originally did have the problem that it returned only the year number within the 20th century, and for compatibility's sake still returns the year as year minus 1900. Many programmers in C, and in Perl and Java, two programming languages widely used in Web development that use the C functions, incorrectly treated this value as the last two digits of the year. On the Web this was a mostly harmless bug, but it did cause many dynamically generated webpages to display January 1, 2000, as "1/1/19100", "1/1/100", or variations of that depending on the format.

Page 40: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Division Computation (Example of error)

int num1 = 167; int num2 = 0; int result; if (num2 != 0) result = num1 / num2; else // Divide num1 by num2 num2 = 1; result = num1 / num2; print (“Error:Attempt to Divide by zero”); // Causes program to crash // Cannot divide by zero

Page 41: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Breaks down the original set of program specifications into smaller, more manageable sections

These sections are called modules

Identify the the major functions of a program, called the main module

Decompose (break down) the main routine into smaller sections called subroutines

Analyze each subroutine to determine if it can be decomposed further

Continue decomposing subroutines until each one performs a single function

A section of a program that performs a single function is a module

What is top-down design?

Designing Computer Programs

Page 42: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Structured Computer Program Design

What is structured design?

A technique that builds all program logic from a combination of three basic control structures

Sequence,Selection,Looping

A control structure is a design that determines the logical order of program instructions

Each module typically contains more than one control structure

p.15.6

Next

Sequence control

structure

Selection control

structure

Repetition control

structure

Page 43: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Sequence Control Structure

What is a sequence control structure?Shows one or more actions following each other in order.

Actions:InputsProcessesOutputs

p.15.7 Fig. 15-5

Next

Page 44: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Selection Control Structure (IF-THEN-ELSE)

What is a Selection Control Structure?

Tells the program which action to take, based on a certain condition

Two common types of selection control structures

p.15.7

Next

if-then-else control structure

case control structure

Page 45: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Selection Control Structure (IF-THEN-ELSE)

What is an IF-THEN-ELSE control structure?

Allows a program to evaluate the condition and yields one of two possibilities: true or false

If the result of the condition is true, the program performs one action

If the result is false, the program performs a different (or possibly no) action

p.15.7 Fig. 15-6

Next

Page 46: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Selection Control Structure (IF-THEN-ELSE)

A = 12 // Assign 12 to integer variable A

B = 65 // Assign 65 to integer variable B

IF ( A > B ) // The true condition, if A greater than B

PRINT “The Internet is a great source of info!”

PRINT “Have a nice day !”

ELSE // The false condition: means A <= B

PRINT “This is the false condition”

PRINT “Please study for the final exam !”

Page 47: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Infinite Loops

boolean loopSwitch = true; // 1 bit is set

int count = 5;

while (loopSwitch) // Loop if loopSwitch is true

{

System.out.println(“Count is: “ + count);

count = count – 1; // Subtract 1 from counter

if (count = = 0) // When count reaches 0, stop loop

loopSwitch = false; // Causes loop to end

}

Page 48: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

NESTED IF STRUCTURE (pseudocode)IF (SCORE >= 90) // Nested IF “ladder” GRADE = ‘A’; // Assign letter grade of ‘A’ ELSE IF (SCORE >= 80) GRADE = ‘B’; ELSE IF (SCORE >= 70) GRADE = ‘C’; ELSE IF(SCORE >= 60) GRADE = ‘D’; ELSE // Note: SCORE is <= 59 GRADE = ‘F’;

Page 49: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

CASE ENTRY STRUCTURE(pseudocode)

INPUT SCORESCORE = (int) SCORE / 10; // Make score between ( 0 <= SCORE <= 10) SWITCH (SCORE) // Case Entry is more efficient than a Nested-IF ladder BEGIN SWITCH BEGIN CASECASE 10: GRADE = ‘A’; BREAK;CASE 9: GRADE = ‘A’; BREAK;CASE 8: GRADE = ‘B’; BREAK;CASE 7: GRADE = ‘C’;

BREAK;CASE 6: GRADE = ‘D’; BREAK;DEFAULT: GRADE = ‘F’; END CASEEND SWITCH PRINT GRADE // Next statement after the END SWITCH

Page 50: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

The CASE Control Structure

What is a case control structure?A condition can yield one of four or more possibilities; the last condition is usually the default or error condition. CASE runs faster than a nested IF

p.15.7 Fig. 15-7

Next

Page 51: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Repetition Control Structure (Looping)

What is a repetition control structure?

Also called the iteration control structure or a loop

Used when a program performs one or more actions repeatedly as long as a certain condition is met

Two forms:

p.15.8

Next

Do While control

structure

Do Until control

structure

Page 52: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Do While Control Structure (Looping)

What is a Do While control structure?Repeats one or more times as long as a

condition is true Tests a condition at the

beginning of the loop If the result is true, the

program executes the action(s) inside the loop

Program loops back and tests the condition again

Looping continues until the condition becomes false

p.15.8 Fig. 15-8

Next

Page 53: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

DO WHILE LOOP: EXAMPLE

3000-READ-A-RECORD // Read a record from input fileFLAG = 0 // Set loop control flag to zero DO WHILE (FLAG = = 0) // Loop as long as FLAG is zero 2000-COMPUTE-PAY 2500-PRINT-PAY-RECORD 3000-READ-A-RECORD // Read next record in file IF END-OF-FILE // If End-Of-File (EOF) is detected FLAG = 1 ELSE NULL ENDIFEND DO WHILE

Page 54: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

DO WHILE LOOPS

Given the following pseudocode, what are the values of

COUNTER and SUM when they are printed by the PRINT

statement? Use the Gauss formula: Sum = N*(N+1)/2

COUNTER = 0

SUM = 0

DO WHILE (COUNTER < 11)

COUNTER = COUNTER + 1

SUM = SUM + COUNTER

END DO

PRINT COUNTER, SUM

COUNTER = ____ SUM = ______

Page 55: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Do Until Control Structure (Looping)

What is a Do Until control structure?

Tests the condition at the the end of the loop

The action(s) will always execute at least once

Continues looping until the condition is true, and then stops

p.15.8 Fig. 15-9

Next

Page 56: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

DO UNTIL LOOP

FLAG = 0 3000-READ-A-RECORD // Read first record from input file DO // Start of DO UNTIL loop 2000-COMPUTE-PAY // Invoke COMPUTE-PAY module 2500-PRINT-PAY-RECORD 3000-READ-A-RECORD // Read next record from file IF END-OF-FILE FLAG = 1 ELSE NULL ENDIFUNTIL (FLAG = = 1) // If FLAG is 1, exit the DO-UNTIL LoopEND DO // End of DO UNTIL loop

Page 57: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

COUNT CONTROLLED LOOPS

SUM = 0 // SUM is an AccumulatorFOR I = 1 TO 10 SUM = SUM + I // 1 + 2 + 3 + … + 10NEXT I SUM = 0 // Without a loop, the statements would have to be written I = 1 // many times, making the program very long… SUM = SUM + I // SUM = 0 + 1 I = 2 SUM = SUM + I // 1 + 2 = 3 (SUM)

// Handy formula for this series: SUM = N (N + 1) /2 SUM = 10 ( 10 + 1) /2 = 10 (11)/2 = 5 * 11 = 55PRINT SUM // 55 is the printed SUM

Page 58: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Program Design Guidelines

The program, each of its modules, and each of its control structures must have: No dead code No infinite

loops Single entry

point; Single exit point

p.15.8

Next

Dead code

Any code, or program instruction, that a program never executes

Infinite loop

A set of instructions that repeats continuously

Entry point

The location where a program, a module, or a control structure begins

Exit point

The location where it ends

What are the guidelines of a proper program?

Page 59: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Program Design Guidelines

How are entry and exit points are shown?

Program modules often have control structures nested inside one another

Each control structure should have one entry point and one exit point

p.15.9 Fig. 15-10

Next

Page 60: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Solution Algorithms for Computer Programs

What is a solution algorithm? (3 common tools)Also called program logic.

A graphical or written description of the step-by-step procedures in a module.

To help develop a solution algorithm, programmers use design tools.

p.15.9

Next

Program flowchart

Nassi-Schneiderman

charts

Pseudocode

Page 61: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Flowcharting Computer Programs

What is a Program Flowchart?

Graphically shows the logic in a solution algorithm

Follows a set of standards published by the American National Standards Institute (ANSI) in the early 1960s

p.15.9 Fig. 15-11

Next

Page 62: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Flowcharting Computer Programs

How is a program flowchart drawn?

Most symbols connect with solid lines showing the direction of the program

Dotted lines connect comment symbols

Next

A comment symbol or annotation symbol

Explains or clarifies logicp.15.10 Fig. 15-12

Page 63: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Flowcharting Computer Programs: Software

What is flowcharting software? (Visio, SmartDraw)

Used to develop flowcharts

Makes it easy to modify and update flowcharts

p.15.10 Fig. 15-13

Next

Page 64: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Nassi-Schneiderman (N-S) Charts

What is a Nassi-Schneiderman (N-S) chart?Graphically shows the logic in a solution algorithm

Sometimes called structured flowcharts: Process, Do-While loop, IF, Case

p.15.11 Fig. 15-14

Next

Page 65: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Pseudocode for Computer Program Design

What is pseudocode?

Uses a condensed form of English to convey the logic of a computer program

Also uses indentation to identify the three basic control structures

Often called “A combination of English and your favorite programming language”

p.15.12 Fig. 15-15

Next

Page 66: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Procedural Languages (3GL)

What is a procedural language? (3GL)

p. 13.04 Next

Examples: BASIC, COBOL, and C

Uses a series of English-like words to write instructions

Often called third-generation language (3GL)

Programmer assigns name to sequence of instructions that tells computer what to accomplish and how to do it

Page 67: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Procedural Languages: Compilers

What is a compiler?

p. 13.05 Fig. 13-4 Next

Program that converts entire source program into machine language

(0’s, 1’s) before executing it

Page 68: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Procedural Languages: InterpretersWhat is an interpreter?

p. 13.05 Fig. 13-5 Next

Program that translates and executes one program code statement at a time

Does not produce an EXE object program (binary code) file which is executable

Page 69: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Procedural Languages: BASICA, QBASICWhat is BASIC? (BASICA, GWBASIC, QBASIC)

p. 13.06 Fig. 13-6 Next

Designed for use as simple, interactive problem-solving language

Beginner’s All-purpose Symbolic Instruction Code

Page 70: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Procedural Languages: COBOL

What is COBOL? (Developed in 1959)

p. 13.06 Fig. 13-7 Next

Designed for business applications English-like statements make code easy to read, write,

and maintain COmmon

Business-Oriented Language

Page 71: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Procedural Languages: C

What is C? (Developed in early 1970’s by AT&T)

p. 13.07 Fig. 13-8 Next

Powerful language originally designed to write system software. Executes extremely fast as does C++

Requires professional programming skills

Page 72: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming LanguagesWhat is an object-oriented programming (OOP) language?

p. 13.07 Next

Used to implement

object-oriented design

Major benefit is ability to

reuse existing objects

Event-driven—checks for

and responds to set of events

C++ and Java are complete

object-oriented languages

Object is item that contains data and

procedures that act on

data

Event is action to

which program responds

Page 73: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

What is C++?

p. 13.08 Fig. 13-9 Next

Includes all elements of C, plus additional features for working with object-oriented concepts

Used to develop database and Web applications

Java: based on C++

Page 74: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

C++ Programming Language

/ Demonstrates the declaration of a class and the

// definition of class methods C++ Program: CAR.CPP

#include <iostream.h> // For cout function

#include <stdio.h> // For the gets() function

#include <conio.h>

#include <ctype.h>

class Car // Declare the class

{

public: // Begin public section

void Start(); // Accessor function

void Accelerate(); // Accessor function

void Brake(); // Accessor function

void HonkHorn(); // Accessor function

void SetYear (int year); // Accessor function

int GetYear(); // Accessor function

void SetCylinders (int cyl); // Accessor function

int GetCylinders(); // Accessor function

void SetSpeed (float speed); // Accessor function

float GetSpeed(); // Accessor function

private: // Begin private section

int Year; // Member variable

int Cylinders; // Member variable

int Speed; // Member variable

}; // End of class car

Page 75: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

What is Java? (1995)

p. 13.08 Fig. 13-10 Next

Developed by Sun Microsystems.

Java programs are compiled into Bytecode.

Similar to C++ but uses just-in-time (JIT) compiler to convert source code into machine code.

Page 76: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java GUI Calculator

Page 77: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java Anagram Program / Exercise8_12Healy.java Patrick Healy ITP120 Java I Chapter 8import javax.swing.JOptionPane; // Exercise 8.12 // Try: lemon, melon listen, silent, please, asleep garden, ranged// lingo, login ladies, ideals RESORT, ROSTERpublic class Exercise8_12Healy { public static void main (String[] args) {

while (true) // Infinite while loop { String output = "Angrams are words that have the same letters,\nbut are spelled differently\n Example: ROSTER &

RESORT"; JOptionPane.showMessageDialog(null, output);

String wordQuit = JOptionPane.showInputDialog("Press [Enter] to continue; Type Exit to Exit");

if (wordQuit.equals("exit") || wordQuit.equals("Exit")) break;

String word1 = JOptionPane.showInputDialog("Anagrams: Enter word 1: "); String word2 = JOptionPane.showInputDialog("Anagrams: Enter word 2: ");

outputAnagram (word1, word2); // Determine if words are anagrams

} // End of infinite while loop } // End of main method

Page 78: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java Anagram Program public static void outputAnagram( String w1, String w2) { String word1 = w1.toUpperCase(); String word2 = w2.toUpperCase(); String output = "The words " + word1 + " and " + word2 + " are" + (isAnagram(word1, word2) ? "" : " NOT") + " anagrams."; JOptionPane.showMessageDialog(null, output, "Exercise 8_12 Output", JOptionPane.INFORMATION_MESSAGE); } public static boolean isAnagram (String w1, String w2) { char[] chars1 = w1.toCharArray(); // Convert to arrays char[] chars2 = w2.toCharArray(); java.util.Arrays.sort(chars1); // Sort the arrays java.util.Arrays.sort(chars2); String s1 = String.valueOf(chars1); // Convert to strings String s2 = String.valueOf(chars2); Boolean result = s1.equals(s2); return result; } // End of method

} // End of class Exercise8_12Healy

Page 79: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java Sudoku Puzzle

Page 80: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java Game Links

Text Twist Game (in Java):

http://www.gamefools.com/onlinegames/free/SuperTextTwist.html

Java Sudoku Puzzle (runs as an applet on a Web page)http://sudoku.klaas.nl/

Page 81: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java Applets Example

<html>

<head>

<title> House Class Applet Demo

</title>

</head>

<body>

<applet

code = "HouseApplet.class"

width = 600

height = 500 >

</applet>

</body>

</html>

Page 82: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Java Applets

Minimum of three (3) files are needed:

HouseApplet.java (Java source code) HouseApplet.class (bytecode file) HouseApplet.html (HTML file which refers to HouseApplet.class)

Page 83: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Unified Modeling Language (UML) Class Name: Rectangle

length: double // Data Attributes width: double

+ Rectangle ( ) // Default Constructor+ Rectangle (double l, double w ) // Constructor w/params+ setLength( double l): void // Methods+ getLength( ): double+ setWidth( double w): void+ getWidth( ): double+ findArea ( ): double+ findDiagonal ( ): double+ findPerimeter ( ): double

Page 84: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object Oriented Design

public class RectangleR // Goes with driver program TestRect1.java { private double width; private double height; private static String color;

public RectangleR( ) // Default constructor { height = 1.0; width = 1.0; }

public RectangleR(double w, double h, String c) { width = w; height = h; color = c; }

Page 85: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object Oriented Design public double getWidth() { return width; } public void setWidth(double w) { this.width = w; }

public double getHeight() { return height; }

public void setHeight(double h) { this.height = h; }

public String getColor() { return color; }

public void setColor(String c) { this.color = c; }

public double findDiag { return Math.sqrt(height*height + width * width); } public double findArea() { return height*width; }} // End class RectangleR

Page 86: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object Oriented Design

// Test Class (Driver Program) for the class RectangleR TestRect1.java

public class TestRect1 { public static void main(String [] args) {

RectangleR myRectangle1 = new RectangleR (3.0, 5.0, "Red");RectangleR myRectangle2 = new RectangleR (6.0, 10.0, "Yellow");

Page 87: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object Oriented Design

System.out.println ("The width of Rectangle 1 is " + myRectangle1.getWidth());System.out.println ("The heigth of Rectangle 1 is " + myRectangle1.getHeight());System.out.println ("The color of Rectangle 1 is " + myRectangle1.getColor());System.out.println ("The area of Rectangle 1 is " + myRectangle1.findArea());System.out.println(“The diagonal length is: “ + myRectangle1.findDiag() );System.out.println ("The width of Rectangle 2 is " + myRectangle2.getWidth());System.out.println ("The heigth of Rectangle 2 is " + myRectangle2.getHeight());System.out.println ("The color of Rectangle 2 is " + myRectangle2.getColor());System.out.println ("The area of Rectangle 2 is " + myRectangle2.findArea());

} // End of main method} // End of class TestRect1

Page 88: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Example of Java program: OOP

Defining the circle class:public class Circle{

double radius = 1.0d; // Default radius of circle is 1 unit

double findArea( ){

return Math.PI * radius * radius;}double findPerimeter( ) // Computes circumference of circle{

return 2 * Math.PI * radius;}

} // End of class Circle

Page 89: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Example of a Java program: OOP

public class TestCircle // A test class program to test Circle class{

public static void main(String[ ] args){

Circle circle1 = new Circle(5); // circle1 has radius 5Circle circle2 = new Circle(12); // circle2 has radius 12Circle circle3 = new Circle(45); // circle3 has radius 45// Print the radii of the various circles

System.out.println(“The radius of circle1 is “ + circle1.radius );System.out.println(“The radius of circle2 is “ + circle2.radius );System.out.println(“The radius of circle3 is “ + circle3.radius );} // End of main method

} // End of class TestCircle

Page 90: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Nonprocedural Languages: 4GLs: SQLWhat is a fourth-generation language (4GL)?

p. 13.13 Fig. 13-15 Next

A Nonprocedural language that allows users to access data in a database

A popular 4GL is SQL, query language that allows users to manage data in a relational DBMS

Page 91: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

What is a Visual Programming Language? (a 5GL)

p. 13.09 Next

Programmer writes and implements

program in segments

Visual programming environment (VPE) allows developers to

drag and drop objects to build programs

Often used in a RAD (rapid application

development) environment

Sometimes calledFifth generation

language

Provides visual or graphical interface for creating source code

Examples:Visual Basic .NETVisual C++Visual J#

Page 92: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

What is Visual Studio 2010?

p. 13.10 Next

Suite of visual programming languages and RAD tools .NET is set of technologies that allows program to run on Internet Visual Basic is used to build complex object-based programs

Step 1. The programmer designs the user interface.

Step 2. The programmer assigns properties to each object on the form.

Step 3. The programmer writes code to define the action of each command button.

Step 4. The programmer tests the application.

Page 93: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

93

Object-Oriented Programming Languages and Program Development Tools

• The Microsoft .NET Framework allows almost any type of program to run on the Internet or an internal business network, as well as computers and mobile devices

• Features include:

Discovering Computers 2012: Chapter 13Page 670

CLR (Common Language Runtime)

Classes

Page 94: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Based Programming Languages Visual Basic 2010 (sometimes called VB .NET) is a

visual programming languages that easily allows programmers to develop complex task-oriented object-based programs.

VB 2010 is based on the Visual Basic programming language developed by Microsoft in the early 1990’s.

VB 2010 is a good language for beginning programmers although it is really not that easy!

Page 95: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages Also, in the Visual Studio .NET suite are the Visual

C++ 2010 and Visual C# 2010 (pronounced Visual C sharp) programming languages. Very powerful ! Programmers can develop software for nearly every computer platform !

Visual C# 2010 is a visual programming language built on the .NET platform that takes the complexity out of C++ for easier, rapid software development

Page 96: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages Visual C# 2010 (C# means “C – sharp”)

is a visual programming language that combines the features of C++ with an easier development environment.

This language is supposed to take the complexity out of

Visual C++ 2010 an still provide an object-oriented

language.

Page 97: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

More on C# (C-Sharp)

C# (pronounced "see sharp" or "C Sharp") is one of many .NET programming languages. It is object-oriented and allows you to build reusable components for a wide variety of application types.  Microsoft introduced C# on June 26th, 2000 and it became a v1.0 product on Feb 13th 2002.

C# is an evolution of the C and C++ family of languages. However, it borrows features from other programming languages, such as Delphi and Java. If you look at the most basic syntax of both C# and Java, the code looks very similar, but then again, the code looks a lot like C++ too, which is intentional.

C# tutorials: http://www.csharp-station.com/Default.aspx

Page 98: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

Delphi (from Borland Software)

p. 13.11 Fig. 13-12 Next

Powerful visual programming tool Ideal for large-scale enterprise and Web applications

Page 99: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

Delphi

p. 13.11 Fig. 13-12 Next

Delphi can be used to develop programs quickly for Windows, Linux, and .NET platforms in a RAD environment Delphi has more functionality and features than Visual Basic .NET but is more difficult to learn and use.

Page 100: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Object-Oriented Programming Languages

What is PowerBuilder? (from Sybase Corp.)

p. 13.12 Fig. 13-13 Next

Another powerful visual programming tool Best suited for Web-based and large-scale

object-oriented applications A widely used RAD programming tool

Page 101: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development HTML

What is HTML (Hypertext Markup Language)?

p. 13.16 Fig. 13-18 Next

A special language used to create Web pages

Page 102: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development HTML

You usually view a Web page written with HTML in

a Web browser such as Microsoft Internet Explorer

or FireFox or Safari (Apple) or Chrome (Google),

Opera

HTML is a language used for the placement of text,

graphics, video, and audio on a Web page.

HTML is really NOT a programming language.

p. 13.16 Fig. 13-18 Next

Page 103: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development HTML

A Web page is a file that contains both text and HTML tags. Examples of tags:<html><head><title> ITE100 Web Page example </title></head><body> ( Most of the HTML code goes here )</body></html>

Page 104: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development HTML Example<HTML><HEAD> <TITLE> ITE 100 Sample Web Page</TITLE></HEAD><BODY><CENTER> <IMG SRC = “bigwood.gif” HEIGHT = 75

WIDTH = 170> </CENTER><P><ADDRESS> Nova Community College<BR> 15200 Neabsco Mills Road </BR><BR> Woodbridge, Virginia 22191</BR> </ADDRESS></BODY></HTML>

p. 13.16 Fig. 13-18 Next

Page 105: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

HTML 5

Drag & Drop feature http://html5tutorial.net/tutorials/drag-and-drop.html

W3 Schools Link http://www.w3schools.com/html5/default.asp

Page 106: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

XP

Tutorial 1 New Perspectives on HTML and XHTML, Comprehensive

A Basic Web Pagehttp://www.nvcc.edu/home/phealy/ElmerFuddHomePage.htm

• <html>• <head>• <title>My Test Page at Woodbridge Campus</title>• </head>• <body>• <center> • <img src =“ElmerFudd.jpg”> alt=“Elmer Fudd Photo” />• </center>• <p>• <h2><center>Woodbridge Campus</center></h2>• <h2><center><b>Web page developed by Elmer P.

Fudd.</b><center></h2>• </p>• <p>• The NOVA Woodbridge Campus is located in Northern Virginia.• </p>• </body>• </html>

Page 107: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Programming Languages: Ajax

What is Ajax?

p. 683 Next

Stands for: Asynchronous JavaScript And XML Method of creating interactive Web applications designed

to provide immediate response ! Combines JavaScript, HTML or XHTML, and XML The Google Maps Web site uses Ajax Web browsers that support Ajax are Internet Explorer, Firefox, Opera, Netscape Navigator, Safari (for Apple)

http://en.wikipedia.org/wiki/Ajax_(programming)

Page 108: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Ajax: Example from W3Schools

http://www.w3schools.com/Ajax/ajax_example.asp

Page 109: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

109

Microsoft Visual Basic

Discovering Computers 2011: Living in a Digital World Chapter 13

Page 677Figure 13-16

Page 110: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Microsoft Visual Basic Example Code

http://en.wikipedia.org/wiki/Visual_Basic

Page 111: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

VBScript Language

VBScript (short for Visual Basic Scripting Edition) is an Active Scripting language developed by Microsoft. The language's syntax reflects its pedigree as a limited variation of Microsoft's Visual Basic programming language. VBScript is installed as default in every desktop release of the Windows Operating System (OS) since Windows 98, and may or may not be included with Windows CE depending on the configuration and purpose of the device it is running on. It initially gained support from Windows administrators seeking an automation tool more powerful than the batch language first developed in the late 1970s. A VBScript script must be executed within a host environment, of which there are several provided on a standard install of Microsoft Windows (Windows Script Host, Windows Internet Explorer). Additionally, The VBScript hosting environment is embeddable in other programs, through technologies such as the Microsoft Script control (msscript.ocx).

Page 112: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Rexx Language

REXX (REstructured eXtended eXecutor) is an

interpreted computer programming language which

was developed at IBM. It is a structured high-level

programming language which was designed to be both

easy to learn and easy to read. Both commercial and

open source interpreters for REXX are available on a

wide range of computing platforms, and compilers are

available for IBM mainframes.

http://www.kilowattsoftware.com/tutorial/rexx/

Page 113: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Ruby on Rails (RoR)

RoR provides technologies for developing object-

oriented , database-driven Web sites.

Rails uses a free object-oriented scripting language

called Ruby which is derived from a variety of

languages including Ada, Lisp, Perl and Smalltalk.

Rails is designed to make Web developers more

productive by eliminating time-consuming steps in the

Web development process.http://en.wikipedia.org/wiki/Ruby_on_Rails

Page 114: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Ruby on Rails Sample Code

Click on this link to view sample Ruby code

http://www.tutorialspoint.com/ruby-on-rails/rails-introduction.htm

Page 115: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Microsoft Silverlight

http://www.microsoft.com/SILVERLIGHT/

Silverlight is a Web page authoring program that also enables Web developers to combine interactive content with text, graphics, audio and video.

It is based on the .NET framework and it works with a variety of languages including JavaScript, Ruby, C#, and Visual Basic .NET

Can run on Windows, Mac OS X, Linux platforms

Page 116: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Expression

WebFlash

Web Development Software

What is Web page authoring software?

p. 683

Creates sophisticated Web pages without using HTML This software generates the HTMLcode

Dreamweaver Flash http://www.adobe.com/products/flash/ Microsoft Expression Web Visual Web Studio by Microsoft

Dreamweaver

Page 117: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Microsoft Expression Web

Microsoft Expression Web, code-named Quartz, is a WYSIWYG

HTML editor and general web design program by Microsoft,

replacing Microsoft FrontPage. It is part of the Expression

Studio suite.

Expression Web allows authoring of web pages integrating

XML, CSS 4.0, ASP.NET 2.0, XHTML, XSLT and JavaScript

into sites. It requires the .NET Framework 2.0 to operate. Its

sibling is Microsoft SharePoint Designer. Expression Web can

also work with PHP. Expression Web uses its own standards-

based rendering engine.http://en.wikipedia.org/wiki/Microsoft_Expression_Web

Page 118: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Client-side & Server-side Languages

Client-side Languages: (your computer) JavaScript (based on Java) VBScript (Visual Basic Script)

Server-side Languages PHP (Personal Hypertext Preprocessor)

Usually runs on Apache Web servers ASP (Active Server Page .asp) runs on IIS (Windows) ASP.NET (Similar to PHP) runs on IIS (Windows) JSP (Java Server Page) .jsp ColdFusion (to connect Web pages to a database)

Note: IIS means Internet Information Services (by Microsoft)

Page 119: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Server-Side Web Development LanguagesUsed for Web development:

Perl (Practical Extraction & Report Language)

ASP (Active Server Pages) .asp

JSP (Java Server Pages) .jsp

PHP (Personal Hypertext Preprocessor) .php

Page 120: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

The Python Programming Language

Visit: http://www.python.org/ Python is a programming language that lets you

work more quickly and integrate your systems more effectively. See almost immediate gains in productivity and lower maintenance costs.

Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.

Page 121: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

The Python Programming Language

Visit: http://www.python.org/

Example of nested if statement in Python:

>>> x = int(raw_input("Please enter an integer: "))

>>> if x < 0:

x = 0

print 'Negative changed to zero‘

elif x == 0: print 'Zero'

elif x == 1: print 'Single' .

else: print 'More'

Page 122: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

PHP (Personal Hypertext Preprocessor)PHP is an interpreted SERVER-side scripting language used for creating dynamic Web pages. PHP is used to process data sent from a Web form to a Web server.

PHP is embedded in HTML pages but is usually executed on the Web server.

The code example on the next slide is a very simple PHP CGI application that creates the message

“Hello World, Hello ITE100 Class!” in XHTML. (see next slide)

p. 13.16 Fig. 13-18 Next

Page 123: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

PHP Code Example

<?php$enVars =array(“HTTP_USER_AGENT”);foreach($enVars as $var){print “<html><head><title>PHP CGI Example</title></head></body><h1>Hello, World! Hello ITE100 Class!</h1>Your user agent is:<strong>${$var}.</strong></br></body> </html>“; } ?>

p. 13.16 Fig. 13-18 Next

Page 124: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Example of an Active Server Page (ASP)<%@ LANGUAGE="VBSCRIPT"%>

<% ' Patrick Healy April 15, 2010 Apps Dev II ITP295 If Request.Form("Name") <> "" Then Dept = Request.Form("Dept") Name = Request.Form("Name") Home_Phone = Request.Form("Home_Phone") Extension = Request.Form("Extension") %>

<HTML><HEAD><TITLE>Cyber Company Employee Input Results</TITLE></HEAD>

Comment line

Page 125: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Example of an Active Server Page (ASP)<BODY><H2>Confirm Results</H2><HR><B>You input the following data:</B><P> <TABLE BORDER="1"><TR><TD><B>Department</B> <TD><%= Dept%><TR><TD><B>Name</B> <TD><%= Name%><TR><TD><B>Home Phone</B> <TD><%= Home_Phone%><TR><TD><B>Extension</B> <td><%= Extension%></TABLE>

</BODY></HTML>

<% Else %>

Table definition

Page 126: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Example of an Active Server Page (ASP)<HTML><HEAD><TITLE>Add an Employee to Healy Company Database</TITLE></HEAD>

<BODY onLoad="document.empForm.Name.focus()"><H2>Add an Employee to Healy Company Database</H2><HR>

<TABLE><FORM NAME="empForm" METHOD="post" ACTION="add1.asp"><TR><TD ALIGN="right" VALIGN="top"><B>Department:</B>

<TD><SELECT NAME="Dept"><OPTION>Personnel<OPTION>Finance<OPTION>Education<OPTION>Sales<OPTION>Management

</SELECT>

Page 127: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Example of an Active Server Page (ASP)

<TR><TD ALIGN="right" VALIGN="top"><B>Name:</B><TD><INPUT TYPE="text" NAME="Name">

<TR><TD ALIGN="right" VALIGN="top"><B>Home Phone:</B><TD><INPUT TYPE="text" NAME="Home_Phone">

<TR><TD ALIGN="right" VALIGN="top"><B>Extension:</B><TD><INPUT TYPE="text" NAME="Extension">

<P><P><TR><TD ALIGN="left" COLSPAN="2"><INPUT TYPE="submit" NAME="cmdSubmit" VALUE="Submit"><INPUT TYPE="reset" NAME="cmdReset" VALUE="Reset">

</FORM></TABLE>

</BODY></HTML><% End If %>

Page 128: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Development: Applets, Servlets

How are special effects and interactive elements added to a Web page?

p. 13.17 Next

Hit Countertracks

number of visitors to a

Web site

Image mapgraphic

image that points to a

URL

ScriptInterpreted

program that runs on client

Appletusually runs

on client, but is compiled

Processing form

collects data from visitors to a Web site

ServletApplet that

runs on server

ActiveX control

Small program that runs on

client

Page 129: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Development: ActiveXControls

An ActiveX Control is a small program, similar to an applet, that runs on the client computer instead of the server.

ActiveX is a set of object-oriented technologies developed by Microsoft that allows components on a network to communicate with one another.

Web browsers must support ActiveX in order to

run an ActiveX control program.

Page 130: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

More on ActiveXControls

It is a control using ActiveX technologies. An ActiveX control can be automatically downloaded and executed by a Web browser.

ActiveX is not a programming language, but rather a set of rules for how applications should share information.

Programmers can develop ActiveX controls in a variety of languages, including C, C++, Visual Basic, and Java.

Page 131: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: CGI

What is the common gateway interface (CGI)?

p. 13.18 Next

Communications standard that defines how Web server communicates with outside sources

Step 3. When the user submits a request, it is sent to the CGI program. The CGI program contacts the database and requests information for the user. In this case, it looks for a movie titled The Secret Garden.

Step 1. The programmer stores the CGI program in a special folder on the Web server such as /cgi-bin.

Step 2. The Webmaster creates a link between the CGI program and Web page. When a user displays the Web page, the CGI program automatically starts.

Step 4. The CGI program receives information from the database, assembles it in an HTML format, and sends it to the user’s Web browser.

Database

CGI script—program that manages sending and receiving across CGI

Page 132: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Development: XHTML

What is XHTML ?

eXtensible HTML is a combination of HTML & XML

http://en.wikipedia.org/wiki/XHTML

p. 13.20 Next

XHTML (Extensible HTML)

enables Web sites to be displayed more easily on microbrowsers (PDAs)

Includes features of HTML and XML

Page 133: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: XHTML 2.0Like HTML 5 (latest version of HTML)There are 3 flavors of XHTML:

1) XHMTL Transitional (most popular version) and allows formatting inside the document.

2) XHTML Strict (requires the use of Cascading Style Sheets (CSS) for formatting all elements.

3) XHTML Frameset (required for Web pages that use frames which divide up a Web page window)p. 13.20 Next

Page 134: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: XHTML

p. 13.20 Next

Page 135: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: XHTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta name="Keywords" content="CIW, Foundations, Example"/><meta name="Description" content="For the CIW Foundations Course"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><!-- <link rel="stylesheet" type="text/css" href="myform.css" title="stylesheet"/> --

><!-- Patrick Healy, NVCC-Woodbridge --><title>Basic Web Form for ITE Classes</title></head><body><h1>Basic NVCC XHTML Input Form</h1><form method="post" action="http://ss1.ciwcertified.com/cgi-bin/process.p1">

p. 13.20 Next

Page 136: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: XHTML

<strong>Enter Your Name: <input type = "text" name="Name" size="47"/></strong> <br/> <br/> <strong> Enter Your Email Address: <input type = "text" name="Email" size="40"/></strong> <br/> <br/><strong>Do you want to be adding to our mailing list?</strong><input type="radio" name="AddToList" value="yes" checked="checked"/>Yes<input type="radio" name="AddToList" value="no" />No <br/> <br/>Which campus of NVCC to you regularly visit ? (Check all that apply): </br><input type="checkbox" name="Alexandria"/> Alexandria <br/><input type="checkbox" name="Annandale"/> Annandale <br/><input type="checkbox" name="Loudon"/> Loudon <br/><input type="checkbox" name="Manassas"/> Manassas <br/><input type="checkbox" name="Woodbridge"/> Woodbridge <br/><br/><br/>

p. 13.20 Next

Page 137: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: XHTML

How often do you want to receive an Email from NOVA? <br/><select name="EmailFreq"><option>Every Day </option><option> Once a Week </option><option> Once every two weeks </option><option> Once a Month </option><option value="Remove">Never </option></select><br/><br/>Where would you like to vacation? (Choose all that apply)<br/><select name="vacation" multiple="multiple" size="4"><option>Hawaii</option><option>Virgin Islands</option><option>Canada</option><option>France</option><option>Mexico</option></select><br/><br/> <input type="submit"/> <input type="reset"/></form></body></hmtl> p. 13.20 Next

Page 138: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Page Development: XML, WMLWhat are XML and WML?

p. 13.20 Next

XML (Extensible Markup Language)

allows developers to create customized tags

WML (Wireless Markup Language)

allows developers to design pages specifically for microbrowsers

Uses wireless application protocol (WAP),

standard that specifies how wireless devices

communicate with Web

Server sends entire record to client, enabling client to do much of processing without

going back to server

Page 139: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

XML: eXtensible Markup Language

With XML, the server sends an entire record to the client, enabling the client computer to do much of the processing without going back to the server.

XML allows developers to define a single link that points to multiple Web sites.

XML separates Web page content from its format, allowing the Web browser to display the contents of a Web page in a form appropriate for the display device. (Smart phone, PDA, Laptop, PC, iPod )

Page 140: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

XML

XML Does not DO Anything !Perhaps it is hard to understand, but XML does

not DO anything. XML was created to structure, store,

and transport information.

The following example is a note to Tiny from Jane,

stored as XML:

<note><to>Tiny</to><from>Jane</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>

Page 141: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

XP

Tutorial 1 New Perspectives on HTML and XHTML, Comprehensive

141

XML: eXtensible Markup Language

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!-- Edited with XML Spy v2007 http://www.altova.com)   -->

- <note>

  <to>Shawn</to>

  <from>Caitlyn</from>

  <heading>Reminder</heading>

  <body>Don't forget me this weekend!</body>

  </note>

Page 142: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS) is a stylesheet language

used to describe the presentation of a document

written in a markup language. Its most common

application is to style web pages written in HTML and

XHTML, but the language can be applied to any kind

of XML document. The CSS specifications are

maintained by the World Wide Web Consortium

(W3C).

http://en.wikipedia.org/wiki/Cascading_Style_Sheets

Page 143: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

CSS Example

<html>

<head>

<title> Sunny Acres Farm </title>

<style type=“text/css”>

h2 h3 {color: yellow; background-color: black }

</style>

<link href=“farm.css” rel=“stylesheet” type=“text/css”/>

</head>

<body>

( much more goes here )

</body>

</html>

Page 144: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Perl: (Practical Extraction & Report Lang) Perl is a cross-platform programming language that enables users to

write custom CGI scripts. Perl is used for Web server processes. http://en.wikipedia.org/wiki/PerlAn example of Perl follows: #!/usr/bin/perluse CGI qw/:all/;$cgi_object = CGI::new( );print “Content-type: text/html\n\n”;print”<html>\n<head>\n<title>\nPerl CGIExample\n</title>\n<body>\n<h1>Hello, World!</h1>\nYour user agent is: <b>\n”;print $cgi_object->user_agent( );print “</b>.</html>\n”

Page 145: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Microsoft

Expression Web

Adobe Flash

Web Page Development: Author Software

Adobe Fireworks

What is Web page authoring software?

p. 13.21 Next

Creates sophisticated Web pages without using HTML Generates HTML

Adobe Dreamweaver

Lotus FastSite

Adobe LiveMotion

Adobe GoLive

and SharePoint Designer

Page 146: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

146

Web Page Development

• Most Web 2.0 sites use APIs (Application Programming Interface)– An API enables programmers to interact with an

environment such as a Web site or operating system

Discovering Computers 2012: Chapter 13Page 684Figure 13-21

Page 147: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Adobe Dreamweaver

http://en.wikipedia.org/wiki/Macromedia_Dreamweaver

Adobe Dreamweaver, or simply Dreamweaver, is a web development tool, originally created by Macromedia. Initial versions of the application served as simple WYSIWYG HTML editors but more recent versions have incorporated notable support for many other web technologies such as CSS, JavaScript, and various server-side scripting frameworks. [1] The software is available for both the Mac and Windows platforms, but can also be run on Unix-like platforms through the use of emulation software such as Wine. Dreamweaver is currently owned by Adobe Systems which purchased Macromedia in 2005. http://www.adobe.com/devnet/dreamweaver/articles/working_with_images_04.html

Page 148: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Web Developer Software

Perl

Python

PHP4, PHP5, PHP6(beta) Adobe Dreamweaver Adobe Flash

NetObjects Fusion

Page 149: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Perl

Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier.[1][2] Since then, it has undergone many changes and revisions and become widely popular amongst programmers. Larry Wall continues to oversee development of the core language, and its upcoming version, Perl 6.

Page 150: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Perl Syntax

my $a = 5; $a++; # $a is now 6; we added 1 to it. $a += 10; # Now it's 16; we added 10 to $a $a /= 2; # And divided it by 2, so $a is 8 #!/usr/bin/perl print "Content-type: text/html \n\n";

#HTTP HEADER #CREATE STRINGS WITH ESCAPING CHARACTERS $string = "David paid \$4.34 for Larry\'s shirt."; $email = "youremail\@youremail.com"; #PRINT THE STRINGS print "$string<br />"; print "$email<br />"; print '$string and $email';

Page 151: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

PHP (Used in Facebook)

PHP: Hypertext Preprocessor is a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. As a general-purpose programming language, PHP code is processed by an interpreter application in command-line mode performing desired operating system operations and producing program output on its standard output channel.

It may also function as a graphical application.

Page 152: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

PHP Syntax

<html>

<head>

<title>PHP Test</title>

</head>

<body>

<?php echo "Hello World";

/* echo("Hello World"); works as well, although echo isn't a function, but a language construct. In some cases, such as when multiple parameters are passed to echo, parameters cannot be enclosed in parentheses. */

?>

</body>

</html>

Page 153: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Multimedia Software Development

What is multimedia authoring software?

p. 13.22 Fig. 13-23 Next

Combines text, graphics, animation, audio, and video into interactive presentation

Used for computer-based training (CBT) and Web-based training (WBT)

Software includes Toolbook, Authorware, and Director

Page 154: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Mobile Phone Software Development Tools

Varies greatly by platform:

Java/Eclipse for Android

Objective-C/Xcode for iPhone

C# VB/Visual Studio for WinPhone

C++ Java/Blackberry SDK

Page 155: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Which platform(s) do you target?

The market is fragmented.

Build it from scratch for each platform.

Different tools, equipment, skills.

Different processes, rules, form factors.

Expensive. Difficult for small shops.

Page 156: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Which platform(s) do you target?

The market is fragmented.

Build it from scratch for each platform.

Different tools, equipment, skills.

Different processes, rules, form factors.

Expensive. Difficult for small shops.

Page 157: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

We chose to build a Native Android App

Bad Move: 9 months to build in Java.

First question everyone asked: Do you have an iPhone version?Not enough time to learn/build a version in Objective-C.

Then it was: Kindle Fire? Blackberry? WinPhone7?

Page 158: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Even big s/w shops can't build for all.

Android, iPhone, Blackberry, WinPhone

Kindle Fire, iPad, Playbook, and more.

But there are so many mobile devices!

Page 159: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

There is only one technology stack common to almost all devices.

i.e. Next Generation Web Technologies(and there's little the platform vendors can do about it.)

Page 160: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Javascript

Now a very serious development language.

Many consider it the “must-know” language.

Microsoft making JS/HTML5 first class citizen.

Many unbelievable projects in Javascript:

PC Emulator/Game of DOOM in Javascript Google Apps Anyone? Calc, Doc, Maps, etc Other languages implemented in Javascript

Page 161: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

HTML5 Apps have a serious limitation

Work inside a web browser.

Sandboxed. No accessing the phone.

No access to local files.

Typically served from a web server.

Cannot be installed on a phone. Big Problem!

HTML5 apps are web-apps not phone-apps.

Page 162: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Bridging the Gap between Web and Phone

The browser is just a control.

What if an app could load the brower control?

Feed it pages?

Provide hooks to allow pages to access the phone?

Camera, Databases, Contacts, Files, GPS, etc

Could a web-app then be packaged like a real app?

Page 163: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Multimedia Development: ToolBook

Next

ToolBook, from SumTotal Systems has a GUI and uses an object-oriented approach. Developers can design multimedia applications using basic objects such as buttons, fields, graphics, backgrounds, and pages.

In ToolBook, developers can convert a multimedia applications into HTML and Java so it can be distributed over the Internet.

ToolBook can be used to create content for distance learning courses.

Page 164: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

164

Multimedia Program Development

Discovering Computers 2012: Chapter 13Page 685Figure 13-22

Page 165: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Multimedia Development: Authorware 7

p. 13.22 Fig. 13-23 Next

Authorware, from Adobe, is a multimedia authoring program that provides the tools developers need to build interactive multimedia training and educational programs.

Authorware offers a powerful authoring environment for developing multimedia magazines, catalogs, and reference titles for CD-ROMs and DVD-ROMs.

Users need the Shockwave software plug-in to view certain applications.

http://www.adobe.com/products/authorware/

Page 166: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Multimedia: Adobe Director

p. 13.22 Fig. 13-23 Next

Director from Adobe, is a popular multimedia authoring program that provides powerful features for developers who need to build highly interactive multimedia applications and games.

Director’s features make it well suited for developing electronic presentations.

Users need the Shockwave software plug-in to view certain applications.

http://www.adobe.com/products/director/

Page 167: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Other Programming Languages and Development Tools

• Classic programming languages include:

Discovering Computers 2012: Chapter 13 167Page 675Figure 13-14

Ada ALGOL APL BASIC

Forth FORTRAN HyperTalk LISP

Logo Modula-2 Pascal PILOT

PL/1 Prolog RPG Smalltalk

Page 168: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Other Programming Languages LISP: LISt Processing– used for artificial

intelligence applications. (began in 1958) Logo: Used to teach children programming and

problem-solving. Pascal: used to teach structured programming. Modula-2: A successor to Pascal; used for

developing systems software. PL/I: Combination of FORTRAN & COBOL Smalltalk: Object-oriented programming language

Page 169: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

LISP PROGRAMMING LANGUAGE

LISP (LISt Processor) is generally regarded as the language for AI. LISP was formulated by AI pioneer John McCarthy in the late 1950's. Although LISP doesn't have a built-in inference mechanism, inference processes can be implemented into LISP very easily. LISP's essential data structure is an ordered sequence of elements called a "list." The elements may be irreducible entities called "atoms" (functions, names or numbers) or they can be other lists. Lists are essential for AI work because of their flexibility: a programmer need not specify in advance the number or type of elements in a list. Also, lists can be used to represent an almost limitless array of things, from expert rules to computer programs to thought processes to system components.

Originally, LISP was built around a small set of simple list-manipulating functions which were building blocks for defining other, more complex functions.

Today LISPs have many functions and features which facilitate development efforts. Among contemporary implementations and dialects, have gained acceptance as a standard. A substantial amount of work has also been done in Scheme, a LISP dialect which has influenced the developers of Common LISP.

John McCarthy

Page 170: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

LISP: LISt Processor

DescriptionThis program demonstrates a fairly simple conversion implemented in LISP. Each time the program (CONVERT) is called it asks the user for any Fahrenheit degree, then displays the equivalent Celsius degree for the user. Source Code

;;; This function, given a specific number of degrees in Fahrenheit,;;; presents the user with equivalent Celsius degree.

(defun convert ()(format t "Enter Fahrenheit ") (LET (fahr) (SETQ fahr (read fahr)) (APPEND '(celsisus is) (*(- fahr 32)(/ 5 9)) ) ))

Page 171: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

LISP Result

Page 172: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Do While Loops

Given the following pseudocode, what are the values of COUNT and SUM

when they are printed in the PRINT statement?

COUNT = 0

SUM = 0

DO WHILE (COUNT < 5)

COUNT = COUNT + 1

SUM = SUM + COUNT

END DO

PRINT COUNT, SUM COUNT = ____ SUM = _______

Page 173: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Do Until Loops

Given the following pseudocode, what are the values of COUNT and SUM

when they are printed in the PRINT statement?

COUNT = 0

SUM = 0

DO

COUNT = COUNT + 1

SUM = SUM + COUNT

UNTIL (COUNT > 7)

PRINT COUNT, SUM

Page 174: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

Nanotech: Future of Computers

According to a recent Computer World magazine article, magnetic disk drives in laptops and other devices will be replaced with nanotechnology in the coming years, which will greatly speed up performance. LiveScience.com also reported in July 2008 that researchers had created the first artificial DNA, which will influence technological advancements, including computers.A security engineer and tech expert who wishes to remain anonymous because of the nature of his job, explains: “With regard to nanotechnology and artificial DNA, computers are going to get smaller and be able to handle more tasks. For example, I see artificial DNA being used with accelerating the use of 'self-healing' servers (servers that can fix themselves when a problem occurs).” “What technology experts want to achieve is what they've wanted to achieve for decades now: computerized devices with more capacious storage and faster processing units. Nanotech and DNA-based computers are just possible means to these ends.”

Page 175: Discovering Computers CHAPTER 13 COMPUTER PROGRAMMING & SOFTWARE DEVELOPMENT

End of Chapter 13 Presentation