Monday, 12 September 2016

Unit 6 Assignment 1

Unit 6 - Assignment 1

Task 1

The Procedural Paradigm

This is basically a set of computational steps (Procedures) in order to complete a specific task. This is a very fast process and, because of its simplistic approach, it is often the paradigm used when teaching programming to beginners due to its relative simplicity. When writing code for complex software, procedural programming would not be the preferred paradigm because the complex software would require many lines of code, making it an unwieldy and perhaps confusing way of coding.
The languages that can be included are:
C.
C++.
FORTRAN.
Pascal.
Basic.


The Event Driven Paradigm

Event driven programming is designed to react to events such as user inputs, usually mouse clicks or key presses. This allows for more intuitive and interactive programs to be created, especially when programing GUIs. EDPs also allow for easy communication between hardware and software. The event driven paradigm is generally only useful when programming for GUIs due to its interactive and reactive nature, which renders it a fairly inflexible way of programming.
The languages that can be included are:
*Any language can be used, but can be made easier by using a language that provides high level abstractions like FOCUS, Lisp, Perl, Python, Ruby, SAS and COBOL.
The type of programs that are made using this are things like Games. This is because they are designed to work with the input created by a user, this can also work in things such as washing machines and microwaves. A kettle is another device that also uses this type of programming. All of these work because as certain things (events) occur; washing machines reach different points in their wash cycle, microwaves work for different time periods on different settings and kettles stop heating up once a temperature target is achieved. These are actual uses of Event Driven Paradigms.

The Object Orientated Paradigm

This focuses on using Objects rather than procedures in order to accomplish a task. This can be beneficial because it is modular; this allows separate objects to respond to the same instruction differently. Also, it allows the programmer to alter specific objects without altering the whole program. OOP has a steep learning curve, requires a lot of planning and consideration of the relationships between objects can be difficult to get used to. OO programs also tend to be larger in size, which can be a problem in some circumstances.
The languages that can be included are:
C++.
Objective-C.
Smalltalk.
Java.
C#.
VB.

Task 2

Time constraints

Depending on how much time a programmer has depends on what language they will use for a particular project, this is because some languages take longer to code with than others. This is something that will have to be taken into account when deciding what coding language you want to use.

Organisational Policies

Organisations will have different policies for all the different areas/things within the company. This could be something as basic as what kind of computers & operating systems the company uses (Windows, Linux, Mac OS) and they may also have a policy on what programming languages have to be used for any systems that area created for them.
However, if the company does not have a policy on what language has to be used then the programmer can pick whatever language they believe to best suit the system that they are coding for. Through the use of the information that the programmer can collect from the company they will be able to decide what language will be best however, this will be based on the language architecture for example; Visual Basic works well on Windows but could crash when used on Linux.

Suitability

The next phase would be for the programmer to find out what the system needs to do and then what kind of program the organisation wants. The programmer will need to find out what the company uses the system for then they can help the organisation figure out what would best fit the system.

Availability of Trained Staff

It is fine making a system for an organisation however, what really needs to be taken into consideration is the other staff members within the company. The programmer needs to find out if there are IT technicians within the company and find out which programming languages they can support because it will be pointless for the system to be created in a language that the technicians don’t know.

Reliability

Everyone wants a program that does not however, that cannot always be the case. It all depends on how reliable the company wants the system to be for example; if it crashes, is it just a case of losing 10 minutes of business or will it be a full day or two?
Another factor that must be considered is that, the reliability will also depend on the time the programmer has to code which will depend on the language that the programmer uses. However, in certain cases the organisation may say that they want a program that doesn’t crash but, may only use Windows operating systems but, the problem is a lot of programs on Windows crash because the operating system was not designed very well.

Environment

A company like a supermarket may want their system to link up to other pieces of hardware such as barcode scanners, the programmer must work out whether or not the programme that is being designed is going to be compatible with the hardware or if the hardware is going to need to be updated. Once the programmer knows this he/she will be able to determine what language is needed to do the job.

Hardware

You need to make sure that the hardware that you are using is compatible with the programming language that you have chosen to use (as mentioned previously).

Development and Maintenance Costs

Although it is free to use programming languages as the software to code them on is free to download off the internet there are other costs that the company may have to pay out. The programmer will have to look at what the specs on the computers are so they can tell the company if any of their hardware needs to be upgraded; in effect it will cost them money.
There will need to be a thought on how much it will cost for maintenance on the program and again this will all depend on how in depth the programmer wants to be depending on the other factors such as time, if they just quickly throw something together then there may be a chance that it will cost the company to bring the programmer back in to make patches and fix any bugs that have come up. There will also be costs for little things like upgrades on the programme, maybe the company have bought better computers and need the programme to work smoother on the new computers so the programmer may have to put a few tweaks on the programme.

Expandability

If a company is happy with the programme that has been made for them they may want it to be expanded onto all the computers in the office, the programmer will then need to add some more coding to the programme that has been made so that it can be used across multiple devices.
If everything is running smoothly further down the line the company may call the programmer and ask them if they can expand the programme nationally or even internationally to the company’s other offices which again just means that the programmer will need a few more lines of code and it will be operational.

Task 3

Sequencing

This is the first of the three basic logic structures in computer programming; In a sequence structure an action or event, leads to the next ordered action in a predetermined order. A sequence can contain any number of actions however; no actions can be skipped in the sequence. The program (when run) has to perform each action in order with no possibility of skipping an action or branching off to another action. Basically, in a sequence everything must be done in the order that they have been set, nothing can change or it will break.

Selection

This can also be called a “decision”; this is the second of the three basic logic structures found in a computer programming. In a selection structure, a question is asked and then depending on the answer, the program takes one of two courses of action. Once that has been done the program is then able to progress onto the next event.
This structure is sometimes referred to as an “if-then-else” process, this is because it directs the program to perform in this way: If Condition A is considered True then perform Action X else perform Action Y.


Iteration (Loops)

A single pass through a group of instructions, most programs contain loops of instructions that are executed over and over again. The computer iterates through the loop, which means that it repeatedly executes the loop.
All logic problems in programming can be solved by forming algorithms using only the three logic structures, and they can be combined in an infinite number of ways. The more complex the computing needs, the more complex the combination of structures;



Task 4

This is a table that briefly explains the different Data Types that you can use within a programming language.
Data Types
Value Range
Space Occupied
Boolean
True or False
Depends on implementing platform
Byte
0 through 255 (unsigned)
1 byte
Date
0:00:00 (midnight) on January 1 0001 through 11:59:59 PM on December 31 9999
8 bytes
Decimal
0 through +/- 999,999,999,999 with no decimal
0 through +/- 999,999,999,999 with 28 places to the right of the decimal place.
16 bytes
Double
-1.79769313486231570E+308 through -4.94065645841246544E-324 † for negative values;
4.94065645841246544E-324 through 1.79769313486231570E+308 † for positive values

8 bytes
Integer
-2,147,483,648 through 2,147,483,647 (signed)
4 bytes
Long
-9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2...E+18 †) (signed)
8 bytes
Short
-32,768 through 32,767 (signed)
2 bytes
String
0 to approximately 2 billion Unicode characters
Depends on implementing platform

Data Types are used for many different reasons but, they are completely situational. This is because the different types of data types are more suited to certain uses and others are more suited to other situations. This is because there are many different ways in which you can use each of the data types for example, you could use the integer data types for anything that requires a whole number; this means that it can be for values in a game or for stock numbers in a company. This means that there are certain scenarios that the different data types can be used in but, they are all related to the same thing.

Other important factors:
Logical Operators (AND/OR/NOT): Within Python there are three main Logical Operators, they are the "And", "Or" and the "Not". These work in their own individual ways:
And - This is where both the operands are true then condition becomes true. For example, (a and b is true).
Or - If any of the two operands are non-zero then condition becomes true. For example, (a or b) is true.
Not - Used to reverse the logical state of its operands. For example, Not (a and b) is false.

Selection Operators (<,>,=): There are also some Selection Operators that you can find within Python "<", ">"and "=".
< - If the value of left operand is less that the value of right operand, then condition becomes true. For example, (a < b) is true.
> - If the value of left operand is greater than the value of right operand, then condition becomes true. For example, (a > b) is not true.
= - Assigns values from right side operands to left side operand. For example, c = a + b assigns value of a + b into c.

WHILE Loops:
A WHILE Loop statement in Python programming language repeatedly executes a target statement as long as a given condition is true. The Syntax that you would use within Python to create a WHILE Loop is:
"while expression:
       statements(s)"
In this example you can see that "statement(s)" may be a single statement or a block of statements. The condition may be any expression, and true is any non-zero value. The loop iterates while the condition is true.
However, when the condition becomes false, program control passes to the line immediately following the loop.
In Python, all the statements indented by the same number of character spaces after a programming construct are considered to be part of a single block of code. Python uses indentation as its method of grouping statements.


Advantages and Disadvantages of Visual Languages/Script and Markup Language