computing and the web computer languages, algorithms & program development
TRANSCRIPT
Computing and the WebComputing and the WebComputer Languages, Algorithms Computer Languages, Algorithms & Program Development& Program Development
OverviewOverview Communicating with a ComputerCommunicating with a Computer The Role of Languages in CommunicationThe Role of Languages in Communication The program Language ContinuumThe program Language Continuum Assembled, Compiled, or Interpreted LanguagesAssembled, Compiled, or Interpreted Languages Programming for EveryoneProgramming for Everyone Building a ProgramBuilding a Program Software DevelopmentSoftware Development Building a ProgramBuilding a Program
Communicating with a ComputerCommunicating with a Computer
Communication CycleCommunication Cycle– Idea ~ encoder ~ sender ~ medium ~ receiver ~ decoder ~ Idea ~ encoder ~ sender ~ medium ~ receiver ~ decoder ~
responseresponse– Thought ~ brain ~ mouth ~ air ~ ear ~ brain ~ new thoughtThought ~ brain ~ mouth ~ air ~ ear ~ brain ~ new thought
Process is prone to failureProcess is prone to failure– Medium: windy / under waterMedium: windy / under water– Encoder / decoder: must speak the same languageEncoder / decoder: must speak the same language– Receiver: doesn’t hear / distractedReceiver: doesn’t hear / distracted– Response: subject matter is understoodResponse: subject matter is understood
People are adaptable (try to overcome)People are adaptable (try to overcome) Computers are rigid (they don’t try)Computers are rigid (they don’t try)
Role of Languages in Role of Languages in CommunicationCommunication Programming language is Programming language is
a series of specifically a series of specifically defined commands defined commands designed by designed by programmers to give programmers to give directions to digital directions to digital computers.computers.
Semantics refers to the Semantics refers to the meaning of the languagemeaning of the language
Syntax is the Syntax is the grammatical structure or grammatical structure or form of the languageform of the language
Translation is the porting Translation is the porting of ideas and concepts of ideas and concepts from one language for to from one language for to anotheranother
Human Language Computer Language
Develop and gain meaning haphazardly
Designed by computer scientists
Meanings are derived by the users of the language
Meanings are specified by the language developers
Possibility of multiple meanings for words & phrases
Only one possible meaning for any given word
Possibility of idiomatic or regional meanings
No idiomatic or regional meanings
Meanings are derrived from the context, people can evaluate & select
Each command must have a specific meaning regardless of context
All human concepts & ideas can be represented
Not all human concepts can be represented by computer languages
The Program Language The Program Language ContinuumContinuum
A program is a series of instructions for A program is a series of instructions for the computer to carry out.the computer to carry out.
Early computers relied heavily on Early computers relied heavily on physical wiring to implement the physical wiring to implement the programprogram– Soldered and patch cord connectionsSoldered and patch cord connections– ENIAC could perform a variety of tasksENIAC could perform a variety of tasks
This lead to the development of the 1This lead to the development of the 1stst computer language “machine computer language “machine language”language”
Machine LanguageMachine Language 11stst generation language used to program generation language used to program Instructions were represented as binary codes Instructions were represented as binary codes
that could be placed directly into computerthat could be placed directly into computer Took many hours to create and code programsTook many hours to create and code programs Was very machine focused and machine Was very machine focused and machine
dependentdependent Programmers had to know the instruction set Programmers had to know the instruction set
of the machineof the machine
Assembly LanguageAssembly Language 22ndnd generation programming language generation programming language Used mnemonics to represent machine Used mnemonics to represent machine
instructionsinstructions Allowed the use of symbolic memory referencesAllowed the use of symbolic memory references More programmer friendly and less error proneMore programmer friendly and less error prone Required a “translator” called an assembler to Required a “translator” called an assembler to
convert the program into binaryconvert the program into binary Still machine dependentStill machine dependent One-to-one correspondence between the program One-to-one correspondence between the program
instruction and the machine code producedinstruction and the machine code produced
0000062A 286E FFEC movea.l -20(a6),a4
0000062E 526C FFAE addq.w =1,-82(a4) count
High-level LanguagesHigh-level Languages 33rdrd generation languages were much more generation languages were much more
people orientedpeople oriented Language statements looked like English phrasesLanguage statements looked like English phrases Each statement could generate many machine Each statement could generate many machine
level instructionslevel instructions Programs became machine independentPrograms became machine independent
– Very little reprogramming needed to change platformsVery little reprogramming needed to change platforms– Start of the software industryStart of the software industry
Creation of structured programming techniquesCreation of structured programming techniques– Procedures, functions, and subprogramsProcedures, functions, and subprograms– Logical grouping of functionalityLogical grouping of functionality
Average = ((region1 * quantity) + (region2 * quantity)) / 2Average = ((region1 * quantity) + (region2 * quantity)) / 2
Nonprocedural LanguagesNonprocedural Languages 44thth generation languages focused on simplifying generation languages focused on simplifying
taskstasks Query languages for simplified data retrievalQuery languages for simplified data retrieval Report writers for simplified outputReport writers for simplified output Application generators for simplified program Application generators for simplified program
creationcreation Focus is results oriented and not process orientedFocus is results oriented and not process oriented
– Example: Planting a treeExample: Planting a tree Object Oriented programmingObject Oriented programming
– Objects have properties and interact with other ob jectsObjects have properties and interact with other ob jects– Closely parallels the way people thinkClosely parallels the way people think
Select * from (studentmaster) where “year=senior”Select * from (studentmaster) where “year=senior”
55thth Generation Language? Generation Language? Treating problems as humans doTreating problems as humans do Inheritance of characteristics (like Inheritance of characteristics (like
genetics)genetics) Encourages modular developmentEncourages modular development Use of natural language to Use of natural language to
communicatecommunicate– Similar to SCi-FI computersSimilar to SCi-FI computers
The ContinuumThe Continuum Started out very machine focusedStarted out very machine focused
– Computers were expensiveComputers were expensive– People were cheapPeople were cheap
Each successive generation improvedEach successive generation improved– Built upon the previous generationBuilt upon the previous generation– Added capabilities and opened new doorsAdded capabilities and opened new doors
Latest generations are people focusedLatest generations are people focused– Computers are cheapComputers are cheap– People are expensivePeople are expensive
Assembled, Compiled, or InterpretedAssembled, Compiled, or Interpreted
Assembled languages have a one to one Assembled languages have a one to one correspondence between source and machine correspondence between source and machine codecode
Compiled languages are translated in their Compiled languages are translated in their entirety into machine code. There is a one to entirety into machine code. There is a one to many correspondence between source code and many correspondence between source code and machine codemachine code
Interpreted languages are translated and Interpreted languages are translated and executed one line at a time. There is a one to executed one line at a time. There is a one to many correspondence between source code and many correspondence between source code and machine codemachine code
Programming for EveryoneProgramming for Everyone Current applications contain limited capability Current applications contain limited capability
to automate tasksto automate tasks Macro: recorded set of operations within an Macro: recorded set of operations within an
application for later executionapplication for later execution HTML: language for describing and defining HTML: language for describing and defining
web pagesweb pages– Uses special tags to specify formattingUses special tags to specify formatting– Requires the browser to understandRequires the browser to understand
Script: similar to programming, uses a limited Script: similar to programming, uses a limited subset of commands to accomplish a tasksubset of commands to accomplish a task– Think of as an extension to applicationThink of as an extension to application– JAVA, Perl, Rexx, VBScript, AppleScriptJAVA, Perl, Rexx, VBScript, AppleScript
Building a ProgramBuilding a Program Understand the problemUnderstand the problem Develop the algorithmDevelop the algorithm
– Algorithm is a detailed description of the exact Algorithm is a detailed description of the exact method to solve a problemmethod to solve a problem
– Consider the inputs and outputsConsider the inputs and outputs– Evolve the logic of the processingEvolve the logic of the processing
FlowchartsFlowcharts Nassi-schneidermann chartsNassi-schneidermann charts pseudocodepseudocode
Write the programWrite the program Document the programDocument the program Test and debug the programTest and debug the program
Building a ProgramBuilding a Program Write the programWrite the program Document the programDocument the program Test and debug the programTest and debug the program
– Syntax errors: mistake in the form or Syntax errors: mistake in the form or grammar of the languagegrammar of the language
– Logic errors: error in the logic or processingLogic errors: error in the logic or processing– Runtime error: error induced by the input Runtime error: error induced by the input
datadata Reliability & RobustnessReliability & Robustness
– Correctness Correctness – Detection and correction of runtime errorsDetection and correction of runtime errors
Software DevelopmentSoftware Development How long does it takeHow long does it take
– Time is in person-months or person-yearsTime is in person-months or person-years How big are some programsHow big are some programs
– ROBOT simulatorROBOT simulator 1,000+ lines1,000+ lines
– Compiler (limited)Compiler (limited) tens of thousandstens of thousands
– Word ProcessorWord Processor hundreds of thousandshundreds of thousands
– Operating SystemOperating System approx 6,000,000 approx 6,000,000
– Weapon Mgt programWeapon Mgt program several millionseveral million
Building a ProgramBuilding a Program Creation of a payroll programCreation of a payroll program Basic process for a pay checkBasic process for a pay check
– Hours X rateHours X rate– Remove taxesRemove taxes– Print paycheckPrint paycheck
Special considerationsSpecial considerations– OvertimeOvertime– Variable tax scalesVariable tax scales– Monthly deductionsMonthly deductions