You are on page 1of 42

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Le Tan Trong Student ID GCD18787

Class GCD0807B Assessor name Nguyen Van Loi

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

Grading grid

P2 P3 P4 P5 M2 M3 M4 D2 D3 D4
❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents
I. PROGRAMMING INTRODUCTION........................................................................................................................5
1. Procedural Programming.................................................................................................................................5
2. Object-Oriented Programming........................................................................................................................7
3. Event-driven Program......................................................................................................................................8
4. Summary........................................................................................................................................................10
II. EVALUATE THE PROBLEM..................................................................................................................................12
1. Introduction...................................................................................................................................................12
2. Context..........................................................................................................................................................12
3. User Requirements........................................................................................................................................12
III. DESIGN THE SOLUTION......................................................................................................................................13
1. Flowchart.......................................................................................................................................................13
2. Write Pseudo-Code........................................................................................................................................14
3. Development.................................................................................................................................................14
4. User Interface................................................................................................................................................14
5. Source Code...................................................................................................................................................15
6. Implement.....................................................................................................................................................19
IV. INTEGRATED DEVELOPMENT ENVIRONMENT (IDE).......................................................................................23
1. Introduction...................................................................................................................................................23
2. Common features of IDE................................................................................................................................24
3. Summary........................................................................................................................................................28
4. Application development with and without using IDE...................................................................................32
V. DEBUGGING PROCESS.......................................................................................................................................33
1. What is Debugging.........................................................................................................................................33
2. How importance of Debugging is?.................................................................................................................34
3. Debugging Facilities Available in the IDE.......................................................................................................34
VI. CODING STANDARD.......................................................................................................................................36
Table of Figures
Figure 1. Procedural Programming Model...................................................................................................................5
Figure 2. OOP Model...................................................................................................................................................7
Figure 3. Event-driven Model......................................................................................................................................9
Figure 4. Procedural and Object-Oriented Programing.............................................................................................11
Figure 5. User Interface.............................................................................................................................................15
Figure 6. IDE WORK INTERFACE.................................................................................................................................23
Figure 7. Squiggles and Quick Actions in IDE.............................................................................................................24
Figure 8. Code Cleanup..............................................................................................................................................25
Figure 9. Refactoring.................................................................................................................................................25
Figure 10. IntelliSense................................................................................................................................................26
Figure 11. Search Box................................................................................................................................................26
Figure 13. CodeLens..................................................................................................................................................27
Figure 14. Go To Definition........................................................................................................................................27
Figure 15. Peek Definition..........................................................................................................................................28
Figure 16. Code Completion......................................................................................................................................29
Figure 17. Resource Management.................................................................................Error! Bookmark not defined.
Figure 18. Debugging Process....................................................................................................................................33
I. PROGRAMMING INTRODUCTION

1. Procedural Programming
a) Definition of Procedural Programming

Procedural programming is a programming paradigm that uses a linear or top-down


approach. It relies on procedures or subroutines to perform computations.

It is a step by step programming approach to perform some logic. It is a set of instruction


which tell the OS to perform the logic. Procedural programming is based on routines or
subroutines. It contains the steps or we can say series of logic to be carried out. It is also known
as top-down language. Also, it is known as Linear Programming.

Figure 1. Procedural Programming Model

b) Characteristic of Procedural Programming


- Predefined functions: A predefined function is typically an instruction identified by
a name. Usually, the predefined functions are built into higher-level programming
languages, but they are derived from the library or the registry, rather than the
program. One example of a pre-defined function is ‘charAt()’, which searches for a
character position in a string.
- Local Variable: A local variable is a variable that is declared in the main structure of a
method and is limited to the local scope it is given. The local variable can only be used
in the method it is defined in, and if it were to be used outside the defined method, the
code will cease to work.
- Global Variable: A global variable is a variable which is declared outside every other
function defined in the code. Due to this, global variables can be used in all functions,
unlike a local variable.
- Modularity: Modularity is when two dissimilar systems have two different tasks at
hand but are grouped together to conclude a larger task first. Every group of systems
then would have its own tasks finished one after the other until all tasks are complete.
- Parameter Passing: Parameter Passing is a mechanism used to pass parameters to
functions, subroutines or procedures. Parameter Passing can be done through ‘pass
by value’, ‘pass by reference’, ‘pass by result’, ‘pass by value-result’ and ‘pass by the
name’.
- For example: There is a basic example of C# procedural programing to sum up two numbers.

-
2. Object-Oriented Programming
a) Definition of OOP

OOPs are based on object, means everything is talked about in terms of object. An object
is a component of a program that performs actions and interacts with other elements of the
program. Object oriented programming uses reusability of code. We can take an example of
object like employee. Employee has some properties like name, salary, address etc. An Employee
can have different objects. Object Oriented Programming uses an object to design applications
and programs.

Figure 2. OOP Model

b) Characteristic of OOP
- Encapsulation – Encapsulation is capturing data and keeping it safely and securely from
outside interfaces.
- Inheritance- This is the process by which a class can be derived from a base class with all
features of base class and some of its own. This increases code reusability.
- Polymorphism- This is the ability to exist in various forms. For example an operator can
be overloaded so as to add two integer numbers and two floats.
- Abstraction- The ability to represent data at a very conceptual level without any details.
- For example:
-

-
-

3. Event-driven Program
a) Definition od Event-driven Program
Event-driven programming is a programming model in which all business logic is performed
in the source code of a program. The program's runtime thread will be determined based on
events. Events here could be:
- Click the button on the screen
- Press the key on the keyboard
- Mouse over
- Timeout
- Receives the output signal of the sensor
- Receive messages from other program or threads

Figure 3. Event-driven Model

b) Characteristic of Event-driven Program


- Service orientated: Service oriented is a programming paradigm that is used to
write programs that are made for services: Service oriented is a programming
paradigm that is used to write programs that are made for services.
- Time driven:  it is code that runs on a time trigger, this could be a piece of code that
runs at a specific time, which could be once a week or whenever a program is
launched, this means it is a pre-set task.
- Event handlers: is a function or method that takes place when a certain event
happens, they are executed in response to a certain event that takes place.
- Trigger functions:  is ran when a specific event occurs, they are used to choose when
event handlers are ran for the event that occurs
- Events(Mouse, keyboard and user interface): For the events within a program to
happen, they need to be triggered, this is when the user interacts with an object,
which may be a button getting clicked by a mouse, events can be triggered in mays
different ways, it can be with your mouse, due to movement
- Pre-defined functions.
- Local variables: is a variable that is declared within a method, that variable will only
be used by the method where it is mentioned, other methods will not use it. 
- Parameter passing: is used by a function, it allows a value to be passed through a
program, it can be used for many things, including an alarm or finding a certain
character at a certain position

4. Summary
a) Comparison between Procedural Programing and OOP

The following are the features that will show some differences between Procedural Programming
and Object-Oriented Programming:

- Programming Style: Procedural programming is linear programming but OOPs is not.


- Fundamental Unit: Object is the fundamental unit of OOPs, but function or method is the
fundamental unit of procedural programming.
- Code Organization: In OOPs, we do the encapsulation of code in the form of object, but in
procedural programming code is organized into small procedures.
- Reusability: Reusability is the main feature of OOPs. OOPs reuse the code higher than
procedural programming.
- Abstraction: Hide the private data to outer logic main concern in programming logic. So,
Abstraction of OOPs is higher than procedural programming.
- Inheritance: In OOPs, we can inherit the existing functionality from parent, but Procedural
programming does not support inheritance.
- Encapsulation & Polymorphism: Encapsulation and polymorphism is also not supported
by Procedural programming.
Figure 4. Procedural and Object-Oriented Programing

b) The relationship between Procedural Programming and Event-Driven


Programming

Procedure- programming, which you can think of as traditional programming, defines the
programming process as the development of procedures that explicitly direct the flow of data and
control.
Event-driven programming defines the programming process as the development of
procedures that respond to the flow of data and control as directed by the user, program, or
operating system.
These programming models differ in flow of execution and structure. In addition, each model
works best with a particular programming environment.

c) The relationship between OOP and Event-Driven Programming

Object-oriented programming focuses on performing actions and manipulation of data that is


encapsulated in objects within a sequential series of steps while event-driven is more dynamic and
relies on event triggering and event handling to determine the sequencing of the program. Event-
driven programs can have threads that perform actions based upon triggers/events in your
program.
II. EVALUATE THE PROBLEM

1. Introduction
According to the requirements of the local high school, this report has been made to do the
following section:

• Implement and analyze the Student management application’s coding process

• Evaluate the importance of the Integrated Development Environments (such as Microsoft


Visual Studio 2019) in the application’s development

• Evaluate the application’s debugging process

• Evaluate the importance of Coding standards in the application’s development

2. Context
In order to find a better solution for managering all the student information, this application are
decided to design an application can help them easier in term of manager books, which include
these function:

Student Name
Student ID
Math Score
English Score
Chemistry Score

3. User Requirements
The teacher manager required this application must have at least these function:

Add
Delete
Update
III. DESIGN THE SOLUTION

1. Flowchart
2. Write Pseudo-Code
Program: Student Manager
Input Student’s name, Student ID, grades

Do-while: (do the action that user select)

o Add more student


o Delete student’s information
o Edit student’s information
o Exit

End.

3. Development
This application has been created by utilizing C# Programming Language, coded,
repaired and prepared on Microsoft Visual Studio 2019, one of the most well-known and
effective IDE nowadays.

In order to complete this application, software’s necessities have been divided into littler
issues so that will make the calculation of each issue become easier to solve. This application
has been made by utilizing both Event-Driven Programming paradigm and Procedural
Programming paradigm.

4. User Interface
This application will provide a friendly and easy-to-use user’s interface so that
doctors and/or nurses can easily manage their student’s information. For instance,
the application will have this following user’s interfaces:
Figure 5. User Interface

In figure 5: The main interface of the application will provide the method to control
student’s information such as add, delete and edit. Additionally, the application provides to manager
a grid box, which perform all student data.

5. Source Code
Things to explain have been commented in the code itself, below is the entire source used to
form this application:
6. Implement
When the manager opens the application and presses the Add button to enter student
information, there are the operations that the user will perform:
If the user wants to edit the information entered, user will press the Edit button and do the
following:
If the user wants to delete the student data entered, user will press the Delete button and do
the following.
IV. INTEGRATED DEVELOPMENT ENVIRONMENT (IDE)

1. Introduction
According to Microsoft [CITATION Mic19 \n \l 1033 ], The Visual Studio integrated
development environment is a creative launching pad that you can use to edit, debug, and
build code, and then publish an app. An integrated development environment (IDE) is a
feature-rich program that can be used for many aspects of software development. Over and
above the standard editor and debugger that most IDEs provide, Visual Studio includes
compilers, code completion tools, graphical designers, and many more features to ease the
software development process.

Figure 6. IDE Work Interface

Figure 6, shows Visual Studio with an open project and several key tool windows
you'll likely use:

Solution Explorer (top right) lets you view, navigate, and manage your code
files. Solution Explorer can help organize your code by grouping the files
into solutions and projects.
The editor window (center), where you'll likely spend a majority of your time,
displays file contents. This is where you can edit code or design a user interface such
as a window with buttons and text boxes.

Team Explorer (bottom right) lets you track work items and share code with
others using version control technologies such as Git and Team Foundation Version
Control (TFVC).

After opening the software, the basic function that a coder will need to do:

- Open a project/ solution


- Create a new one

2. Common features of IDE


Some of the popular features in Visual Studio that help you to be more productive as you
develop software include:

 Squiggles and Quick Actions


Squiggles are wavy underlines that alert you to errors or potential problems in your
code as you type. These visual clues enable you to fix problems immediately without waiting
for the error to be discovered during build or when you run the program. If you hover over a
squiggle, you see additional information about the error. A light bulb may also appear in the
left margin with actions, known as Quick Actions, to fix the error.

Figure 7. Squiggles and Quick Actions in IDE

 Code Cleanup
With the click of a button, format your code and apply any code fixes suggested by
your code style settings, .editorconfig conventions, and Roslyn analyzers. Code Cleanup helps
you resolve issues in your code before it goes to code review. (Currently available for C#
code only.)

Figure 8. Code Cleanup

 Refactoring
Refactoring includes operations such as intelligent renaming of variables, extracting
one or more lines of code into a new method, changing the order of method parameters, and
more.

Figure 9. Refactoring

 IntelliSense
IntelliSense is a term for a set of features that displays information about your code
directly in the editor and, in some cases, write small bits of code for you. It's like having basic
documentation inline in the editor, which saves you from having to look up type information
elsewhere. IntelliSense features vary by language. For more information, see C#
IntelliSense, Visual C++ IntelliSense, JavaScript IntelliSense, and Visual Basic IntelliSense. The
following illustration shows how IntelliSense displays a member list for a type:

Figure 10. IntelliSense

 Search box
Visual Studio can seem overwhelming at times with so many menus, options,
and properties. The search box is a great way to rapidly find what you need in Visual
Studio. When you start typing the name of something you're looking for, Visual Studio
lists results that take you exactly where you need to go. If you need to add
functionality to Visual Studio, for example to add support for an additional
programming language, the search box provides results that open Visual Studio
Installer to install a workload or individual component.

Figure 11. Search Box


 CodeLens
CodeLens helps you find references to your code, changes to your code, linked bugs, work
items, code reviews, and unit tests, all without leaving the editor.

Figure 12. CodeLens

 Go To Definition
The Go To Definition feature takes you directly to the location where a function or type is
defined.

Figure 13. Go To Definition

 Peek Definition
The Peek Definition window shows the definition of a method or type without actually
opening a separate file.
Figure 14. Peek Definition

3. Summary
 Advantages of using IDE
IDEs are simply programs to write programs. They are generally editing
environments with tools to help programmers write code quickly and efficiently. As an
example, we can create PHP-driven web applications using a combination of Eclipse and PHP.
Core features typically include:

- Code completion or code insight


- Resource management
- Compile and build
- Debugging tools

There are also a lot of other advantages that IDE would bring to developers such as:
communicate with database systems, multiple project configurations, bookmarking code
segments, etc.

 Code completion or code insight

The ability of an IDE to know a language’s keywords and function names is crucial.
The IDE may use this knowledge to do such things as highlight typographic errors, suggest a
list of available functions based on the appropriate situation, or offer a function’s definition
from the official documentation.
Figure 15. Code Completion

 Solution Explorer

Visual Studio provides a Solution Explorer window that enables you to explore and
manage your solutions and projects. To open the window select View > Solution Explorer.

Solution Explorer displays the projects that form your solution, the files and folders in
a project as they appear on the physical hard drive, and any assemblies, COM objects or files
the project references. The context menus within Solution Explorer provide a variety of
commands that help you manage your projects.

Default view:
Searching in Solution Explorer:

You can use the search field in Solution Explorer to search for files in your solution.
Searching also finds copybooks in the copybook dependency view even if they are not part of
any of the projects in the solution:
 Compile and build
When compiling, Visual Studio not only execute the code on the debugging mode, but
also displaying the application’s diagnostics, where indicate the process memory, how CPU
process, etc. to help developers consider the efficiency of the code when it’s running and then
make changes if something went wrong

 Debugging tools

 Disadvantages of using IDE


Besides of various helpful functions that IDE provides, it also having some of following
disadvantages:
- IDEs are complicated tools. Maximizing their benefit will require time and patience.
- If you throw the learning curve of an IDE on top of learning how to program, it can be
quite frustrating. Further, features and shortcuts for experienced programmers often
hide crucial but mundane details of a language. Details should not be overlooked
when learning a new language. Using an IDE may hamper the learning of a new
language.
-  Will not fix bad code, practices, or design: You still need to be proficient and
meticulous. An IDE will not eliminate efficiency or performance problems in your
application. IDEs are like paintbrushes. Whether you create a Van Gogh or a Velvet
Elvis is dictated by your skill and decisions.

4. Application development with and without using IDE


V. DEBUGGING PROCESS

1. What is Debugging

Figure 16. Debugging Process

Some examples of common coding errors include the following:

 Syntax error

 Runtime error

 Semantic error

 Logic error

 Disregarding adopted conventions in the coding standard

 Calling the wrong function


 Using the wrong variable name in the wrong place

 Failing to initialize a variable when absolutely required

 Skipping a check for an error return

2. How importance of Debugging is?


Debugging is an important part of determining why an operating system, application or
program is misbehaving.

Even if developers use the same coding standard, it's more than likely that a new software
program will still have bugs. In many cases, the process of debugging a new software program
can take more time than it took to write the program. Invariably, the bugs in software
components that get the most use are found and fixed first.  

In order to reduce the complexity of Debugging process, Debugger, which is one of IDEs
most basic functions, will help developers to indicate where the bugs occur, types of the
bugs and suggest for solution by using Breakpoints or Step-by-step code executing.

3. Debugging Facilities Available in the IDE.


 Code highlighting`

When an IDE detects a syntax error, it will often help you by highlighting the section of code
where it has detected the error.

It’s useful to remember that the IDE may not always highlight the actual error. In this
example, the variable name has been highlighted, but the error is actually the extra key word
before it (that isn’t used in Python).
Tip: if you see code highlighted, check the previous line of code for an error.

 Breakpoints
Breakpoint in an IDE is a useful tool that allows you to pause a program at a specific line of
code to check the value of variables.
Usually, a breakpoint can be inserted into the code editor by clicking on the line number on
the left. They are generally identified as red circles over the line number.

 Steppers
Steppers are similar to breakpoints as they will pause the running of the code at a specific
line, but they also allow you to keep running the code line by line by pressing a specific key on
the keyboard.
This allows you as a programmer to check the value of variables at each step of the code
(very similar to creating a trace table for a variable).

 Watch
The Watch Window allows you to see value of variables and expressions while debugging.
It’s kind of like the DataTip you get when hovering over a variable, except that you can write any
expression you want. It’s available from Debug | Windows | Watch | Watch 1.

VI. CODING STANDARD


This application is developed by C# Programing Language and written on an IDM (Visual
Studio 2019).
Coding standard is a set of rules defined to convention a code process in a project.
Usually built after the system requirements analysis process, based on the functional
groups of a system.
The Project manager will build a Coding Conventions framework for the whole project
as well as the team leader can build each set of Coding Conventions for his team based on the
original framework.
According to [ CITATION Mic15 \l 1033 ], C# Coding standard serve the following
purposes:
o They create a consistent look to the code, so that readers can focus on content,
not layout.
o They enable readers to understand the code more quickly by making
assumptions based on previous experience.
o They facilitate copying, changing, and maintaining the code.
o They demonstrate C# best practices.
a) Benefits of Coding standard
- A coding standard gives a uniform appearance to the codes written by different engineers.
- It improves readability, and maintainability of the code and it reduces complexity also.
- It helps in code reuse and helps to detect error easily.
- It promotes sound programming practices and increases efficiency of the programmers.
b) Some of Coding Standard
 Naming convention:

 Commenting Conventions
o Place the comment on a separate line, not at the end of a line of code.
o Begin comment text with an uppercase letter.
o End comment text with a period.
o Insert one space between the comment delimiter (//) and the comment text, as
shown in the following example.

 Indentation

Proper indentation is very important to increase the readability of the code. For
making the code readable, programmers should use White spaces properly.

c) Why a Coding Standard is necessary


VII. Deploy Package for client
Name: Student Manager
Description: Manager Student Application
Layer: 4 Layer: Form1, Resource, Program, Settings
Language: Write by C# written on Visual Studio 2019
This package contains source files: Asm_2
Bibliography
Microsoft. (2015, 7 20). Retrieved from https://docs.microsoft.com/en-us/dotnet/csharp/programming-
guide/inside-a-program/coding-conventions

Microsoft. (2019, 3 19). Retrieved from https://docs.microsoft.com/en-us/visualstudio/get-started/visual-studio-


ide?view=vs-2019

You might also like