Programming and Programming Languages (Week 6) Flashcards
What does it mean for a computer to be a general-purpose computing machine?
Computers are general- purpose computing machines, they can be used for many different tasks
But they do not know how to do anything unless somebody programs them => tells them what to do
What is Programming?
Programming means creating a sequence of instructions for a computer to carry out a task
What is the difference between an algorithm and a program?
- An algorithm is an “abstract or idealized” process
=> it might ignore details, e.g. invalid user input, hardware failure or limitations of the hardware - A program, like an algorithm, is a sequence of detailed instructions, but…
=> A computer must understand each instruction and accomplish the task
=> A program is much more detailed than an algorithm – it implements the algorithm
What do Programs need to worry about that Algorithms don’t?
Unlike an algorithm, a program may have to worry about the shortcomings of hardware and data input, e.g.
- Insufficient memory: not enough storage or RAM
- Limited processor speed: too much data per time unit
- Invalid or malicious input: letter instead of number
- Hardware failure, e.g. broken network connection
A program typically contains implementations of one or more algorithms bundled together.
What is Machine Code?
At first (1950’s), people wrote programs “manually”
Programs were written in machine code - a sequence of binary numbers for instructions and data.
What are some drawbacks of Machine Code?
Time consuming to create, difficult to locate and correct errors
Each CPU type uses its own set of instructions
How was Machine Code initially inputted?
Punched cards were used to load programs and data into the memory of a computer.
What is an Assembly Language?
Soon, assembly languages were used – the instructions we used for the Toy computer are an example for an assembly language.
Allows programmers to use meaningful words instead of binary numbers for instructions and memory locations.
* E.g. PRINT instead of machine code 001
* E.g. STORE Sum instead of 010 110 (labels in assembly languages make it easier to refer to a memory location)
What is an Assembler?
Assembler: a program that translates assembly code to machine code
Basic idea: use a program that helps to create other programs
Why write code in Assembly language?
It is easier to use than binary code.
The assembler also automates some of the “clerical tasks”, e.g. it keeps records where data is stored in memory.
What is the main limitation of Assembly Code?
Machine Dependency
- An assembly language program running on one CPU must be largely rewritten to run on a different CPU type
- An assembler is aware of specific instructions and properties of a CPU, e.g. how many accumulators can be used, etc.
What is a High Level Programming Language?
A high-level programming language is a programming language with a strong abstraction from the details of the computer (think binary/machine code).
It may use natural language understanding and elements for ease of use.
It may automate (or even hide entirely) significant areas of computing systems like storage management - making the process of developing a program simpler and more understandable than when using a lower-level language.
Why were High Level Programming Languages developed?
Various high level languages have been developed to make it easier to create programs, usually for specific purposes, e.g.
- Learning how to program, scientific calculations, business tasks, web applications, system programming, data analytics, etc.
What advantages do High Level Languages have?
They provide instructions that are more powerful than assembly code and closer to the way people think.
=> Learning how to write programs is easier and faster.
Software can be created in shorter time.
=> Shorter time to market and lower cost of development.
It is easier to detect some program errors.
Programs are independent of any specific CPU architecture.
What are 6 examples of High Level Languages?
- Fortran
- Cobol
- Basic
- C and C++
- Java
- Javascrips