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

Ho Tan Rin Asm2 Programming

The document is an assignment submission for a programming course. It includes: - Cover pages with student and assignment details. - Acknowledgments and assurances sections. - A table of contents listing the chapters and sections within the document. - Chapters discussing programming paradigms like procedural, object-oriented and event-driven programming as well as integrated development environments (IDEs). - A section implementing a factorial algorithm using an IDE to fulfill an assignment requirement. - Discussions of debugging processes, coding standards and how IDEs help with development. The document appears to be a student's programming assignment, covering topics like different programming models, using an IDE to code an
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
427 views

Ho Tan Rin Asm2 Programming

The document is an assignment submission for a programming course. It includes: - Cover pages with student and assignment details. - Acknowledgments and assurances sections. - A table of contents listing the chapters and sections within the document. - Chapters discussing programming paradigms like procedural, object-oriented and event-driven programming as well as integrated development environments (IDEs). - A section implementing a factorial algorithm using an IDE to fulfill an assignment requirement. - Discussions of debugging processes, coding standards and how IDEs help with development. The document appears to be a student's programming assignment, covering topics like different programming models, using an IDE to code an
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

BTEC FPT INTERNATIONAL COLLEGE

INFORMATION TECHNOLOGY
ASSIGNMENT 2
UNIT: PROGRAMMING

STUDENT : HO TAN RIN


CLASS : IT16102
STUDENT ID : BDAF200038
SUPERVISOR : NGUYEN HOANG ANH VU

DaNang, August 2021


ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 4 HND Diploma in Business

Unit number and title Unit: Programming

Date received (1st


Submission date 15/8/2021 15/8/2021
submission)

Date received (2nd


Re-submission date
submission)

Student name HO TAN RIN Student ID BDAF200038

Class Assessor name NGUYEN HOANG ANH VU


IT 16102

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the con-
sequences of plagiarism. I understand that making a false declaration is a form of malpractice.

Student’s signature:

HO TAN RIN

Grading grid

P2 P3 P4 P5 M2 M3 M4 D2 D3 D4
Summative Feedbacks: Resubmission Feedbacks:

Grade: Assessor Signature: Date:


Internal Verifier’s Comments:

Signature & Date:

i
ACKNOWLEDGMENTS
First of all, I would like to express a special and enormous thanks to my family for their
invaluable encouragement, enthusiasm, and support. Without all of this, I couldn't have
achieved it Second, I would like to sincerely thank teacher NGUYEN HOANG ANH VU for
enthusiastically supporting me to achieve my academic results and thanking him for his
support in the exercises as well as the knowledge that he taught and taught. solve whole-
heartedly.Besides, I would also like to thank my friends at BTEC FPT International College
for allowing me to exchange knowledge and help me understand the issues in this course.
Finally, I would also like to thank the authors, brothers, sisters and friends who have pro-
vided a lot of knowledge to use as references throughout this exercise.

ii
ASSURANCE

I certify that this assignment is my work, based on my study and that I have acknowledged
all material and sources used in its preparation, whether they be books, articles, reports,
lecture notes, and any other kind of document, electronic or personal communication. I also
certify that this assignment has not previously been submitted for assessment in any other
unit, except where specific permission has been granted from all unit coordinators involved,
or at any other time in this unit, and that I have not copied in part or whole or otherwise
stealing ideas the work of other persons.

Learners declaration

I certify that the work submitted for this assignment is my own and research sources
are fully acknowledged.
Student signature: Date:
HO TAN RIN

iii
TABLE OF CONTENT

INSTRUCTOR/ SUPERVISOR/ ASSESSOR……………………………………………I

REVIEWERS………………………………………………………………………………..I

ACKNOWLEDGMENTS……………………………………………………………….….II

ASSURANCE………………………………………………………………………..…….III

TABLE OF CONTENT……………………………………………………………….…..IV

LIST OF TABLES AND FIGURES………………………………………………..…….VI

INTRODUCTION…………………………………………………………………….....VIII

CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE……….1

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


programming, conduct an analysis of a suitable Integrated Development Environment
(IDE)……………… ….……………………………………………………………………………1
2.1 Give explanations of what procedural, object-oriented and event-driven paradigms
are;their characteristics and the relationship between them. (P2)………… …………….1
2.1.1 Procedure-Oriented Programming(POP)……………………………….…….………1

2.1.2 Event-driven programming……………………………………..……………………….2

2.1.3 Object-oriented programming (OOP)……………………………………… …………5

2.1.4 Characteristics of the programming models…………………………………………….6

2.1.5 What is the difference between procedural programming (POP) and object-oriented
programming (OOP)……………………………………………………………………………….9

2.2 Analyze the common features that a developer has access to in an IDE(M2)… ………10

2.2.1 IDE definition………………………………………………………………………………10

2.2.2 Basic features of common IDE…………………………………………………………..10

2.2.3 Benefits of IDE for programmers…………………………….…………………………..13

CHAPTER 3 IDE problems, debugging procedures, and coding standards……………...14

LO3 Implement basic algorithms in code using an IDE ………………………………….……14


LO4 Determine the debugging process and explain the importance of a coding standard..14
3.1 Write a program that implements an algorithm using an IDE(P3)………………. ……..14

3.2 Use the IDE to manage the development process of the program(M3)……… ………23
iv
3.3 Evaluate the use of an IDE for development of applications contrasted with not using an
IDE(D3)……………………………………………………………..…………………………….30

4.1 Explain the debugging process and explain the debugging facilities available in the
IDE(P4)………………………………………………………………………………………….31
4.2 Evaluate how the debugging process can be used to help develop more secure, robust
applications(M4)…………………… …………………………………………………………...38
Critically evaluate why a coding standard is necessary in a team as well as for the individ-
ual(D4)………………………………………………………………….…………………………41

5.1 Outline the coding standard you have used in your code(P5)……… ……….…………42

CRITICAL EVALUATION………………………………………………………………..50

CONCLUSION ........................................................................................................ 51

REFERENCES ....................................................................................................... 52

v
LIST OF TABLES AND FIGURES

Table 2-1 Compare POP and OPP……………………………………………………………..9


Table 3-1: Some coding standard………………….…………………..………………………..36
Figure 2-1 Example for Procedural programming………………………………………………2

Figure2-2 CODE…………..…………………………………………………………………….….4

Figure 2-3 Result……………………………………………………………………………………5

Figure 2-4 Object Oriented Programming (OOP)……………………………………… ….…..5

Figure 2-5 algorithm results………………………………….……………………………….……6

Figure2-6 Abstraction………………………………………………………………………………8

Figure 2-7 Encapsulation…………….…………………………………………………………….8

Figure 2-8 Inheritance…………………………….……………………………………………….8

Figure 2-9 Polymorphism………………………….……………………………………………….8

Figure 2-10 Example about text editor in Visual studio…………………….…………………..11

Figure2-11 This is a debugger in Visual studio……….…………………………………..…….11

Figure2-12 Debugging in Visual studio……………………………………………………..…..12

Figure2-13 Debugging in Visual studio……………………………………………………..…..12

Figure 2-14 Several languages are supported in Visual Studio…………………………..…13

Figure 3-1 Main interface…………………..………………………………….…………………15

Figure 3-2 Create new project………………………………………………..………….…..….16

Figure 3-3 Main Form………………………………………………………………………....…17


Figure 3-4 Adding elements to form………………………………………..……………....….18
Figure 3-5: Element properties…………………………………………………………………..22

Figure 3-6 Example of IDE project……………………………………………….…….………..22

Figure 3-7 results………………………………………………………………………………….23

Figure 3-8 Create a new project or open project………………………………………….…..24

Figure 3-9: Create a new project……………………………………………………..….…..….25

vi
Figure 3-10: Choose project templates………………………………………………….….….26

Figure 3-11: Set the name of the new project and select a framework……………….………26

Figure 3-12: Introduce workspace in Visual studio………………………………………….…27

Figure 3-13 count the factorials from 1 to n………………………………………………….…27

Figure 3-14 Result………………………………………..…………………………………….…28

Figure 3-15: Create a new item in Visual studio……………………………………….…….…28

Figure3-16: Create a new class…………………………………..………………………….…..29


Figure3-17 Workspace of class in Visual Studio………………………………………..……..29

Figure3-18 Set breakpoint in Visual studio……………………………………………….…….30


Figure3-19 How to follow the program…………………………………….……………………30
Figure3-20 Some IDEs…………………………………………………………………..……….31
Figure3-21 Result………………………………………………………..………………………..32
Figure3-22 Result…………………………………………..……………………………………..36
Figure3-23 Program has error…………………….……………………………………………..39

Figure3-24 IDE debugger find error ………………………………………………………….39


Figure3-25 The program is out of error………………………………………………………….40

Figure3-26 For example…………………………………………………………………….……41

Figure 3-27 The program has a line of code with the wrong keyword………………………41

Figure 3-28 Symbolic of Coding standards……………………………………………………..46

Figure 3-29 Form Design……………..………………………………………………….……….47


Figure 3-30 Code Form…………………………….……………………………………………..48
Figure 3-31 Finish form…………………………………………………….……………….……49
Figure 3-32 Test…………….………………………………………………………….....…..….49
.

vii
INTRODUCTION

Programming is one of the subjects to master the knowledge base, understanding


programming models such as procedural programming, object-oriented programming, and
event-oriented programming, the structure of a program, data, basic data, at the same time
to introduce to students the knowledge of IDE, the functions of the IDE and some standard
rules, rules of naming in code. At the same time, it helps students gain knowledge to build
basic applications.

This report includes the following:

CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS AND IDE.

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

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

CHAPTER 3 IDE problems, debugging procedures, and coding standards.

LO3 Implement basic algorithms in code using an IDE .

LO4 Determine the debugging process and explain the importance of a coding standard

viii
CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS
AND IDE.

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


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

2.1 Give explanations of what procedural, object-oriented and event-driven


paradigms are;their characteristics and the relationship between them. (P2)

Programming:
is an imaginary developer-driven cycle that instructs the PC how to perform a task. A
program can be a series of guidelines that refer to the PC's attempt to return feedback
for a difficult alternative. There are different ways to deal with programming interaction,
given as a programming paradigm. In a genral sense, different models deal with different
ways of solving synthetic answers to obvious types of problems using programming.
Most programming languages etablish a model, but some have components of multiple
models.

2.1.1 Procedure-Oriented Programming(POP):

Procedure-oriented programming can be a programming paradigm, derived from


imperative programming, that supports the concept of procedure invocation.
Procedures (regular forms or subroutines) simply contain a series of steps
Calculations to be performed. Any given procedure can be called at any time during
the execution of the program, including other procedures or.
A function:
is a subroutine within a large program. The function takes (or doesn't) satisfy and
returns (or doesn't) a value to a program that calls it. It makes it conceivable to fragment
a program into discrete pieces that operate independently of a giant program. This
implies that a capacity can be used in one program but can also be used in another,
making it simple to check and update the program.
• For example: Create a recursive function to calculate the factorial of a number

The first is to create the main function:

Perfomed Student:HO TAN RIN 1


Next, create a recursive function:

When running the program will get results.

Figure 2-1 Example for Procedural programming.

2.1.2 Event-driven programming:

Event-driven programming is known as one of the programming paradigms of computers


that are determined by user activities. it uses events to determine the control flow of the
program. This type of application is designed to detect events as they occur and use an
appropriate event handler to handle them. To handle them, the procedure usually uses a
callback function or method.

For example: Generate electricity bill.

Perfomed Student:HO TAN RIN 2


• I use the "TextBox" to enter the A and B values and print them out, and the "
Button" to click the result and delete the result. Data A when entering them should
enter a non-zero number if entering 0 it will say "Or enter another 0"

The example below will show us


`

Perfomed Student:HO TAN RIN 3


Figure2-2 CODE

This is the result:

Perfomed Student:HO TAN RIN 4


Figure2-3 Result.

2.1.3 Object-oriented programming (OOP).

Object-Oriented Programming (OOP):

is a programming technique that creates objects in code that abstracts objects. Objects in
programming will correspond to problems, it will belong to attributes (attributes), actions
(methods). Objects can interact with each other. Object-oriented programming languages
are usually: Java, C#, Python, Ruby, Swift, Object-C. It has four basic properties of
object-oriented programming: abstraction, encapsulation, polymorphism, inheritance.

Figure2-4 Object Oriented Programming (OOP).


For example: write simple student management programs:

Perfomed Student:HO TAN RIN 5


first create a new class and initialize the student properties:

Next is the main part:

When running the program will get results:

Figure2-5 algorithm results.

2.1.4 Characteristics of the programming models

Procedural programming:

Functional characteristics:

Perfomed Student:HO TAN RIN 6


They have two forms of passing parameters to a method as it is called by reference
and by reference:

• A variable provides a parameter to the value, the variable value is copied and treated
in the method as a surrounding variable so that the outer variable is unchanged.
• The variable in the parameter itself is already using it by the function using the
reference, instead of creating a variable area inside the function, so it has a do
something on the variables inside out. To the application of the reference, express the
parameters in the method, as you want when choosing whether to use the keyword.
• Recursive Method: Recursion is the declaration method, in its body, it calls itself.
Recursion is quite similar to a loop, you need a stop condition to avoid endless
crecursion. Most recursive methods can be switched to using loops, so keep in mind
that if the loop is simple, loops should be used.

Characteristics of procedural programming.

• when we set up a certain program, POP will in some way follow a hierarchical
programming approach.
• Most of the functions allow information to be shared widely throughout the system.
• It also classifies large projects into smaller pieces called functions.
• The system allows being freely developed information around.
• Functions are responsible for converting data from one structure to another.

Event-driven programming:

• Service-oriented: Since it consumes less power on the computer's prcessing power


and the services normally run in the operating platform, this feature is used to write
programs that render services and do not slow the computer down. It is also a key
feature in event-driven programming processing power and usually, services run in
the background of OS.
• Time-Driven: Time-driven is a model, it is code that runs on a time trigger, it can be
a piece of code that runs over a specified period of time. It is set up for duty.
• Event Handlers: A kind of function or method that will run a specific action when an
event is fired.
• Trigger functions: When a particular event occurs, the trigger is what determines
what code to run, used to choose the event handler when an event can occur.

Perfomed Student:HO TAN RIN 7


• Events: Are keyboard, mouse, interface, If we want events to happen, we have to
activate them.
Simplicity of Programming and Ease of Development:
Compared to other types of programming, event-driven programming is considered one
of the simplest and easiest to use. We can add or remove an object, event, or code
directly into the application with just one click or pressing a button on the keboard. We
have more custom properties, how it works for each object without having to manually
write lengthy, lengthy code. Thanks to its simplicity and ease of use, it's easy for
developers to develop applications in the future.
Object-Oriented Programming
Object-Oriented Programming has four basic properties: inheritance, polymorphism,
encapsulation, and abstraction.

Characteristics of the properties:

• Abstraction: Means generalizing something up, without paying attention to the details
inside. It doesn't care what the details are inside and people still understand it every
time they hear about it.

Figure2-6 Abstraction.

• Encapsulation: Related data and methods are packaged into classes for easy
management and use.

Figure 2-7 Encapsulation.

Perfomed Student:HO TAN RIN 8


• Inheritance: it allows us to build a class based on the definition of a created class. That
means that the parent class can share data and methods between the child classes.
When inheriting the child class, all the methods and properties of the parent class are
inherited. Subclasses do not need to be redefined, other than extending the inherited
components and adding new ones. Reuse the source code optimally, take advantage of
the source code. Some common types of inheritance are single inheritance, multiple
inheritances, multiple inheritances, hierarchical inheritance.

Figure2-8 Inheritance.

• Polymorphism: considered as an action that can be performed in many different


ways. This is another property that can be considered as containing almost all the
power of object-oriented programming.

Figure2-9 Polymorphism.

2.1.5 What is the difference between procedural programming (POP) and object-ori-
ented programming (OOP).

POP OOP

Basic Procedural/Structur Oriented. Object Oriented.

Inherit Does not support inheritance Inheritance is supported in three


states "public", "private", "
protected"

Perfomed Student:HO TAN RIN 9


Security There's no proper way of hiding Data is hidden in three modes
data, so it's not safe "public", "private", "protected",
thus increasing data security.

Functions There is no concept of Function Classes or functions can


and Classes and Class communicate with each other
with keywords. (depending on
different languages, the keyword
will be different)

Commonly C, Pascal C++, JAVA, VB.NET, C# .NET,


used Ruby,...

languages

Data sharing System-wide data is shared Data is shared between objects


between functions in the pro- through functions.
gram.

Table 2-1 Compare POP and OPP.

2.2 Analyze the common features that a developer has access to in an IDE(M2).

2.2.1 IDE definition: An integrated development environment (IDE). IDE is considered an


interface for users to write code to develop applications, organize groups of documents,
automate programming activities. The IDE is also integrated with other supporting features
such as compiler, compiler, interpreter, error checking (Debugger), formatting organizing
code folders, searching code.

2.2.2 Basic features of common IDE:

❖ Text editor: code editor is a feature designed to write and edit code.

Perfomed Student:HO TAN RIN 10


Figure 2-10 Example about text editor in Visual studio.

❖ Debugger: Debugging tools help programmers identify errors in the source code.
When there is an error, it will report the error to the programmer and indicate the error
line so that the programmer knows and corrects the error.

the line is in error!

information about each error

Figure 2-11 This is a debugger in Visual studio.

❖ Compiler: is the component that translates from this programming language into a
computer-processable language, such as binary code.

Perfomed Student:HO TAN RIN 11


❖ Code completion: Full code features help programmers by intelligently detecting
and adding common code elements. These features help developers save coding
time and reduce syntax capabilities law.

Figure 2-12 Debugging in Visual studio.

Figure 2-13 Debugging in Visual studio.


❖ Programming language support: IDEs are typically specific to one programming
language, however, some applications such as Sublime Title and Visual Studio are
supported in multiple languages. Before we go into coding, we need to find out the
language we want to use and then choose a suitable IDE.

Perfomed Student:HO TAN RIN 12


select the language you
want to choose

Figure 2-14 Several languages are supported in Visual Studio.

2.2.3 Benefits of IDE for programmers:

• The IDE creates a homogenous environment between tools that can meet developer
requirements, including version control and debugging tools.
• The IDE provides us with quick ideas, complete statements and code, and it also
automatically detects problems and points out errors in specific lines of code.
• It easily adapts to many different operating systems. Besides, it allows adding of new
features to meet the needs of programmers.
• The standard IDE development interface is considered an effective assistant to help
programmers collaborate more easily, speed up deployment quickly and increase
work efficiency.
• IDE makes developing software and game applications more convenient and easier
on mobile and desktop platforms.
• Create a working environment that helps programmers become easier and more
convenient in their work. Thereby improving their working results.

Perfomed Student:HO TAN RIN 13


CHAPTER 3 IDE problems, debugging procedures, and

coding standards.

LO3 Implement basic algorithms in code using an IDE

LO4 Determine the debugging process and explain the importance of a coding
standard.

3.1 Write a program that implements an algorithm using an IDE(P3).

I will write an event-driven program that creates a Windows form to manage employee
information. First, I will talk about the properties of the components that I will use to
write the program:
I write software to manage employee information and find employee information, it
includes:
• Enter information: Staff code, full name, date of birth, hometown, Age, Gender,
salary.
• In the information section, I use 3 buttons "Button". The first button I named "
Additional" is used to add the data I entered above into the system, the second
button is named "Amend" it has a function to correct information when we fill in
the wrong information, the third button is called "Delete" it has the function of de-
leting information on the system we entered.
• I use the "TextBox" button to record the employee's information and there is a
"DateTime picker" button that has the function to select the date of the year.
• Find employee information by searching by hometown, Gender, hometown.
• In the search section, I use the "checkBox" button to mark the information I need
to search and I also use the "Button" button called "search" it has the function of
searching for data information on the system. the system that I entered earlier in
the information section.
Here are the steps I took to create the employee information table from Visual Studio
software
❖ Step 1: Create a new Project.

Perfomed Student:HO TAN RIN 14


Figure 3-1 Main interface.

❖ Step 2: when entering the previously created project, we will create window forms in
that project. I will show you the steps to do it with pictures as follows.

First we right click on ConsoleApp1.

After right clicking on ConsoleApp1, it will appear on the table, click Add and then we
select Form(windows form)

Perfomed Student:HO TAN RIN 15


After selecting the Form (window form) it will ap+pear a table for us to name the project.

❖ Step 3: Enter a name for the project. Here I will default to the initial name is :Form1.cs
and click Add.

Figure 3-2 Create new project

❖ Step 4: In the Properties section of the Form you can change the Text as you like,
this is the title of the software. Will appear in the upper left corner of the form. Here I
will leave the default as Form1.

Perfomed Student:HO TAN RIN 16


Figure 3-3 Main Form.

❖ Step 5: You add the necessary components to the Form, here I will add Label,
TextBox, Button, Datatimepicker, Panel, ComboBox , and checkBox ....(These
components are in the ToolBox section).

Perfomed Student:HO TAN RIN 17


Figure 3-4: Adding elements to form.

❖ Step 6: To edit you can edit in the Properties of the components

Figure 3-5: Element properties.

❖ Step 7: After preparing the interface, I start to code. You double click on the button1
to capture the event (or the event in Properties). You can coding like a picturebelow:

Perfomed Student:HO TAN RIN 18


Perfomed Student:HO TAN RIN 19
Perfomed Student:HO TAN RIN 20
Perfomed Student:HO TAN RIN 21
Figure 3-6: Example of IDE project

❖ Step 8: After saving your project, press F5 or the Start button on the toolbar to run the
program. Once running, enter your information and find yours in the search section.

The result is as shown below

Perfomed Student:HO TAN RIN 22


Figure 3-7 results.

3.2 Use the IDE to manage the development process of the program(M3).

To be able to use a good IDE that fits our application development needs, we need to
choose a language in the IDE that suits our needs. In this section, I will use a language
called C# which is considered a programming language it uses to create a program. I use
Visual Studio software to create and manage them.

❖ Step 1: We need to install the latest version of visual studio software to be able to use
it easily. This can be considered an IDE used to develop a program or an application.
This is quite a famous application among programmers. Visual studio I have installed
on my computer 2019 version is considered the latest version.
• After the installation is complete I open visual studio it will appear as shown below.

Perfomed Student:HO TAN RIN 23


Figure 3-8 Create a new project or open project.

In this interface it will appear two main parts:


• On the left side of the interface, it will show all the projects you have worked on.
• On the right side of the interface, it has the functions of opening files in other
folders and creating new files
• Open a project or solution: it is used to open a project in a previously default
directory that Visual studio installed previously.
• Open a local folder: it is used to open a project that you created earlier and is
saved in a certain folder.
• Create a new project: used to create a new project.
❖ Step 2: we will create a project using the "create a new project" function.

Perfomed Student:HO TAN RIN 24


Figure 3-9 Create a new project.

• After you click "create a new project" it will appear an interface and on the left side
of the interface it will appear the projects you have worked on recently.
• In the middle part of the interface will appear a table of items for you to choose
from such as languages, operating systems for you to program, and areas in
programming such as consoles, games, Service, web, mobile, office….
• In this part, I will choose c# as the main language to create projects on the win-
dows operating system.

Console interface:

Perfomed Student:HO TAN RIN 25


Figure 3-10: Choose project templates

Figure 3-11: Set the name of the new project and select a framework.

• After we have selected the language as the project, operating system, and
programming system.
• we will enter a name for the project and choose a folder to save the project and
click "create" so that the IDE will create a programming space for you.

Perfomed Student:HO TAN RIN 26


❖ Step 3: we start working on the project we created earlier in the IDE.

Figure 3-12: Introduce workspace in Visual studio.

I'm going to write a simple project that counts the factorials from 1 to n so that it prints to
the. scree

Figure 3-13 count the factorials from 1 to n.

To run the program we press start. This is the result.

Perfomed Student:HO TAN RIN 27


Figure 3-14 Result.

To create a new class or a new form, do the following steps:

Figure 3-15: Create a new item in Visual studio.


To create a new class or a new form, do the following steps:

Right-click and select add -> new item, or press "New item...". Then, a new window ap-
pears.

Perfomed Student:HO TAN RIN 28


Figure3-16: Create a new class.
We will select an item and give it a name. In this picture, I choose "class".

Figure3-17 Workspace of class in Visual Studio.

I will use break-point, by clicking on the left sidebar it will appear a red dot, so I can see how
the program does the steps.

Perfomed Student:HO TAN RIN 29


Figure3-18 Set breakpoint in Visual studio.
Then press “start” to know the steps in turn

Figure3-19 How to follow the program.


3.3 Evaluate the use of an IDE for development of applications contrasted with not
using an IDE(D3).
Benefits of using IDE:

• Serves the environment that the majority of developers require, for example:
• It can suggest and complete commands in a single language.
• Providing a database administration system, as well as a project management
system and source code.
• The IDE will automatically break and arrange the code, and it will also verify
variables to make it easier for programmers to handle when working.

Perfomed Student:HO TAN RIN 30


• The IDE offers a debugging capability that helps programmers figure out where the
mistake is and what's causing it.
• In addition, IDE uses distinct colors to separate keywords, variables, and values,
making it easier for programmers to notice and distinguish them while working.
❖ However, programmers will find it tough to construct and create an application if they
do not use an IDE. We must write the language's rules, which makes the compilation
of source code into machine language more difficult, and the task of controlling the
application development process more challenging. Regardless of whether compilers,
editors, or support for a programming language are available, the process of
developing an application requires many more stages, and users must manually
transfer data from step to step for the computer to understand.

Some popular IDEs:

Figure3-20 Some IDEs.

4.1 Explain the debugging process and explain the debugging facilities available in
the IDE(P4).
Debugging: is one of the process of finding and correcting errors in a program.
Debugging often takes a lot longer than writing programs because logic-related errors
are often difficult to spot. Visual Studio provides us with many intuitive tools to simplify
the process of debugging, finding and fixing program errors easier and faster.
The commonly used debugging procedure is:
• Step 1: Try to run the program a few times to check the problem.
• Step 2: Detect bug.
• Step 3: Double-check what is happening that is causing the error.
• Step 4: Fix bug.
• Step 5: Run the program again to see if the error is still there.

One of the most common debugging means:

Perfomed Student:HO TAN RIN 31


I will write a simple project that counts the factorials from 1 to n so that it prints to the screen.
I will create it and discuss common mistakes

Line 15: error with code "CS0103". we forgot to declare the variable "string" so we got
anerror message.

string st = Console.ReadLine();

Need to declare library variable "string" as above I have fixed above.

Line 19: Bug has code “CS0201” The for loop is the wrong structure. We need to fix it as
follows:

for (int i = 1; i <= n; i++)

Results after debugging.

Perfomed Student:HO TAN RIN 32


Now, it can run:

It will appear in the console image and waiting for the user to enter data.

Figure3-21 Result.

In case your program doesn't give you the desired result or cook like you know how your
program works then you set the "breakpoint" by double-clicking on the red bar as shown in
the picture and pressing start to get started.

Perfomed Student:HO TAN RIN 33


Some error cases in visual:
first, I will create a window form to solve the first-degree equation enter two numbers A and
B and print the result.

The source code of this form:

Perfomed Student:HO TAN RIN 34


However, I found the textBox1_TextChanged method redundant so I removed it.

After deleting it will give an error:

Perfomed Student:HO TAN RIN 35


The reason it gives the error is that we deleted the part we double-clicked in the form part it
will create for us, when we delete a method that contains the code it generated it will make
a mistake. It gets deleted and it says it doesn't understand what Form1_Load means in the
source code it generates.

After we fix the method we deleted.

Now, we can see the operation of the program as we like.

Figure3-22 Result.
The next error is that we forgot to declare the library.

using System.Windows.Forms;

Perfomed Student:HO TAN RIN 36


if we don't declare the library "using System.Windows.Forms;" then when declaring "
Application" it will get an error as shown above.

To fix that error, I will Declare the library "using System.Windows.Forms;" as shown below.

Now it's gone error.


Perfomed Student:HO TAN RIN 37
4.2 Evaluate how the debugging process can be used to help develop more secure,
robust applications(M4)
Debugging:
is one of the computer programs used to deal with errors in the program, when it
produces incorrect results or cannot be run. debugging makes our program more robust,
making our program more complete it needs to handle any input or event it may
encounter. should be powerful and create the ability to quickly detect vulnerabilities.
prevent hackers from entering data and crashing systems, applications... So the
debugger helps us a lot in our work. It can diagnose errors and sometimes also pro-vide
fixes for developers. Most IDEs have debuggers to help programmers generate code
faster and avoid as few errors as possible

IDE debugger:

❖ Advantages.
• The IDE's debugger may assist programmers with unscheduling or changing
variables, code, or any other material of the program while it is running; moreover,
when debugging, I can stop and resume when debugging error is completed.
• Debuggers provide several techniques to decrease the time and repetitive labor
involved in nearly every debugging activity.
• The visual debugger is integrated into the IDE it gives us easy access to smart
editing and all the other capabilities found in the IDE. In a single integrated
development environment.
• Both the visual debugger and the console debugger are helpful and share similar
capabilities.
❖ Disadvantages.
• In fact, sometimes when the IDE debugger finishes fixing the error, it runs and
gives incorrect results.
• Sometimes the IDE can't find some errors in the library.

Example about IDE debugger.

Perfomed Student:HO TAN RIN 38


Errors in the
program

Figure3-23 Program has error.

IDE debugging
found error
and debugging

Figure3-24 IDE debugger find error .

Perfomed Student:HO TAN RIN 39


The program
is out of error.

Figure3-25 The program is out of error.

Handmade debugging.

This is manual debugging by our hands and eyes, do not rely on debugging software

at all.

❖ Advantages:
• The program's issue has been fixed.
❖ Disadvantages:
• When you watch the program again, you will realize that there was an error.
• If you create a large program, it will take a long time to fix all the errors.
• This debugging procedure is rarely used by programmers.

Perfomed Student:HO TAN RIN 40


wrong
keyword

Figure 3-26 The program has a line of code with the wrong keyword.

4.3 Critically evaluate why a coding standard is necessary in a team as well as for the
individual(D4).

Define:
Coding conventions: are rules for a particular programming language that
prescribe programming style, techniques, and procedures for each component of a
program developed in that language. File organization, indentation, comments,
declarations, statements, white space, naming conventions, programming techniques,
and programming concepts are often covered by these conventions, Programming best
practices, architectural best practices, and so on. These are criteria for the structural
quality of software. These recommendations are strongly advised for software
programmers to follow in order to increase the readability of their source code and
make software maintenance easier. Coding rules apply solely to a software project's
human maintainers and peer reviewers. Conventions can be as formal as a defined set
of standards that a complete team or organization observes, or as informal as an
individual's regular coding methods. Compilers do not enforce coding standards.

Figure 3-27 Symbolic of Coding standards

Perfomed Student:HO TAN RIN 41


Benefit :
• Easy to maintain: If coding standards are strictly followed, the code will conform to
the standard, making it simple to maintain and conserve.
• Efficiency: Developers frequently spend a significant amount of time fixing problems
that they should not have considered if they had followed the coding standard since
it helps avoid problems from happening.
• Reduced complexity: The more complicated the code, the more likely mistakes are
to occur; coding standards will assist in removing complexity and improving program
productivity.
• Error correction: If the source code is prepared in accordance with coding standards,
it is easy to discover errors.
• Cost savings: The aforementioned benefits, particularly the ability for developers to
reuse any code when needed, will significantly cut expenses.
The benefit of coding standard for a team or personal:
• Because one person cannot build a huge program or application, we must divide it
into little sections, each of which performs a distinct function, and then combine
them into one giant program. Coding standards are intended to identify each
person's work, not to generate confusion or, worse, repetition. Furthermore, during
the length of the project, all team members can trade and absorb code created by
other team members. The second factor is how simple it is to protect and manage
code inside a project or organization. Finally, boost team members' productivity.
• The coding standard improves the aesthetics of each kernel's program, making the
partners more impressed with the project. Future applications will be easy to build
and debug with proper care and upkeep. It significantly decreases the cost of soft-
ware development as well as each individual's working time.

5.1 Outline the coding standard you have used in your code(P5).

Variable:
• Avoid using a lot of global variables, only use them when absolutely necessary.
• We will put footnotes for each section and explain each function of each variable.
• We need meaningful and understandable names.
Some notes in naming:

Perfomed Student:HO TAN RIN 42


• Do not use the same names again (case sensitive only) Identifiers are difficult to
recognize, especially when they are used in the same context and only differ by
case.
• Don't establish two namespaces with the same name that just change in case
letters (upper case / lower case).
• Do not build a method with parameters with the same name and only different case.
• Acronyms should not be used in IDs or parameter names. Though you must employ
acronyms, utilize Camel Case spelling for acronyms with two or more characters,
even if it negates the usual abbreviation of one word.
• When naming abbreviations, you can use the Pascal case or Camel case to name.
• Avoid using acronyms or parts of identifiers, such as GetWindow written to Gethin.

Naming rules:

Conventional types of capitalization:

Pascal Case: The identifier's initial letter and the first letter of each subsequent word
must be capitalized. To name a name with three or more characters, use Pascal Case.

Camel Case: The first letter in an identifier is a lowercase letter and the first letter of the
following hyphen must be capitalized.

Uppercase: All characters in identifiers must be capitalized. Use this rule for identifiers
with 2 characters or less.

Named Assembly and DLL: Use namesthat generally describe the internal functions of
Assembly.

Name the namespace:

• Use Pascal syntax to name the namespace.


• Use the prefix of company and organization names to limit the conflict of
namespaces with the same name.

For example:

Name the class, struct, and interface:

Perfomed Student:HO TAN RIN 43


• Use nouns or noun phrases to name classes, struct. Use Pascal's case.
• Name the interface an adjective phrase, or you can use a noun or a noun phrase.
• Do not use the prefix "C" for class names.
• Should end the name of the inheriting class with the name of the base class.
• Use the "I" prefix for the interface name.

For example: Name the class

• Name the interface:

• Name the method, property, and field of a type:


❖ Name the method:
• Use verb or verb phrase for method names.
❖ Name properties
• Use nouns, noun phrases or adjectives.
• Do not use "Get" prefix for attribute names.

❖ Name the field


• Use Pascal case to name the field.
• Use nouns, noun phrases or adjectives.
• Do not use prefixes for field names.
Indent:
• it makes the source code easier to learn, easier to understand it makes the source
code easier to learn, easier to understand.

Perfomed Student:HO TAN RIN 44


• Every substatement inside a block must be indented.
• The opening braces must be in a straight column with the closing brace.
• we need to avoid confusing using verbose encodings, length of functions we should
keep to a minimum and easy to understand.

For example: Solve equations of degree 1:

❖ CODE

Perfomed Student:HO TAN RIN 45


This is result

Figure3-28 For example.

Some naming ways for objects in “winform”:

Perfomed Student:HO TAN RIN 46


OBJECT NAME SETNAME FOR
OJECT

Textbox txt

Button btn

Label lbl

CheckBox chk

LinkLabel llbl

TabControl tab

DataView dvw

Table 3-1: Some coding standard.

For example: I design a program that calculates quadratic equations, by using wiform.
❖ I designed the Form as follows:

Figure 3-29 Form Design.


CODE:

Perfomed Student:HO TAN RIN 47


Figure 3-30 Code Form.

After finishing writing the program.

Perfomed Student:HO TAN RIN 48


Figure 3-31 Finish form.

Test.

Figure 3-32 Test

Perfomed Student:HO TAN RIN 49


CRITICAL EVALUATION
Regarding the aforementioned task, I believe I am completely deserving of a
Certificate of Merit because I successfully met the criteria of the passing section
and received a noteworthy mark in the assignment summary. I've discussed the
differences between procedural, object-oriented, and event-driven programming, as
well as the IDE. Using the IDE, implement fundamental algorithms in code, identify
and show the debugging process, and discuss the relevance of coding standards.

Perfomed Student:HO TAN RIN 50


CONCLUSION
After completing this report I have achieved the definition of algorithm, flowchart,
application software development. In addition, I know the characteristics of procedural
programming, countermeasure, and event direction. Know IDE concept and IDE problems.
Know how to debug, correct errors and the importance of coding standards

Perfomed Student:HO TAN RIN 51


REFERENCES

Perfomed Student:HO TAN RIN 52

You might also like