Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
866 views

Assignment 1 - Program Review

This document reviews two programs. For Program 1, it summarizes that the program is a currency exchange calculator, allowing a user to input an amount and exchange rate to calculate the converted amount. It analyzes the code, identifying elements like variables, event handling for the calculate button, and mathematical operators. It notes some problems with the program like a lack of labels and errors, and suggests improvements like adding labels, error messages, and handling large amounts of data.

Uploaded by

api-315864424
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
866 views

Assignment 1 - Program Review

This document reviews two programs. For Program 1, it summarizes that the program is a currency exchange calculator, allowing a user to input an amount and exchange rate to calculate the converted amount. It analyzes the code, identifying elements like variables, event handling for the calculate button, and mathematical operators. It notes some problems with the program like a lack of labels and errors, and suggests improvements like adding labels, error messages, and handling large amounts of data.

Uploaded by

api-315864424
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Unit 12

ASSIGNMENT 1 PROGRAM REVIEW


CHANDINI DUDHNATH

Resubmission

TABLE OF CONTENTS

Introduction.................................................................................................2
Program 1....................................................................................................3
Purpose of the program............................................................................3
Characteristics..........................................................................................3
Tools and techniques which have been used............................................5
Problems with the code and improvements program 1............................6
Problems...................................................................................................6
Improvements...........................................................................................6
Flowchart program 1.................................................................................8
Program 2....................................................................................................9
Purpose of the program............................................................................9
Characteristics..........................................................................................9
Tools and techniques used......................................................................11
Quality of the code program 1.................................................................12
Efficiency/performance...........................................................................12
Maintainability........................................................................................12
Portability................................................................................................12
Reliability................................................................................................12
Robustness.............................................................................................13
Usability..................................................................................................13
Strengths and weaknesses Program 1....................................................14
Strengths................................................................................................14
Weaknesses............................................................................................14
Definitions/keywords.................................................................................15
Conclusion.................................................................................................17
Bibliography..............................................................................................19

INTRODUCTION

In this assignment I will be comparing two pieces of code. We have been


given this scenario, You are a programmer working for a software
development company. Your manager has asked you to look at
two programs shown below as program 1 and program 2.
For each piece of code I will be explaining:

The purpose of each code


The characteristics of each code
Tools and techniques used in each code
The quality of each code
Strengths and weaknesses of each code
Problems and improvements that can be made to each code

PROGRAM 1

PURPOSE OF THE PROGRAM

This code can be used as a currency exchanger: you enter the amount in
the amount box and then enter the exchange rate in the rate box. Once
you click the calculate button the application will give you the answer. It
can also be used as a calculator, however its intended use is for currency
exchange. This is useful for people who are going to a foreign country and
need to convert one currency to another or for businesses import export
calculations.
CHARACTERISTICS

The
exchange
rate is entered
in this box.

This is where
the amount of
money
is
entered in.

This box outputs


the result.

Once you have entered


the amount and rate
you click this button.

This is the currency exchanger


running.
As you can see
the
user
as
entered in the
amount.

The user has then


clicked
the
calculate button.
3

The user as then


entered
the
exchange rate.

This is the output the


user is left with.

This is the code


to this form
application.

This part of the code


refers to the Calculate

Public Class Form1


Private Sub

btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click


'data declaration
Dim amount, rate, result As Decimal
amount = CDec(txtAmount.Text)
rate = CDec(txtRate.Text)

This part of the code


refers to the amount
and rate boxes.

'calculate result by multiplying amount with exchange rate


result = amount * rate
'display result
txtResult.Text = result

This part of the


displays the result.

code

This part of the code shows that


the
currency
exchanger
is
multiplying the amount by the
rate. This means we can also use
this for multiplication, however
its intended purpose is to be
used as a currency exchanger.

TOOLS AND TECHNIQUES WHICH HAVE BEEN USED

Command words these are instruction words which usually form a


statement which tells the computer to perform a certain task. An example
of a command word from the code would be, Dim amount, rate, result As
Decimal. This line of code is declaring a variable as a decimal.
Event handling event handling, handles the user inputs within the
program. An example of an event handling in the code would be , Private
Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles
btnCalculate.Click. This line of code is in charge of the button that the user
clicks once they have inputted the amount and result.
Mathematical operators these are operators which handle
mathematical operations. An example of a mathematical operator from
the code would be, result = amount * rate. This has been used to multiply
the amount and rate together to create the result.
Data structures a data structure is a way in which data is stored and
manage in a piece of code a variable is a storage space. A variable is a
type of data structure. Dim, is used to declare the variable. An example
of this from the code would be, Dim amount, rate, result As Decimal. This
is declaring a storage space.
Basic String Handling String handling is a set of predefined functions
that allow programmers to write software programs to manipulate strings.
A string consists of one or more characters, including text or numbers.
For example, I enjoy sport is a string. You can manipulate string in the
following ways: removing all spaces, replacing characters or changing
lower case characters to upper case. An example of basic string handling
in VB is as follows; lngLen = Len("Visual Basic") ' lngLen = 12 (T
Basic file Handling File Handling is a set of predefined functions that
allow programmers to write software programs that open, read, write and
close files. Information is stored in files that are saved on the computer
system, storing information in files allows uses to retrieve data quickly. For
example, letters, images and emails are saved in files. An example of file
handling in VB would be as follows; Open "c:\test.txt" For Binary As #f
(This example was from the internet references will be in the bibliography)
Subroutines A subroutine, function or procedure is a portion of the
code within a program that performs specific task, either separately or in
connection with the main program. . An example of subroutines in VB

would be as follows; Private Sub btnCalculate_Click(sender As Object, e


As EventArgs) Handles btnCalculate.Click
Loops a loop enables you to run a section of code repeatedly.

PROBLEMS WITH THE CODE AND IMPROVEMENTS PROGRAM 1

PROBLEMS

There are multiple problems with program 1 and in the following section I
will be discussing these problems.
The program is not labelled at all which means that a user might not know
what it does and how to use it. The program should be labelled to help out
the user and enable a better user experience. Although the boxes are
labelled the user might get confused as to what it does. This means that
the user could also get confused as to where the data is going to be
inputted or outputted. As well as this if the program crashes, there are no
error messages. This can be frustrating and the user will most likely not
know what is going on.
The program also cannot handle large amounts of data without crashing.
This isnt good for users because no one wants to use an application
which lags and doesnt give the answer promptly. This also makes the
program very unreliable. It also limits the users which are going to use this
program because some users might need an application which handles
large amounts of data. This means that this program does not cater to all
needs of the customers/users.
The program doesnt run in any other languages which means its not very
portable. This again can limit the amount of users who can actually use
this application. As well as this there are no currency signs, there should
be a drop down box with currency signs. A drop down box would make the
program easier to use and currency signs will enhance the user
experience.

IMPROVEMENTS

There are many ways in which this program could be improved and in this
section I will discuss these possible improvements.
Error/Pop-up messages should come up whenever the program crashes.
This will enable the user to understand what is going on. There could also
be a Report a crash problem. These type of features are available on
many software programs currently. They enable the user to send report
messages to the makers of the program. This allows the person in charge
of the program to improve the software and fix any problems with the
code.
Labels have to be added a description of the program to help the user use
the program and understand what it does. Currently the program is not
labelled leaving it very confusing as to what the program does and where
the data should be entered. As well as this currency signs should also be
added in a dropdown menu to enhance the user interface and make it
easier and more engaging to use. As well as this, the program should be
altered so that it can be made available on many other operating systems.
This will make the program more portable and allow more people to use it.

IMPROVEMENT FLOWCHART PROGRAM 1

The following flow chart is an improvement flowchart. I have added an


error message as an improvement. The error message appears when the
program crashes. This will help users understand what it going on so that
they dont get frustrated when using the program.

Star
t

Do you need
to exchange
money?

Yes

Enter the amount


you
want
to
exchange in the
amount box.

Error
message

Enter the exchange


rate in the rate
box.

N
o

Click the calculate


button and wait for
your answer.

If it didnt work it
might have been
because
you
entered
letters
instead of numbers.
Make
sure
you

PROGRAM 2

PURPOSE OF THE PROGRAM

This code gives bonuses. When you enter a number between 50000 and
89000 you get a 5000 bonus. If you enter a number between 90000 and
149999 then you get an 8000 bonus. If you enter the number 150000 or
anything higher you achieve a 12000 bonus. This application can be used
by bank customers to work out how much interest they receive or it can
be used by employers to work out if there employees are entitled to a pay
bonus.

This is the application not


working. As you can see
there is a white box and a
submit button. The number is
entered into the white box
then the submit button is
clicked.

The user has entered the


number 150000 and has
received a bonus.

CHARACTERISTICS

10

The user as input a number.


The user has then clicked the
submit
button.
The
application processes it and
comes up with a box saying
bonus achieved: 0. This
means the person does not

Public Class form1

This part of the code


refers
to
the
Submit button.

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles btnSubmit.Click
'Data Declaration
Dim Sales_Total As Integer
Sales_Total = txtSalesTotal.text

These parts of the code is


used so that the user is told
whether or not they have
received a bonus.

'Amount entered into Sales Total Textbox equal or greater than 150,000 in the If
Statement then message displays 12,000
If Sales_Total >= 150000 Then
MsgBox("Bonus Achieved: 12000")
'Amount entered between 90000 and 149999 then message box bonus of 8000
ElseIf Sales_Total >= 90000 And Sales_Total <= 149999 Then
MsgBox("Bonus Achieved: 8000")
'Amount entered into Sales Total textbox ranges from 50,000
to 89,999 then message box to display 5000
ElseIf Sales_Total >= 50000 And Sales_Total <= 89000 Then
MsgBox("Bonus achieved: 5000")
'Amount entered is less 50,000 then bonus message should
be 0
Else : MsgBox("Bonus achieved: 0")
End If
End Sub
End Class

TOOLS AND TECHNIQUES USED


11

This line of code is used


as a boundary setter.
These boundaries deter
whether or not the user
is entitled to a bonus.
These
types
of
if
statements are used
throughout the code.

Command words - these are instruction words which usually form a


statement which tells the computer to perform a certain task. An example
of a command word from the code would be Dim Sales_Total As Integer.
This is declaring sales total as an integer.
Form control this controls the user interface. Things like buttons are
example of form control. An example of form control from the code is
btnSubmit_Click. This bit of code is referring to the submit button in the
final user interface.
Variables a variable is a storage space. Dim, is used to declare the
variable. An example of this from the code would be, Dim Sales_Total As
Integer. This is creating a storage space for sales total.
Basic file Handling File Handling is a set of predefined functions that
allow programmers to write software programs that open, read, write and
close files. Information is stored in files that are saved on the computer
system, storing information in files allows uses to retrieve data quickly. For
example, letters, images and emails are saved in files. An example of file
handling in VB would be as follows; Open "c:\test.txt" For Binary As #f
(This example was from the internet references will be in the bibliography)
Basic String Handling String handling is a set of predefined functions
that allow programmers to write software programs to manipulate strings.
A string consists of one or more character, including text or numbers. For
example, I enjoy sport is a string. You can manipulate string in the
following ways: removing all spaces, replacing characters or changing
lower case characters to upper case. An example of basic string handling
in VB is as follows; lngLen = Len("Visual Basic") ' lngLen = 12 (T
Data structures A data structure is the way in which data is stored,
organised and accessed within a software program. Arrays and records are
examples of data structures.
Subroutines A subroutine, function or procedure is a portion of the
code within a program that performs specific task, either separately or in
connection with the main program.
Event Handling Event handling manages and responds to the inputs
received within a software program. For example, when a user clicks on a
mouse button (event), the event handler routine recognises this and
performs the defined set of actions of that event
Maths operators these are used to manipulate numbers.

12

Loops a loop enables you to run a section of code repeatedly.

13

QUALITY OF THE CODE PROGRAM 1


EFFICIENCY/PERFORMANCE

Efficiency/performance of a code
refers to the overall performance of
the code.
The code is very quick and
responsive. This is because the code
has been kept to a minimal meaning
that it doesnt have to process too
much whilst running. This means its
efficiency and performance are both
very good.

MAINTAINABILITY

Maintainability refers to how easily


the code is easy to maintain. For
example is the code easy to edit and
modify, if so, it is easy to maintain.
There were no errors in this program
which meant it was well written and is
very easy to maintain.

PORTABILITY

Portability of the code refers to how


easily the program can be ran on
different computers. All computers
are different which means the
software can run at different speeds
but the software has to be simple and
efficient in order for it to portable.
Although this code runs very
smoothly in VB it does not work in
other programming languages which
mean it will not work on many
operating systems, limiting its
portability.

RELIABILITY

14

Reliability refers to how dependable


the code is. In order for the code to be
reliable people need to be able to
trust that the software is giving
correct information. Quality of outputs
also is key.

This code is very reliable in the sense


that it runs small data processes very
quickly and efficiently however it does
tend to crash when it is processing
large amounts of data.
ROBUSTNESS

Robustness of a code refers to how


the software copes with handle large
data processes. For example, does it
crash easily, if so then the software
isnt very robust?
The program isnt very robust
because the inputs can only be
numbers due to the fact that at the
start of the code the variables are
stored as integers meaning it can only
process numbers.

USABILITY

This refers to how easy the software is


to use. Is the user interface easy to
use and comprehend?
The program is very easy to use and
is very user friendly however there is
no initial labelling or instructions
meaning that the user may not know
where to input the data etc. this
means that the not very good
however the program is still usable.

15

STRENGTHS AND WEAKNESSES PROGRAM 1

Program 1 has many strengths and weaknesses to it. In this section I will
be explaining what its strengths and weaknesses are as follows.

STRENGTHS

The program is pretty efficient, there is no major lagging which creates a


smooth user interface. The code is quite simple and well-structured which
means there is no unnecessary line of code. This in turn means that the
code doesnt take a long time to modify and transfer into other coding
languages.
The program is quite easy to use and understand even without labelling
which means users of all ages can easily use this program.
Another major strength of this ode would be that there were no initial
errors to start with. This made it easy to use and makes the code more
maintainable. I also noticed that the quote has been kept to a bare
minimal meaning that it is fast and responsive.
This code is also very reliable because none of the answers that it gives
out are wrong. This means that the code is always right and you know that
the outputs are correct.

WEAKNESSES

16

Although the program is very simple and efficient I think that it lacks
many things such as labelling. When I first used ran this code in VB I had
no idea what it did because there was no labelling or instructions. This
makes it hard for users to use because they do not know how to use the
program.
Another weakness to this program would be that no error messages popup when the program crashes.
A well as this the code does not work in other programming languages.
This means that the program isnt very portable. It also limits the amount
of people that can use the application because it in turn doesnt cater for
different operating systems.

DEFINITIONS/KEYWORDS

The following set of keywords have all been copied from a


textbook, the reference will be in the bibliography.
Basic file Handling File Handling is a set of predefined functions that
allow programmers to write software programs that open, read, write and
close files. Information is stored in files that are saved on the computer
system, storing information in files allows uses to retrieve data quickly. For
example, letters, images and emails are saved in files.
Basic String Handling String handling is a set of predefined functions that
allow programmers to write software programs to manipulate strings. A
string consists of one or more characters, including text or numbers. For
example, I enjoy sport is a string. You can manipulate string in the
following ways: removing all spaces, replacing characters or changing
lower case characters to upper case.
Command words A command word is an instruction which usually forms
parts of a statement that tells the computer system to perform a specific
task. For example, FOR and NEXT are command words used in Visual
Basic.
Data structures A data structure is the way in which data is stored,
organised and accessed within a software program. Arrays and records are
examples of data structures.
17

Efficiency - When you design a software program, a key feature will be


how well it performs in terms of speed, processor time, memory space and
interaction with storage media.
Event Handling Event handling manages and responds to the inputs
received within a software program. For example, when a user clicks on a
mouse button (event), the event handler routine recognises this and
perform the defined set of actions of that event
Maintainability - When you design a software program, a key feature will
be how well it performs in terms of speed, processor time, memory space
and interaction with storage media.
Portability Programmers must think about how software programs will
run on different types of computer system. Software can react and
perform differently, depending on the type of computer system. Software
is considered highly portable if it can execute any type of computer
system.
Reliability People depend on software to provide them with accurate
information. The data is used to inform important decisions. For example,
sales figures can determine whether or not someone receives bonus. So
the accuracy and reliability of a software a programs output are another
crucial measure of quality.
Robustness Software needs to be able to cope with processing large
amounts of data reliably. It must be also be able to handle unexpected
input values in a controlled way (for example, by displaying a warning
instead of crashing.
Subroutines A subroutine, function or procedure is a portion of the code
within a program that performs specific task, either separately or in
connection with the main program.
Usability It is important that a software program is easy to use for its
intended purpose. You need to design software carefully to guard against
problems such as poor layout of the user interface, a lack of instructions
to help the user, or error messages which do not explain how a problem
can be fixed. As part of the design, users should be involved in testing the
software for usability.

18

CONCLUSION

For this assignment I had to review two programs. Program one was a
currency exchanger which exchanges one currency to another for people
who are going on holiday. It could also potentially double up as a
calculator because it multiplies two number together. Program two was an
application which gives bonuses depending on what number you enter.
This can be used by employees to find out whether or not they are
allegeable to a bonus. I think that its main use however is to work out
interest rate for a bank. This can be useful as it can quickly work out the
answer instead of the individual having to physically do the maths to work
it out.
I have reviewed both programs and discussed;

19

The purpose of each program


The characteristics of each program
Tools and techniques used in each program
The quality of program 1

Strengths and weaknesses of program 1


A flow chart showing the processes of program 1
Problems and possible improvements for program 1
Program 1 is a currency exchanger. When the user enters an amount and
an exchange rate in the required boxes they get the exchanged currency.
Program 1 is a lot simpler and more efficient which means it operates fast
than program 2. However I think it lacks some features. For example when
there is an error, no error boxes/messages are shown which can be
frustrating for the user as they do not know what is going on. It also lacks
labelling an instructions which is very important. The program also tends
to crash if the user inserts large amounts of data.
Program 2s purpose is to give out bonus when a certain total is met.
When a user enters a certain amount they might get a bonus depending
on whether or not that number hits the bonus boundaries. The code for
program 2 is a lot longer meaning that it is less efficient however it does
have a better structure because more techniques are used. Although the
structure is better when I ran the code in VB for the first time I came
across a couple of errors meaning that I had to fix them. This in turn
means that program 2 is less portable. I also found that there were no
error messages so when the program crashed I did not know what was
going on.
In my opinion, both programs have their separate strengths and
weaknesses however for me I preferred program 1 to program 2. This is
because originally there were many errors with program 2 and I found that
it lagged it a bit. As well as this program was harder to use in my opinion.
Program 1 in my opinion is better because it has two uses; a currency
exchanger and a multiplier. Program 1 was more labelled than program 2.
As wells as this the code is a lot simpler making it easy to modify and
transfer into other languages.

20

BIBLIOGRAPHY

Keywords BTEC First information and creative technology, pages 382384


Picture on front cover - https://www.google.co.uk/search?
q=coding&es_sm=93&source=lnms&tbm=isch&sa=X&ei=UpjOVPCLN4rm
aOvsgrgO&ved=0CAgQ_AUoAQ&biw=968&bih=539#tbm=isch&q=coding
&imgdii=wDtWco1WqhOwDM%3A%3BClRiO_17DB2YCM
%3BwDtWco1WqhOwDM%3A&imgrc=wDtWco1WqhOwDM%253A
%3BobD5ZCL8uNLD-M%3Bhttp%253A%252F
%252Fwww.conceptcupboard.com%252Fresource-centre%252Fwp-content
%252Fuploads%252F2013%252F07%252Fcoding.jpg%3Bhttp%253A
%252F%252Fwww.evenfromhere.org
%252F2014%252F04%252F25%252Fcoding-is-just-storytelling%252F
%3B1280%3B960
http://www.dreamincode.net/forums/topic/56171-file-handling-in-visualbasic-6-part-2-binary-file-handling/ - basic file handling example
http://www.vb6.us/tutorials/vb6-string-functions - basic file string example

21

You might also like