You are on page 1of 88

BTEC FPT INTERNATIONAL COLLEGE

INFORMATION TECHNOLOGY

ASSIGNMENT 2

UNIT: PROGRAMMING

STUDENT : NGO NGUYEN NHAT LINH

CLASS : SE06202

STUDENT ID : BD00345

SUPERVISOR : NGUYEN HOANG ANH VU

Da Nang, August 2023


ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 4 HND Diploma in Computing

Unit number and


Unit: Programming
title

Date received (1st


Submission date 07/08/2023 07/08/2023
submission)

Re-submission Date received (2nd


date submission)

Student name Ngo Nguyen Nhat Student ID BD00345


Linh

Class Assessor name Nguyen Hoang Anh Vu

Student declaration

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

Student’s signature:

Nhat Linh

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:

Perfomed Student: Ngo Nguyen Nhat Linh i


ACKNOWLEDGMENTS
First of all, I would like to thank my mentor Nguyen Hoang Anh Vu for his constant support
in my studies and research, for his patience, motivation, enthusiasm and rich knowledge. His
guidance has helped me throughout the time of studying and writing this thesis. Without your
wonderful help, I would not have been able to achieve this.

In addition to my mentor, I would like to thank my friends who have helped me


improve my knowledge of my subject. Not only that, they are always there to support me when
I need it. And besides, I would like to thank the school for creating all conditions for me to have
adequate facilities to help me complete my work.

Last but not least, I would like to thank my family, Ms. Nguyen Thi Huong and Mr. Ngo
Quang Thanh who gave birth to me from the beginning and supported me spiritually. They are
always behind to care and help me have more motivation to complete the work well!

Perfomed Student: Ngo Nguyen Nhat Linh ii


ASSURANCE
I declare that this is my work, based on my research, and that I have recognized all materials
and sources utilized in its production, including books, papers, reports, lecture notes, and any
other type of document, electronic or personal communication.

I further declare that I have not previously submitted this assignment for assessment in any
other unit, except where explicit permission has been granted by all unit coordinators involved, or
at any other time in this unit, and that I have not duplicated or stolen ideas from the work of others
in any way.

Declaration of the learner

I verify that the work I've submitted for this assignment is all my own, and that all
research sources have been properly credited.

Signature of the student: Date:

Nhat Linh

Perfomed Student: Ngo Nguyen Nhat Linh iii


TABLE OF CONTENT

INSTRUCTOR/ SUPERVISOR/ ASSESSOR . …………………………………………………..i

REVIEWERS…………………………………………………………………….……………….....ii

ACKNOWLEDGMENTS ...................................................................................................... ii

ASSURANCE ..................................................................................................................... iii

TABLE OF CONTENT ........................................................................................................ iv

LIST OF TABLES AND FIGURES ...................................................................................... vi

LIST OF ACRONYM ............................................................................................................ x

INTRODUCTION ................................................................................................................. 1

CHAPTER 2: EXPLAIN THE CHARACTERISTICS OF PROCEDURAL, OBJECT-


ORIENTED AND EVENT-DRIVEN PROGRAMMING, CONDUCT AN ANALYSIS OF A
SUITABLE INTEGRATED DEVELOPMENT ENVIRONMENT (IDE). (LO2) ....................... 2

2.1 Give explanations of what procedural, object-oriented and event-driven paradigms are;
their characteristics and the relationship between them. (P2) ........................................... 2

2.1.1 Procedural programming system (POP) ...................................................... 2

2.1.2 Oject-oriented programming system (OOPs) ............................................... 4

2.1.3 Event driven programming (EDP) .............................................................. 13

2.1.4 Relationship between Procedural, Object-oriented, Event-driven. ............. 18

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

2.2.1 Introduction about IDE. ............................................................................. 19

2.2.2 The most popular features of Visual Studio. .............................................. 25

CHAPTER 3: IMPLEMENT BASIC ALGORITHMS IN CODE USING AN IDE. (LO3) ....... 31

3.1 Write a program that implements an algorithm using an IDE and Use the IDE to manage
the development process of the program. (P3-M3) ......................................................... 31

CHAPTER 4: DETERMINE THE DEBUGGING PROCESS AND EXPLAIN THE


IMPORTANCE OF A CODING STANDARD. (LO4) .......................................................... 49

Perfomed Student: Ngo Nguyen Nhat Linh iv


4.1 Explain the debugging process and explain the debugging facilities available in the
IDE. (P4).......................................................................................................................... 49

4.1.1 Definition Debugging.................................................................................. 49

4.1.2 Debug process. ......................................................................................... 49

4.1.3 Analyze and give example debugging. ...................................................... 50

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

4.2.1 Naming Standard in Console. .................................................................... 55

4.2.2 Naming Standard in C# Winforms. ............................................................ 63

4.3 Evaluate how the debugging process can be used to help develop more secure, robust
applications. (M4) ............................................................................................................ 67

CRITICAL EVALUATION................................................................................................... 74

CONCLUSION................................................................................................................... 75

REFERENCES .................................................................................................................. 76

Perfomed Student: Ngo Nguyen Nhat Linh v


LIST OF TABLES AND FIGURES

Figure 1: Procedural programming system (POP)........................................................... 2

Figure 2: Coures code find the largest number in 3 number ........................................... 4

Figure 3: Code run .......................................................................................................... 4

Figure 4 Oject-oriented programming system (OOPs) .................................................... 5

Figure 5 Classes ............................................................................................................. 5

Figure 6 Object ................................................................................................................ 6

Figure 7 Data abstraction ................................................................................................ 6

Figure 8 Data encapsulation............................................................................................ 7

Figure 9 Inheritance ........................................................................................................ 7

Figure 10 Polymorphism ................................................................................................. 8

Figure 11 Overloading and Overriding ............................................................................ 8

Figure 12 Binding ............................................................................................................ 9

Figure 13: Message Passing ........................................................................................... 9

Figure 14 Coures code of Money Management Using Inheritance In C# ...................... 11

Figure 15 Coures code of Money Management Using Inheritance In C# ...................... 11

Figure 16 Coures code of Money Management Using Inheritance In C# ...................... 12

Figure 17 Code run ....................................................................................................... 13

Figure 18 Event driven programming (EDP).................................................................. 13

Figure 19 Coures code of login interface and create an account .................................. 15

Figure 20 Coures code of login interface and create an account .................................. 16

Figure 21 Coures code of login interface and create an account .................................. 17

Figure 22 Code run ....................................................................................................... 18

Figure 23 IDE ................................................................................................................ 19

Figure 24 Visual Studio ................................................................................................. 20

Figure 25 Visual Studio 97 ............................................................................................ 20


Perfomed Student: Ngo Nguyen Nhat Linh vi
Figure 26 Visual Studio 1.0 (1991) ................................................................................ 21

Figure 27 Visual Studio 1.0 (1991) ................................................................................ 21

Figure 28 Visual Studio 6.0 (1998) ................................................................................ 21

Figure 29 Visual Studio .NET (2002) ............................................................................. 22

Figure 30 Visual Studio 2005 ........................................................................................ 22

Figure 31 Visual Studio 2010 ........................................................................................ 23

Figure 32 Visual Studio 2015 ........................................................................................ 23

Figure 33 Visual Studio 2019 ........................................................................................ 24

Figure 34 Visual Studio 2022 ........................................................................................ 24

Figure 35 Cross-platform ............................................................................................... 25

Figure 36 Hierarchical Storage ...................................................................................... 25

Figure 37 Multitasking screen....................................................................................... 26

Figure 38 Code support ................................................................................................. 26

Figure 39 Git support ..................................................................................................... 27

Figure 40 Multilingual support ....................................................................................... 27

Figure 41 Powerful code editor...................................................................................... 28

Figure 42 Debugging ..................................................................................................... 28

Figure 43 Build and Deploy ........................................................................................... 29

Figure 44 User Interface Design.................................................................................... 29

Figure 45 Code Analysis and Testing ............................................................................ 30

Figure 46 Microsoft Azure Integration ........................................................................... 30

Figure 47 Flowchart of first interface ............................................................................. 32

Figure 48 Flowchart of second interface ....................................................................... 34

Figure 49: Open Visual Studio....................................................................................... 35

Figure 50: Create New Project ...................................................................................... 35

Figure 51: Select Console App (.Net Framework) ......................................................... 36

Perfomed Student: Ngo Nguyen Nhat Linh vii


Figure 52: Create Name ................................................................................................ 36

Figure 53 Add the statement "using System.Windows.Forms;" ..................................... 37

Figure 54 Create Winforms ........................................................................................... 37

Figure 55 Create Winforms ........................................................................................... 38

Figure 56 Choose the tools ........................................................................................... 38

Figure 57 Design is complete ........................................................................................ 39

Figure 58 Set up the properties section ......................................................................... 39

Figure 59 Double-click on each component .................................................................. 40

Figure 60 Code each function ....................................................................................... 40

Figure 61 Code each function ....................................................................................... 41

Figure 62 Code each function ....................................................................................... 42

Figure 63 Code each function ....................................................................................... 42

Figure 64 Code each function ....................................................................................... 43

Figure 65 Student management .................................................................................... 43

Figure 66 Code each function ....................................................................................... 44

Figure 67 Debugging ..................................................................................................... 45

Figure 68 Debugging ..................................................................................................... 45

Figure 69 Debugging ..................................................................................................... 46

Figure 70 Connect Two Winforms ................................................................................ 46

Figure 71 Code run ....................................................................................................... 47

Figure 72 Code run ....................................................................................................... 47

Figure 73 Code run ....................................................................................................... 48

Figure 74 Code run ....................................................................................................... 48

Figure 75 Code run ....................................................................................................... 49

Figure 76 Error 1 ........................................................................................................... 51

Figure 77 Debug of error 1 ............................................................................................ 51

Perfomed Student: Ngo Nguyen Nhat Linh viii


Figure 78 Error 2 ........................................................................................................... 52

Figure 79 Debug of this code ........................................................................................ 52

Figure 80 Error 1 ........................................................................................................... 53

Figure 81 Error 1 ........................................................................................................... 53

Figure 82 Debug of Error 1 ............................................................................................ 54

Figure 83 Error 2 ........................................................................................................... 54

Figure 84 Error 2 ........................................................................................................... 54

Figure 85 Debug of error 2 ............................................................................................ 55

Figure 86 Variable Naming ............................................................................................ 56

Figure 87 Use meaningful and self-explanatory ............................................................ 56

Figure 88 Provide clear comments ................................................................................ 56

Figure 89 Avoid using the same names ........................................................................ 57

Figure 90 Be consistent with naming ............................................................................. 57

Figure 91 Use Pascal Case or Camel Case .................................................................. 57

Figure 92 Avoid using acronyms or parts ...................................................................... 58

Figure 93 Always use English ....................................................................................... 58

Figure 94 Use Pascal Case ........................................................................................... 58

Figure 95 Use Camel Case for names starting with a lowercase letter ......................... 59

Perfomed Student: Ngo Nguyen Nhat Linh ix


LIST OF ACRONYM

IDE Integrated Development Environment

POP Procedural oriented programming

OOPs Oject-oriented programming system

EDP Event driven programming

Perfomed Student: Ngo Nguyen Nhat Linh x


INTRODUCTION

Programming plays a very important role in life. It will help us understand more deeply
what an algorithm is, and understand programming models such as procedural
programming, object-oriented programming, the structure of a program, data, basic data,
and introduction.

Give students knowledge of IDE rules of naming in code. At the same time, helping stu-
dents have the knowledge to build basic applications. Coming to this report, we will learn
about the characteristics of procedural, object-oriented and event-driven programming,
conduct an analysis of a suitable Integrated Development Environment (IDE). Let's find out
in this assignment.

This report includes the following:

Chapter 1: Explain the characteristics of procedural, object-oriented and event-driven


programming, conduct an analysis of a suitable integrated development environment (ide).
(LO2)
➢ Give explanations of what procedural, object-oriented and event-driven paradigms are;
their characteristics and the relationship between them. (P2)
➢ Analyze the common features that a developer has access to in an IDE. (M2)
Chapter 2: Implement basic algorithms in code using an IDE. (LO3)
➢ Write a program that implements an algorithm using an IDE. (P3)
➢ Use the IDE to manage the development process of the program. (M3)
Chapter 3: Determine the debugging process and explain the importance of a coding
standard. (LO4)
➢ Explain the debugging process and explain the debugging facilities available in the
IDE. (P4)
➢ Integrates many programs such as code completion, compiler, editor Outline the
coding standard you have used in your code. (P5)
➢ Evaluate how the debugging process can be used to help develop more secure, robust
applications. (M4)

Perfomed Student: Ngo Nguyen Nhat Linh 1


CHAPTER 2: EXPLAIN THE CHARACTERISTICS OF PROCEDURAL, OBJECT-
ORIENTED AND EVENT-DRIVEN PROGRAMMING, CONDUCT AN ANALYSIS OF
A SUITABLE INTEGRATED DEVELOPMENT ENVIRONMENT (IDE). (LO2)

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


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

2.1.1 Procedural oriented programming (POP)

❖ Definition POP

Procedure oriented programming is the conventional way of programming where an


application problem is viewed as a sequence of steps. In procedure oriented programming
the problems is broken down into various modules such as data entry reporting querying
modules etc. The procedure-oriented programming is the traditional approach of
programming for developing application software.

Figure 1: Procedural programming system (POP)

There are two types of data, which are associated with these modules, one is global and
another is local data.

❖ The characteristics of POP

Perfomed Student: Ngo Nguyen Nhat Linh 2


Some Characteristics exhibited by procedure-oriented programming are:

• Emphasis is on doing things (Algorithms).

• Large programs are divided into smaller programs known as functions.

• Most of the functions share global data.

• Data move openly around the system from function to function.

• Functions transform data from one form to another.

• Employs top-down approach in program design.

❖ Advantages of procedure oriented programming


- It is easy to understand explain and documentation.
- Procedure oriented programming is easier to learn as compared to other new ways of
programming.
- The testing and debugging is also easy.
- Programming in procedural language is easy because the programmer can focus on just
one small, simple problem.
❖ Disadvantages of procedure oriented programming
- It stresses more an algorithm rather than data.
- It takes more time in processing.

- The global data is available to the function so it is easily accessed by any function,
which creates certain problems.
❖ Application of procedural programming (POP)
- File management: By using procedures and functions to perform operations such as
reading, opening and closing files, procedural programming can be applied in reading data
and processing files.
- Embedded systems: Procedural programming can be used Procedural programming
can be used for hardware control, memory management, event handling, and other tasks in
embedded systems.
- Digital Science: It is used in arithmetic computation, data analysis and simulation.
- Application multitasking: POP allows concurrent tasks to be handled through the use
of processes and threads to manage and control tasks sequentially.
❖ An example of POP
Example program to find the largest number in 3 number.

Perfomed Student: Ngo Nguyen Nhat Linh 3


- Coures code:

Figure 2: Coures code find the largest number in 3 number

- Code run:

Figure 3: Code run

2.1.2 Oject-oriented programming system (OOPs)

❖ Definition OOPs
- Object-Oriented Programming (OOP) is a programming paradigm in computer science
that relies on the concept of classes and objects. It is used to structure a software program
into simple, reusable pieces of code blueprints (usually called classes), which are used to
create individual instances of objects. There are many object-oriented programming
languages, including JavaScript, C++, Java, and Python.

Perfomed Student: Ngo Nguyen Nhat Linh 4


Figure 4 Oject-oriented programming system (OOPs)

❖ The characteristics of OOPs


- Classes: Are blueprints or patterns created to create objects. They encapsulate data
and methods that define the object's attributes and actions.

Figure 5 Classes

Perfomed Student: Ngo Nguyen Nhat Linh 5


- Object: A class that represents real-world objects. Objects have unique state and
behavior based on the class they belong to.

Figure 6 Object

- Data abstraction: Simplifying complex objects by defining classes with abstract data
types, hiding the implementation details and exposing only relevant features to the outside

world.

Figure 7 Data abstraction

Perfomed Student: Ngo Nguyen Nhat Linh 6


- Data encapsulation: The bundling data (attributes) and methods that operate on the data
within a single unit (class). It helps control access to the data and ensures data security.

Figure 8 Data encapsulation

- Inheritance: The ability of a class (child/subclass) to inherit properties and behaviors


from another class (parent/superclass). This promotes code reusability and allows for
creating specialized classes based on existing ones.

Figure 9 Inheritance

Perfomed Student: Ngo Nguyen Nhat Linh 7


- Polymorphism: Objects can have many forms and have different behaviors. The ability
of objects to take on multiple forms and exhibit different behaviors based on the context.

Figure 10 Polymorphism

- Overloading and Overriding: Methods can be defined with the same name but different
parameters (overloading) and derived classes can provide their own implementation of
inherited methods (overriding).

Figure 11 Overloading and Overriding

Perfomed Student: Ngo Nguyen Nhat Linh 8


- Binding: Binding links object properties together, enabling changes in one property to
affect others, either dynamically or statically.

Figure 12 Binding

- Message Passing: Objects communicate by sending messages to each other, and it


also allowing for complex interactions and program structure.

Figure 13: Message Passing

Perfomed Student: Ngo Nguyen Nhat Linh 9


❖ Advantages of OOPs
- Improved productivity: OOP's modularity, extensibility, and reusability enable efficient
software development by providing separation of duties, allowing for easy extension of
objects, and promoting code reuse.
- Enhanced maintainability: OOP's modular design facilitates easier maintenance, as
updates can be made to specific parts of the system without requiring large-scale changes.
- Faster development: Code reuse in OOP speeds up development as developers can
leverage existing libraries and previously developed components.
- Lower cost: The reuse of software components reduces development costs, and the
emphasis on object-oriented analysis and design further optimizes overall expenses.
- Higher software quality: With more time and resources available due to faster
development and lower costs, OOP allows for better software verification, potentially
resulting in higher-quality software.
❖ Disadvantages of OOPs
- Steep expectation to learn and adapt: The thought process involved in OOP may be
unfamiliar to some individuals, requiring time and effort to adapt. Creating programs based
on object interactions can be complex, and understanding concepts like inheritance and
polymorphism may initially pose challenges.
- Larger codebase: Object-oriented programs tend to have a larger number of lines of
code compared to procedural programs.
- Slower execution: Object-oriented programs typically execute slower than procedure-
based programs, as they often involve more instructions to be executed.
- Limited suitability: OOP may not be suitable for all types of problems. Some problems
are better suited for other programming paradigms such as functional programming, logic
programming, or procedural programming, and attempting to apply OOP in those cases may
not result in efficient solutions.
❖ Application of OOPs
- Real Time Systems
- Client Server System
- Hypertext and Hypermedia
- Object Oriented Database
- Neural Networks and Parallel Programming
- AI Expert Systems
- Simulation and Modeling System
Perfomed Student: Ngo Nguyen Nhat Linh 10
- CIM/CAD/CAM Systems
- Computer Aided Designs
❖ An example of OOPs
Example Of Money Management Using Inheritance In C#
- Coures code:

Figure 15 Coures code of Money Management Using Inheritance In C#

Figure 14 Coures code of Money Management Using Inheritance In C#

Perfomed Student: Ngo Nguyen Nhat Linh 11


Figure 16 Coures code of Money Management Using Inheritance In C#

- Code Explanation:

In the above example, I have created two classes: Account and SavingsAccount, using
inheritance method in C#. The Account class is the base class, representing a bank account.
This class has two properties: AccountNumber (account number) and Balance (balance).

The Account class provides methods to deposit (Deposit), withdraw (Withdraw) and
display the balance (DisplayBalance). The Withdraw method checks if the balance is
sufficient for withdrawal.

The SavingsAccount class inherits from the Account class and extends the functionality
by adding an InterestRate property and a CalculateInterest (calculating interest) method.
The CalculateInterest method calculates the interest rate and adds it to the current balance.

In the Main section, I created a SavingsAccount object with the account number and the
corresponding interest rate. Then we make a deposit to the account through the Deposit
method and display the account information using the DisplayBalance method. Next, we
calculate the interest rate and add it to the current balance via the CalculateInterest method.
We withdraw some amount from the account using Withdraw method and show the account
information after withdrawing.

Perfomed Student: Ngo Nguyen Nhat Linh 12


- Code Run:

Figure 17 Code run


2.1.3 Event driven programming (EDP)

❖ Definition EDP

- Event driven programming (EDP) is a paradigm that relies on the occurrence of events
to trigger the execution of certain functions or methods. EDP can improve the
responsiveness, modularity, and scalability of your applications, but it also requires careful
design and organization of your code.

Figure 18 Event driven programming (EDP)

❖ The characteristics of EDP


- Event Handlers: Functions or methods designed to respond to specific events.

Perfomed Student: Ngo Nguyen Nhat Linh 13


- Asynchronous Execution: The program operates non-linearly, responding to events as
they happen, allowing multiple tasks to be performed simultaneously.
- Event-Listener Model: Components or objects register as event listeners to particular
events. When an event occurs, registered listeners are notified and perform appropriate
actions.
- Event Loops: Fundamental part that continuously monitors and dispatches events to
event handlers.
- User-Driven Interaction: User interactions drive program execution, waiting for user
actions before proceeding.
- Flexibility and Modularity: Promotes easy addition, removal, or modification of
components without affecting the entire program's structure.
- GUI Development: Extensively used in graphical user interface development to trigger
responses to graphical elements.
- Non-Blocking Operations: Encourages responsiveness during long-running tasks or
I/O operations.
- Event Propagation: Some systems allow events to propagate through a hierarchy of
objects, providing a flexible control flow.
- Event Synchronization: Requires proper mechanisms to handle concurrent events
effectively and avoid race conditions.
❖ Advantages of Event Driven Programming
- Simplicity: When compared to other types of programming languages, event driven
programming is more easier to use. Once there is a business requirement, the
development of the program is hassle free.
- Convenience: Predictive coding is another feature of event driven programming.
With the help of languages like visual basic, predictive coding is made possible. When the
developer is typing the code, the relevant suggestions are given.
- Flexibility: In event driven programming, there is no specific order from start to finish.
This order can make it easy to carry out the code. In addition to that, this is a type of code
that can be altered when necessary. If there is a requirement or errors in coding, the code
is flexible to be changed.
- GUI Support: A pre-programmed toolbar in the form of Graphical User Interface
(GUI) is available in event driven programming. From this toolbar it is able to create more
interactive programs. For an example, tools such as radio buttons are already included.
- Power Consumption: Implementation of event driven programming is from hardware
Perfomed Student: Ngo Nguyen Nhat Linh 14
interrupts. As a result, there is considerably less power consumption.
❖ Disadvantages of Event Driven Programming
- Speed: As event driven programming is based on GUIs. the programs overall
execute reduced performance. Especially, if the installed memory is insufficient.
- Complexity: Event driven programming is too complex for simple programs. The flow
of the program and stack management is all what makes EDP more complex. If it is a
small program, it is worth considering other options like batch programming.
- Resource Utilization: Event driven programming uses main loop which is well known
to drain system resources. Because, the main loop is constantly functioning in the
background. Moreover, due to the usage of GUI, EDP cannot provide an interface unless
the required specifications are met.
- Language Translation: Once a program is written using the EDP language, you
cannot translate it to a different language. Because some functionalities like button are
programmed to work only with event driven programming.
- Platform Support: Generally, event driven programming is platform dependent.
When a particular program uses EDP, it cannot function on other platforms. For an
example, the program visual basic works using windows library files. If the program is
moved to a different OS, these files cannot be found
❖ An example of EDP
Code the login interface and create an account.
- Coures code:

Figure 19 Coures code of login interface and create an account

Perfomed Student: Ngo Nguyen Nhat Linh 15


Figure 20 Coures code of login interface and create an account

Perfomed Student: Ngo Nguyen Nhat Linh 16


Figure 21 Coures code of login interface and create an account

Perfomed Student: Ngo Nguyen Nhat Linh 17


- Code run:

Figure 22 Code run

❖ Event-Driven Programming Applications


➢ Event-driven programming is generally used in three cases:
- When programming games in which a set of objects carries out control flow.
- When creating server applications, it is undesirable to spawn service processes if, for
one reason or another.
- When building user interfaces, including graphical ones.
2.1.4 Relationship between Procedural, Object-oriented, Event-driven.
- Procedural programming focuses on build applications and programs by execute
logical steps in a certain sequence. These steps are independent of external state and are
fixed in the program. However, in some cases, procedural programming can be combined
with object-oriented programming to represent more complex environments and more
efficient state management.
- Event-based programming focuses on handling events triggered by the user or the
system. This event can occur at any time and the events can process concurrently. This
makes state management more complex and requires the assistance of object-oriented
programming to represent the environment and interactions between objects. Object-

Perfomed Student: Ngo Nguyen Nhat Linh 18


oriented programming provides modelof system state and behavior through classes and
objects, make event handling easier and more organized.
- Object-oriented programming is an efficient method to represent the state and behavior
of the system using classes and objects. It is well compatible with both procedural and event-
oriented programming. Classes and objects provide a more organized approach to
environment representation and state management, making event handling easier and more
efficient.

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

2.2.1 Introduction about IDE.

- IDE definition: IDE is the Integrated Development Environment that provides the user
interface for code development, testing, and debugging features. It helps to organize the
project artifacts relevant to the software application’s source code. It provides several tools
and features to make development easy and standardized based on the programming
language the developer writes the code. The IDEs also have the functionalities to compile
and interpret the program. Some widely used IDs are Eclipse for Java programming
development, Microsoft Visual Studio, Android Studio for Mobile Apps Development,
RStudio for R programs, and PyCharm for Python programming.

Figure 23 IDE

Perfomed Student: Ngo Nguyen Nhat Linh 19


- Visual Studio is a well-known and widely used integrated development environment
(IDE) among professional programmers, particularly those working with languages like VB+
and C#. It has a rich history of development and continuous improvement over the years.

Figure 24 Visual Studio


❖ History Of Visual Studio

Visual Studio was first released in 1997. The first version of Visual Studio was numbered
"Visual Studio 97" and was released in February 1997. Before that, Microsoft had separate
development tools. for each language such as Visual Basic, Visual C++ and Visual FoxPro.

Figure 25 Visual Studio 97

Perfomed Student: Ngo Nguyen Nhat Linh 20


❖ The Development Process Of Visual Studio
➢ Visual Studio started in the early 1990s and has gone through many versions and
improvements over the years:
- Visual Studio's development journey began in the early 1990s and has seen numerous
versions and enhancements since then. Some key milestones include:
▪ Visual Studio 1.0 (1991): Introduced as version 1.0, supporting various
programming languages like Visual Basic 4.0, Visual C++ 4.0, Visual FoxPro 2.5,
and Visual SourceSafe 4.0. It marked the advent of Microsoft's first integrated
development environment.

Figure 27 Visual Studio 1.0 (1991)


Figure 26 Visual Studio 1.0 (1991)

• Visual Studio 6.0 (1998): Released as version 6.0, it brought updates to


programming languages and remained widely used for an extended period.

Figure 28 Visual Studio 6.0 (1998)


Perfomed Student: Ngo Nguyen Nhat Linh 21
• Visual Studio .NET (2002): A crucial turning point, introducing the .NET
Framework and supporting new languages like C# and ASP.NET. It enabled
development for mobile, web, and personal computer applications.

Figure 29 Visual Studio .NET (2002)

• Visual Studio 2005: Introduced in 2005 with improved features and enhanced web
development tools, supporting the .NET Framework 2.0.

Figure 30 Visual Studio 2005

Perfomed Student: Ngo Nguyen Nhat Linh 22


• Visual Studio 2010: Released in 2010, it offered an improved user interface, .NET
Framework 4.0 support, and integration with Windows Azure.

Figure 31 Visual Studio 2010

• Visual Studio 2015: Launched in 2015, it provided support for .NET Core and
allowed cross-platform application deployment.

Figure 32 Visual Studio 2015

Perfomed Student: Ngo Nguyen Nhat Linh 23


• Visual Studio 2019: Introduced in 2019, continues to improve performance,
integrate new tools, and enhance the development experience.

Figure 33 Visual Studio 2019

• Visual Studio 2022: This is the latest version of Visual Studio, there are many new
and improved features such as: 64-bit IDE, .NET support, Intellicode, Hot Reload,
Find in Files faster

Figure 34 Visual Studio 2022

Perfomed Student: Ngo Nguyen Nhat Linh 24


2.2.2 The most popular features of Visual Studio.

Here are some highlights about Visual Studio:


✓ Cross-platform support: Available on Windows, Linux, and MacOS, offering
convenience for developers across different platforms.

Figure 35 Cross-platform

✓ Hierarchical Storage: Organizes snippet data files for easy access and
management.

Figure 36 Hierarchical Storage

Perfomed Student: Ngo Nguyen Nhat Linh 25


✓ Multitasking screen: Allows simultaneous opening of multiple files and folders,
promoting efficient multitasking.

Figure 37 Multitasking screen


✓ Code support: Suggests alternative options to improve code convenience and
usability.

Figure 38 Code support

Perfomed Student: Ngo Nguyen Nhat Linh 26


✓ Git support: Seamlessly connects to GitHub, enabling easy copying, drag-and-drop,
and code collaboration.

Figure 39 Git support

✓ Multilingual support: Supports various programming languages, including C#, C++,


F#, Visual Basic, JavaScript, Python, TypeScript, and more.

Figure 40 Multilingual support

Perfomed Student: Ngo Nguyen Nhat Linh 27


✓ Powerful code editor: Features syntax highlighting, smart code hints, and syntax
error checking for efficient coding.

Figure 41 Powerful code editor


✓ Debugging: Provides a powerful environment for debugging code, with variable
monitoring and error capture.

Figure 42 Debugging

Perfomed Student: Ngo Nguyen Nhat Linh 28


✓ Build and Deploy: Offers customization options for building, releasing, and
deploying applications.

Figure 43 Build and Deploy


✓ User Interface Design: Provides drag-and-drop tools for creating UI in Windows
Forms, WPF, and ASP.NET web applications.

Figure 44 User Interface Design

Perfomed Student: Ngo Nguyen Nhat Linh 29


✓ Code Analysis and Testing: Offers Code Analysis and Code Metrics tools for
optimizing code quality and identifying issues.

Figure 45 Code Analysis and Testing


✓ Microsoft Azure Integration: Seamlessly integrates with Microsoft Azure services,
simplifying application deployment and resource management.

Figure 46 Microsoft Azure Integration

Perfomed Student: Ngo Nguyen Nhat Linh 30


CHAPTER 3: IMPLEMENT BASIC ALGORITHMS IN CODE USING AN IDE. (LO3)

3.1 Write a program that implements an algorithm using an IDE and Use the IDE to
manage the development process of the program. (P3-M3)

In this part, I will write an event-driven program that creates a Windows form to manage
student information. First, I will talk about the properties and functions of the components
that I will use to write the program:
I will write a program Winforms that uses the IDE that is Visual Studio to create a user
interface with common main functions such as login / account creation and student
management interface, these functions including:
❖ First one is User Interface:
- In this interface I use the following components:
• First I created 2 panels to contain the 2 main components of the interface, which are
Login and Register.
• Second, in the Register section, I used 3 Textboxes and named them " txt_tentao" /
"txt_pass" / "txt_cpass" respectively to use in entering information " user name" ; "password"
; "confirm password". In the Login section, I used 2 Textboxes named "txt_ten" and "txt_mk"
used to enter the information created in the Register section that is "user name" and
"password".
• Third, in the Register section I used 6 Label to use for noting information like "Get
Started" ; "Username" ; "Password" ; "Password" ; "Confirm Password" ; "Already have an
account" and "Back to LOGIN". In the Login section, I used 5 Labels for noting information
like "Get Started" ; "Username" ; "Password" ; "Password" ; "Don't have an account" and
"Create New Account".
• Fourth, in the LOGIN section I used 2 Buttons. The first button is "LOGIN" used to log
in to the student management interface, the second button is "DELETE" used to delete
information if entered incorrectly. In the REGISTER section I also used 2 Buttons, the first
button is "REGISTER" used to create an account, the second button is "DELETE" used to
delete information if entered incorrectly.
• And finally, I used two Checkboxes named "Show Password" for both the LOGIN and
REGISTER sections, whose function is to show the newly entered password.

Perfomed Student: Ngo Nguyen Nhat Linh 31


• Flowchart of this interface:

Figure 47 Flowchart of first interface

Perfomed Student: Ngo Nguyen Nhat Linh 32


❖ Secondly is Student Management Interface:
- In this interface I use the following components:
• First, I used a Groupbox named "Student Manager" to hold all the components inside
this interface.
• Second, I used 7 Textboxes to enter student information like "Oder Number" ; "Student
Name" ; "Student ID" ; "Student Mail" ; "Student's address" ; "Student's class" ;
"Student image link".
• Third, I used 9 Label to note the elements in the interface as "Oder Number"
respectively; "Student Name" ; "Student's gender" ; "Student ID" ; "Student Mail" ;
"Student's Birthday" ; "Student's address" ; "Student's class" and "Student image".
• Fourth, I used a ComboBox to select the student's gender information, in addition I
used a DateTimePicker to select the student's date of birth and finally a PictureBox to
display the student's photo.
• Fifth, I use a DataGridView table to display the student information entered.
• Finally, I used 5 Buttons, the first button is "Add" which is used to put information in the
table, the second button is "Delete Data" to delete the information in the table, the third
button is "Delete" Used to delete entered information, the fourth button is "Browse"
used to select and put the image into the PictureBox, the last button is "Exit" used to
exit the interface.
• Flowchart of this interface:

Perfomed Student: Ngo Nguyen Nhat Linh 33


Figure 48 Flowchart of second interface

Perfomed Student: Ngo Nguyen Nhat Linh 34


❖ Step 1: Open Visual Studio:

Figure 49: Open Visual Studio

❖ Step 2: Click Create New Project:

Figure 50: Create New Project

Perfomed Student: Ngo Nguyen Nhat Linh 35


❖ Step 3: Select Console App (.Net Framework):

Figure 51: Select Console App (.Net Framework)

❖ Step 4: Create Name Of The Project:

Figure 52: Create Name

Perfomed Student: Ngo Nguyen Nhat Linh 36


❖ Step 5: Once the project has been created, to run the win form program you
need to add the statement "using System.Windows.Forms;" in the library
declaration.

Figure 53 Add the statement "using System.Windows.Forms;"

❖ Step 6: Next select Console.App1 and select Add >> Form(Windows Form).

Figure 54 Create Winforms

Perfomed Student: Ngo Nguyen Nhat Linh 37


Figure 55 Create Winforms

❖ Step 7: Next you choose the tools in the tool box to design your winform.

Figure 56 Choose the tools

Perfomed Student: Ngo Nguyen Nhat Linh 38


❖ Step 8: After the design is complete, you will get an interface as follows.

Figure 57 Design is complete

❖ Step 9: Next we will select each component of the winform such as: button, text
box, ... then set up the properties section to set its properties.

Figure 58 Set up the properties section

Perfomed Student: Ngo Nguyen Nhat Linh 39


❖ Step 10: And after setting the properties for each element in the winform, we
continue to double-click on each component to code each function for each
component.

Figure 59 Double-click on each component

Figure 60 Code each function

Perfomed Student: Ngo Nguyen Nhat Linh 40


Figure 61 Code each function
Perfomed Student: Ngo Nguyen Nhat Linh 41
Figure 62 Code each function

Figure 63 Code each function

Perfomed Student: Ngo Nguyen Nhat Linh 42


❖ Step 11: Doing the same steps as above, I have created a second interface
that is student management.

Figure 65 Student management

Figure 64 Code each function


Perfomed Student: Ngo Nguyen Nhat Linh 43
Figure 66 Code each function
Perfomed Student: Ngo Nguyen Nhat Linh 44
❖ Step 12: Debugging, if you accidentally hit delete part of your code and make it error,
then something like this happens just go back to your source code and press control + z
until your code is back to normal.

Figure 67 Debugging

Figure 68 Debugging

Perfomed Student: Ngo Nguyen Nhat Linh 45


Figure 69 Debugging

❖ Step 13: To connect two created winforms together you need to use the command
below.

Figure 70 Connect Two Winforms

Perfomed Student: Ngo Nguyen Nhat Linh 46


❖ Step 14: Code run

- When running the code, you will first be taken to the account creation interface
to log in.

Figure 71 Code run

- After successfully creating an account, you will click the back to login button.

Figure 72 Code run


Perfomed Student: Ngo Nguyen Nhat Linh 47
- Next, log in to your newly created account.

Figure 73 Code run

- After the system checks and confirms your account is correct, you will be taken
to the student management interface.

Figure 74 Code run

Perfomed Student: Ngo Nguyen Nhat Linh 48


- Here you can enter, add, delete student information.

Figure 75 Code run

CHAPTER 4: DETERMINE THE DEBUGGING PROCESS AND EXPLAIN THE


IMPORTANCE OF A CODING STANDARD. (LO4)

4.1 Explain the debugging process and explain the debugging facilities available in
the IDE. (P4)

4.1.1 Definition Debugging.

- Debugging is the process of identifying and fix errors or defects in a computer program
to ensure that it runs correctly and produces the correct result expected output. It involves
a systematic approach to locating and resolving issues that prevent the program from
functioning as intended. And Visual Studio provides us with many tools to simplifythe
process of debugging, finding and fixing program errors easier and faster.

4.1.2 Debug process.

The debugging process typically including the these steps:


❖ Step 1: Locate the Error

- The first step is to identify error in the program. This can be done through various
means, such as observing unexpected behavior, incorrect outputs, or encountering
exceptions during program execution or by Breakpoints in Visual Studio.

Perfomed Student: Ngo Nguyen Nhat Linh 49


❖ Step 2: Find the Cause of the Error
- After detecting the error, the next step is to determine cause of the issue. There are
many errors in programming, such as:
- Syntax Error: These occur when there are mistakes in the code's structure or syntax.
- Declaration Error: These errors arise when variables or command are declared
incorrectly.
- Algorithm Error: These are logical errors that lead to incorrect result.
❖ Step 3: Troubleshooting
- Once the cause of the error is identified, the programmer needs to troubleshoot and
analyze the code to understand why the error occurred and how to fix it. This may involve
inspecting variables, stepping through the code, and check the program's flow.
❖ Step 4: Run and Test
- After fixed and troubleshooting the code, it is crucial to run various case on the
program to ensure that the error has been resolved successfully, and the program now
functions as expected.
The debugging utilities that Visual Studio provides:
- Breakpoints: mark the wrong code to pause program execution at specific lines,
allowing inspection of the program's state, variable values, and control flow.
- Step-through Execution: execute the program line by line, observing behavior and
examining variable values at each step.
- Watch Window: monitor variable values and expressions during program execution.
- Locals Window: view the values of local variables and parameters within the current
scope.
- Immediate Window: execute code directly during debugging and see immediate
results.
- Call Stack Window: view the sequence of function calls leading to the current point of
execution, aiding understanding of the program's flow.
- Exception Settings: configure how exceptions are handled during debugging, including
breaking on unhandled exceptions or customizing exception behavior.
- Debug Console: for console applications, view and interact with console output during
debugging.

4.1.3 Analyze and give example debugging.

Some of the most common console errors:

Perfomed Student: Ngo Nguyen Nhat Linh 50


- I will write a simple project that sum of two number so that it prints to the screen.

Error 1:

Figure 76 Error 1
In this code, there is a logical error in the way the program is taking input for variable 'b'.
The code is using the same input (st) for both 'a' and 'b', causing the program to calculate
the sum of the same value twice instead of taking two different input values for 'a' and 'b'.
Make the program inoperable.

And here are debugging of this code:

Figure 77 Debug of error 1

Perfomed Student: Ngo Nguyen Nhat Linh 51


Error 2:

- In this code, at line 15 I forgot word "e" and at line 18 I forgot sign ";" .

And here are debugging of this code:

Figure 78 Error 2

Figure 79 Debug of this code

Perfomed Student: Ngo Nguyen Nhat Linh 52


Some of the most common Winforms errors:

Error 1:

Figure 80 Error 1
- In the above code, there is a logical error that I forgot to set the division condition in
case b is zero, causing the Form to run the calculation wrong.

Figure 81 Error 1

Perfomed Student: Ngo Nguyen Nhat Linh 53


To fix the error in the above code I will rewrite the above code using " if - else "
conditional statement.

Figure 82 Debug of Error 1

Error 2:

The next error is that I forgot to declare the library.

Figure 83 Error 2

This makes when declaring " Application " it will give an error as shown below if we do
not declare the library " using System.Windows.Forms; "

Figure 84 Error 2
And to fix the above error we just need to declare the library used to run Winforms with
the statement " using System.Windows.Forms; "

Perfomed Student: Ngo Nguyen Nhat Linh 54


Figure 85 Debug of error 2

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

4.2.1 Naming Standard in Console.

"Coding Standard" is a set of rules designed to guide writing code in a uniform and
standard way in a software project. This is an important part of the software development
process, especially when the project has many members involved or when the source code
needs to be maintained and expanded later.

The goal of applying the Coding Standard is to create code that is easy to read,
understand, maintain, and increase the consistency of the project's source code. A Coding
Standard typically includes rules for code formatting, naming variables and functions, code
layout conventions, use of control structures, memory management, and many other
aspects of writing code.

Complying with the Coding Standard reduces the likelihood of bugs in the source code,
enhances the readability and understanding of the code for team members, minimizes
conflicts between members when working together, and supports the maintenance of the
code. maintain and extend the source code in the future.

- There are many Coding Standard Used, but here are some of the most usually:

Variable Naming:

Perfomed Student: Ngo Nguyen Nhat Linh 55


➢ Minimize the use of global variables, and only use them when necessary. Prefer local
variables within functions or classes to limit their scope.

Figure 86 Variable Naming

➢ Use meaningful and self-explanatory names for variables to enhance code readability.

Figure 87 Use meaningful and self-explanatory

➢ Provide clear comments or footnotes explaining the purpose and usage of variables,
especially for complex or less intuitive ones.

Figure 88 Provide clear comments

Perfomed Student: Ngo Nguyen Nhat Linh 56


Naming Rules:
➢ Avoid using the same names with different cases (case sensitive), as it can lead to
confusion and unintended behaviors.

Figure 89 Avoid using the same names

➢ Be consistent with naming conventions across namespaces, method parameters, and


variables to maintain code clarity and avoid potential bugs.

Figure 90 Be consistent with naming

➢ When naming abbreviations, use Pascal Case or Camel Case to make them easily
distinguishable from regular words and to improve code understanding.

Figure 91 Use Pascal Case or Camel Case

Perfomed Student: Ngo Nguyen Nhat Linh 57


➢ Avoid using acronyms or parts of identifiers that might cause ambiguity or conflicts
within the codebase.

Figure 92 Avoid using acronyms or parts

➢ Always use English for function and variable names.

Figure 93 Always use English

Conventional Types of Capitalization:


➢ Pascal Case should be used for names with three or more characters, where the initial
letter of the identifier and the first letter of each subsequent word are capitalized.

Figure 94 Use Pascal Case

Perfomed Student: Ngo Nguyen Nhat Linh 58


➢ Use Camel Case for names starting with a lowercase letter, followed by capitalized
first letters of subsequent words. This convention is ideal for local variables and method
names.

Figure 95 Use Camel Case for names starting with a lowercase letter

➢ Uppercase identifiers should be reserved for constants or predefined values, using all
capitalized letters.

Namespace Naming:
➢ Follow Pascal syntax when naming namespaces to maintain consistency across
projects, make them easily distinguishable and use prefixes to avoid namespace conflicts
in larger codebases or collaborations with external libraries.

Perfomed Student: Ngo Nguyen Nhat Linh 59


Class, Struct, and Interface Naming:
➢ Choose meaningful nouns or noun phrases for class and struct names in Pascal Case,
clearly indicating the object's purpose and responsibilities.

➢ Name interfaces with adjective phrases or noun phrases, and prefix them with "I" to
distinguish them from classes.

➢ Avoid using the prefix "C" for class names, as it might be redundant and not add much
value.

Perfomed Student: Ngo Nguyen Nhat Linh 60


➢ When inheriting classes, the derived class name should reflect the base class's name
to maintain a clear hierarchy.

Method, Property, and Field Naming:


➢ Use verb or verb phrases for method names, clearly conveying their actions or
operations.

➢ Name properties with nouns, noun phrases, or adjectives, avoiding "Get" prefixes for
attributes since properties implicitly represent attributes.

Perfomed Student: Ngo Nguyen Nhat Linh 61


➢ Fields should be named in Pascal Case, using nouns, noun phrases, or adjectives,
and avoiding prefixes to keep code clean and concise.

Indentation:
➢ Utilize proper indentation to enhance source code readability and maintain a consistent
visual structure.
➢ Indent every substatement inside a block to clearly define code hierarchy and control
flow.
➢ Maintain aligned opening braces in a straight column with the corresponding closing
brace to make code blocks visually coherent.
➢ Write concise and clear functions, avoiding excessively long functions that could
reduce code comprehension.

Perfomed Student: Ngo Nguyen Nhat Linh 62


4.2.2 Naming Standard in C# Winforms.

in C# Winforms there are many rules for naming objects, but below is a summary
of some common naming conventions for objects in Winforms:

OBJECT NAME SET NAME FOR OBJECT EXAMPLE

Button btn Btn_Login

Check Box chk Chk-


_ShowPass
Data View dvw Dvw_Student

Form frm Frm_LogIn

Label lbl lbl_NameUser

Link Label llbl Llbl_Facebook

List View lsvw Lsvw_Staff

Numeric nud Nud_Hour


Up Down

Picture Box pic Pic_Logo

Perfomed Student: Ngo Nguyen Nhat Linh 63


Scroll Bar sbr Sbr_Table

Tab Control tab Tab_Design

Textbox txt Txt_Password

Timer tmr Tmr_Deadline

ToolTip tip Tip_Copy

Tree View tre Tre_Books

RadioButton rdb rdb_Option

DataGridView dgv dgv_Managermen


t
ComboBox cmb cmb_Name

GroupBox grb grb_Car

Exemple:
- In this part I wrote a Winforms with functions like addition, subtraction, multiplication
and division like a notebook.

Perfomed Student: Ngo Nguyen Nhat Linh 64


- Source code:

Perfomed Student: Ngo Nguyen Nhat Linh 65


- In the above code I used object naming rules like " txt_ketqua " ; " btn_pheptinh " ; "
btn_number " ; " btn_nutbang " ; " btn_nutcong " ; " btn_nutxoa " ; " btn_nutce " to perform

Perfomed Student: Ngo Nguyen Nhat Linh 66


functions such as performing addition, subtraction, multiplication, and division calculations
and print the results for the calculations you entered.

4.3 Evaluate how the debugging process can be used to help develop more secure,
robust applications. (M4)

- Debugging is a feature created to find and handle errors in the program, when the code
produces incorrect results or cannot be run. The debugger makes our program more
complete, more secure against external attacks or unexpected problems, ensures the
software works as planned, and resolves problems. problems occur during development
and maintenance as quickly as possible. Most IDEs have debuggers to help programmers
generate code faster and avoid avoid errors when coding. The Visual Studio Debugger is a
powerful and popular tool built into the Visual Studio integrated development environment
(IDE). It provides features and functions that support debugging in software development
such as Breakpoint, Remote Debugging, Call Stack, Step Over, Step Into, Step Out, etc.

❖ Advantages of Debugging:

- Improved system quality: By identifying and resolving bugs, a software system can be
made more reliable and efficient, resulting in improved overall quality.

Perfomed Student: Ngo Nguyen Nhat Linh 67


Reduced system downtime: By identifying and resolving bugs, a software system can be
made more stable and less likely to experience downtime, which can result in improved
availability for users.

- Increased user satisfaction: By identifying and resolving bugs, a software system can
be made more user-friendly and better able to meet the needs of users, which can result in
increased satisfaction.

- Reduced development costs: By identifying and resolving bugs early in the development
process, it can save time and resources that would otherwise be spent on fixing bugs later
in the development process or after the system has been deployed.

- Increased security: By identifying and resolving bugs that could be exploited by


attackers, a software system can be made more secure, reducing the risk of security.

- Better understanding of the system: Debugging can help developers gain a better
understanding of how a software system works, and how different components of the system
interact with one another.

- Facilitates testing: By identifying and resolving bugs, it makes it easier to test the
software and ensure that it meets the requirements and specifications.

❖ Disadvantages of Debugging:

- Time-consuming: Debugging can be a time-consuming process, especially if the bug is


difficult to find or reproduce. This can cause delays in the development process and add to
the overall cost of the project.

- Requires specialized skills: Debugging can be a complex task that requires specialized
skills and knowledge.

- Can be difficult to diagnose: Some bugs may be caused by interactions between


different components of a software system, which can make it challenging to identify the root
cause of the problem.

- Can be expensive: Debugging can be an expensive process, especially if it requires


additional resources such as specialized debugging tools or additional development time.

Perfomed Student: Ngo Nguyen Nhat Linh 68


- Sometimes the debugging can't find some errors in the library when declare.

❖ Example about debugger in Visual Studio:

In the example below, I wrote a program to calculate the sum of two numbers entered
from the keyboard, but there was an algorithm error that caused the program's results to be
wrong compared to reality. so please join me in using the debugging feature in Visual Studio
to fix the above program.

Perfomed Student: Ngo Nguyen Nhat Linh 69


To fix the above code, we do the following steps:

Step 1: Set a breakpoint: Click on the line of code "int result = x + y;" and press F9 or
right-click and choose "Breakpoint >> Insert Breakpoint" from the menu.

Perfomed Student: Ngo Nguyen Nhat Linh 70


Step 2: Run the program in debug mode: Press F5 or choose "Debug" -> "Start
Debugging" from the menu or use the "Start Debugging" icon (a green triangle).

Step 3: Debug and check variable values: The program will run and stop at the
breakpoint you set (the line "int result = x + y;"). In the "Watch" window (which can be opened
by selecting "Debug" -> "Windows" -> "Watch" -> "Watch 1"), add the expression "x + y" to
check the value of this expression. You will see the value of the expression based on the
inputs you provided for 'a' and 'b'.

Perfomed Student: Ngo Nguyen Nhat Linh 71


Step 4: Press F11 (or right-click and choose "Step Into") to execute the AddNumbers
function. The "Watch" window will display the return value of the function, which is not the
sum but the difference of 'a' and 'b'.

Perfomed Student: Ngo Nguyen Nhat Linh 72


Step 5: Fix the bug: To fix the bug, go back to the code inside the AddNumbers function
and replace the statement "return x - y;" with "return x + y";.

Step 6: Run the program again and check the result: Press F5 to continue executing
the program. Now the program will correctly calculate the sum of 'a' and 'b' and display the
result.

Perfomed Student: Ngo Nguyen Nhat Linh 73


CRITICAL EVALUATION
Throughout the chapters, I have explored the characteristics of procedural, object-
oriented, and event-driven programming paradigms. I also conducted an analysis of a
suitable Integrated Development Environment (IDE), focusing on the common features
provided by Visual Studio. Additionally, I implemented basic algorithms using the IDE and
managed the development process of the program.
In Chapter 1, I gained an understanding of the three programming paradigms. Procedural
programming (POP), Object-Oriented Programming (OOPs), Event-Driven Programming
(EDP). The relationship between these paradigms was explored, showcasing how they can
complement each other.
Chapter 2 focused on the features accessible to developers in an IDE, with a detailed
analysis of Visual Studio's popular features.
In Chapter 3, I practically applied the knowledge gained from the previous chapters by
implementing algorithms using an IDE. We wrote a program that implemented an algorithm
and effectively managed the development process through the IDE's tools and features.
Chapter 4 delved into the critical process of debugging, explaining its significance and
exploring the debugging facilities available in the IDE. Besides, I outlined the importance of
a coding standard in Chapter 4.
Finally, I evaluated how the debugging process can contribute to the development of more
secure and robust applications.
Throughout this critical evolution, we have gained essential insights into programming
paradigms, utilized an IDE to develop and manage code, and understood the significance
of debugging and adhering to coding standards in software development. Therefore, I
humbly assert that the quality of this study merits an M.

Perfomed Student: Ngo Nguyen Nhat Linh 74


CONCLUSION

In conclusion, we have gained essential insights into programming paradigms, utilized


an IDE to develop and manage code, and understood the significance of debugging and
adhering to coding standards in software development. Above all, I am immensely indebted
to Mr. Nguyen Hoang Anh Vu for his unwavering commitment, thoughtful guid-ance, and
wholehearted devotion to his students. It is through his selfless mentorship that I have
triumphantly accomplished this essay. I extend my sincerest appreciation for his in-valuable
support throughout this journey.

Perfomed Student: Ngo Nguyen Nhat Linh 75


REFERENCES

1. https://ecomputerconcepts.com/procedure-oriented-programming/
2. https://examradar.com/procedure-oriented-programming-vs-oop/
3. https://www.educative.io/blog/object-oriented-programming
4. https://www.interviewbit.com/blog/characteristics-of-object-oriented-programming/
5. https://yandex.com/images/search?img_url=https%3A%2F%2Fpbs.twimg.com%2Fm
edia%2FFODka5CXoAIniCR.png&lr=10543&pos=3&rpt=simage&text=Oject-
oriented%20programming%20system%20(OOPs)
6. https://yandex.com/images/search?img_url=https%3A%2F%2Fblog.freec.asia%2Fw
p-content%2Fuploads%2F2020%2F05%2Fviec-lam-lap-trinh-
vien.jpg&lr=10543&pos=5&rpt=simage&text=l%E1%BA%ADp%20trinh%20th%E1%
BB%A7%20t%E1%BB%A5c
7. https://www.aplustopper.com/advantages-and-disadvantages-of-oop/
8. https://learn.saylor.org/mod/page/view.php?id=22041
9. https://www.interviewbit.com/blog/applications-of-oops/
10. https://cloudbites.tv/wp-content/uploads/2019/06/35-lightning-components-series-e.jpg
11. https://studybay.com/blog/event-driven-development-features/
12. https://www.linkedin.com/advice/0/what-some-common-oop-design-patterns
13. https://www.hitechwhizz.com/2022/11/5-advantages-and-disadvantages-limitations-
benefits-of-event-driven-programming.html
14. https://stackoverflow.com/questions/74426618/what-are-the-relationships-among-
procedural-object-oriented-and-event-driven-pa
15. https://www.educba.com/what-is-ide/
16. https://www.geeksforgeeks.org/software-engineering-debugging/
17. https://gkscientist.com/procedure-oriented-programming/
18. https://ecomputerconcepts.com/procedure-oriented-programming/
19. https://www.collegenote.net/curriculum/object-oriented-programming/67/357/
20. https://www.geeksforgeeks.org/difference-between-oop-and-pop/
21. http://www.hexainclude.com/procedure-oriented-programming-language/
22. https://www.educative.io/blog/object-oriented-programming
23. https://www.tindores.com/object-oriented-programming-and-software-development/

Perfomed Student: Ngo Nguyen Nhat Linh 76

You might also like