Ho Tan Rin Asm2 Programming
Ho Tan Rin Asm2 Programming
INFORMATION TECHNOLOGY
ASSIGNMENT 2
UNIT: PROGRAMMING
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:
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
REVIEWERS………………………………………………………………………………..I
ACKNOWLEDGMENTS……………………………………………………………….….II
ASSURANCE………………………………………………………………………..…….III
TABLE OF CONTENT……………………………………………………………….…..IV
INTRODUCTION…………………………………………………………………….....VIII
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
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
Figure2-2 CODE…………..…………………………………………………………………….….4
Figure2-6 Abstraction………………………………………………………………………………8
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-27 The program has a line of code with the wrong keyword………………………41
vii
INTRODUCTION
LO4 Determine the debugging process and explain the importance of a coding standard
viii
CHAPTER 2 PROBLEMS RELATED TO PROGRAMMING METHODS
AND IDE.
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.
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.
Procedural programming:
Functional characteristics:
• 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.
• 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:
• 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.
Figure2-8 Inheritance.
Figure2-9 Polymorphism.
2.1.5 What is the difference between procedural programming (POP) and object-ori-
ented programming (OOP).
POP OOP
languages
2.2 Analyze the common features that a developer has access to in an IDE(M2).
❖ Text editor: code editor is a feature designed to write and edit code.
❖ 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.
❖ Compiler: is the component that translates from this programming language into a
computer-processable language, such as binary code.
• 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.
coding standards.
LO4 Determine the debugging process and explain the importance of a coding
standard.
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.
❖ 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.
After right clicking on ConsoleApp1, it will appear on the table, click Add and then we
select Form(windows form)
❖ Step 3: Enter a name for the project. Here I will default to the initial name is :Form1.cs
and click Add.
❖ 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.
❖ 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).
❖ 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:
❖ 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.
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.
• 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:
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.
I'm going to write a simple project that counts the factorials from 1 to n so that it prints to
the. scree
Right-click and select add -> new item, or press "New item...". Then, a new window ap-
pears.
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.
• 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.
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.
Line 15: error with code "CS0103". we forgot to declare the variable "string" so we got
anerror message.
string st = Console.ReadLine();
Line 19: Bug has code “CS0201” The for loop is the wrong structure. We need to fix it as
follows:
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.
Figure3-22 Result.
The next error is that we forgot to declare the library.
using System.Windows.Forms;
To fix that error, I will Declare the library "using System.Windows.Forms;" as shown below.
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.
IDE debugging
found error
and debugging
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.
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.
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:
Naming rules:
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.
For example:
❖ CODE
Textbox txt
Button btn
Label lbl
CheckBox chk
LinkLabel llbl
TabControl tab
DataView dvw
For example: I design a program that calculates quadratic equations, by using wiform.
❖ I designed the Form as follows:
Test.