Unit 6 (P1, P2, P3, P4): Programming Language

Describe the Application and Limits of Procedural, Object Oriented and Event Driven Programming Paradigms (P1)

Procedural Programming

Procedural programming works like a step by step guide. You have to create a sequence of instructions which tells the computer what to do first, second, third and so on. Examples of a procedural programming language would be Pascal, Turbo Pascal and Basic.


Procedural programming would be used when it is necessary to complete steps in a program and is only used when a user is about to do a certain task. An example of a procedural programming scenario would be that if a user has to enter their details into a form in order to move onto the next step such as you need to login first so you can confirm your order then this would require procedural programming. Procedural programming can also help solve calculations for scientific usage too.


There are a few limitations when using procedural programming as is can be very time consuming to write and can not be related to real world objects. Procedural programming is used to instruct a computer on what to do with simple instructions. It is also very difficult to change details once it has be coded due to its layout.


Object Oriented Programming

Object oriented programming is basically having a problem and in order to solve the problem, you break it down into several classes. This makes it easier to change the code as programmers are encouraged to place code in different classes rather than just one so it is less directly accessible by the computer system. Unlike procedural programming which uses an algorithm, object oriented programming is made simpler to code. Examples of a object oriented language would be  C++, Java and Microsoft Visual Basic.


Object oriented programming is a language model organised around objects rather than actions and data rather than logic. Object Oriented is a specific class that has two areas, state and behaviour. It not only describes the data base of a data structure but also the type of operations.


There are a few limitations with object oriented programming as there are no tools that develop the application and that this programming language could be used in PHP coding only using software like Adobe Dreamweaver and VB.NET. Another main limitation of object oriented programming is that it has to be done manually; bigger in file size because they have many lines of code for standard applications.


Event Driven Programming

Event driven programming is written using procedural programming and can use object oriented programming. This type of language determines how the program responds to the users’ needs and is not related to the structure of the program. Event Driven programming is only used when it is going to use a windows graphical interface as this may not be suitable on any other interface. An event driven language can be created using Microsoft Visual Basic. Most modern GUI use Event Driven Programming.


Event driven programming is a way that allows the program to respond to many different inputs or events. This is a paradigm in which the flow of the program is determined by events. The events can be from any source such as timers and sensors. An example of an event driven scenario would be like an alarm clock set for a certain time to do a certain task like ring and send a message saying “Wake Up!”.


A limitation of event driven programming would be that it does not automatically allow you to enter event loops and requires the user to manually enter loops. In addition to this, it also require a large amount of processing power due to the need of continuously active event loops.


Supporting Tools and Environments

IDE is a software application that provides tools to programmers. IDEs such as Eclipse and Net Beans which provides a compiler and interpreter unlike some other IDEs. Most other IDEs normally consists of a source code editor, build automation tools and a debugger. Most modern IDEs offer Intelligent code completion feature.


CASE is the use of a computer-assisted method to organise and control the development of software. CASE allows designers, code writers, testers, planners, and managers to share a common view of where a project stands at each stage of development. A CASE tool may show the progress graphically.


Because the development process emphasises testing and redesign, the cost of servicing a product over its lifetime can be reduced considerably.

Factors Influencing the Choice of Programming Language

Describe the Factors Influencing the Choice of Programming Language (P2)

Organisational Policy

When working for a certain company, there will be an organisational policy that will consist of you using certain hardware and software. Furthermore, when choosing a programming language to create a piece of software which only uses Windows 7/8 hardware and software then the chosen programming languages you are able to use are ones that support Windows 7/8 such as Python and Java etc.


Suitability

When asked to create a piece of software then you will need to select the correct programming language that would be suitable to create the software that has been asked of you. There are many languages that can be chosen but it depends on what software you are making and what tools the programming language provides to help you make the software.


Availability of Trained Staff

If you have trained staff available then this can make creating software much easier as the staff that you hire would presumably already know the programming language that you will be using to create a particular software. However, even If your staff do not know a certain language, then they can be trained by other staff members who know the programming language to teach them. Staff members will be more confident in doing the task if there are other staff members that can help which means you can cut cost down and not worry about issues such as training staff etc.


Reliability

Any software created would need to be reliable as if you do have a software that is unreliable then it may harm your computer. This can also be linked with the people who you work with as you must be able to trust staff members to be able to do a task on time and also to a quality standard.


Development and Maintenance Cost

The development and Maintenance cost for creating a piece of software is the budget that is available for development and then you will need to maintain the program after it has been developed. 


When in development you will need to make sure that there is enough budget to cover recruitment and being able to purchase hardware and software needed to complete the task. Then, you will also be required to maintain the program when it is in use as technology is always being updated so it is good to keep the software updated regularly to keep people interested.


Expandability

You will need to expand the company in order to keep up with the latest technology. So the programming language for the software you made and there is a new technology released, then that software will need to be expanded so the company that is maintaining it makes sure it is up to date. Some programming languages are easier to update then other languages such as python which can be updated quicker than most since it cuts down on the code you need to use to complete a task which means that there will not be a lot of updating.


Python

Python is very reliable. The language has been around for over 20 years, and is in use in tens of thousands if not more sites. Python is actively maintained, so when problems are reported, they are dealt with promptly. However, the reliability of code you write depends on your skill at programming. If you write buggy code, Python cannot save you from your own errors.


Python is suitable. Python is open-source so people can freely use and distribute. Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages.


Python is not a heavy programming language like Java. It is very quick easy to create and update. Python cuts down on the amount of code you need to execute a task. Python very closely resembles the English language, using words like ‘not’ and ‘in’ to make it to where you can very often read a program, or script, aloud to someone else and feel like it makes sense to someone who does not know programming. This is also helped by Python’s very strict punctuation rules which means you don’t have curly braces ({ }) all over your code.


Python is expandable. An example of this is ForecastWatch.com which is in the business of rating the accuracy of weather reports from companies such as Accuweather, MyForecast.com, and The Weather Channel. ForecastWatch.com is a 100% pure Python. Python was chosen initially because it comes with many standard libraries useful in collecting, parsing, and storing data from the web. The threading library turned out to be very important in scaling ForecastWatch.com's coverage to over 800 cities.


Another use of Python is a program called The Molecular Modeling Toolkit (MMTK) which is an open source Python library for molecular modeling and simulation with a focus on biomolecular systems, written in a mixture of Python and C. Python was chosen because it has a high-level interpreted language and a CPU-efficient compiled language which meets the requirements of rapid development and efficient execution.


This alone shows that Python can be used for many different tasks.


Java

Java is reliable to the extent of the programmer. If the coding is not efficient or not organised, it could be slow overall. Software such as eclipse that programs in Java helps you to spot errors in the code which you can easily fix.


Java is suitable for all machines running Java VM. It is designed so that Java can write once, run everywhere. Java is better suited for the internet and mobile devices, Android is written in Java.


Java is one of the most popular choices of programming language so when a company is recruiting staff, it is more likely that the potential employee has Java experience.


Construct 2

Construct 2 is a reliable software for developing games. There are no crashes and you don’t need to be a professional programmer to make a game.


Construct 2 is suitable only for Windows OS. It is suitable for gamers who want to make 2D games, you can’t make 3D games with this software.


Construct 2 only uses Windows OS because the majority of gamers use this OS. Since Windows OS is widely used for gaming, it is only logical for Construct 2 to support Windows OS than Mac or Linux.

Sequence

Explain Sequence, Selection and Iteration as Used in Computer Programming (P3)

A simple definition of sequence is that it is a set of instructions that are in order, one instruction after another.


A flow chart is a diagram that uses shapes to visualise a process. Flow charts are useful because it is an effective way to visualise than to describe. Every flow chart has a start and an end.


Psudocode:

Start

  Perform one or more actions in sequence

Stop


Example in Python:

  1. list1 = [ICT', ‘Maths', 1997, 2015];

  2. list2 = [1, 2, 3, 4, 5, 6, 7 ];

  3. print "list1[0]: ", list1[0]

  4. print "list2[1:5]: ", list2[1:5]

Output:

list1[0]: ICT

list2[1:5]: [2, 3, 4, 5]


Selection

A selection is when a question is asked and depending on the answer, there may be more than one outcome. For example, “What is your age?” might be asked and there are multiple outcomes. Using the if statement, I could say that ‘if the number is between 13 and 17, say “You are a teenager’. This means that if I type a number in between 13 and 17 including 13 and 17 then it would say I am a teenager.


Psudocode:

Start

  Test a condition for true or false

  On true 

    Take one or more actions in sequence

  On false

    Take none, one, or more actions in sequence

Stop


Example in Python:

  1. def test(x):

  2.     if x in (0, 2, 4):

  3.         print("Match")

  4.     else:

  5.         print("Nope")

  6. test(0)

  7. test(1)

  8. test(2)

Output

Match

Nope

Match


Iteration

An iteration is a loop that goes through a group of instructions when it gets executed repeatedly.


Iteration involves the use of two variables which are called ‘while’ and ‘do while’.

The while statement performs a function and the code will run until that function is true depending on how you set up the loop.


Psudocode:

Start

  Test a condition for true or false

  Stop on false

  On true

    Perform one or more actions in sequence

    Go back and test the condition again


Example in Python:

  1. a = 0

  2. while a < 10:

  3.     a = a + 1

  4.     print a

Output:

1

2

3

4

5

6

7

8

9

10

Benefits of Data Types

Outline the Benefits of Having a Variety of Data Types Available To the Programmer (P4)

The various data types allow the programmer to describe how the data is to be stored inside a program. It also allows the programmer of the code to understand the maximum and minimum values that may be stored there. It also allows the programmer of the code to understand the maximum and minimum values that may be stored there.

The Boolean data type for example, indicates how the data is to be used. A Boolean variable may have only one of two possible values, either true or false. An Integer may not contain fractional values, and so on and must only contain whole numbers. Both of these variables do not take a lot of bytes to store and is very easy to process.

Double take a large amount of data. It is similar than single type but it takes twice the memory storage and therefore it takes longer to process. This means that if you are using numbers that are below 7 digits, then using a double data type will be a waste of memory and inefficient.

Having a variety of data types is good to the programmer and can save up on memory and CPU usage of using a variety where necessary. Efficient storage and faster processing shows that a variety of data types is beneficial to the programmer. It also makes it easier to debug since a data type may be causing errors and since you used a variety of data types, this makes it easier to pin-point where the bug is.

Boolean

  • Used for creating true or false statements.

  • Can be written in both algorithm and coding.

Char

  • Need to hold only a single character but do not need other data types known as strings.

  • You will need quotation marks when using char

String

  • Can hold multiple characters without having to use char.

  • This will need quotation marks.

Integer

  • This enables the programmer to use whole numbers between 0 and 9 in code.

Single / Double

  • Double has more digits than a single data type

  • Both can use decimals

  • Double data type stores twice as much as single. (Double, 8 Bytes, up to 14 Digits – Single, 4 Bytes, up to 7 Digits)

Floating Point

  • Floating Points are numbers that have a decimal in them.

  • Similar to integer but you are allowed to use decimals.


0 views
  • White LinkedIn Icon
  • White Twitter Icon
  • YouTube
  • White Discord Icon

Privacy Policy

 © 2020 Jack Young (SirHandsomeJack). All rights reserved.