Mapa mental
3.2.2 - 3.2.4 (Programming)
Conteúdo do mapa
3.2.2 - 3.2.4 (Programming)
A computer Programm is simply a series of statements that are executed one after another
- They conventinally follow the pattern of:
- INPUT - PROCESS - OUTPUT
- They conventinally follow the pattern of:
As programs build up, programming constructs are formed. They consist of:
- Sequence - Do one statement after another
- Selection - Do a set of statements based on conditions; allowing the code to make choices and branch.
- Iteration - Do a set of statements in repeatedly in a loop
- There is COUNT CONTROLLED LOOPS and CONDITION CONTROLLED LOOPS
An Algorithm is the logical steps needed to solve a problem
- They can be expressed through FLOWCHARTS, PSEUDO CODE and HIGH LEVEL CODE
- More complicated problems may require multiple algorithms in order to solve them.
- They can be expressed through FLOWCHARTS, PSEUDO CODE and HIGH LEVEL CODE
When expressing a flowchart, there are certain symbols that need to be used:
- Terminator - [THIS SHAPE]
- Process - [RECTANGLE]
- Input/ Output - [RHOMBUS]
- Decision - [DIAMOND]
Pseudo Code is a method of describing an algorithm by using simplified code.
- There are certain rules that need to be addressed when writing pseudo code:
- Each step needs to be brief
- UPPERCASE letters for pseudo code similar to the programming language
- lowercase letters for pseudo code similar in the english language
- If keywords are used to show the beginning and end of a block of code, it should be indented.
- There are certain rules that need to be addressed when writing pseudo code:
Programmers write programs, users use them to accomplish tasks
- The User interacts with the program's interface
Commands within a programming language are called keywords. How they are structured within a program is called its syntax.
- The 'Console.WriteLine' is used to output to the screen
- '.ForegroundColour' changes the colour of the text
- '.BackgroundColour' changes the colour of the console window
Whilst computer programs are running, the computer stores data in memory. So therefore we can reference part of the memory that hold data with a variable.
- They are essentially then just pieces of data. This data can be assigned a different type and its value can be changed at any point.
- It is also good to properly name variables.
- They must also be declared before they can be used.
- Data Types Include:
- String - One line of text
- Char - A single character
- Integer - A Whole Number
- Double - Number with a decimal or fraction
- Boolean - True or False
- Using the '.ReadLine' allows data to be inputted in Variables
- They are essentially then just pieces of data. This data can be assigned a different type and its value can be changed at any point.
When using variables to hold the output of a calculation, the right data types must be used.
- Format Specifier ({0:F2}) can be used to have the output be formatted in the right type.
When writing programs, it is often wanted for a computer to take different routes in the program, depending on the value of the variables
- This can be done through conditions (IF statements)
- Keywords include 'IF', 'THEN' and 'ELSE'
- This can be done through conditions (IF statements)
A case statement is used when the 'IF' statement is too large. This way it is far more efficient as it is only run if the variable meets the value.
Mathematical operations can be performed with mathematical operators
Iteration and loops are useful for repeating sections of codes again and again.
- Count controlled loops use 'counter' and 'next'.
- Condition controlled loops use 'do' and 'while'.
Tracing Execution is used to track a computer program.
- It involves following the program through; taking each line of defining when variables change their value.
A procedure is a self contained set of commands that can be called at any point in the program.
- Useful for breaking a problem down into sections and preventing calling the same piece of code multiple times
An array is used when you have one variable with multiple instances of it.
- Useful when storing things such as names.
- Declared with a set of brackets.
- Useful when storing things such as names.
A function is a subroutine that takes in parameters and returns a value
- A function will only operate if it given the correct data typed parameters.
A record structure is a collection of related fields (variables). Each variable in the record can have a different data type.
- Steps include: Defining what will be in the record, Declaring the variables and then assigning them a value.
Recursion is a function that calls itself and has a terminating condition.
- This method however is not very efficient at all. Large amounts of memory are wasted.
Files are used to store data from programs once they are closed as the data is lost when it is closed.
- There are 5 main types of files that need to be understood:
- Serial Files: A file that stores data in no particular order; rather the order it arrives in.
- Deleting from a serial file involves creating a new file and copying all the data expect the part that needs deleting. This then becomes the new file.
- Searching through a serial file involves starting at the first item and working your way down.
- Sequential File: Data is stored in a key field which can be used as an identifier.
- Adding and Deleting from this file is practically the same as from a serial file.
- Indexed Sequential File: A file where the data is arranged according to key fields in the record, but it also has an index.
- This way the file can be accessed both sequentially and directly.
- To add to this file, the first record within the set of the record is looked up. The sequential method is then used.
- Deleting is much of the same as sequential
- To search the file, the index is searched sequentially for the first item in the set. The address is then directly accessed, and which point the file is searched sequentially.
- Direct Access Files: Being able to access a file directly through reading the length and position.
- Random Files: Records are stored using a key field on any part of a disk using a hash algorithm. This calculation then becomes the location, which can be randomly scattered
- Finding data can be extremely quick is the key field and the hash algorithm are known.
- Random files are useful for large databases and very large files
- When searching the data, the address can be accessed directly.
- Hashing involves converting a product code into an address. This however has problems.
- The file cannot be too big or the space can be wasted if the entire address is not used.
- Different product codes can create the same file address. This is called synonyms.
- Adding to the file involves generating an address in the file and checking its existence.
- This is similar to deleting, amending and finding data from the file.
- Serial Files: A file that stores data in no particular order; rather the order it arrives in.
- There are 5 main types of files that need to be understood:
Informações
- Descrição
- Mapa Mental sobre 3.2.2 - 3.2.4 (Programming), criado por Inponity em 09-03-2015.
- Criado por
- Inponity
- Visualizações
- 1
- Avaliação