Programming Languages Flashcards
What is Computational Thinking?
• formulates the solution to a problem in the form of
algorithms
- solves by using computer
- consists of several parts
- a sequence of step-by-step instructions
- tells the computer how to solve a problem
Computational Thinking Process
Computational Thinking Process
- Abstraction, Function and data structure
- Decomposition, Break a problem into smaller parts
- Pattern Recognition, Identify similarity in a problem
- Algorithm Design, Step-by-step instructions for the computer
At the end of this lesson, you should be able to
- Distinguish between the low-level machine-language and high-level programming language
- Describe the two ways of translating high-level language program code to machine-language instructions
- State the main features of high-level programming languages: C, C++, Java, Python
Programming is the process of
Programming is the process of
implementing a representation of the solution for the computer to execute
• taking an algorithm and encoding it using certain programming language
Programming language is a medium through which
Programming language is a medium through which programmer may give instructions to a computer
The computer has its own language.
The computer has its own language.
• machine-language that is specific to the type of
computer processor
• consists of a set of machine instructions and
data objects that are encoded in ‘0’ and ‘1’
binary format
• error-prone for human to code a program
directly using the computer’s machine codes
High-level programming languages that are more user-friendly are hence invented.
High-level programming languages that are more user-friendly are hence invented.
- provide abstraction from the internal operating detail of the computer
- enable the programmers to focus on solving the problem
- make the process of developing the algorithm simpler
Program Translations Sequence
High-level program code is first translated into low-level machine-language instructions.
Which then instruct the computer to perform the necessary operations.
Two approaches for program translation:
- interpretation
* compilation
Interpretation approach
• uses a program known as interpreter
• reads one high-level code statement at a time
- immediately translates and executes the statement before processing the next one
• examples: Python, R, and JavaScript
Compilation approach
• uses a program called compiler
• reads and translates the entire high-level language program
(source) code into its equivalent machine-language instructions in an
executable file
• the resulting machine-language instructions can then be
executed directly on the computer when the program is launched
• examples: C and C++
Pros for Interpreter
• very portable across different computing platforms
• produces results almost
immediately
- easy to debug
- program executes more slowly
- useful for implementing dynamic, interactive features, such as those used on web pages
Compiler
- program runs very fast AFTER compilation
- smaller in code size after compilation
- must compile the entire program before execution
- needs to be re-compiled if to be used on different computing platforms
• used in large and sophisticated software applications when speed is
of the utmost importance
C language
• developed to help implement the Unix operating system
• allow for direct access of, and manipulation of, the underlying computer’s
hardware.
It is a compiled language
• the program code (i.e. source code) needs to be
compiled first, before it can be executed.
Most suitable for applications
- direct access to the computer’s hardware
- fast real-time response
C++ language
- an extension to the C language
- with additional support for Object-Oriented Programming (OOP)
In OOP
• programs are designed based on objects that contain attributes
and behaviors
• programming is then focused on how the objects interact with one another
- without the need to know the internal code detail of the object
C++ is a compiled language
• used for applications that need high performance and are based on object-oriented software design principles