Wednesday 8 February 2017

1.1 Programming Basics

  • Memory: the location where instructions and data are stored on the computer
  • Algorithm: a sequence of steps that can be followed to complete task and that always terminates
  • Syntax: the rules of how words are used within a given language
  • Memory address: a specific location where instructions or data are stored
  • Assignment: the process of giving a value to a variable or constant
  • Constant: an item of data whose value does not change
  • Variable: an item of data whose value could change while the program is being run
  • Debug: the process of finding and correcting errors in programs
  • Declaration: the process of defining variables and constants in terms of their names and data types
  • Data type: determines what sort of data are being stored and how it will be handled by the program
  • Integer: any whole positive or negative number including zero
  • Pointer: a data item that identifies a particular element in a data structure - normally the front or rear
  • Array: a set of related data items stored under a single identifier. Can work on one or more dimensions
  • Element: a single value within a set or list - also called a member
  • Record: one line of a text file


Naming and Storing Data
  • The data are stored in memory along with the instructions
  • Using meaningful names will help you when they are trying to trace bugs and it also allows other programmers to follow the code more easily
  • The process of giving data values is called ‘assignment’
  • A simplified visualisation of how data is handled
Memory Addresses
1000
1001
1002
Variable
Number1
Number2
Answer
Data
2
3
5


  • There will be millions of memory addresses, only three are shown in this diagram


Constants and Variables
  • Data are stored either as a constant or a variable
  • The name given to a constant should be self-explanatory
  • Meaningful names make the code easier to work with as the program gets bigger
  • It also makes it easier for anyone else that looks at the code, to work out what the program is doing
  • It makes it easier to debug
  • Several programmers can work on it at the same time
  • Easier to update the code


Data types
  • Integer - VB can store -2 147 483 648 to + 2 147 483 647
  • Real/float
  • Text/string
  • Boolean
  • Character
  • Date/Time
  • Pointer/reference
  • This data type is used to store a value that will point to or reference a location in the memory of the computer
  • If you think of memory as a series of pigeon-holes or addresses where instructions and data are stored, the pointer/reference is used in a program to go to a specific address
  • Array
  • Each individual name in the array is called an element
  • Records
  • Used to store a collection of related data items, where the items all have different data types


Built-in and user-defined data types

  • User-defined data types are combining existing data types together

No comments:

Post a Comment