Mind map
Basic components of programming
Map content
Basic components of programming
Computer programs are written to process DATA
- Data stored with different DATA STRUCTURES
- COMPLEX
- ARRAY/LIST
- OBJECT
- OOP
- class
- starts with class keyword, followed by class name and colon eg class LivingThings():
- methods and attributes
- properties
- instance
- encapsulation
- class
- OOP
- ARRAY/LIST
- SIMPLE
- VARIABLE
- global
- at start
- local
- for specific function
- $number = 0; $name = 'John Smith';
- superglobals
- always available regardless of scope
- global
- VARIABLE
- COMPLEX
- DATA TYPE
- Data stored with different DATA STRUCTURES
Algorithm CONTROL STRUCTURES
- SEQUENCE
- step by step
- statement; statement; statement;
- step by step
- SELECTION
- true/false
- if-then-else
- if (condition) { statement; statement; }
- Statement executed only when TRUE
- if (condition) { statement; statement; } else { statement; statement; }
- if (condition) { statement; statement; } else if (condition) { statement; statement; } else { statement; statement
- if (condition) { statement; statement; }
- ITERATION
- counted loop
- for
- for ($variable=0; $variable < somenumber; $variable++) { statement; statement; }
- for (initialization expression; test condition; update expression) { // code to be executed }
- for
- pretested loop
- while
- while (condition) { statement; statement; }
- while (set condition true){code;}
- certain condition met at start of loop
- while
- post tested loop
- used for looping until condition met at end of loop
- do-while
- foreach loop
- used in arrays
- counted loop
- CONDITION
- logical expression
- logical operators AND OR NOT
- SEQUENCE
Arithmetic
- Basic maths calculations + - * /
FUNCTIONALITY
- METHODS
- see OOP
- FUNCTIONS
- function function_name($somevariable){ executable code; }
- to use (call) a function use just its name followed by semicolon eg displayName()
- Consists of three parts: function name, set of () to hold incoming variables, set of {} to enclose code for function
- Forms
- <formaction = "where it goes file.php" method "post">
- input element example: <input name="something" type ="input type" value "something">
- input name used for $_POST variable
- input value passed when submit button pressed
- form element example: <form name="something" method ="post" action "someaction.php"></form>
- METHODS
Control Flow of program
- Event listeners like mouse click
- events trigger functions to run
- Event listeners like mouse click
naming conventions
- variables
- starts with $, lowercase (snake case) with underscore between words
- function
- lowercase with underscore between words
- do things so name must use verb
- include keyword function as part of the name
- name must reflect what function does
- inside a class
- properties (variable inside a class or object
- camelCase (starts with lowercase
- methods (similar to function but in class or object)
- same as properties
- properties (variable inside a class or object
- constants
- UPPERCASE with underscore between
- classes
- Titlecase (starts with uppercase), singular
- files
- lowercase with underscore
- class files
- match class name
- variables
common issues
- indentation must be correct - use three spaces not tab
- lines with conditionals (if,else etc) must be terminated with semi-colons
- capitals are important
- parentheses and braces must match closing ones
- quotes around strings
Information
- Description
- Year 10 Digital Technologies Mind Map on Basic components of programming, created by L O on 25/08/2019.
- Created by
- L O
- Views
- 0
- History
-
- Created by L O · Aug 25, 2019
- Copied by L O · Aug 25, 2019
- Rating