Professional Documents
Culture Documents
Pro
Pro
Pro
Student’s name
List which assessment Pass Merit Distinction
criteria the Assessor has
awarded.
INTERNAL VERIFIER CHECKLIST
Do the assessment criteria awarded
match those shown in the assignment
brief? Y/N
Is the Pass/Merit/Distinction grade
awarded justified by the assessor’s Y/N
comments on the student work?
Has the work been assessed accurately?
Y/N
Is the feedback to the student:
Give details:
• Constructive?
• Linked to relevant assessment criteria?
• Identifying opportunities for improved Y/N Y/N
performance? Y/N
• Agreeing actions? Y/N
Does the assessment decision need
amending? Y/N
1
Internal Verifier signature Date
Programme Leader signature (if
required) Date
Give details:
Assessor Feedback:
LO1. Define basic algorithms to carry out an operation and outline the process of programming an
application.
Pass, Merit & P1 M1 D1
Distinction Descripts
LO2. Explain the characteristics of procedural, object-orientated and event-driven programming,
conduct an analysis of a suitable Integrated Development Environment (IDE).
Pass, Merit & P2 M2 D2
Distinction Descripts
LO3. Implement basic algorithms in code using an IDE.
Pass, Merit & P3 M3 D3
2
Distinction Descripts
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & P4 P5 M4 D4
Distinction Descripts
* Please note that grade decisions are provisional. They are only confirmed once internal and
external moderation has taken place and grades decisions have been agreed at the assessment
board.
3
4
General Guidelines
1. A Cover page or title page – You should always attach a title page to your
assignment. Use previous page as your cover sheet and be sure to fill the details
correctly.
2. This entire brief should be attached in first before you start answering.
3. All the assignments should prepare using word processing software.
4. All the assignments should print in A4 sized paper, and make sure to only use one
side printing.
5. Allow 1” margin on each side of the paper. But on the left side you will need to leave
room for binging.
Important Points:
1. Check carefully the hand in date and the instructions given with the assignment. Late
submissions will not be accepted.
2. Ensure that you give yourself enough time to complete the assignment by the due
date.
3. Don’t leave things such as printing to the last minute – excuses of this nature will not
be accepted for failure to hand in the work on time.
4. You must take responsibility for managing your own time effectively.
5. If you are unable to hand in your assignment on time and have valid reasons such as
illness, you may apply (in writing) for an extension.
6. Failure to achieve at least a PASS grade will result in a REFERRAL grade being
given.
5
7. Non-submission of work without valid reasons will lead to an automatic REFERRAL.
You will then be asked to complete an alternative assignment.
8. Take great care that if you use other people’s work or ideas in your assignment, you
properly reference them, using the HARVARD referencing system, in you text and
any bibliography, otherwise you may be guilty of plagiarism.
9. If you are caught plagiarising you could have your grade reduced to A REFERRAL or
at worst you could be excluded from the course.
6
Student Declaration
I hereby, declare that I know what plagiarism entails, namely to use another’s work and to
present it as my own without attributing the sources in the correct way. I further understand
what it means to copy another’s work.
rvindubndrsnnyk@gmail.com
Student’s Signature: Date: 2019 – 07 – 22
(Provide E-mail ID) (Provide Submission Date)
7
8
Higher National Diploma in Computing
Assignment Brief
The student should submit a GUI based system developed using an IDE. The system should
connect with a backend database and should have at least 5 different forms and suitable
functionality including insert, edit and delete of main entities and transaction processing.
3. Presentation
With the submitted system student should do a presentation to demonstrate the system that was
developed. Time allocated is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while doing
the presentation, but live demonstration of the system is required. Evaluator will also check the
ability to modify and debug the system using the IDE.
LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.
9
LO3. Implement basic algorithms in code using an IDE.
LO4. Determine the debugging process and explain the importance of a coding
standard
10
Assignment Brief and Guidance:
Task 1: Define basic algorithms to carry out an operation and outline the process of
programming an application (LO1)
Searching on an array/list is to find a given element on the array and return whether
it is found or not and return its position if found. Linear search and binary search
are two popular searching algorithms on arrays.
1.1 Define what an algorithm is and outline the characteristics of a good algorithm.
Develop algorithms for linear search and binary search using Pseudo code (P1).
1.2 Describe the steps involve in the process of writing and executing a program.
Take an array of 10 or more elements and dry run the above two algorithms.
Show the outputs at the end of each iteration and the final output (M1).
1.3 Define what Big-O notation is and explain its role in evaluating efficiencies of
algorithms. Write the Python program code for the above two algorithms and
critically evaluate their efficiencies using Big-O notation (D1).
2.3 Write small snippets of code as example for the above three programming
paradigms using a suitable programming language(s) and critically evaluate
their structure and the characteristics (D2).
Ayubo Drive is the transport arm of Ayubo Leisure (Pvt) Ltd, an emerging travel &
tour company in Sri Lanka. It owns a fleet of vehicles ranging from cars, SUVs to
vans.
The vehicles that it owns are hired or rented with or without a driver. The tariffs are
based on the vehicle type. Some of the vehicle types that it operates are, small car,
sedan car, SVUs, Jeep (WD), 7-seater van and Commuter van. New vehicle types
are to be added in the future.
1. Rent (With or without driver) – For each type of vehicle rates are given per day,
per week and per month. Rate for a driver also given per day. Depending on the
rent period the total rent amount needs to be calculated. For example: if a
11
vehicle is rented for 10 days with a driver, total amount to be calculated as
follows:
2. Hire (with driver only) – These are based on packages such as airport drop,
airport pickup, 100km per day package, 200km per day package etc. Standard
rates are defined for a vehicle type for a package type that is applicable for that
type of vehicle. For each package maximum km limit and maximum number of
hours are also defined. Extra km rate is also defined which is applicable if they
run beyond the allocated km limit for the tour. For day tours if they exceed max
hour limit, a waiting charge is applicable for extra hours. Driver overnight rate
and vehicle night park rate also defined which is applicable for each night when
the vehicle is hired for 2 or more days.
3
3.1 Design suable algorithms for vehicle tariff calculation for rents and hires (P3).
3.2 Implement the above algorithms using visual studio IDE (using C#.net) and
design the suitable database structure for keeping the tariffs for vehicle types
and different packages which must be used for implementing the above
functions (M3).
3.3 What is the purpose of using an IDE in application development? Evaluate the
use of the Visual Studio IDE for your application development contrasted with
not using an IDE. (D3).
Task 4: Determine the debugging process and explain the importance of a coding
standard (LO4).
12
4
Design and build a complete system for the vehicle reservation and billing
for Ayubo drive. This includes the completing the database design started in
3.2 and designing the suitable interfaces for vehicle and package additions
and reservation handling and customer billing (P4).
4.1
4.2 What is debugging an application? Explain the importance of the debugging
facility in Visual studio IDE. Debug your source code by putting few
debugging points in your application (P4).
4.3 Implement the above functionalities using the IDE while adopting the coding
standards to improve maintainability of the code. Explain the coding standards
used in your code in the written report (P5).
4.4 Evaluate how you used the debugging process to develop more secure, robust
application with examples (M4).
4.5 Explain the coding standards you have used in your application development.
Critically evaluate why a coding standard is necessary in a team as well as for
the individual. (D4).
13
Table of Contents
Acknowledgment.....................................................................................................................15
Algorithms................................................................................................................................18
Linear search............................................................................................................................21
Binary Search...........................................................................................................................23
Programming Paradigms..........................................................................................................45
File Menu.......................................................................................................................104
Go to Menu....................................................................................................................105
Calculate Menu..............................................................................................................106
About..............................................................................................................................106
14
The Exit Option..................................................................................................................108
Packages.............................................................................................................................108
Vehicles..............................................................................................................................109
Rent Calculator...................................................................................................................109
Debugging..............................................................................................................................112
Debugging Methods...............................................................................................................112
Breakpoints........................................................................................................................112
Coding Standards...................................................................................................................114
Indentation..........................................................................................................................115
Naming...............................................................................................................................116
Comments..........................................................................................................................117
Data Tooltip...........................................................................................................................118
Diagnostic Tools....................................................................................................................119
Feedback Form.......................................................................................................................124
Figure 1IPO-Model..................................................................................................................30
Figure 2Basic Symbols in a flowchart.....................................................................................31
Figure 3Example: Flowchart....................................................................................................32
Figure 4Example: Pseudocode.................................................................................................33
Figure 5Example: Desk-checking............................................................................................35
Figure 6Python code – Linear Search algorithm......................................................................44
Figure 7Output of Python code – Linear Search algorithm - With an available element........44
Figure 8Output of Python code – Linear Search algorithm - With an unavailable element....45
15
Figure 9Python code – Binary Search algorithm.....................................................................46
Figure 10Output of Python code – Binary Search algorithm - With an available element.....46
Figure 11Output of Python code – Binary Search algorithm - With an unavailable element. 47
Figure 12Programming Paradigms..........................................................................................48
Figure 13Event-driven programming process..........................................................................53
Figure 14Events on .NET.........................................................................................................55
Figure 15IDE Diagram.............................................................................................................58
Figure 16Eclipse Logo.............................................................................................................59
Figure 17Code Blocks Logo....................................................................................................59
Figure 18CodeLite Logo..........................................................................................................59
Figure 19Xcode Logo..............................................................................................................59
Figure 20Visual Studio Logo...................................................................................................59
Figure 21NetBeans Logo.........................................................................................................59
Figure 22PyCharm Logo..........................................................................................................59
Figure 23IntelliJ IDEA Logo...................................................................................................59
Figure 24Pascal Code...............................................................................................................62
Figure 25Pascal Run Error.......................................................................................................64
Figure 26Pascal 1st Window....................................................................................................64
Figure 27Pascal Wrong Input...................................................................................................65
Figure 28Pascal Second Value.................................................................................................65
Figure 29Pascal Output Total...................................................................................................66
Figure 30Python Code - Part 1.................................................................................................67
Figure 31Python Code - Part 2.................................................................................................67
Figure 32Python Code - Part 3.................................................................................................68
Figure 33Python Output - Part 1..............................................................................................70
Figure 34Python Output - Part 2..............................................................................................70
Figure 35Python Output - Part 3..............................................................................................71
Figure 36Calculator – Form.....................................................................................................72
Figure 37Calculator – Code.....................................................................................................73
Figure 38Add – Code...............................................................................................................74
Figure 39Subtract – Code.........................................................................................................74
Figure 40Multiply – Code........................................................................................................74
Figure 41Divide – Code...........................................................................................................75
Figure 42Calculator – Executed...............................................................................................76
16
Figure 43Add Button................................................................................................................76
Figure 44Subtract Button.........................................................................................................77
Figure 45Multiply Button........................................................................................................77
Figure 46Divide Button............................................................................................................78
Figure 47Ayubo Drive Database..............................................................................................85
Figure 48Vehicle Table Design View......................................................................................86
Figure 49Package Table Design View.....................................................................................86
Figure 50Vehicle Table Records..............................................................................................87
Figure 51Package Table Records.............................................................................................87
Figure 52Rent Calc Code Part 1...............................................................................................88
Figure 53Rent Calc Code Part 2...............................................................................................89
Figure 54Rent Calc Code Part 3...............................................................................................90
Figure 55Rent Calc Code Part 4...............................................................................................91
Figure 56Day Tour Hire Calc Code Part 1...............................................................................92
Figure 57Day Tour Hire Calc Code Part 2...............................................................................93
Figure 58Day Tour Hire Calc Code Part 3...............................................................................94
Figure 59Day Tour Hire Calc Code Part 4...............................................................................95
Figure 60Long Tour Hire Calc Code Part 1.............................................................................96
Figure 61Long Tour Hire Calc Code Part 2.............................................................................97
Figure 62Long Tour Hire Calc Code Part 3.............................................................................98
Figure 63Long Tour Hire Calc Code Part................................................................................99
Figure 64Rent Calc Code Output...........................................................................................100
Figure 65Day Tour Hire Calc Code Output...........................................................................101
Figure 66Day Tour Hire Calc Code Output...........................................................................102
Figure 67 Login Interface.......................................................................................................105
Figure 68 LogIn Table - Design View...................................................................................106
Figure 69 LogIn Table Records.............................................................................................106
Figure 70 Main Interface........................................................................................................107
Figure 71 File Menu...............................................................................................................108
Figure 72 Ho to Menu............................................................................................................108
Figure 73 Calculate Menu......................................................................................................109
Figure 74 About Box..............................................................................................................109
Figure 75 Add New User.......................................................................................................110
Figure 76 Change User Password..........................................................................................110
17
Figure 77 Packages................................................................................................................111
Figure 78 Vehicles.................................................................................................................112
Figure 79 Rent Calculator......................................................................................................113
Figure 80 Day Tour - Hire Calculator....................................................................................113
Figure 81 Long Tour Hire – Calculator.................................................................................114
Figure 82 Breakpoints............................................................................................................116
Figure 83 Breakpoints 2.........................................................................................................116
Figure 84 Breakpoints 3.........................................................................................................117
Figure 85 Coding Standards 1................................................................................................118
Figure 86 Coding Standards 2................................................................................................119
Figure 87 Coding Standards 3................................................................................................120
Figure 88 Coding Standards 4................................................................................................121
Figure 89 Data Tooltip...........................................................................................................122
Figure 90 Diagnostic Tools....................................................................................................123
Figure 91 Diagnostic Tools 1.................................................................................................123
Figure 92 Gantt Chart.............................................................................................................126
Figure 93 Feedback Form......................................................................................................127
18
749Table 1Dry run - Linear Search – With an available element............................................39
Table 2Dry run - Linear Search – With an unavailable element..............................................40
Table 3Dry run - Binary Search – With an available element.................................................41
Table 4Dry run - Binary Search – With an unavailable element.............................................42
Table 5Efficiency Analysis – Linear Search algorithm...........................................................46
Table 6Efficiency Analysis – Binary Search algorithm...........................................................48
Table 7Algorithm - Inputs & Outputs......................................................................................80
19
Introduction
This document contains the answer to the assignment given on the subject Programming
under the title Design & Implement a GUI based system using a suitable Integrated
Development Environment.
20
Task 1: Define basic algorithms to carry out an operation and outline the process of
programming an application (LO1)
Searching on an array/list is to find a given element on the array and return whether it is
found or not and return its position if found. Linear search and binary search are two popular
searching algorithms on arrays.
1.4 Define what an algorithm is and outline the characteristics of a good algorithm. Develop
algorithms for linear search and binary search using Pseudo code (P1).
Algorithms
21
Following are some of the popular algorithms used.
Audio and video compression algorithms
o E.g.: - The quick transmission of live videos on google hangouts
Route finding algorithms
o E.g.: - Google maps use this algorithm to figure out how to get from one place
to another
Optimization and scheduling algorithms
o E.g.: - The NASA use this algorithm to arrange the solar panels of the
International Space Station
Even though the above algorithms are very complex they are also step by step procedures
used to accomplish tasks[ CITATION Wha19 \l 1033 ].
22
Characteristics of a good algorithm
Unambiguous
An algorithm should be clear and definite. Each of its steps and their input/outputs
should be clear and must only lead to only one meaning.
Input
An algorithm should have zero or more well defined inputs.
Output
An algorithm should have one or more well defined outputs and should match the
desired output.
Finiteness
An algorithm must terminate after a finite number of steps.
Feasibility
An algorithm should be feasible with the available resources.
Independent
An algorithm should have step by step directions, which should be independent
from any programming languages.
23
Linear search
Advantage(s)
Can be used on any type of array regardless of the type of sortation
(sorted/unsorted).
Disadvantage(s)
Search time is longer when searching large arrays.
Following is a simple algorithm represented using pseudo codes on how the linear
search works.
24
Pseudo Code
Begin
numbers = array (‘i’, [142, 685, 572, 865, 891, 933, 749, 409, 982, 828, 518, 875, 414, 964,
160])
/* Function */
/* Main Program */
input s_key
index = linear_search (s_key)
if index > -1 then
print (‘Number found at index:’, index)
else
print (‘Number not in the array.’)
end if
End
25
Binary Search
In binary search the algorithm will compare the middle element and continue the
search on upper or lower half of the array based on the fact the value is greater
than or smaller than the middle. This continues until the value is found or it is
confirmed that the value is not present
Advantage(s)
Search time is considerably smaller than the search time it is taken to search a
large array using the linear search.
Disadvantage(s)
The binary search can only be applied to a sorted array.
Following is a simple algorithm represented using pseudo codes on how the binary
search works.
26
Pseudo code
Begin
prices = array (‘i’, [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300,
1400, 1500])
/* Function */
/* Main Program */
input s_key
index = binary_search (s_key)
if index > -1
print (“Price found at index:”, index)
27
else
print (“Price not available in the array.”)
end if
End
28
1.5 Describe the steps involve in the process of writing and executing a program. Take an
array of 10 or more elements and dry run the above two algorithms. Show the outputs at
the end of each iteration and the final output (M1).
29
1) Defining the problem
The task of defining the problem consists of identifying what you know and what
you want to obtain. In other words, input and output. In this stage of the
programming process the limitations and goals of the program are identified by
consulting with the user/client. Then they are defined in a manner which is
understandable by both the user and the programmer. The IPO-Model (Input
Process Output Model) can be used to define the problem without any ambiguity
Figure 1IPO-Model
30
2) Planning the solution (Algorithm Design)
There are 2 ways to plan a solution to a problem.
Flowcharts
A flowchart is a diagrammatic representation of a step by step process which leads
to a solution to a problem. It has arrows showing the order of the program and
boxes and other symbols representing actions
31
Following is a simple flowchart representing an algorithm which adds 2 numbers.
32
Pseudocode is a structured English like language which represents a solution to a
problem. It’s considered as a first draft because eventually it has to be translated
in to a programming language. Pseudocode allows the programmer to focus on the
program logic without having to concern about the precise syntax of a
programming language. However, pseudocodes are not executable by a computer.
33
3) Coding the program
In this stage of the programming process the flowchart or the pseudocode will be
translated in to a programming language. A programming language is a set of
rules that provides a way to instruct the computer what operations to perform.
Following are some of the popular programming languages.
Java
Python
C
C#
C++
34
4) Testing the program
After coding the program, the programmer must prepare test the program. In this
stage of the programming process following phases are involved.
Translating
A translator is a program that checks the syntax of a program and then translates it
into a form the computer can understand. In case of any syntax errors it shows a
detailed description of the error called a diagnostic.
35
Debugging
Debugging means detecting, locating, and correcting bugs (mistakes) by running the
program. These bugs are logic errors that are corrected using the previously planned
test data. It is important to test every part of the program to ensure the program is bug
free.
36
5) Documenting the program
Documentation is a written detailed description of the entire program throughout its
every stage. It includes specific facts about the program such as origin of the problem,
program logic, data record descriptions, program listings, testing results, and
comments.
37
Dry run - Linear Search – With an available element
38
Dry run - Linear Search – With an unavailable element
39
Dry run - Binary Search – With an available element
prices s_key search_k lowesthighes lowest middlesearch_key search_key return index index outpu
ey t <= == > value > -1 t
highes prices[midd prices[midd
t le] le]
100 300 300 0 14 true 7 false false - - - -
200 - - 0 6 true 3 false false - - - -
300 - - 0 2 true 1 false true - - - -
400 - - 2 2 true 2 true - 2 2 true Price
found
at
index:
2
500 - - - - - - - - - - - -
600 - - - - - - - - - - - -
700 - - - - - - - - - - - -
800 - - - - - - - - - - - -
900 - - - - - - - - - - - -
100 - - - - - - - - - - - -
1100 - - - - - - - - - - - -
1200 - - - - - - - - - - - -
1300 - - - - - - - - - - - -
1400 - - - - - - - - - - - -
1500 - - - - - - - - - - - -
Table 3Dry run - Binary Search – With an available element
40
Dry run - Binary Search – With an unavailable element
prices s_key search_k lowesthighes lowest middlesearch_key search_key retur index index output
ey t <= == > n > -1
highes prices[midd prices[midd value
t le] le]
100 1700 1700 0 14 true 7 false true - - - -
200 - - 8 14 true 11 false true - - - -
300 - - 12 14 true 13 false true - - - -
400 - - 14 14 true 14 false true - - - -
500 - - 15 14 false - - - -1 -1 false Price
not
availabl
e in the
array.
600 - - - - - - - - - - - -
700 - - - - - - - - - - - -
800 - - - - - - - - - - - -
900 - - - - - - - - - - - -
100 - - - - - - - - - - - -
1100 - - - - - - - - - - - -
1200 - - - - - - - - - - - -
1300 - - - - - - - - - - - -
1400 - - - - - - - - - - - -
1500 - - - - - - - - - - - -
Table 4Dry run - Binary Search – With an unavailable element
41
1.6 Define what Big-O notation is and explain its role in evaluating efficiencies of
algorithms. Write the Python program code for the above two algorithms and critically
evaluate their efficiencies using Big-O notation (D1).
It is important to make algorithms that are more efficient in order to get the
required performance without wasting resources. If an algorithm is not efficient
there will be a notable delay when handling large volumes of data despite the
speed of the computer.
To get know the pure efficiency of an algorithm we establish a relationship
between running time (execution time) and volume of data. It is because the
running time depends on the volume of data.
1) Best Case
Checking the efficiency at the most favorable situation.
2) Worst Case
Analyzing the efficiency at the most adverse situation
3) Average Case
The average of the best case and worst-case scenarios.
42
Python code – Linear Search algorithm
Figure 7Output of Python code – Linear Search algorithm - With an available element
43
Figure 8Output of Python code – Linear Search algorithm - With an unavailable element
44
Python code – Binary Search algorithm
45
Output of Python code – Binary Search algorithm - With an available element
Figure 10Output of Python code – Binary Search algorithm - With an available element
46
Figure 11Output of Python code – Binary Search algorithm - With an unavailable element
47
Task 2: Explain the characteristics of procedural, object-orientated and event-driven
programming, conduct an analysis of a suitable Integrated Development Environment (LO2).
4.6 Define what is meant by a Programming Paradigm. Explain the main characteristics of
Procedural, Object oriented and Event-driven paradigms and the relationships among
them (P2).
Programming Paradigms
Programming paradigms are styles of programming which has characteristic features and are
classified based on those features. There are many programming languages. But all of them
need to follow some strategy when implemented and these methodologies/strategies are
known as programming paradigms. Some programming languages are classified into multiple
paradigms. There are a lot of paradigms to fulfill each and every demand. Following are
some the basic programming paradigms.
48
Procedural Programming Paradigm
It is one of the oldest programming paradigms. It is based on the Von Neuman architecture. It
recognizes the fact that computers have reusable memory space that can change state
(variables). It performs step by step tasks by changing the state. Each step affects the global
state of the computation. The main focus of this paradigm is in how to achieve the goal.
Example: -
total = total + 22
the above statement changes the state of the “Variable total” by incrementing it by 22.
49
Characteristics of Procedural Programming
o Discipline and idea – Digital hardware technology and ideas of Van Neumann
o Incremental change of the program state as function of time
o Execution of computational steps in an order governed by the control
structures
o Straight forward abstraction of the way a traditional Van Neumann computer
works
o Similar to descriptions of everyday routines
E.g.: - Food Recipe
o The natural abstraction is the procedure
o Abstracts one or more actions to a procedure, which can be called as a single
command
50
Object Oriented Programming Paradigm (OOP)
Object Oriented Paradigm focus on the objects that a program is representing. It defines
objects which will send messages to each other. All kind of computations are performed on
the objects only. Objects have their own internal (encapsulated) state and public interfaces.
Objects belong to classes. Normally all objects of the same class will have same kind of
behavior. Classes are usually arranged in a class hierarchy.
Many popular programming languages are considered as Object Oriented. They are mostly a
mixture of OOP and imperative looking code.
Simula-67 was the first OOP language. Soon Smalltalk followed as the first pure OOP
language.
51
Examples of OOP Languages
Simula : First ever OOP language
Java : Developed by James Gosling at Sun Microsystems
C++ : Developed by Bjarne Stroustrup
Objective-C : Designed by Brad Cox
Visual Basic .NET : Developed by Microsoft
Python : Developed by Guido van Rossum
Ruby : Developed by Yukihiro Matsumoto
Smalltalk : Developed by Alan Kay, Dan Ingalls, Adele Goldberg
CLOS : Common Lisp Object System)
Eiffel : Developed by Eiffel Software.
Modula-3 : Developed by Elego Software Solutions GmbH
Ada 95 : Developed by Jean Ichbiah
52
Event-driven Programming Paradigm
In event driven programming paradigm, the control flow of the program execution is
determined by the occurrence of events.
E.g.: - Left Mouse Click
Right Mouse Click
Key Press
The occurrence of these events is observed by a program known as the event listener. If it
detects any predefined event has occurred it will run a program called event handler. Event
handler will trigger a callback function or a method once the event is occurred.
The following image represents a simple process of an event driven program
53
Characteristics of Event Driven programming
Service-orientated processing
In service-oriented processing complex problems get divided and form a collection of
processes that provides services to the application. These services usually run as a
background processes hidden from the user. These processes respond to events to produce
actions that are required to provide the specific service.
The coding of the clock or the countdown will generate the regular event needed to update
the display.
54
Trigger Functions
A trigger function responds to events which the code encounters. The programmer has a wide
range of choices to select from in the programming environment.
The above image shows some of the trigger events available in a .NET program.
After selecting a trigger event the coder can enter the code, they want to run from the event
trigger.
55
Technical terms used in event driven programming
Event Source
When an event occurs, it will occur on an event source object. This event source provides
information about the event to its handler.
Event Source examples
A button
A checkbox
A dropdown menu
Event Object
It is the object that identifies the occurred event
Event Listener
An event listener waits for an event to occur in a procedure or a function of a computer
program. Examples for an event are,
User clicking or moving the mouse
Pressing a key on the keyboard
An internal timer
Event Handler
It is used to simply deal with the occurred event which allows the programmer to write a code
that will be executed once the event occurs.
56
To get a better understanding about the relationship between the procedural, object oriented
and event driven paradigms they need to be compared. The following table demonstrates the
comparison between those paradigms.
4.7 Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development (M2).
57
such as,
Text Editors
Code Libraries
Compilers
Test Platforms
Debuggers
Without an IDE a developer has to find and use those tools separately which will complicate
and slow the developing process. An IDE can simplify the software development and can
identify and minimize the mistakes in the source code. Even though some IDEs focus on
specific programming languages such as Python or Java most IDEs have cross language
capabilities[ CITATION Rou19 \l 1033 ].
58
There are many IDEs designed for the purpose of creating software. Following are some of
the popular IDEs used by the programmers.
3) PyCharm 7) CodeLite
59
Common Features of IDEs
Even though there are many IDEs out there, there are some features common to all IDEs.
Text Editor (Code Editor)
All the IDEs usually have place to write and manipulate the source code known as the text
editor (Code Editor). Even though some IDEs have visual based components that has to be
dragged and dropped most have an interface with language specific syntax
highlighting[ CITATION Wal19 \l 1033 ].
Debugger
The Debugger in the IDE is used to detect and correct the errors within the source code. It
simulates real world scenarios to test the application. It helps programmers to test the various
segments of the code and identify any bugs before the application is released[ CITATION
Wal19 \l 1033 ].
Compiler
Compilers are used to translate the source code of the program from the programming
language into a language that the computer can understand.
E.g.: - Binary Code
After the translating process the machine code is then analyzed to ensure its accuracy. Then
the compiler parses and optimizes the code to get the maximum performance[ CITATION
Wal19 \l 1033 ].
Code Completion
The code completion feature intelligently identifies and inserts common code components
which makes the coding process easy for the coder. Thanks to this feature programmers can
save time and avoid the likelihood of typos and bugs[ CITATION Wal19 \l 1033 ].
Programming Language Support
Some IDEs offer single language support while the others offer multi lingual support. Before
coding a program, the coder must figure out in which programming language is he going to
code. After that he can choose a supported IDE for that language and begin
coding[ CITATION Wal19 \l 1033 ].
E.g.: - Ruby
Python
Java IDE Tools
Integrations and Plugins
It is no surprise that integrations need to be considered in and IDE because its already
60
included in the name IDE. An IDE is the development portal of a programmer. So being able
to incorporate all the necessary development tools will improve the development workflow
and the productivity. So, it’s important to understand how an IDE fits into the ecosystem of
existing tools before installing a new IDE[ CITATION Wal19 \l 1033 ].
61
2.3 Write small snippets of code as example for the above three programming
paradigms using a suitable programming language(s) and critically
evaluate their structure and the characteristics (D2).
Procedural Programming Paradigm
The following image displays a simple code written using the programming language pascal
which is a procedural programming language. The function of the code is to add 2 numbers
inputted by the user and then display the total.
62
All the above variables are declared as integer in the above code.
In the second line of the code a command is given to begin the program. In pascal a program
will not run unless the begin command is properly given.
In the next line of the code the user is asked to input the first number to add. In that line a
command named “write” can be seen. In pascal language “write” and “writeln” are used to
display texts or variables on the screen.
In the next command line, the following can be seen,
readln (num_1);
the function of this command is to read the input of the user and store it in the memory under
the given variable name and type. In this case its “integer: num_1”. The purpose of the
command “readln” is to read a variable entered from the keyboard and then move to the next
line. The command “read” can also be used for this purpose but then the cursor won’t move
to the next line. Both of those commands will continue to read until the “ENTER” key in the
keyboard is pressed.
In the next command line, the user is asked to enter the second number to add. After entering
it the program will read it like before and store it in the variable “num_2”.
In the next command line, the values of the 2 variables “num_1” and “num_2” are added and
the result will be stored in the variable declared before as “Total”.
In the next command line, the program will display sum of the 2 values entered by the user.
In other words, the value of variable “Total”.
Then a “readln” command is given to hold the program without exiting. Otherwise the
program will end instantly after it completed all the commands.
At last the “end” command is given to end the program. The dot at the end of the “end”
command is compulsory in pascal because otherwise it’ll display an error message as shown
in the following image.
63
Figure 25Pascal Run Error
Following is the window that appears once the program is compiled and ran.
64
Figure 27Pascal Wrong Input
If a correct integer value is entered then the program will ask for the second value like shown
in the following image.
65
Figure 29Pascal Output Total
Now the program has executed all the command lines and once the “Enter” key is pressed the
program will exit.
As shown in the above images of the program output the processing part of the program is
not visible to the user. This is because to display something in the output the “write” or
“writeln” command has to be given.
66
Object Oriented Programming (OOP) Paradigm
The following images show a code written using the Python language. Python is a
programming language which supports multiple programming paradigms. But the code below
belongs to the OOP paradigm.
67
68
Figure 32Python Code - Part 3
The python code shown in the above images works with a class named “Employee” and the
objects of that class. As shown in the Pytohn_Code__Part_1 there are 4 functions defined in
the code before the main program begins. Respectively the 4 functions are named,
1. __init__
2. show_product_details
3. issuing_product
4. product_discount
The “__init__” function serves the purpose of creating the desired class in the python
program.
The “show_product_details” function is there to display the attributes of the objects when
needed.
The “issuing_product” function calculate the stock balance after a product is issued.
The “product_discount” function calculates the discount of each product.
69
As shown in the Pytohn_Code__Part_1 there are 3 main attributes of the class “Employee”.
They are,
1. prd_name : The product name
2. stock_bal : The available stock of the product
3. price : The price of the product
In the function “show_product_details” it will display the values stored as the above 3
attributes of the class object.
In the function “issuing_product” a new parameter is introduced as the “amount_issued”
which is required to calculate the leftover stock available after a product is issued. The
function will subtract the number of issued products from the available stock and store the
result as the available stock.
In the function “product_discount” it will minimize the price of the product by subtracting
10% from the price of each product. And then the name of the product and the discounted
price is displayed.
As shown in the Python_Code__Part_2 the first thing the main program will do after it starts
is creating the objects of the class “Employee”. According to the code 3 objects are created
from the class. Following are the names and attribute values of those objects.
p1 = Product ("Flash Light", 35, 150)
p2 = Product ("Battery", 250, 30)
p3 = Product ("Bulb", 100, 45)
Then the details of those 3 objects will be displayed by calling in the function
“show_product_details”.
Then the stock balance of each product will change according to the given parameter values
of the function “issuing_product”.
After that the program will again display the product details with the changed values of the
attribute “stock_bal”.
At last the program will calculate and display the discount price of each product along with
the product name.
Then the program will end because all of the given commands are executed.
70
The following images show the output of the above python code once the program is
executed.
71
details again along with the changed values as shown in the above image.
72
Event Driven Programming Paradigm
In event driven programming there are 2 things to be considered. They are the interface of the
program which has all the trigger events and the source code which has all the methods and
functions.
So, the following image shows a simple windows form created using the C# language in the
Microsoft Visual Studio 2019. The program of that windows form is a calculator which can
add, subtract, multiply and divide 2 given numbers.
73
Figure 37Calculator – Code
As shown in the above image there are 4 separate code components for each of the 4 buttons
in the windows form. But if the code is observed carefully it can be seen that the only
difference between the 4 code components are the mathematical symbol of each calculation.
The code to add the 2 numbers:
74
Figure 38Add – Code
The above code is used to perform the additions and display the results.
The code to subtract the 2nd number from the 1st number:
75
The above code is used to perform the multiplications and display the results.
The code to divide the 1st number by the 2nd number:
76
Figure 42Calculator – Executed
As shown in the image the cursor is at the first textbox so that the user can input the first
value.
After the values are input the functionalities of all the 4 buttons must checked.
Add Button
77
Figure 44Subtract Button
As shown in the above image the result of the calculation is correct. Therefore, the purpose of
the subtract button is served.
Multiply Button
78
Divide Button
79
5
5.1 Design suable algorithms for vehicle tariff calculation for rents and hires (P3).
When developing a software for Ayubo Drive transport arm of the Ayubo Leisure (Pvt) Ltd,
they require 3 main calculations to be done using the software. The 3 calculations are,
1) Rent Calculation
2) Day Tour - Hire Calculation
3) Long Tour – Hire Calculation
To include these calculations in the software, 3 algorithms have to be designed first. When
designing the algorithms, the user inputs and the desired outputs have to be taken into
consideration. The following table show the relevant inputs and outputs of the 3 algorithms
that will be designed.
After figuring out the inputs and outputs the algorithms can be designed. This can be done
using either pseudo codes or flowcharts. But on this occasion algorithms will be designed
using pseudo codes.
Following is the algorithm designed for “Rent Calculation” using pseudo codes.
Begin
Function rent_calculation (rented_date, return_date, boolean_driver)
start_date = rented_date
end_date = return_date
no_of_days = end_date – start_date
80
/* Find the no. of months, weeks and days */
months = no_of_days / 30
weeks = (no_of_days % 30) / 7
days = (no_of_days % 30) % 7
Retrieve the required vehicle records from the database for calculation
purposes.
/* Finding the monthly, weekly, and daily rate */
monthly_rate = rent_per_month * months
weekly_rate = rent_per_week * weeks
daily_rate = rent_per_day * days
if (driver == true) then
driver_rate = daily_driver_rate * no_of_days
else
driver_rate = 0
end if
/* Calculating the total rent value */
total_rent = monthly_rate + weekly_rate + daily_rate + driver_rate
print no_of_days
print months
print weeks
print days
print monthly_rate
print weekly_rate
print daily_rate
print driver_rate
print total_rent
End Function
End
81
Following is the algorithm designed for “Day Tour - Calculation” using pseudo codes.
Begin
Function day_tour_calculaion (start_time, end_time, start_km_read, end_km_read)
st_time = start_time
e_time = end_time
st_km = start_km_read
e_km = end_km_read
/* Calculating the no. of hours */
no_of_hours = e_time - st_time
Retrieve the required package records from the database for calculation
purposes.
if (no_of_hours > max_no_of_hours) then
/* Calculating the extra no. of hours */
extra_no_of_hours = no_of_hours - max_no_of_hours
else
extra_no_of_hours = 0
end if
/* Calculating the extra hour charge */
extra_hour_charge = extra_no_of_hours * rate_per_extra_hour
no_of_kms = e_km – st_km
if (no_of_kms > max_no_of_kms) then
extra_no_of_kms = no_of_kms - max_no_of_kms
else
extra_no_of_kms = 0
end if
extra_km_charge = extra_no_of_kms * rate_per_extra_km
/* Calculating the total hire value */
total_hire_value = package_rate + extra_hour_charge + extra_km_charge
print package_rate
print extra_hour_charge
print extra_km_charge
print total_hire_value
82
End Function
End
83
Following is the algorithm designed for “Long Tour - Calculation” using pseudo
codes.
Begin
Function long_tour_calculation (start_date, end_date, start_km_read, end_km_read)
st_date = start_date
e_date = end_date
st_km = start_km_read
e_km = end_km_read
/* Calculating the no. of days and kms */
no_of_days = e_date – st_date
no_of_kms = e_km – st_km
Retrieve the required package records from the database for calculation
purposes.
if (no_of_kms > (max_no_of_kms * no_of_days)) then
extra_no_of_kms = no_of_kms - (max_no_of_kms * no_of_days)
else
extra_no_of_kms = 0
end if
/* Calculating the extra km charge, base hire charge, driver and vehicle
overnight charge and the total overnight charge */
extra_km_charge = extra_no_of_kms * rate_per_extra_km
base_hire_charge = package_rate * no_of_days
driver_overnight_charge = driver_rate_per_night * (no_of_days - 1)
vehicle_overnight_charge = vehicle_rate_per_night * (no_of_days - 1)
total_overnight_charge = driver_overnight_charge +
vehicle_overnight_charge
/* Calculating the total hire value */
total_hire_value = extra_km_charge + base_hire_charge +
total_overnight_charge
print base_hire_charge
print total_overnight_charge
print extra_km_charge
print total_hire_value
84
End Function
End
85
5.2 Implement the above algorithms using visual studio IDE (using C#.net) and design the
suitable database structure for keeping the tariffs for vehicle types and different packages
which must be used for implementing the above functions (M3).
Before implementing the above 3 algorithms for the calculations of the Ayubo Drive
company a database should be created containing the details of vehicles and packages.
The following 2 tables should be in the database and those tables should contain all the values
needed to for the above 3 calculations.
1) Vehicle table – To store vehicle details.
2) Package table – To store package details.
The following image shows the database and the tables that are created to store the vehicle
and package details.
86
The following images shows the design view of the “Vehicle” table which contains the names
of the columns and their data type and maximum length.
87
The following image show the records that are stored in the “Vehicle” table
88
The following set of images shows the C# code of the rent calculation algorithm in the
console application source code.
89
Figure 53Rent Calc Code Part 2
90
Figure 54Rent Calc Code Part 3
91
Figure 55Rent Calc Code Part 4
The following set of images shows the C# code of the day tour hire calculation algorithm in
the console application source code.
92
Figure 56Day Tour Hire Calc Code Part 1
93
Figure 57Day Tour Hire Calc Code Part 2
94
Figure 58Day Tour Hire Calc Code Part 3
95
Figure 59Day Tour Hire Calc Code Part 4
96
The following set of images shows the C# code of the long tour hire calculation algorithm in
the console application source code.
97
Figure 61Long Tour Hire Calc Code Part 2
98
Figure 62Long Tour Hire Calc Code Part 3
99
Figure 63Long Tour Hire Calc Code Part
The source codes of all the 3 calculations are based on the algorithms written in the activity
3.1. Small modifications are made to improve the quality of the program and to ease the use.
Now that the C# algorithms are implemented the main program can be executed and the
calculations can be done.
The following image shows the output of the rent calculation when all the inputs are inserted
in the correct format.
100
Figure 64Rent Calc Code Output
As shown in the above image all the required outputs are resulted by the program. However,
the user will have to be cautious when using the console application because if the input is
not in the correct format then it won’t be accepted by the program.
101
The following image shows the output of the day tour hire calculation when all the inputs are
inserted in the correct format.
102
The following image shows the output of the long tour hire calculation when all the inputs are
inserted in the correct format.
103
5.3 What is the purpose of using an IDE in application development? Evaluate the use of the
Visual Studio IDE for your application development contrasted with not using an IDE.
(D3).
There are many purposes that can be achieved by using an IDE to develop a software instead
of using another method.
Following is a list of reasons that prove the values of using an IDE in application
development
It improves the developing process efficiency
o Because of the features included in an IDE it makes the developing process
more efficient. Features such as,
Automatic code completion
Realtime debugging
Support for multiple programming languages
Visual studio is a popular IDE used by the application developers all over the world. But if a
developer decides to use another method to develop an application instead of using an IDE,
he or she will face a series of problems in their development process.
Following are some of the problems that may occur due to a lack of an IDE
The developer will have to find the different developing tools manually and use them
separately because an environment with the use of multiple tools is not available.
The debugging of the application will be a hard and long process due to the lack of
enhanced debugging options
The developer will have to memorize all the codes and syntaxes needed to program
the application because auto suggest options are not available
The developer will have to be cautious when typing the source code because if an
error is made during the typing process it will be very hard to identify.
The developing process will take a longer time than usual because using the
developing tools are used one by one.
104
Because the developing process is longer the cost will also be higher because more
resources are needed to complete the developing process.
Following are some of the advantages gained by using the Microsoft Visual Studio as an IDE
to develop and design applications[ CITATION Dav15 \l 1033 ].
It provides rich development tools to all developers globally on any platform such as
web, mobile, server and desktop.
It provides a wide selection of development languages such as Visual Basic, C#, PHP,
Objective-C, JavaScript and Visual C++.
The Microsoft .NET Framework provides support for language interoperability
It can be easily used by individual programmers as well as teams.
4.1 Design and build a complete system for the vehicle reservation and billing for Ayubo
drive. This includes the completing the database design started in 3.2 and designing
the suitable interfaces for vehicle and package additions and reservation handling and
customer billing (P4).
105
An interface to calculate the rent value
An interface to calculate the day tour hire value
An interface to calculate the long tour hire value
An interface that allows the user to switch between the above interfaces which will be
the main interface of the program
An interface for the user to log in
An interface to add new users
An interface to change the login password
An about box
The following set of images show the interfaces that was designed to interact with the Ayubo
Drive System and their source code which contains all the functions and commands of the
system.
The Login Interface
106
Figure 68 LogIn Table - Design View
The following image shows the records that are currently in the LogIn table. in other words,
the usernames and passwords.
107
Figure 70 Main Interface
The main interface is used to switch between the other interfaces of the system. the main
interface has a menu strip which contains 4 menu strip items. Following are those menu strip
items.
File Menu
Go to Menu
Calculate Menu
About
108
Figure 71 File Menu
The file menu is used to access he following items.
The add new user interface
The change user password interface
The delete my account option
The exit options
Go to Menu
Figure 72 Ho to Menu
The go to menu is used to access the interfaces that allows the user to insert, update, delete
109
and search records from the vehicle and package tables.
Calculate Menu
110
and program description.
The Add New User Interface
111
This interface is used to change the password of the current user. The passwords of other user
accounts cannot be changed or viewed. To change the password the user only needs to simply
type a new password and click apply. Then the user can use the new password to login to the
system. if at any point the user wishes to exit the change user password interface the cancel
button can be used. Which will take the user back to the main interface.
Delete My Account Option
This option is used to delete he user account that is currently being used. After clicking on the
option, a confirmation message will appear asking the user to confirm the deletion.
Immediately after the account is deleted, the program will exit.
The Exit Option
As the name suggests the exit option is used to exit from the program. After it is clicked a
confirmation message will pop up asking whether the user really want to exit. If the user
clicks yes, the program will exit. If the user clicks no simply the message box will close.
Packages
Figure 77 Packages
The packages interface is used to search, insert, update and delete the records from the
package table in the database. A data grid view is included in the interface to improve the
user experience. To search a package, an existing package id must be entered and the search
button must be clicked. To insert a new record all the text boxes must be filled with valid
information and the insert button must be clicked. To update an existing record, it must first
be searched. Then the user can modify any value except the package id and click the update
112
button. To delete a record the user can enter the package id of the record and click delete.
Vehicles
Figure 78 Vehicles
This in interface is used to search, insert, update and delete records from the vehicle table in
the Ayubo Drive database. A data grid view is included in the interface to improve the user
experience. To search for a vehicle record, an existing vehicle license no. must be entered and
the search button must be clicked. To insert a new record all the text boxes must be filled
with valid information and the insert button must be clicked. To update an existing record, it
must first be searched. Then the user can modify any value except the vehicle license no. and
click the update button. To delete a record the user can enter the license no. of the record and
click delete.
Rent Calculator
113
Figure 79 Rent Calculator
The rent calculator is used to calculate the rent value of a vehicle depending on the selected
vehicle, renting period and the driver parameters. A data grid view is included in the interface
for the ease of the user. Before calculating the total rate, the user must calculate the no. of
days and must select a vehicle. If the vehicle is rented with a driver, the driver check box
must be checked. Else it should be left unchecked. After that the calculate the total rate button
must be clicked. Then the program will do its calculations and display the total rent value.
Day Tour – Hire Calculator
114
This interface is used to calculate the cost of a day tour hire depending on the following facts.
The package selected
The time period of the hire
The distance the vehicle has traveled
A data grid containing the available package details is included in the interface to make it
easier. To calculate the total cost, the user must first select a package. And then the no. of
hours must be calculated. After that the no. of kilometers must be calculated. And then at last
the total cost can be calculated by clicking the calculate day hire button.
Long Tour – Hire Calculator
To calculate the total cost, the following things have to be calculated first.
A package should be selected
The no. of days must be calculated
The no. of kilometers must be calculated
115
After calculating the above things, the total cost can be found by clicking the calculated day
hire button.
4.2 What is debugging an application? Explain the importance of the debugging facility
in Visual studio IDE. Debug your source code by putting few debugging points in
your application (P4).
Debugging
Debugging can be identified as a process that locates and removes bugs, errors or any other
abnormalities in a computer program. Debugging is done by the developers of the program
by using debugging tools. These debugging tool can check, detect and correct the errors or
bugs that usually prevent the program by functioning as intended. Debugging is also known
as debug[ CITATION Tec19 \l 1033 ].
The Importance of Debugging Options
Debugging is an important part of the software development process. It helps to correct the
errors within the source code of the program so that the program can run smoothly. Following
are some reason that explains why debugging is important.
Because if the debugging process did not take place then the program can’t be
expected to run as intended
Because it helps the programmer to locate in which part of the program is the error in.
Because it helps to correct the issues within the source codes.
Because it helps to get a better idea on how the program is working
Because it can be used to find mistakes in the code
Because it can handle errors within the program
Debugging Methods
Breakpoints
Breakpoints are a debugging method that helps to identify the values in the variables while
running the program. It allows the execution of the program to be paused when the program
reach the line with the specific breakpoint. Multiple breakpoints can be set at once. They can
also be conditional so that only when the condition is met will it get triggered[ CITATION
INT19 \l 1033 ].
Following are some breakpoints implemented in the Ayubo Drive System.
116
Figure 82 Breakpoints
As shown in the above image breakpoint are implemented in the long tour hire calculation of
the system. When the program reaches the first break point it will be paused.
Figure 83 Breakpoints 2
As shown in the above image the program is paused at the breakpoint. And the current value
of the variable in the breakpoint is show in the “Autos” section.
The current value of the variable total_no_of_days is 00:00:00.
If the program id continued. It will again be paused at the next breakpoint.
117
Figure 84 Breakpoints 3
As shown in the above image the program is continued and is stopped at the second
breakpoint.
And the value of that breakpoint and the previous break point is shown in the “Autos”
section.
The value of the previous breakpoint is changed.
Now the value of the variable total_no_of_days is 5.00:00:00. Which means 5 hours.
This is why breakpoint are very useful when debugging an application. The developer can
easily identify where it went wrong.
4.3 Implement the above functionalities using the IDE while adopting the coding
standards to improve maintainability of the code. Explain the coding standards used
in your code in the written report (P5).
Coding Standards
Coding standard can be identified as a set of guidelines, practices, programming styles or
conventions that are adhered by professional developers when writing code. They help to
ensure the safety, security and the reliability of the code. They should be practiced by every
developer because they help to prevent glitches and defects in the code[ CITATION Per19 \l
1033 ].
Following are some of the coding standards that should be practiced by a programmer.
One statement per line
118
This coding standard is self-explanatory. It simply means that there should only be a single
statement in a single line of code. If this coding standard is not followed the code becomes
messy and hard to follow. So outside programmers might have difficulties in understanding
the code. Therefore, it is always best to follow this coding standard[ CITATION Ken16 \l
1033 ].
The following image serves as evidence to the fact that the source code of the Ayubo Drive
system is written with the adherence of this coding standard
119
Figure 86 Coding Standards 2
As shown in the above image with every if condition of the code the lines are indented,
making it clear and more visible. Even though indentation is not a must in C# it is used as a
good practice. Therefore, it is proved that the above coding standard is used.
Naming
When naming the elements in a code such as variable, fields, classes and objects it is
important to give proper names instead of gibberish names. Most of the beginner level
programmers are used to naming the variables as x or y or by another meaningless name.
This is completely wrong. The reason why this is such an important coding standard is
because it helps to better understand the code. And also, if an outside developer takes a look
at such a code, he or she will have no idea the about what the variables are used for. It also
makes it harder to identify errors in such a code.
The following image serves as evidence to the fact that proper names were used when writing
the code for the Ayubo Drive system.
120
Figure 87 Coding Standards 3
As shown in the above image each integer variable is named with a proper name. anyone who
looks at the code will understand the purpose of each variable easily. It is also easy to
remember the variable names when they are named properly. So, as proven by the above
image the naming coding standard is properly used.
Comments
Comments are a very important part of coding. They help to better understand a program
written by another programmer. When comments are included in a code, they show us what
the program is supposed to do and is doing. A properly commented code can guide another
programmer through the code without the help from the programmer who originally typed the
code. That is why comments are an important aspect when it comes to programming.
The following image serves as evidence to the fact that comments were used in the coding
process of the Ayubo Drive system.
121
Figure 88 Coding Standards 4
As shown in the above image there are green color lines included in the code. Those are the
comments. In the dark theme of the Visual Studio IDE comments are showed in green color.
There are 2 ways to comment when using C#. Those 2 ways are,
1) Using the // <comment>
4.4 Evaluate how you used the debugging process to develop more secure, robust
application with examples (M4).
In the task 4.2 the debugging mechanisms are explained and the use of breakpoints is also
given. But break point are not the only developing tool available in Visual Studio IDE.
Following are some other debugging tool in the Visual Studio IDE.
Data Tooltip
This debugging tool us used with the breakpoints. When the program is paused at the
breakpoint the developer can point the mouse to a variable in the source code. It will display
the current value of that variable.
122
The use of the data tooltip is given in the following image. It is used to debug the Ayubo
Drive system.
123
Figure 90 Diagnostic Tools
As shown in the above image red diamonds are displayed when the execution of the code
encounters an error. The diamond is shown on both the timeline and the event list. To go to
the place where the error exist the diamond must be double clicked.
124
So, the above image serves as evidence to the fact that diagnostic tools were used as a
debugging method in the Ayubo Drive system.
According to the above example given regarding debugging methods, it is proven that help to
build more secure and robust applications. That’s because they are used to test the system
with various unexpected situations so that the system would withstand any error or bug that it
interacts with. Therefore, the use of debuggers helps to make the applications more secure
and error free.
4.5 Explain the coding standards you have used in your application development.
Critically evaluate why a coding standard is necessary in a team as well as for the
individual. (D4).
As previously established in the task 4.3 coding standards help to improve the maintainability
of the code. They help to make the code more beautiful and understandable. Which leads to
easier error detection.
Following is a list of coding standards used when developing the Ayubo Drive system.
One statement per line
Proper Indentation
Proper Variable Naming
Suitable Comments
125
Because then the code can be easily maintained. If the application is maintained and
developed by an individual it’ll be hard to maintain if the code is not understandable
right away. If the code is written while following the coding standards then it will be
simple and easy to understand. Therefore, anyone can understand it and modify it
without any problem.
Following are the reasons that explain why the coding standards are important as a team
When working in a developing team a developer should understand the piece of code
written by another member of the team. If it is not understandable the development
process will get more complicated. But if the coding standards are followed by every
member of the team, they will be able to understand each other codes because they
followed the same guidelines.
When developing an application with a team it is a costly process. If any problems
occur in their code, they will have to spend more time on finding and fixing the
problem. And this will cost more for the team. But if coding standards are
implemented it reduces the chance of error. And therefore, it decreases the chance of
cost increase as well.
In a code created with the adherence of the coding standards, the code is consistent.
So, it reduces the chances of failure. When doing a software project as a team it is
important to succeed. And because coding standards decrease the chance for failure it
increases the change to success.
As shown in the reason given in the above section coding standards are very important to
individuals as well as teams. Therefore, it is in a developer’s best interest to practice and use
them at all times.
126
References
Anon., 2019. Linear Search Algorithm | Studytonight. [Online]
Available at: https://www.studytonight.com/data-structures/linear-search-algorithm
[Accessed 16 June 2019].
Anon., 2019. What is an algorithm and why should you care? (video) | Khan Academy.
[Online]
Available at: https://www.khanacademy.org/computing/computer-science/algorithms/intro-
to-algorithms/v/what-are-algorithms
[Accessed 16 June 2019].
Anon., n.d. Event-driven programming features - Pearson Schools and FE Colleges. [Online]
Available at:
https://www.pearsonschoolsandfecolleges.co.uk/AssetsLibrary/SECTORS/FurtherEducation
Colleges/ReviseBTEC/samples/9781292150208-btec-comp-rg.pdf
[Accessed 17 June 2019].
Anon., n.d. Properties of Algorithms - Video & Lesson Transcript | Study.com. [Online]
Available at: https://study.com/academy/lesson/properties-of-algorithms.html
[Accessed 16 June 2019].
127
David, M., 2015. Visual Studio IDE offers many advantages for developers. [Online]
Available at: https://searchsoftwarequality.techtarget.com/feature/Visual-Studio-IDE-offers-
many-advantages-for-developers
[Accessed 21 June 2019].
INTELLIGENT DATA MINING LIMITED, 2019. Visual Studio - Intelligent Data Mining.
[Online]
Available at: https://www.intel-datamining.co.uk/services/tools/visual-studio/
[Accessed 21 June 2019].
Kenneth Reitz, 2016. Code Style - The Hitchhiker's Guide to Python. [Online]
Available at: https://python-guide-fil.readthedocs.io/en/latest/writing/style.html
[Accessed 21 June 2019].
Margaret, R., n.d. What is integrated development environment (IDE)? - Definition from
WhatIs.com. [Online]
Available at: https://searchsoftwarequality.techtarget.com/definition/integrated-development-
environment
[Accessed 17 June 2019].
Perforce Software, Inc, 2019. Intro to Coding Standards — Coding Rules and Guidelines |
Perforce. [Online]
Available at: https://www.perforce.com/resources/qac/coding-standards
[Accessed 21 June 2019].
Walker, A., n.d. What is an IDE: Integrated Development Environments for Beginners in
2019. [Online]
Available at: https://learn.g2.com/ide#ide-features
[Accessed 17 June 2019].
128
129
Grading Rubric
130
D2 Critically evaluate the source code of an application
which implements the programming paradigms, in terms
of the code structure and characteristics.
131