170 likes | 269 Views
Computing and the Web. Computer Languages, Algorithms & Program Development. Overview. Communicating with a Computer The Role of Languages in Communication The program Language Continuum Assembled, Compiled, or Interpreted Languages Programming for Everyone Building a Program
E N D
Computing and the Web Computer Languages, Algorithms & Program Development
Overview • Communicating with a Computer • The Role of Languages in Communication • The program Language Continuum • Assembled, Compiled, or Interpreted Languages • Programming for Everyone • Building a Program • Software Development • Building a Program
Communicating with a Computer • Communication Cycle • Idea ~ encoder ~ sender ~ medium ~ receiver ~ decoder ~ response • Thought ~ brain ~ mouth ~ air ~ ear ~ brain ~ new thought • Process is prone to failure • Medium: windy / under water • Encoder / decoder: must speak the same language • Receiver: doesn’t hear / distracted • Response: subject matter is understood • People are adaptable (try to overcome) • Computers are rigid (they don’t try)
Role of Languages in Communication • Programming language is a series of specifically defined commands designed by programmers to give directions to digital computers. • Semantics refers to the meaning of the language • Syntax is the grammatical structure or form of the language • Translation is the porting of ideas and concepts from one language for to another
The Program Language Continuum • A program is a series of instructions for the computer to carry out. • Early computers relied heavily on physical wiring to implement the program • Soldered and patch cord connections • ENIAC could perform a variety of tasks • This lead to the development of the 1st computer language “machine language”
Machine Language • 1st generation language used to program • Instructions were represented as binary codes that could be placed directly into computer • Took many hours to create and code programs • Was very machine focused and machine dependent • Programmers had to know the instruction set of the machine
Assembly Language • 2nd generation programming language • Used mnemonics to represent machine instructions • Allowed the use of symbolic memory references • More programmer friendly and less error prone • Required a “translator” called an assembler to convert the program into binary • Still machine dependent • One-to-one correspondence between the program instruction and the machine code produced 0000062A 286E FFEC movea.l -20(a6),a4 0000062E 526C FFAE addq.w =1,-82(a4) count
High-level Languages • 3rd generation languages were much more people oriented • Language statements looked like English phrases • Each statement could generate many machine level instructions • Programs became machine independent • Very little reprogramming needed to change platforms • Start of the software industry • Creation of structured programming techniques • Procedures, functions, and subprograms • Logical grouping of functionality Average = ((region1 * quantity) + (region2 * quantity)) / 2
Nonprocedural Languages • 4th generation languages focused on simplifying tasks • Query languages for simplified data retrieval • Report writers for simplified output • Application generators for simplified program creation • Focus is results oriented and not process oriented • Example: Planting a tree • Object Oriented programming • Objects have properties and interact with other ob jects • Closely parallels the way people think Select * from (studentmaster) where “year=senior”
5th Generation Language? • Treating problems as humans do • Inheritance of characteristics (like genetics) • Encourages modular development • Use of natural language to communicate • Similar to SCi-FI computers
The Continuum • Started out very machine focused • Computers were expensive • People were cheap • Each successive generation improved • Built upon the previous generation • Added capabilities and opened new doors • Latest generations are people focused • Computers are cheap • People are expensive
Assembled, Compiled, or Interpreted • Assembled languages have a one to one correspondence between source and machine code • Compiled languages are translated in their entirety into machine code. There is a one to many correspondence between source code and machine code • Interpreted languages are translated and executed one line at a time. There is a one to many correspondence between source code and machine code
Programming for Everyone • Current applications contain limited capability to automate tasks • Macro: recorded set of operations within an application for later execution • HTML: language for describing and defining web pages • Uses special tags to specify formatting • Requires the browser to understand • Script: similar to programming, uses a limited subset of commands to accomplish a task • Think of as an extension to application • JAVA, Perl, Rexx, VBScript, AppleScript
Building a Program • Understand the problem • Develop the algorithm • Algorithm is a detailed description of the exact method to solve a problem • Consider the inputs and outputs • Evolve the logic of the processing • Flowcharts • Nassi-schneidermann charts • pseudocode • Write the program • Document the program • Test and debug the program
Building a Program • Write the program • Document the program • Test and debug the program • Syntax errors: mistake in the form or grammar of the language • Logic errors: error in the logic or processing • Runtime error: error induced by the input data • Reliability & Robustness • Correctness • Detection and correction of runtime errors
Software Development • How long does it take • Time is in person-months or person-years • How big are some programs • ROBOT simulator 1,000+ lines • Compiler (limited) tens of thousands • Word Processor hundreds of thousands • Operating System approx 6,000,000 • Weapon Mgt program several million
Building a Program • Creation of a payroll program • Basic process for a pay check • Hours X rate • Remove taxes • Print paycheck • Special considerations • Overtime • Variable tax scales • Monthly deductions