Unit 01 Programming M.I.inamulhaq
Unit 01 Programming M.I.inamulhaq
Programme title
student work?
Give details:
Internal Verifier
signature Date
Programme Leader
signature (if required) Date
Student Name/ID
Unit Title
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
Resubmission Feedback:
* 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.
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.
Assignment Brief
Unit Tutor
Assignment Title Design & Implement a GUI based system using a suitable
Integrated Development Environment
Issue Date
Submission Date
Submission Format
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)
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.
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).
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
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.1 Design suable algorithms for vehicle tariff calculation for rents and hires (P3).
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.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
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.
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
Index 0 1 2 3 4 5 6 7 8 9
Value -10 2 5 6 9 10 14 19 25 32
Binary Search
Pseudo Code of Binary Searching
Mid=(Max +Min)/2
Max= (Mid-1)
Min=(Mid+1)
Else
Return Mid
End if
End While
Return False
Binary Search
Pseudo Code of Binary Searching
Find the value 14;
Mid=(10 +0)/ 2
If list[5]> 10 then
Max= (5-1)
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
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
2.Programe
Step-2(Programming Process)
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
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
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
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
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
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
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
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)
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.
There are three types of analysis that are used in Big-O notation, They are;
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.
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.
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
Output
Python code
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,
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
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
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)?
(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.
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.
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
Error checking- When the error occurs the errors will be shown with the red color underline.
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
Figure 17 Outcome
2.3.B-Object oriented paradigm code
Interface
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 .
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();
}
////////////
txttotalrent.Text = result;
}
public double count1, count2;
public string rent_calculate(string dri, string st, string en)
{
}
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);
}
return (torent);
}
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();
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();
}
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();
using System.Collections;
namespace Ayubo_Drive_Sl
{
public partial class Update_Cars : Form
{
public Update_Cars()
{
InitializeComponent();
}
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)
{
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)
{
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();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}
}
}
}
}
Database creation of Ayubo SL
Figure 31 IDE
Advantages to IDEs:
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.
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
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
Code Analysis
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.
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.
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.
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 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]
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.
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].