0% found this document useful (0 votes)
38 views

Unit 01 Programming M.I.inamulhaq

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

Unit 01 Programming M.I.inamulhaq

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

Higher Nationals

Internal verification of assessment decisions – BTEC (RQF)

INTERNAL VERIFICATION – ASSESSMENT DECISIONS

Programme title

Assessor Internal Verifier


Unit-01
Unit(s)
Programming
Assignment title
M.I.Inamulhaq
Student’s name

List which assessment criteria Pass Merit Distinction


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 comments on the Y/N

student work?

Has the work been assessed


accurately? Y/N

Is the feedback to the student:


Give details:
• Constructive?
• Linked to relevant assessment criteria?
Y/N
• Identifying opportunities for
Y/N
improved performance?
Y/N
• Agreeing actions?
Y/N
Does the assessment decision need
amending? Y/N

Assessor signature Date

Internal Verifier signature Date

Programme Leader signature (if required)


Date

Confirm action completed

Remedial action taken

Give details:

Assessor signature Date

Internal Verifier
signature Date

Programme Leader
signature (if required) Date

Higher Nationals - Summative Assignment Feedback Form

Student Name/ID

Unit Title

Assignment Number Assessor

Date Received 1st


Submission Date submission

Date Received 2nd


Re-submission Date submission
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
Distinction Descripts
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & P4 P5 M4 D4
Distinction Descripts

Grade: Assessor Signature: Date:

Resubmission Feedback:

Grade: Assessor Signature: Date:

Internal Verifier’s Comments:

Signature & Date:

* 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.
Pearson Higher Nationals in

Computing
Unit 01: Programming
Assignment 01
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.

Word Processing Rules


1. Use a font type that will make easy for your examiner to read. The font size should be 12
point, and should be in the style of Time New Roman.
2. Use 1.5 line word-processing. Left justify all paragraphs.
3. Ensure that all headings are consistent in terms of size and font style.
4. Use footer function on the word processor to insert Your Name, Subject,
Assignment No, and Page Number on each page. This is useful if individual sheets
become detached for any reason.
5. Use word processing application spell check and grammar check function to help edit
your assignment.

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.
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.
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.

1. I know that plagiarism is a punishable offence because it constitutes theft.


2. I understand the plagiarism and copying policy of the Edexcel UK.
3. I know what the consequences will be if I plagiaries or copy another’s work in any of the
assignments for this program.
4. I declare therefore that all work presented by me for every aspects of my program, will be my
own, and where I have made use of another’s work, I will attribute the source in the correct way.
5. I acknowledge that the attachment of this document signed or not, constitutes a binding
agreement between myself and Edexcel UK.
6. I understand that my assignment will not be considered as submitted if this document is not
attached to the attached.

M.I.Inamulhaq 20th August 2018


(Provide E-mail ID) (Provide Submission Date)
Higher National Diploma in Computing

Assignment Brief

Student Name /ID Number

Unit Number and Title Unit 01: Programming

Academic Year 2017/18

Unit Tutor

Assignment Title Design & Implement a GUI based system using a suitable
Integrated Development Environment

Issue Date

Submission Date

IV Name & Date

Submission Format

This submission will have 3 components

1. Written Report

This submission is in the form of an individual written report. This should be written in a concise,
formal business style using single spacing and font size 12. You are required to make use of
headings, paragraphs and subsections as appropriate, and all work must be supported with research
and referenced using the Harvard referencing system. Please also provide a bibliography using the
Harvard referencing system. (The recommended word count is 1,500–2,000 words for the
report excluding annexures)

2. Implemented System (Software)

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.

Unit Learning Outcomes:

LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.

LO2. Explain the characteristics of procedural, object-orientated and event-driven


programming, conduct an analysis of a suitable Integrated Development
Environment (IDE).

LO3. Implement basic algorithms in code using an IDE.

LO4. Determine the debugging process and explain the importance of a coding
standard
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).

Task 2: Explain the characteristics of procedural, object-orientated and event-


driven programming, conduct an analysis of a suitable Integrated
Development Environment (LO2).

2.1 Define what is meant by a Programming Paradigm. Explain the main


characteristics of Procedural, Object oriented and Even-driven paradigms and
the relationships among them (P2).
2.2 Analyze the features of an Integrated Development Environment (IDE) and
explain how those features help in application development (M2).

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.

Vehicle rent hire options are described below.

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
vehicle is rented for 10 days with a driver, total amount to be calculated as
follows:

Total rent = 1_week_car_rent + 1_day_rent x 3 + 1_day_driver_rent x 10

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.

Task 3: Implement basic algorithms in code using an IDE (LO3).

3.1 Design suable algorithms for vehicle tariff calculation for rents and hires (P3).

Ideally 3 functions should be developed for this purpose as follows:

Function 1: Rent calculation.


Return the total rent_value when rented_date, return_date, with_driver parameters
are sent in. with_driver parameter is set to true or false depending whether the
vehicle is rented with or without driver.

Function 2: Day tour - hire calculation.


Calculate total hire_value when start_time, end_time, start_km_reading,
end_km_reading parameters are sent in. Should return base_hire_charge,
waiting_charge and extra_km_charge as output paramters.

Function 3: Long tour - hire calculation.


Calculate total hire_value when start_date, end_date, start_km_reading,
end_km_reading parameters are sent in. Should return base_hire_charge,
overnight_stay_charge and extra_km_charge as output parameters.
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).

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 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.2 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.3 Evaluate how you used the debugging process to develop more secure, robust
application with examples (M4).

4.4 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).
Table of Contents
Activity 01 .................................................................................................................................................. 19
1.1 Define what an algorithm............................................................................................................ 20
1.1.1 Characteristics of an Algorithms ................................................................................................ 20
1.1.2- Searching................................................................................................................................... 21
1.1.2.A-Binary Search .......................................................................................................................... 21
Binary search flowchart ...................................................................................................................... 22
1.1.3-Liner Search ............................................................................................................................... 25
1.2 Describe the steps involve in the process of writing and executing a program .......................... 26
The process of writing a programing .................................................................................................. 28
Algorithm ............................................................................................................................................ 28
............................................................................................................................................................ 29
Pseudo code ........................................................................................................................................ 29
1.3.1.A-How to Measure and Analyzing the Efficiency of an Algorithms ........................................... 35
Activity 02 .................................................................................................................................................. 39
Programming Paradigm .......................................................................................................................... 40
Imperative programming .................................................................................................................... 40
Object-oriented programming ............................................................................................................ 41
Logic paradigm .................................................................................................................................... 41
symbolic paradigm .............................................................................................................................. 41
Declarative paradigm .......................................................................................................................... 41
Functional paradigm ........................................................................................................................... 41
Procedural Oriented Programing ............................................................................................................ 42
Characteristics of Procedural oriented programming ........................................................................ 42
Drawback of Procedural oriented programming (structured programming):- .................................. 42
Object-oriented programming ................................................................................................................. 43
Characteristics of Object oriented programming ............................................................................... 43
event-driven programming...................................................................................................................... 44
Characteristics of Event-driven programming .................................................................................... 44
Example with simple c# interface and coding .................................................................................... 45
Relationship among procedural, object oriented and event driven paradigm ................................. 46
Integrated Development Environment .................................................................................................... 47
Features Integrated Development Environment (IDE) ....................................................................... 48
2.3 Write small snippets of code as example .................................................................................... 52
2.3.1- Procedural Paradigm code........................................................................................................ 52
2.3.B-Object oriented paradigm code................................................................................................. 53
2.3.C-Even-driven paradigm ............................................................................................................... 55
Activity 03 .................................................................................................................................................. 58
................................................................................................................................................................ 59
Design suable algorithms for vehicle tariff calculation for rents and hires . .......................................... 59
.................................................................................................................................................................... 60
3.1 Implement the above algorithms using visual studio IDE .......................................................... 61
C# Code for above rent calculation..................................................................................................... 62
Car Rents and Registration.................................................................................................................. 67
C# Code for above Car rent and registration interface....................................................................... 68
Update cars interface.......................................................................................................................... 70
C# Code for above interface ............................................................................................................... 70
Database creation of Ayubo SL ........................................................................................................... 75
Purpose of using IDE .............................................................................................................................. 76
Activity 04 .................................................................................................................................................. 78
4.1.2 Debugging facility in Visual studio ............................................................................................ 79
Debug Source Code ............................................................................................................................. 80
4.2 Implement the above functionalities using the IDE ......................................................................... 82
4.3 Evaluate how you used the debugging process to develop more secure ..................................... 84
Better practice for the debugging security ......................................................................................... 84
Table of figures

Figure 1 flowchart ....................................................................................................................................... 29


Figure 2 phython code ................................................................................................................................ 30
Figure 3 Output ........................................................................................................................................... 30
Figure 4 python code .................................................................................................................................. 34
Figure 5 liner search .................................................................................................................................... 37
Figure 6 liner search output ........................................................................................................................ 37
Figure 7 binary search ................................................................................................................................. 38
Figure 8 OOP ............................................................................................................................................... 43
Figure 9 event driven .................................................................................................................................. 44
Figure 10 C# code ....................................................................................................................................... 45
Figure 11 IDE ............................................................................................................................................... 45
Figure 12 Relationship ................................................................................................................................ 46
Figure 13 IDE ............................................................................................................................................... 47
Figure 14 Syntax Coloring ........................................................................................................................... 50
Figure 15 Error Checking ............................................................................................................................. 50
Figure 16 Procedural paradigm code .......................................................................................................... 52
Figure 17 Outcome ..................................................................................................................................... 52
Figure 18 OOP python Code........................................................................................................................ 53
Figure 19 OOP outcome .............................................................................................................................. 53
Figure 20 Even driven Interface .................................................................................................................. 55
Figure 21 Interface code ............................................................................................................................. 55
Figure 22 Code Outcome ............................................................................................................................ 56
Figure 23paradigm Relationship ................................................................................................................. 57
Figure 24 Vehicle Therif .............................................................................................................................. 59
Figure 25 Rent Calculation .......................................................................................................................... 60
Figure 26 Rent Calculation Interface........................................................................................................... 61
Figure 27 Vehicle Registration .................................................................................................................... 67
Figure 28 Error List ...................................................................................................................................... 80
Figure 29 Code Analysis .............................................................................................................................. 80
Figure 30 Code map .................................................................................................................................... 80
Figure 31 Break point .................................................................................................................................. 81
Figure 32 Berakpoint 2 ................................................................................................................................ 82
Figure 33 debug toolbar.............................................................................................................................. 83
Figure 34 Code editor ................................................................................................................................. 83
Figure 35 Breakpoint ................................................................................................................................... 86
Figure 36 toolbar......................................................................................................................................... 86
Activity 01
Task 1: Define basic algorithms to carry out an operation and outline the process of
programming an application .

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).

A procedure for resolution a mathematical drawback (as of finding the best common measure.)
In a finite variety of steps that regularly involves repetition of associate operation; generally a
step by step procedure for resolution a issues or accomplishing some finish particularly by pc.

1.1.1 Characteristics of an Algorithms

 Accuracy – the steps are precisely stated (defined).


 Uniqueness – results of each step are uniquely defined and only depend on the input and
the result of the preceding steps.
 Finiteness – the algorithm stops after a finite number of instructions are executed.
 Input – the algorithm receives input.
 Output – the algorithm produces output.
 Generality – the algorithm applies to a set of inputs.
(Chegg.com,2018)
1.1.2- Searching

The task of looking out is one amongst most frequent operations in programing.
It conjointly provides a perfect ground for application of the information structures up to
now encountered. There exist many basic variations of the theme of looking out, and plenty
of totally different algorithms are developed on this subject. Such as;

 Liner Search
 Binary Search
 Table Search
 Straight String Search

Here we are going to discuss about Liner Search and Binary Search

1.1.2.A-Binary Search

It refers to the idea of subdividing a given problem into smaller components, each of which can
be solved separately. We then combine the results to obtain a solution to the original problem.

It refers to the concept of subdividing a given downside into smaller elements, every of which
might be resolved on an individual basis. we tend to then mix the results to get an answer to the
initial downside

Binary search: Locates a target value in a sorted array / list by successively eliminating half of
the array from consideration.
Binary search flowchart

Searching the array below for the value: 14

Index 0 1 2 3 4 5 6 7 8 9
Value -10 2 5 6 9 10 14 19 25 32

MIN MID MAX


NOTE- The binary Search method in the Arrays class searches an array very efficiently if the
array is sorted.

Binary Search
Pseudo Code of Binary Searching

Binary Search (Array list, Min,Mid,Max,Key)

While Min=< Max do

Mid=(Max +Min)/2

If list[Mid]> Value then

Max= (Mid-1)

Else if [Mid]< value then

Min=(Mid+1)

Else

Return Mid

End if

End While

Return False
Binary Search
Pseudo Code of Binary Searching
Find the value 14;

Binary Search (Array list, Min,Mid,Max,Key)

While Min=< Max do

Mid=(10 +0)/ 2

If list[5]> 10 then

Max= (5-1)

Else if [5]< 10 then

Min=(5+1)

Else

Return Mid=14

End if

End While

Return False
1.1.3-Liner Search

Linear search could be a terribly easy search rule. during this kind of search, a ordered search is
formed over all things one by one. each item is checked and if a match is found then that
exact item is came, otherwise the search continues until the top of the info assortment.

Liner Search
Pseudo Code of Binary Searching

procedure linear Search (list,value)

Define list (list 1[ ])


List1.sort ()
Y=input number
i=0
x = length (Binary list)
While (i <= x) then
Z = (i+x)/2
If (list (Z) == Y) then
print (list [Z])
break
else if (list (Z) > Y) then
i = Z+1
else
x = Z-1
End
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).

Describe the steps involve in the process of writing and executing a program;

There are Five steps to be consider when writing and executing a program

Objectives

1. It presents a six step procedure for program development.


2. At the end of this topic you should be able to develop more complex programs
using a systematic approach.

Step-1(Programming and Problem Solving)

1.Programming and Problem Solving Algorithm

- A sequence of precise instructions which leads to a solution

2.Programe

-An algorithm expressed in a language the computer can understand

Step-2(Programming Process)

a. Up till now we’ve gone straight to programming.


b. For big complex problems we need to be more systematic.
c. We need “solve the problem” and “map out a solution” before trying to code it.
d. This is where algorithms in pseudo code come in.
Step-3(Program Design)

1.Programming is a creative process


a. No complete set of rules for creating a program
b. It takes lots of practice.
2.Program Design Process
a. Problem Solving Phase
Result is an algorithm that solves the problem
b. Implementation Phase
-Result is the algorithm translated into a programming language.

Step-4(Problem Solving Phase)

1.Understand the Problem


a. What is the input?
b. What is the output?
c. What is the relationship between the input and output? What formulas or
techniques do we need?

2.Do a small example by hand


3.Write an algorithm to solve the problem
a. Use pseudo code

Step-5(Implementation Phase And Maintenance)

1.Translate the algorithm into a programming language


2.Test the program Testing may result in Compilation (parse) errors ,
Logic errors .The errors will require you to return to some step

3.Software maintenance is a vast activity which includes optimization, error


correction, deletion of discarded features and enhancement of existing features.
Since these changes are necessary, a mechanism must be created for estimation,
controlling and making modifications. The essential part of software maintenance
requires preparation of an accurate plan during the development cycle. Typically,
maintenance takes up about 40-80% of the project cost, usually closer to the
higher pole. Hence, a focus on maintenance definitely helps keep costs down

The process of writing a programing

Creating a flow chart


Write the Pseudo code
Write the pseudo code in python code

Example 1

Algorithm

Step 1 : Start
Start 2 : Input num1, num2, num3
Start 3 : Calculate avg = (num1 + num2 + num3)/3)
Start 4 : Output avg
Start 5 : Stop
Flowchart for Average

Pseudo code

Begin
Input num1
Input num2
Input num3
Sum= num1+num2+num3
Average=sum/3
Print Average
End

Figure 1 flowchart
Python code

Figure 2 phython code

Output

Figure 3 Output
1.2-b 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.

Binary Search
Find 40

5 15 17 75 82 40 4 1 10 25 22 34 89
0 1 2 3 4 5 6 7 8 9 10 11 12

Sort to ascending order

1 4 5 10 15 17 22 25 34 40 75 82 89
0 1 2 3 4 5 6 7 8 9 10 11 12

Find the middle position

Middle position= low position + (high position – low position)/2

M=0 + (12-0)/2

=6

1 4 5 10 15 17 22 25 34 40 75 82 89
0 1 2 3 4 5 6 7 8 9 10 11 12

List [6] <40

low position=7 , high position=12

M=7+(12-7)/2

=9.5
=10

1 4 5 10 15 17 22 25 34 40 75 82 89
0 1 2 3 4 5 6 7 8 9 10 11 12

List [10] >40

low position=7 , high position=9

M=7+(9-7)/2

=8

1 4 5 10 15 17 22 25 34 40 75 82 89
0 1 2 3 4 5 6 7 8 9 10 11 12

List [8] <40

1 4 5 10 15 17 22 25 34 40 75 82 89
0 1 2 3 4 5 6 7 8 9 10 11 12

low position=9 , high position=9

Therefore List [9] = =40


Python code

Figure 4 python code


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.

1.3.1-Big-O Notation
Big O notation is used in Computer Science to describe the performance or complexity of
an algorithm. Big O specifically describes the worst-case scenario, and can be used to
describe the execution time required or the space used (e.g. in memory or on disk) by an
algorithm
(Rob Bell 2008-2018)

1.3.1.A-How to Measure and Analyzing the Efficiency of an Algorithms

The program will be used many times and has a lifetime that makes maintenance likely,
then other factors come into play including readability, extensibility, portability,
reusability, ease of use and efficiency.

The efficiency of an algorithm depends on its use of resources, such as:


– The time it takes the algorithm to execute
– The memory it uses for its variables
– The network traffic it generates
– The number of disk accesses it makes
Algorithm Class Algorithm Relationship between t and n Big-O Notation

Class A Hashing t∝1 O(1)

Class B Binary Search t ∝ log2 n O (log2 n)

Class C Linear Search t∝n O (n)

Class D Quick Sort t ∝ n log2 n O (n log2 n)

Class E Bubble Sort t ∝ n2 O (n2)


Algorithm Efficiency reduced when moving from class A to class

There are three types of analysis that are used in Big-O notation, They are;

1.Best case time complexity

2.Worst case time Complexity

3.Average Time complexity Algorithm

Best case time complexity

The best case time complexity of an algorithm is a measure of the minimum time that the
algorithm will require for an input of size 'n.' The running time of many algorithms varies not
only for the inputs of different sizes but also for the different inputs of the same size.

Worst case time Complexity

The worst case time complexity of an algorithm is a measure of the minimum time that the
algorithm will require for an input of size 'n.' Therefore, if various algorithms for sorting are
taken into account and say 'n,' input data items are supplied in reverse order for a sorting
algorithm, then the algorithm will require n2 operations to perform the sort which will
correspond to the worst case time complexity of the algorithm.

Average Time complexity Algorithm

This is the time that the algorithm will require to execute a typical input data of size 'n' is
known as the average case time complexity.
In case of liner search

Figure 5 liner search

Output

Figure 6 liner search output

Best case Defining value is in the first position in list.


Worst case Defining value is in the end position in the list.
Average case Defining value is in the middle point of the list.
Incase of binary search

Python code

Figure 7 binary search


Activity 02
2.1 Define what is meant by a Programming Paradigm. Explain the main characteristics of
Procedural, Object oriented and Even-driven paradigms and the relationships among
them.

Programming Paradigm
A programming paradigm is a fundamental style of building the structure and elements of a
program. The styles and capabilities of programming languages are defined by their
paradigms.

“A set of assumptions, concepts, values, and practices that constitutes a way of viewing reality
for the community that shares them, especially in an intellectual discipline”
( Wpshout- 2018)

For example,
A programming language may only be designed to follow one paradigm (i.e. Haskell), while
others can support multiple paradigms (i.e. Python). Furthermore,

There are six main programming paradigms:


1. Imperative
2. Object-oriented
3. Logic
4. Symbolic
5. Declarative
6. Functional

Imperative programming -Imperative programming is a paradigm of computer


programming in which the program describes a sequence of steps that change the state of
the computer.
Object-oriented programming -Object-oriented programming (OOP) is a programming
paradigm based upon objects (having both data and methods) that aims to incorporate the
advantages of modularity and reusability. Objects, which are usually instances of classes,
are used to interact with one another to design applications and computer programs.

Logic paradigm-Logic programming is a computer programming paradigm in


which program statements express facts and rules about problems within a system of formal
logic.
symbolic paradigm-symbolic programming is a programming paradigm in which
the program can manipulate its own formulas and program components as if they were plain
data.

Declarative paradigm-Declarative programming is a programming paradigm in which the


programmer defines what needs to be accomplished by the program without defining how it
needs to be implemented. In other words, the approach focuses on what needs to be
achieved instead of instructing how to achieve it.

Functional paradigm-Functional programming languages are specially designed to handle


symbolic computation and list processing applications. Functional programming is based on
mathematical functions. Some of the popular functional programming languages include:
Lisp, Python, Erlang, Haskell, Clojure, etc.
(cs.lmu.edu)
Procedural Programing
As the name implies, Procedure Oriented Programming contains step by step procedure to
execute. Here, the problems get decomposed into small parts and then to solve each part one or
more functions are used. Thus in POP approach, the problem is viewed as a sequence of things to
be done, such as, input taking, calculating and displaying. The primary focus stays on functions
which will be used to accomplish each task.

Characteristics of Procedural programming

1. It focuses on process rather than data.


2. It takes a problem as a sequence of things to be done such as reading, calculating
and printing. Hence, a number of functions are written to solve a problem.
3. A program is divided into a number of functions and each function has clearly
defined purpose.
4. Most of the functions share global data.
5. Data moves openly around the system from function to function.

Drawback of Procedural programming (structured programming):-

1. It emphasis on doing things. Data is given a second class status even through data
is the reason for the existence of the program.
2. Since every function has complete access to the global variables, the new
programmer can corrupt the data accidentally by creating function. Similarly, if
new data is to be added, all the function needed to be modified to access the data.
3. It is often difficult to design because the components function and data structure
do not model the real world.
Object-oriented programming

Figure 8 OOP

Object-oriented programming (OOP) is a programming paradigm based upon objects


(having both data and methods) that aims to incorporate the advantages of modularity and
reusability. Objects, which are usually instances of classes, are used to interact with one
another to design applications and computer programs.

Characteristics of Object oriented programming

1.Abstraction-The ability to represent data at a very conceptual level without any details.

2. Encapsulation- Encapsulation is capturing data and keeping it safely and securely from
outside interfaces.

3. Inheritance- This is the process by which a class can be derived from a base class with all
features of base class and some of its own. This increases code reusability.

4. Polymorphism-This is the ability to exist in various forms. For example an operator can be
overloaded so as to add two integer numbers and two floats.
event-driven programming

Figure 9 event driven

In computer programming, event-driven programming is a programming paradigm in


which the flow of the program is determined by events such as user actions (mouse clicks,
key presses), sensor outputs, or messages from other programs/threads.

Characteristics of Event-driven programming

1. Service Oriented.
2. Time Driven.
3. Event Handlers.
4. Trigger Functions.
5. Events.
6. Simplicity of Programming and Ease of Development.
Example with simple c# interface and coding

Even - driven paradigms uses to create interfaces and procedural and object oriented paradigms
uses to code the program.

Figure 11 IDE

Figure 10 C# code
Relationship among procedural, object oriented and event driven paradigm

Even driven programming contain object oriented programing. Object oriented programing
contain procedural programing. Therefore procedural programing is the base of the application

Figure 12 Relationship
2.2 Analyze the features of an Integrated Development Environment (IDE) and explain
how those features help in application development .
2.2.A. What is meant by Integrated Development Environment (IDE)?

Integrated Development Environment

An integrated development environment (IDE) is an application that facilitates application


development. IDEs are designed to encompass all programming tasks in one application.
Therefore, IDEs offer a central interface featuring all the tools a developer needs.

(veracode.com, 2017)

Figure 13 IDE
Features Integrated Development Environment (IDE)

The Explorer- The Explorer File systems tab presents a hierarchical view of directories and files
that have been mounted for use in NetBeans. Files that are used by BBx or one of their accessory
programs, such as AppBuilder, are identified by unique icons to the left of the name.

The Source Editor- The Source Editor is a modern programmer's text editor that is optimized
for writing Business BASIC source code. BBx program files in either text or tokenized format
can be opened and edited.

The Debugger- This is a program within the IDE that is used to detect errors. If the debugger
detects errors, it may suggest what the type of error is and what line it is on.

The Compiler- A compiler translates the whole program into machine code before the program
is run. It can be difficult to test individual lines of compiled code compared to interpreted
languages as all bugsare reported after the program has been compiled.

The Data File Viewer- The Data File Viewer provides a convenient way to view the contents of
database files. Like the character-based _browse utility, it does not allow creation or editing of
data files, but instead displays their contents in hexadecimal and ASCII.

The Data Dictionary- The IDE's Data Dictionary plug-in module provides the ability to view
and maintain BASIS data dictionaries in the same environment used for developing applications.

The Form Builder- The Form Builder plug-in module replaces the MS Windows-only
ResBuilder utility and is used to create graphical user interfaces for BBj programs. Graphical
controls are arranged on a "form" just as they will appear in the application program.

[http://documentation.basis.com/BASISHelp/WebHelp/ide2/ide_features_basis.htm]

(basis.com)
How the Feature of an IDE helps in Application Development

In Terms of features of an IDE plays a role of helps in the application development as mentioned
above.

Following are the advantages of IDE;

1.It make simpler the creation of database applications.

2.It does not require a detailed knowledge of database.

3.It provides facilities to search, sort, retrieve and process data in database.

4.It also provide facilities to create an attractive user interface with menu, buttons text boxes etc.

Features of an IDE with the visual Studio examples

Auto Complete- when typing the code autocomplete the words in the code or selection list
appears
Syntax coloring-Syntax Highlighting improves the understanding of source code by changing
the font and/or the background

Figure 14 Syntax Coloring

Error checking- When the error occurs the errors will be shown with the red color underline.

Figure 15 Error Checking


Without an IDE, developers spend time deciding what tools to use for various tasks, configuring
the tools and learning how to use them. Many or even all of the necessary dev-test tools are
included in one integrated development environment.

Conclusion- An IDE should be a test environment too, not only in terms of debugging, also in
terms of tests, mainly component and unit tests. Enabling to verify functionality with specified
test calls and results, enabling to test components with the help of mockups and stubs simplifying
dependencies.
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

2.3.1- Procedural Paradigm code

Codes are written using the platform of python

Figure 16 Procedural paradigm code

The outcome is;

Figure 17 Outcome
2.3.B-Object oriented paradigm code

Codes are written using a platform of python

Figure 18 OOP python Code

The outcome is;

Figure 19 OOP outcome


2.3.C-Even-driven paradigm

Interface

Figure 20 Even driven Interface

C# code for the above interface

Figure 21 Interface code


Outcome of the code

Figure 22 Code Outcome

Procedural programming means that you define a program and its subprograms as a series of
steps. In contrast, declarative programs try to describe the result without regard to the steps taken
to computer it but rather some description or denotation of the desired result.

Object oriented programming is a way of organizing code around the principles of encapsulation,
inheritance, substitution, programming to interfaces, and so on. Object oriented programs are
usually mostly procedural.

Event based programming is about writing event handling procedures and having the core event
loop provided by the underlying system. In this way you can save the trouble of writing your
own event loop and benefit from various libraries that already work with the system provided
event loop. Event based programs are very often writing using object oriented style, but not
always. These three categories are thus not related strictly hierarchically, but in common usage
they are mostly nested within one another.

(quora-2018)
Figure 23paradigm Relationship
Activity 03
Task 3: Implement basic algorithms in code using an IDE (LO3).

Design suable algorithms for vehicle tariff calculation for rents and hires .

Figure 24 Vehicle Therif


Algorithm for rent calculation

Figure 25 Rent Calculation


3.1 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.

Rent Calculation

Figure 26 Rent Calculation Interface


C# Code for above rent calculation

namespace Ayubo_Drive_Sl
{
public partial class Rent : Form
{
public Rent()
{
InitializeComponent();
}
public int dayfee, weekfee, monthfee, dkm, wkm, mkm;
private void Rent_Load(object sender, EventArgs e)
{
Class1 objconnection = new Class1();
string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

try
{
con.Open();
SqlCommand command = new SqlCommand("SELECT plate_num FROM
[Car_rates]", con);
SqlDataReader reader;
reader = command.ExecuteReader();
ArrayList carrent = new ArrayList();
while (reader.Read())
{
carrent.Add(reader[0].ToString());
}
comboBox1.Items.AddRange(carrent.ToArray());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}

////////////

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)


{
string stdate = dateTimePicker1.Value.ToShortDateString();
sdate.Text = stdate.ToString();
}

private void dateTimePicker2_ValueChanged(object sender, EventArgs e)


{
string enddate = dateTimePicker2.Value.ToShortDateString();
edate.Text = enddate.ToString();
}
string driver;
private void button1_Click(object sender, EventArgs e)
{
if (yes.Checked == true)
{
driver = "true";
}
else
{
driver = "false";

string startday = sdate.Text;


string endday = edate.Text;

rent t1 = new rent();

string result = rent_calculate(driver, startday, endday);

txttotalrent.Text = result;

}
public double count1, count2;
public string rent_calculate(string dri, string st, string en)
{

DateTime sday = Convert.ToDateTime(st);


DateTime eday = Convert.ToDateTime(en);

TimeSpan difference = eday - sday;


int days = Convert.ToInt32(difference.TotalDays);
double totalrent;

if (days <= 30)


{
if (days >= 7)
{
count1 = days / 7;
count2 = days % 7;

count1 = count1 * weekfee;


count2 = count2 * dayfee;

}
else
{
count2 = days * dayfee;
}

}
else
{
count1 = days / 30;
count2 = days % 30;
count1 = count1 * monthfee;
count2 = count2 * dayfee;
}

if (dri == "true")
{
totalrent = count1 + count2 + days * 1000;
}
else
{
totalrent = (count1 + count2);
}

string torent = Convert.ToString(totalrent);

return (torent);
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
try
{
Class1 objconnection = new Class1();
string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

con.Open();
SqlCommand command = new SqlCommand
("SELECT per_day,per_week,per_month,day_km,week_km,month_km FROM
[Car_rates] where plate_num = '" + comboBox1.Text + "'", con);
SqlDataReader reader;
reader = command.ExecuteReader();
ArrayList carrent = new ArrayList();

while (reader.Read())
{
dayfee = int.Parse(reader[0].ToString());
weekfee = int.Parse(reader[1].ToString());
monthfee = int.Parse(reader[2].ToString());
dkm = int.Parse(reader[3].ToString());
wkm = int.Parse(reader[4].ToString());
mkm = int.Parse(reader[5].ToString());
}

}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
//con1.Close();
}
try
{
Class1 objconnection = new Class1();
string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

con.Open();
SqlCommand command = new SqlCommand
("SELECT brand,per_day,per_week,per_month FROM [Car_rates] where
plate_num = '" + comboBox1.Text + "'", con);
SqlDataReader reader;
reader = command.ExecuteReader();
ArrayList carrent = new ArrayList();

string type = "";


string day = "";
string week = "";
string month = "";
while (reader.Read())
{
type = reader[0].ToString();
day = reader[1].ToString();
week = reader[2].ToString();
month = reader[3].ToString();

txtvtype.Text = type.ToString();
txtday.Text = day.ToString();
txtweek.Text = week.ToString();
txtmonth.Text = month.ToString();

}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}

private void button2_Click(object sender, EventArgs e)


{
this.Close();
}
}
}
Car Rents and Registration

Figure 27 Vehicle Registration


C# Code for above Car rent and registration interface

namespace Ayubo_Drive_Sl
{
public partial class Car_rates : Form
{
public Car_rates()
{
InitializeComponent();
}
private void btnsubmit_Click(object sender, EventArgs e)
{
Class1 objconnection = new Class1();
string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

try
{
string brand = txtbrand.Text;
string model =txtmodel.Text;
string plate = txtplate.Text;
string day = txtday.Text;
string kmday = txtkmday.Text;
string week = txtweek.Text;
string kmweek = txtkmweek.Text;
string month = txtmonth.Text;
string kmmonth = txtkmmonth.Text;
con.Open();

SqlCommand command = new SqlCommand("INSERT INTO [car_rates]


(brand,model,per_day,day_km,per_week,week_km,per_month,month_km,plate_num) VALUES
('" + brand + "','" + model + "','" + day + "','" + kmday + "','" + week + "','" + kmweek + "','" +
month + "','" + kmmonth + "','" + plate + "')", con);
command.ExecuteNonQuery();

MessageBox.Show("Insert Successfully", "School_", MessageBoxButtons.OK,


MessageBoxIcon.Information);
txtbrand.Clear();
txtmodel.Clear();
txtplate.Clear();
txtday.Clear();
txtkmday.Clear();
txtweek.Clear();
txtkmweek.Clear();
txtmonth.Clear();
txtkmmonth.Clear(); ;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}
}
Update cars interface

Figure 28 update cars

C# Code for above interface

using System.Collections;

namespace Ayubo_Drive_Sl
{
public partial class Update_Cars : Form
{
public Update_Cars()
{
InitializeComponent();
}

private void Update_Cars_Load(object sender, EventArgs e)


{
Class1 objconnection = new Class1();
string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

try
{
con.Open();
SqlCommand command = new SqlCommand("SELECT plate_num FROM
[Car_rates]", con);
SqlDataReader reader;
reader = command.ExecuteReader();
ArrayList plate_num = new ArrayList();
while (reader.Read())
{
patientids.Add(reader[0].ToString());
}
cmbplate.Items.AddRange(patientids.ToArray());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}
}
public string plate = "";
public string brand = "";
public string model = "";
public int day;
public int dkm;
public int week;
public int wkm;
public int month;
public int mkm;
private void cmbbrand_SelectedIndexChanged(object sender, EventArgs e)
{

Class1 objconnection = new Class1();


string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

try
{
con.Open();
SqlCommand command = new SqlCommand("SELECT
plate_num,brand,model,per_day,day_km,per_week,week_km,per_month,month_km FROM
[Car_rates] WHERE plate_num = '" + cmbplate.Text + "' ", con);

SqlDataReader reader;
reader = command.ExecuteReader();
ArrayList plate_num = new ArrayList();

while (reader.Read())
{
plate = reader[0].ToString();
brand = reader[1].ToString();
model = reader[2].ToString();
day = int.Parse(reader[3].ToString());
dkm = int.Parse(reader[4].ToString());
week = int.Parse(reader[5].ToString());
wkm = int.Parse(reader[6].ToString());
month = int.Parse(reader[7].ToString());
mkm = int.Parse(reader[8].ToString());

cmbplate.Text = plate.ToString();
txtbrand.Text = brand.ToString();
txtmodel.Text = model.ToString();
txtday.Text = day.ToString();
txtkmday.Text = dkm.ToString();
txtweek.Text = week.ToString();
txtkmweek.Text = wkm.ToString();
txtmonth.Text = month.ToString();
txtkmmonth.Text = mkm.ToString();

}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}
}
private void cmbmodel_SelectedIndexChanged(object sender, EventArgs e)
{

private void btnsubmit_Click(object sender, EventArgs e)


{
if (txtday.Text == "" || txtkmday.Text == "" || txtweek.Text == "" || txtkmweek.Text ==
"")
{
MessageBox.Show("Please Fill the Values", "Ayubo_Drive_Sl",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
Class1 objconnection = new Class1();
string getstring = objconnection.conMethod();
SqlConnection con = new SqlConnection(getstring);

try
{
string plate = cmbplate.Text;
string brand = cmbplate.Text;
string model = txtmodel.Text;
string day = txtday.Text;
string dkm = txtkmday.Text;
string week = txtweek.Text;
string wkm = txtkmweek.Text;
string month = txtmonth.Text;
string mkm = txtkmmonth.Text;

con.Open();

SqlCommand command = new SqlCommand("UPDATE [Car_rates] SET brand =


'" + txtbrand.Text + "', model = '" + txtmodel.Text + "',per_day = '" + txtday.Text + "', day_km
='" + txtkmday.Text + "',per_week = '" + txtweek.Text + "',week_km = '" + txtkmweek.Text +
"',per_month = '" + txtmonth.Text + "', month_km = '" + txtkmmonth.Text + "' where
plate_num='" + plate + "' ", con);

command.ExecuteNonQuery();

MessageBox.Show("Update Successfully", "Ayubo_Drive_Sl",


MessageBoxButtons.OK, MessageBoxIcon.Information);
cmbplate.SelectedIndex = 0;
txtbrand.Clear();
txtmodel.Clear();
txtday.Clear();
txtkmday.Clear();
txtweek.Clear();
txtkmweek.Clear();
txtmonth.Clear();
txtkmmonth.Clear();

}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}
}
}
}
}
Database creation of Ayubo SL

Figure 29 sql query for database creation

Figure 30 Evidence of database creation


3.2 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.

Purpose of using IDE


An Integrated Development Environment (IDE) is a software environment used to write
other programs using tools like an editor and compiler. This can prove to be an extremely
useful tool when coding uses various languages for many reasons. Examples of different
IDE’s include Eclipse, Visual Studios, and NetBeans. Each IDE has its own niche strengths
and weaknesses.

(Sam Travarca, 2017)

Figure 31 IDE

Advantages to IDEs:

1. Increased Efficiency – faster coding with less effort

2. Collaboration – A group of programmers can easily work together within an IDE

3. Project Management – Program resources are easily


Easy to create this kind of interfaces by using this IDE. Users can input data by using these
interfaces. Interfaces are the main part of an application. According to this system visual studio
IDE used for create these interfaces.

Easy to develop the code using IDE. It suggest key words when writing the code.

Another feature to IDE’s is the ability to debug your program. This is arguably one of the most
important tools to deploying a successful program. Testing is crucial to make sure that your user
does not experience an incident where the code does not handle a specific error and crash the
program. Debugging provides you with the ability to run through the program, stopping the code
at specified points to check values of variables or other interests as needed, to verify that the
code and functions are running as intended.

(Vantage,2018)
Activity 04
Task 4: Determine the debugging process and explain the importance of a coding standard.

4.1.1 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.
Debugging is the routine process of locating and removing computer program bugs, errors or
abnormalities, which is methodically handled by software programmers via debugging tools.
Debugging checks, detects and corrects errors or bugs to allow proper program operation
according to set specifications. And also Debugging is also known as debug.

Developing software programs undergo heavy testing, updating, troubleshooting and


maintenance. Normally, software contains errors and bugs, which are routinely removed. In
the debugging process, complete software programs are regularly compiled and executed to
identify and rectify issues. Large software programs, which contain millions of source code
lines, are divided into small components. For efficiency, each component is debugged
separately at first, followed by the program as a whole.
(techopedia.com, 2018)

4.1.2 Debugging facility in Visual studio

Full symbol and source integration-Edit and continue support, enabling source code to be
modified and recompiled on-the-fly without having to exit the current running program or restart
the debugger

Remote machine debugging-Attaching and detaching to and from processes. Integrated


debugging across programs written in both .NET and native Windows languages

Script ability or the ability to control via a macro or scripting language-. Any language which
can talk to COM can be used.

Local and remote debugging of SQL stored procedures on supported versions of Microsoft SQL
Server.
Debug Source Code

Error List

Figure 32 Error List

Code Analysis

Figure 33 Code Analysis

Figure 34 Code map


Break Point

A breakpoint, in the context of C#, is an intentional stop marked in the code of an application
where execution pauses for debugging. This allows the programmer to inspect the internal state
of the application at that point.

A breakpoint helps to speed up the debugging process in a large program by allowing the
execution to continue up to a desired point before debugging begins. This is more efficient than
stepping through the code on a line-by-line basis.

Conditions associated with a breakpoint represent an expression that determines whether the
breakpoint is to be hit or skipped. When filters that specific process or thread are attached to the
breakpoint, it is easier to debug parallel applications spread across multiple processors.

(Technopedia.com,2018)

A breakpoint can also be set at a memory address in the disassembly window and on a function
using the call stack window.

Multiple breakpoints can be set on a line containing multiple executable statements.

Figure 35 Break point


4.2 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 .

set breakpoints when you want to stop debugger execution, perhaps to see the state of code
variables or to look at the call stack. They are one of the most important debugging techniques in
a developer's toolbox. starts the debugger and stops at the first breakpoint.

Figure 36 Berakpoint 2
Navigate code in the debugger using step commands.

Get familiar with commands and shortcuts to navigate code in the debugger and that will make it
faster and easier to find and resolve issues in your app. While you navigate code in the debugger,
you can inspect the state of your app or learn more about its execution flow.

Debug running process

Figure 37 debug toolbar

1. Break all
2. Stop debugging
3. Restart
4. Show next statement
5. Step into
6. Step over
7. Step out
View data values in DataTips in the code editor

DataTips provide a convenient way to view information about variables in your program during
debugging. DataTips work only in break mode and only with variables that are in the current
scope of execution.

Figure 38 Code editor


4.3 Evaluate how you used the debugging process to develop more secure, robust
application with examples .
The ability to debug another process gives you extremely broad powers that you would not
otherwise have, especially when debugging remotely. A malicious debugger could inflict
widespread damage on the machine being debugged.
However, many developers do not realize that the security threat can also flow in the
opposite direction. It is possible for malicious code in the debuggee process to jeopardize the
security of the debugging machine: there are a number of security exploits that must be
guarded against.

Better practice for the debugging security

There is an implicit trust relationship between the code you are debugging, and the
debugger. If you are willing to debug something, you should also be willing to run it. The
bottom line is that you must be able to trust what you are debugging. If you cannot trust
it, then you should not debug it, or you should debug it from a machine that you can
afford to jeopardize, and in an isolated environment.

In order to reduce the potential attack surface, debugging should be disabled on


production machines. For the same reason, debugging should never be enabled
indefinitely.
Robust programming

In computer science, robustness is the ability of a computer system to cope with errors
during execution and cope with erroneous input. Robustness can encompass many areas of
computer science, such as robust programming, robust machine learning, and Robust Security
Network. Formal techniques, such as fuzz testing, are essential to showing robustness since this
type of testing involves invalid or unexpected inputs. Alternatively, fault injection can be used to
test robustness. Various commercial products perform robustness testing of software analysis.

[Wikimedia,2018]

Robust programming, also called bomb-proof programming, is a style of programming that


prevents abnormal termination or unexpected actions. Basically, it requires code to handle bad
(invalid or absurd) inputs in a reasonable way. If an internal error occurs, the program or library
terminates gracefully, and provides enough information so the programmer can debug the
program or routine.

This handout discusses the principles of bomb-proof coding and gives you a detailed example of
how to do it right. Our example is library for managing queues (FIFO lists) of numbers. This
allows the example to consider parameters and global variables. The principles apply to
programs, also; specifically, input and parameters are equivalent, and the environment is like
global variables.

[Matt Bishop, 1998-2002]


Breakpoint

Figure 39 Breakpoint

Toolbar

Figure 40 toolbar
wikipedia.com, 2018. Robust programing. [Online]
Available at: https://en.wikipedia.org/wiki/Robustness_(computer_science)
[Accessed 10 May 2018].
techopedia.com, 2018. Debugging. [Online]
Available at: https://www.techopedia.com/definition/16373/debugging
[Accessed 12 April 2018].

Bishop.com, 2018. Robust . [Online]


Available at: http://nob.cs.ucdavis.edu/bishop/secprog/robust.html
[Accessed 16 May 2018]
Wpshot.com, paradigm [Online] Available at:-https://wpshout.com/development-paradigms-
procedural-object-oriented-functional/
[Accessed 26 March 2018]

Robbell.com, Big-O Notation [Online]


Available at:https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/
[Accessed 27 March 2018]

Chegg.com, algorithms [Online]


Available at;- https://www.chegg.com/homework-help/questions-and-answers/characteristics-
good-algorithm-precision-steps-precisely-stated-defined--uniqueness-result-q603838
[Accessed 26 April 2018]

Quora.com, procedural programing,[Online]


Available at;https://www.quora.com/What-are-the-relationships-between-programming-
procedural-object-oriented-and-event-driven-paradigms
[Accessed 30 April 2018]
Vantage.com, integrated development,[Online]
Available at: https://vantageonesoftware.com/reasons-integrated-development-environment/
[Accessed 05 May 2018]

Programing Paradigm, [Online]


Available at: https://www.cs.lmu.edu/~ray/notes/paradigms/
Accessed on 25 June 2018

Veracode.com ,Integrated development Environment, [Online]


https://www.veracode.com/security/integrated-development-environments
[Accessed on 25 July 2018]
basis.com , features of IDE, [Online]
Available at :http://documentation.basis.com/BASISHelp/WebHelp/ide2/ide_features_basis.htm
[Accessed on 15 august 2018]

Sam Travarca, IDE, [Online]


Available at: https://vantageonesoftware.com/reasons-integrated-development-environment/
Accessed on 18 June 2018

You might also like