Learning Unit 4 Programming Theory Flashcards
(12 cards)
We use computers
To help us solve problems.
Computational thinking provides us with
A method (used to produced a solution) by taking a complex problem and using 4 key techniques in problem - solving process.
4 key techniques to computational thinking:
- Decomposition
- Pattern recognition
- Abstraction
- Algorithms
As a programmer, you need to make sure that you are
Solving the problem that the user intended.
When you analyze a statement, do:
- Read the problem carefully and make sure you understand it.
- Underline words that describe what is to be done.
- State in your own words what you need to do.
- List all facts given about the problem.
Pattern recognition:
- Maybe an existing program that can be used to solve the problem.
- Maybe be pre-written methods that can be called completely/partially solve the problem.
- Maybe existing generic algorithms that can be adapted to solve the problem.
- Some code may need to be repeated.
Abstraction:
- Purpose: focus on what is important to the problem and ignore the rest.
- Most problems are very complex, one way to to manage it: break problem into parts (decompositions) and focus on each task individually.
Algorithms:
Can be a flowchart/pseudocode.
Data Structure
Information in the problem is stored in a data structure.
Flow Charts:
- Used in place of pseudocode to represent an algorithm.
- Great at providing a more visual representation of a problem.
Pseudocode:
- Start code with “begin” and finish with “end”. Indent all instructions between “begin” and “end”.
- One line of pseudocode is similar to a line of Java code.
- Assignment statement is arrow —- pointing left (not =)
- No semi-colons at the end of a statement.
- Variable types vary from one language to another, so don’t include any variable declarations.
- Do not use any method names that only belong to one language.
- Mathematical symbols are universal in any language and can be used.
- Use the word input when entering data from the keyboard.
- Use display when displaying data on screen.
Trace Table:
Good way of locating a logical error and helps to understand the purpose of the program.