Task 1 –
Programming Paradigms
Describe the application and limits of Procedural, Object
Oriented and Event Driven programming paradigms.
Procedural programming: These have start and end points that
are definite. Before there were GUI operating systems the languages were normal
as they usually have a single starting point and then follow a sequence. The
modern versions of programs respond to events. This means that the start points
can be anywhere within the code. An advantage is if making a big operating
system then it is one of the best paradigms to use as it is used to make large
programs. The main disadvantage of procedural programming is that it isn’t as
fast compared to lower-level language code. This means that for applications
that may require a lot of processing power, it can then limit the effectiveness
of it. The big restriction of procedural language is re-using it . The same
method of coding cannot be used multiple times as it will become more and more
complex.
Object Oriented: This is about classes and inheritance. The objects can be viewed as
machines which have an individual role. These are capable of receiving
messages, processing data and sending messages to other objects. This is known as encapsulation. An advantage is
that it is useful to create classes and sub-classes for a website such as
ticking boxes that would be displayed on a site. This is also very good for a user
interface design. A disadvantage is there are only a few illustrations with
object oriented and there are also no tools to develop the application.
Event Driven: These respond t.o events and an example would be
a louse click. This is an example of modern programming because they need to
have the responses to a large variety of events that GUI operating systems
provide. An advantage is that it allows you to add sounds to a task such as an
alarm clock for when it reaches a certain time it will make a soundSpy. A
disadvantage is that this doesn’t allow you to enter event loops and doesn’t
allow a user to do it manually.
Here is a video on Programming Paradigms: https://youtu.be/sqV3pL5x8PI
Here is a video on Programming Paradigms: https://youtu.be/sqV3pL5x8PI
Visual Basic:
Advantages:
· Visual Basic is easy to learn and is also an integrated IDE. It is free to download and there is great online help available.
·
Disadvantages:
·
They only work in Windows OS and a lot of memory is required. It is also slower than other languages.
C++:
Advantages:
·
Its free to download and is one of the fastest around.
·
The syntax is similar to what is used in other languages and it is multi-paradigm friendly.
Disadvantages:
·
It is a complicated language
·
It is difficult to debug
·
It is only 8-bit
DarkBASIC:
Advantages:
·
Free download
·
Easy to learn
·
Doesn’t require a lot of code
Disadvantages:
·
Costs money to use a version without advertisements
·
Mainly focused on creating games
·
Not very fast
JavaScript:
Advantages:
·
Java is free so anyone can use it.
·
It is a secure program to use so people can use it and keep their files safe.
·
Cross platform so can be used on multiple operating system.
It is also easy to learn so that anyone can go on to use it.
It is also easy to learn so that anyone can go on to use it.
Disadvantages:
·
Can be difficult to learn if the correct resources aren't used.
·
Slow to develop and run so projects could use with another form of code to develop and run things.
HTML:
Advantages:
·
Free to use
·
Text is used to make it easy to understand
·
Supported by most browsers
·
Search engine friendly
Disadvantages:
·
Limited security
·
Static language
Pages must be edited separately
Pages must be edited separately
P2
Time Constraints: Different programming languages take
longer to code so if a programmer has limited time then they will have to
choose a language which doesn’t take as long to code.
Organisational policies: Organisations will have to follow
policies of which programming languages can be used on which operating systems
they use such as Windows, Linux, and Apple Mac. If the company doesn’t have a
policy which states which programming language they have to use then they can
choose whichever they like. This will be chosen to suit the build of the system
which is being used.
Suitability: The programmer will need to find out what the
system needs to do for an organisation. They do this by asking what they need
the system for and what they do on it and they then will help figure out what
would fit the system.
Availability of trained staff: The programmer will need to
find out what staff members there are in the company and how trained they all
are to use specific language. This is because if the programmer creates the
system in the language in the preferred language of the technicians.
Reliability: A company will have to have a reliable company
system if they do not want the program to crash. If the program did crash it
all depends on the system whether it will be down for a short period or even a
day or two and this can be fatal to a business. The reliability also depends on
how long the programmer actually has to code which results on which language is
chosen. Most organisations which use Windows operating systems say that they
want a reliable program but this can’t be helped because windows was designed
with faults so crashes a lot.
Environment: A programmer will have to take into
consideration what hardware may need to be linked up to the system such as for
a supermarket they will have to link up to bar code scanners which will connect
to the system and say what is in stock and how much an item is. A different
type of programming language may need to be chosen once the programmer knows
what an organisation needs.
Development and maintenance costs: Depending on how much
programming language s used and how in-depth that language is will result on
how much maintenance and cost is needed.
A programmer will have to deal with and bugs and create patches which
will fix any problems. If there is a big problem there will be a big patch
which needs to be create but then it will be fixed and will run smoother.
Expandability: This is if a company happy with the programme that they have made for them then they may want this expanded to all of the computers at the office. The programmer will then need to edit the code so that it can be used on multiple devices.
Expandability: This is if a company happy with the programme that they have made for them then they may want this expanded to all of the computers at the office. The programmer will then need to edit the code so that it can be used on multiple devices.
Sequence: In Python a sequence is a set in order such as
lists, strings and tuplets. They show how tasks are carried out. For example if someone was to make a scrambled egg there would be a list of stages throughout which show clearly what to do next.
Selection: These are used in code mainly for if statements for
setting a single conditions. The program then evaluates the condition to
execute the demand depending on if it is true or false; this is done by using selection
operators <,>, ==, !=, >=, and <=.
This
code shows how the operators can be used to output different messages
depending on conditions being met or not.
Loops:
For and While
For
loop: These are a form of iterative loops that make running code efficient.
This allows a programmer to simultaneously run one or more statements
constantly until a false expression occurs.
The
code above shows a for loop which will output all of the elements in the array
between the commas and the last one stop the element outputting with a comma.
While
loop: This is a form of infinite loop which can execute one or more statements
repeatedly until the condition chosen is met. The loop keeps repeating until
the condition is met and then the loop will stop.
This
while loop is used to make sure the input from the user is between two
numbers.If the condition is not met first time round then the loop is
continuously run until the condition is met.
Data Types
|
Example of data type
|
Space occupied
|
Boolean – True or false
|
This is a
Data type that gives an answer of only True or False.
|
2 bytes
|
Date
|
25/12/2005
14 Feb 2017
05-11-17
These are three different ways in which dates can be displayed.
|
8 bytes
|
Decimal
|
A number with a decimal place 1.4 0.8 etc.
|
14 bytes
|
Double
|
Double precision floating point
|
8 bytes
|
Integer
|
Whole numbers such as 5, 7, 8 etc.
|
2 bytes
|
Long
|
Converts a value into a long integer.
|
4 bytes
|
String
|
This is a string of code that can be as long as the code goes on for.
|
10 bytes + sting length.
|
Why various data types are useful:
Boolean: Boolean's are useful as a data type because they
give a straight yes or no or true false answer. They are good for getting
straight to a point but this means that they can’t be used in complex
functions.
Date: Dates are useful as data types because it simply is
the date. It allows people to see current times and dates. These are used on
all websites and on real time operating systems like Google. Dates also add a
professional look to any website or operating system.
Decimal: Decimals are a useful data type because it allows a
precise measurement of what the data is rather than just an integer. Decimals
may be used in money too so an exact price is available.
Double: The double data type is useful for when working with
extremely long numbers rather than just having to write out every single number
from that point. This saves time and storage data and allows a processor to not
have to use as much power.
Integer: An integer is one of the most common in
programming, they are used in for or while loops and they are a whole number and
unlike floating pint numbers, they don’t have decimal places. An integer is
easy to understand because there is no long line of decimal places or a long
string of numbers in a row. They also use less space than real or float numbers.
Long: A long data type is a long string of characters. This
is useful because it allows a precise measurement of what is being inputted as
there are the exact numbers that are needed for that task.
String: A string is used to connect other data types like
integers and sentences together. Strings are useful because they make data make
sense and add a context to the data.
Operators: These include logical operators or selection operators. Logical operators are AND/OR/NOT and selection operators are <,>,=. These are used for making different or explaining different values quicker than it is to type them out.
Operators: These include logical operators or selection operators. Logical operators are AND/OR/NOT and selection operators are <,>,=. These are used for making different or explaining different values quicker than it is to type them out.



No comments:
Post a Comment