Monday, 29 September 2014

Recursion

 - A method or function that calls itself.
 - A type of iteration or looping.
 - Must have a stopping condition (this prevents endless loops).

Two types:
 - Tail, when the last thing that happens is the recursive call.
 - Head, when the first thing that happens is the recursive call.

Functions, Subroutines, Procedures - Worksheet Answers

A function can pass values, and will return a value:
                    Def function(somenum):
                                  Return somenum*3

A subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code (called by name):
          go sub

A procedure can receive a parameter or argument and does not have a return values (which would make it a function, essentially).
          Def procedure(somenum):
                print(somenum)

An iteration means the act of repeating a process with the aim of approaching a desired goal, target or result. Each repetition of the process is also called and "iteration", and the results of one iteraiton are used as the starting point for the next iteration.
       
         Iteration is used to repeat sections of code:
         
         number = 1

         while number = <10
         print("Iteration!")
         number = number + 1
           
        Iteration means less code == easier to read.
        More efficient // powerful.
        More manageable && maintable
        More extensible with new features.

A for loop is a set of instructions that repeat until a criteria is met. It is:

            - Count controlled
            - Repeats a fixed number of times based on:
                           1. Limit
                           2. Increment
            - Good for arrays or when number of repetitions is known in advance

While loops are condition controlled loops, so they work like IF statements. They repeat for as long as the condition is true, which can be a problem as an indefinite loop never fails.
There are two types of while loops:
       While do: Condition first so may never run:
                      while 10 + 10 = 20
                      print("While do")
       Do while: condition last so always runs at least once
                     print("do While")
                    while 10 + 10 = 20

ITERATION WORKSHEET
For loops
a) A for loop completes a set of instructions, repeating until a criteria is met. The number of repetitions is known in advance.
b) int i = 0; - Initialize (initializes the variable!)
    i < 10; - Argument (continuation condition) - Tests if i meets certain condition (if < 10)
    i++ - Adds on 1

While loops
a) for (int i = 0; i < 10; i++){
               System.out.println(i)
    }
---------------------------------------------
Corrected:
i = 0
While (i < 10)
    print(i)
    i++

b) Program a working solution that counts from 10 to 1:
for (int i = 10; i > 0; i--){
              system.out.println(i)
     }
 
c) What is the difference between a while loop and a for loop?
A for loop is count controlled and will  repeat for a predetermined number of iteraitons.
WHILE is condition controlled and will repeat until a conditional statement is satisfied. 
     

Thursday, 18 September 2014

RAID

RAID
RAID (Redundant Array of Inexpensive/Independent Disks) is a term to describe several hard disks made into one logical disk.

The main reasons why RAID is used are:
-          To make loss of data happen less often
-          For more storage space
-          More flexibility – a disabled hard drive doesn’t mean no computer
-          Access data more quickly

The disadvantages of RAID are:
-          Certain choices can protect against data being lost because one (or a number) of disks failed. This does not, however, protect against the data being deleted or overwritten.
-          After one (or a number) of disk failures, getting the system into a clean state could take a long time
-          RAID can be a little challenging – some easy to make mistakes can result in nulled data

Monday, 15 September 2014

What is an Algorithm? Answers June 2010

An algorithm is simply a set of instructions or steps that is followed to complete a task.

There are 2 common ways to display algorithms, one being flowcharts, and another being pseudo-code.

Designing Solutions to Problems - Data Dictionaries

A data dictionary describes different elements of a program and the relationship between them.

Useful to maintain a program where the original author is absent.


Example Data Dictionary


Wednesday, 10 September 2014

Mini Test Answers (Jun 2010 a451)

(a)
(i) An example of an input device would be a scanner, to scan the barcodes of the various items bought.
(ii) An example of an output device would be a display to give information to the user of the checkout.
(iii) An example of a storage device would be a hard disk, to store information on what is commonly bought to be used to store membership details.


Systems software directly controls the hardware of the system.

Applications packages allows users to do extra tasks.

Monday, 8 September 2014

Key Words

Variable - Location in memory that can be changed

Program design and UI

08/09/2014 (Mon)

3 Key stages to program design:
-          Designing the User Interface
-          Designing the Data
-          Designing the Processing (algorithms)


User interface:
The method where the user tells the device what to do and the device responds.
The difference in UI changes and updates between mobile phones and ATMs is largely to do
with competition. There is no competition between brands of ATMs, however, UI is unique
selling point of many mobile phones. ATMs also have to have familiarity, so that anyone can
use an ATM anywhere in the world.

Types of interface:
1. Command Line Interface (CLI)
 - Linux terminal
 - Command prompt (Windows)
 - PowerShell (Windows)
 - Mac terminal (AT&T UNIX - FreeBSD)

2. WIMP - Menu Driven (Windows Icons Menus and Pointers)

3. Natural Language - Voice recognition technologies - Google search

4. Graphical User Interface



Command Line Interface
-          Purely based on command sets
-          Difficult to learn - Acronym commands that can be chained, hypothetically unlimited commands
-          For technical people.
Command line can be powerful and efficient, such as assigning values to multiple computers.

Menu Driven
-          Easy to use
-          Require little technical knowledge
-          Limited to the options available
-          Examples are Sat Nav systems, old phones, Sky remotes, ATM.

Natural Language
-          “Hello computer, create a spreadsheet with income and expenditure to calculate my monthly outgoings…”
-          Difficult to construct – Human language is very ambiguous
-          AI of computer systems is not developed enough
-          Is used to some extent in Sat Nav car systems.

GUI
Advantages:
-          Commonly used
-          Easy to learn
-          Require limited training
-          Intuitive
-          Fewer mistakes can be made when using the program
-          Use of GUI objects such as drop downs, option buttons, dialogue boxes to alert on validation errors
-          User can associate icons with real world objects – e.g. Filing cabinet and recycle bin.
Limitations:
-          Require more processing power and system resources
-          Not always suitable for the environment it is being used in
-          Can be restrictive for more advanced users.



Factors to consider when designing a user interface:
-          The user
-          Screen layout
Most important functions are central, with more complex or less used functions in menus
-          Validation
Asks if you’re sure – Checks spelling, lets you know you need an @ symbol for your email address, make sure the username is free, date of birth in reasonable range etc.
-          Online help
-          Readability
-          Choice of fonts and colours
-          Technology Platform
-          Help
Windows paperclip man – ‘What would you like to do?’

Windows 8
Windows 8 was redesigned radically, with the new tile based start menu that is completely different to its predecessor. The changes were made partly to shift closer to touch screen devices, such as tablets.
Microsoft seemed to believe that tablets and PCs needed to be combined – but there was no demand. They attempted to create demand with tablet PCs and surface, which also only partly worked.
One detail that was a controversial change was the removal of the start button in the bottom left corner – it was replaced in windows 8.1, but it was unnerving for long term users used to utilizing the start button for the control panel, browse files, and generally use as the first call for system functions.
Windows 8 was received so poorly largely because of the steep learning curve, although these complaints were addressed with Windows 8.1, an update to edge towards the functionality of Windows 7. A desktop mode was also implemented, to actually avoid using the tile system in place.
Windows 8 also most likely failed because it seemed to alienate long term desktop users with a useless interface. For experienced users, the interface got in the way more than it sped things up, especially without a touch screen.







Thursday, 4 September 2014

Compiled and Intepreted Languages

Programming Phases
Define a task/problem        (Specification)
Plan your solution              (Design)
           - Find suitable algorithm to solve it
           - Find suitable data structures to use
Write code        (Implementation)
Fix program error (bugs)        (Testing and debugging)
Make your customer happy       (Deployment)