Professional Documents
Culture Documents
INFORMATION TECHNOLOGY
ASSIGNMENT 2
UNIT: PROGRAMMING
CLASS : SE06202
STUDENT ID : BD00345
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:
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!
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.
I verify that the work I've submitted for this assignment is all my own, and that all
research sources have been properly credited.
Nhat Linh
REVIEWERS…………………………………………………………………….……………….....ii
ACKNOWLEDGMENTS ...................................................................................................... ii
INTRODUCTION ................................................................................................................. 1
2.1 Give explanations of what procedural, object-oriented and event-driven paradigms are;
their characteristics and the relationship between them. (P2) ........................................... 2
2.2 Analyze the common features that a developer has access to in an IDE. (M2) ......... 19
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
4.2 Outline the coding standard you have used in your code. (P5) ................................. 55
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
Figure 95 Use Camel Case for names starting with a lowercase letter ......................... 59
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.
❖ Definition POP
There are two types of data, which are associated with these modules, one is global and
another is local data.
- 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.
- Code run:
❖ 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.
Figure 5 Classes
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 9 Inheritance
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 12 Binding
- 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.
❖ 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.
2.2 Analyze the common features that a developer has access to in an IDE. (M2)
- 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
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.
• Visual Studio 2005: Introduced in 2005 with improved features and enhanced web
development tools, supporting the .NET Framework 2.0.
• Visual Studio 2015: Launched in 2015, it provided support for .NET Core and
allowed cross-platform application deployment.
• 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 35 Cross-platform
✓ Hierarchical Storage: Organizes snippet data files for easy access and
management.
Figure 42 Debugging
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.
❖ Step 6: Next select Console.App1 and select Add >> Form(Windows Form).
❖ Step 7: Next you choose the tools in the tool box to design your winform.
❖ 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 67 Debugging
Figure 68 Debugging
❖ Step 13: To connect two created winforms together you need to use the command
below.
- When running the code, you will first be taken to the account creation interface
to log in.
- After successfully creating an account, you will click the back to login button.
- After the system checks and confirms your account is correct, you will be taken
to the student management interface.
4.1 Explain the debugging process and explain the debugging facilities available in
the IDE. (P4)
- 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.
- 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.
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.
- In this code, at line 15 I forgot word "e" and at line 18 I forgot sign ";" .
Figure 78 Error 2
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
Error 2:
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; "
4.2 Outline the coding standard you have used in your code. (P5)
"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:
➢ Use meaningful and self-explanatory names for variables to enhance code readability.
➢ Provide clear comments or footnotes explaining the purpose and usage of variables,
especially for complex or less intuitive ones.
➢ When naming abbreviations, use Pascal Case or Camel Case to make them easily
distinguishable from regular words and to improve code understanding.
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.
➢ 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.
➢ Name properties with nouns, noun phrases, or adjectives, avoiding "Get" prefixes for
attributes since properties implicitly represent attributes.
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.
in C# Winforms there are many rules for naming objects, but below is a summary
of some common naming conventions for objects in Winforms:
Exemple:
- In this part I wrote a Winforms with functions like addition, subtraction, multiplication
and division like a notebook.
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.
- 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.
- 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:
- Requires specialized skills: Debugging can be a complex task that requires specialized
skills and knowledge.
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.
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.
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'.
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.
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/