1618 IT Fundamental & Procedural Programming
1618 IT Fundamental & Procedural Programming
ID: GCS210101
Class: GCS1003A
Date: 05/03/2022
1
ASSIGNMENT 2 FRONT SHEET
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
1
❒ Summative Feedback: ❒ Resubmission Feedback:
1
Assignment Brief 2 (RQF)
Higher National Certificate/Diploma in Computing
Submission Format:
Format:
● The submission is in the form of an individual written report. This should be written in a concise,
formal business style using single spacing and font size 12. You are required to make use of
headings, paragraphs and subsections as appropriate, and all work must be supported with research
and referenced using the Harvard referencing system. Please also provide a bibliography using the
Harvard referencing system.
Submission
● Students are compulsory to submit the assignment in due date and in a way requested by the
Tutor.
● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/.
● Remember to convert the word file into PDF file before the submission on CMS.
Note:
● The individual Assignment must be your own work, and not copied by or from another student.
● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style.
● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply
this requirement will result in a failed assignment.
2
LO2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct
an analysis of a suitable Integrated Development Environment (IDE)
Assignment scenario
Scenario: You have applied for a post as a trainee with a software development company and have been
invited for an interview. You have been passed the presentation to demonstrate your problem solving and
basic programming skills. Now you are given a more challenge task to create a fully working, secure
application that has been developed using an IDE and adheres to coding standards for a detailed business
problem.
Tasks
You will discuss a suitable problem with your mentor and list the user requirements before designing,
implementing (coding) and testing a solution. You will create a report that should include:
● Introduction to your program (list of requirements and screenshots of program)
● Explain some of programming paradigms. Evaluate why and how your program use these (or some
of) paradigms.
● Explain the common features of an IDE should have and evidence of how the IDE was used to manage
the development of your code.
● An evaluation of developing applications using an IDE versus developing an application without using
an IDE.
● An explanation and evaluation of the debugging process in the IDE used and how it helped with
development.
● An explanation and evaluation of coding standards used in your program and the benefits to
organisations of using them.
The working application produced must also be demonstrated together with the presentation.
Case Studies
You can choose one of following case studies to implement
3
Library Management System
A Library Management System is a software built to handle the primary housekeeping functions of a
library. Libraries rely on library management systems to manage asset collections as well as relationships
with their members. Library management systems help libraries keep track of the books and their
checkouts, as well as members’ subscriptions and profiles.
Library management systems also involve maintaining the database for entering new books and recording
books that have been borrowed with their respective due dates.
1. Any library member should be able to search books by their title, author, subject category as well by
the publication date.
2. The system should be able to retrieve information like who took a particular book or what are the
books checked-out by a specific library member.
3. User can add books with its information such as: title, author, publication date, category etc and
update it
This system involves the scheduling of flights, air ticket reservations, flight cancellations, customer
support, and staff management. Daily flights updates can also be retrieved by using the system.
1. Customers should be able to search for flights for a given date and source/destination airport.
2. Customers should be able to reserve a ticket for any scheduled flight. Customers can also build a
multi-flight itinerary.
3. Users of the system can check flight schedules, their departure time, available seats, arrival time, and
other flight details.
4. The admin of the system can add new aircrafts, flights, and flight schedules. Admin can cancel any
pre-scheduled flight (all stakeholders will be notified).
4
4. The system should support the reservation of tables.
5
Learning Outcomes and Assessment Criteria (Assignment 2):
Learning Outcome Pass Merit Distinction
LO2 P2 Give explanations M2 Analyse the D2 Critically evaluate
of what procedural, common features that the source code of an
object-oriented and a developer has access application which
event-driven to in an IDE. implements the
paradigms are; their programming
characteristics and the paradigms, in terms of
relationship between the code structure and
them. characteristics.
LO3 P3 Write a program M3 Use the IDE to D3 Evaluate the use of
that implements an manage the an IDE for
algorithm using an development process development of
IDE. of the program. applications
contrasted with not
using an IDE.
6
TASK 1: GIVE EXPLANATIONS OF WHAT PROCEDURAL, OBJECT-ORIENTED AND EVENT-
DRIVEN PARADIGMS ARE; THEIR CHARACTERISTICS AND THE RELATIONSHIP
BETWEEN THEM [P2] .................................................................................................................................. 7
1. PROCEDURAL PROGRAMMING ........................................................................................................... 7
2. EVENT-DRIVEN PARADIGMS................................................................................................................ 7
2.1. Definitely .......................................................................................................................... 7
2.2. Example............................................................................................................................ 8
3. OBJECT-ORIENTED PROGRAMMING ................................................................................................. 9
3.1. Explain ............................................................................................................................. 9
3.2. Example.......................................................................................................................... 10
4. WHERE DO YOU USE THE MODEL TO SOLVE YOUR PROBLEM? WHY?....................................10
TASK 2: WRITE A PROGRAM THAT IMPLEMENTS AN ALGORITHM USING AN IDE [P3]……………..11
1. IMPLEMENT BASIC ALGORITHMS IN CODE USING AN IDE AND USING IDE 4 IN DEVELOPMENT
..................................................................................................................................................................... 11
2. BASIC FEATURES OF POPULAR IDES ............................................................................................... 12
TASK 3: EXPLAIN THE DEBUGGING PROCESS AND EXPLAIN THE DEBUGGING FACILITIES
AVAILABLE IN THE IDE [P4]…………………………………………………………………………… 13
1. THE DEBUGGING PROCESS................................................................................................................. 13
2. THE DEBUGGING FACILITIES AVAILABLE IN THE IDE .............................................................. 13
3. USE BREAKPOINT TO DEBUG ............................................................................................................. 14
TASK 4: OUTLINE THE CODING STANDARD YOU HAVE USED IN YOUR CODE [P5] ............. 16
1. CODING CONVENTIONS CONCEPT .................................................................................................... 16
2. CODING CONVENTIONS IN C # .................................................................................................................. 17
2.1. Naming rules .................................................................................................................. 17
2.2. Prefix number of a control ............................................................................................. 19
2.3. Code distribution rules ................................................................................................... 20
2.4. Command-line convention.............................................................................................. 21
2.5. Source code block .......................................................................................................... 22
2.6. Indented and spaced ....................................................................................................... 22
2.7. Note ................................................................................................................................ 23
2.9. Language used ............................................................................................................... 23
REFERENCES .............................................................................................................................................. 25
7
TASK 1: Give explanations of what procedural, object-oriented
and event-driven paradigms are; their characteristics and the
relationship between them. [P2]
1. Procedural programming
Is a method for putting the aforementioned function-oriented strategy into action. A large
program (function) is broken down into small blocks of functions or procedures that can be
easily developed and tested using the procedural approach. Each function has its own set of
data and logic, as well as a start and finish point. In a programming system, variables have
observable ranges. The software's functions are self-contained. Data is sent back and forth via
function call parameters. The split of the program into roles allows a large number of people
to participate in the development process. Each person develops one or more functions
independently. A new concept called as abstraction arises as a result of this method. The
capacity to see a situation without being concerned with its fundamental parts is characterized
as abstraction. In a procedural program, all we need to know is what a function can do for
given duties. It makes no difference how you do the task; as long as the function is reliable,
you may use it without understanding how it works. Functional abstraction is the cornerstone
of procedural programming (or specialization).
2. Event-driven paradigms
2.1 Definitely:
➔ The user's activities, such as pressing a key, clicking, or moving the mouse, are called events. Applications must
respond to these events as they occur. Take, for example, interruptions. Events act as a source of communication
inside the process.
+ Delegates from the same or another class are used to relate events to the Event Handler. The class
that houses the Event is used to declare the event. It's referred to as the Publisher class. Another class
that accepts this event is the Subscriber class. In C # Events, the Publisher-Subscriber model is
employed.
+ A Publisher in C# is an object that stores event and delegate declarations. The event-delegate
connection is also defined by this object. A Publisher class object triggers the Event, which
subsequently notifies other objects.
+ An event subscriber is a C# object that receives events and responds with an Event Handler. The
Delegate of the Publisher class summons the Subscriber class's Event Handler.
8
2.2 Example:
9
3. Object-oriented programming
3.1. Explain
+ A table, a ball, or a cow are examples of objects in the real world. Object-oriented
programming (OOP) is a programming approach that creates programs using classes and
objects. statue. It introduces numerous principles that make software creation and
maintenance easier.
+ An object is a thing that has a state and behaves in a certain way. For example, a bicycle, a
table, a chair, and so forth. It might be of a physical or mental character.
+ Inheritance: When an object inherits the qualities and actions of its parent object, this is
called inheritance. This improves the reusability of the code. It's used to generate
polymorphism at runtime.
10
3.2. Example
11
TASK 2: Write a program that implements an algorithm using an IDE. [P3]
11
2. Basic features of popular IDEs
➔ Text editor:
• Almost every IDE will feature a text editor for writing and altering source code. Some tools, such as Turbo
Pascal and Notepad ++, include intuitive drag-and-drop UI components, whereas the bulk have a simple
interface with language-specific syntax highlighting.
➔ Debugger:
• Debugging software assists in the discovery and fixing of source code defects. They regularly simulate
real-world settings to test functionality and performance. Programmers and software engineers may test
different code components and uncover flaws before an application is launched.
➔ The compiler:
• Compilers are software components that translate programming languages into machine-readable
formats such as binary code. The machine code is tested for accuracy. The compiler then parses and
optimizes the code for better speed.
➔ Code completion:
• The extensive characteristics of the code assist programmers by intelligently locating and inserting
common code components. These capabilities assist developers in cutting down on coding time and
lowering the possibility of syntax errors.
➔ Programming language support:
• Most integrated development environments (IDEs) are dedicated to a single programming language,
however others, such as Sublime Text, support many languages. As a result, the first step is to figure out
what language you're working with before selecting an IDE.
➔ Support many Plugin:
• Given the integrated development environment, it's expected that when selecting an IDE, integration
must be considered. Because your IDE serves as a development portal, being able to combine all of your
other development tools can help you create faster and more efficiently.
12
TASK 3: Explain the debugging process and explain the debugging facilities available
in the IDE. [P4]
1. The debugging process
➔ Debugging is the process of identifying the source of a mistake or the cause of an error (i.e., where the
problem is) so that it may be fixed. For unskilled programmers, controlling errors over several lines of code
is tough.
➔ It is not uncommon for a programmer to make a mistake that affects hundreds of lines of code. The
programmer may not have completed the program correctly, or it may have been run at the incorrect function,
resulting in a poor grade. As a result, when a problem arises, the programmer must troubleshoot the issue in
order for the program (software) to continue to run properly.
2. The debugging facilities available in the IDE.
• Some tools on the IDE that you need to know in advance to facilitate debugging:
+ To load the code into the flash memory, click LOAD .
+ To begin the procedure, click debug , then click again to leave debug mode. Set a breakpoint in the
window disassembly or window source with the breakpoint button .
+ The STM32 allows up to 6 break points during hardware debugging. When the program grinds to a
standstill at a breakpoint, the matching statement is not executed.
+ On the disassembly window and the source window, you can see which statement is being performed.
+ Run: execute from the current (or beginning) place until the stop button is pressed, or the program will
pause at the breakpoint location.
+ Step In: Execute a statement and enter a function if the current line calls that function.
+ Step Over: If the current step invokes that function, perform that command and any commands within it.
+ Step Out: Run the program until the current function returns.
13
3. Use breakpoint to debug
Breakpoints are points (positions) in a program that the programmer selects as the
point at which the executing program will come to a halt. Breakpoints are utilized in
debug mode. Breakpoint is a great tool for troubleshooting and developing programs.
• Breakpoints are used to test whether or not your program can execute the instruction at the breakpoint.
The breakpoint instruction will never be invoked if your software continues to execute. So your program
isn't working properly.
• Use breakpoints to monitor, inspect, and change the values of variables, memory, peripheral suspects,
CPU registers, and peripheral registers as soon as the statement is terminated to test if the program is
working properly. Consider the predicted values or the program's immediate impact instead.
• Use a breakpoint to halt the application while the user interacts with the peripheral, allowing you to see
if the program flow is correct after impact.
➢ Step 1:
14
➢ Step 2:
-Before entering the while function to keep track of variables, we utilize step out to skip the configuration
routines.
15
➢ Step 3:
- With Step, execute each statement to see how the variables change (F11).
- Notice the difference after each statement has been executed.
TASK 4: Outline the coding standard you have used in your code [P5]
-Coding conventions are a collection of rules that dictate how a project's code is written.
Typically constructed during the system requirements analysis process and based on a
system's functional groupings.
-The project manager will create a Coding Conventions framework for the entire project, and
the team leader can use that framework to create individual Coding Conventions for his team.
-Coding standards make it easier for project participants to comprehend and understand one
other's code.
-Other developers will find it more handy when they learn about previous projects to work
on.
-To unify the system or project, create a set of rules.
16
2. Coding Conventions in C #.
2.1. Naming rules
17
- Avoid using extra prefixes or suffixes that aren't necessary:
Shouldn’t Should
enum BorderEnum { ... } enum Boder { ... }
class CHuman { ... } class Human { ... }
Shouldn’t Should
Animal.WeightAnimal Animal.Weight
- If they return true or false, the variable name, the bool method, must be relevant. Before
the variable name, use the prefix "Is" "Can" "Has," method:
Shouldn’t Should
bool CheckAdmin(int n) { } bool IsAdmin(int n) {
}
bool Expired() { } bool IsExpired() { }
bool checked = true;; bool isChecked = true;
- Do not use the same names (case sensitive only) It is difficult to identify identifiers
especially when in the same context and only distinguish the identifier by uppercase /
lowercase.
- Do not create 2 namespaces of the same name and differ only in case of letters (upper /
lower case), for example:
- Do not create a method with arguments that have the same name but distinct fonts,
such as:
- Do not create a type with the same property names and just differentiate it by letters, such
as:
- Do not use the same name for methods that just differ in type, such as:
18
2.2. Prefix number of a control
- All controls participating in background processing must be given a name. Some controls
are prefixed with the following prefix in Pascal style:
19
2.3. Code distribution rules
➔ Each source file only contains one class. The main class must have the same name as the source
file. For example, the Student Class may be found in the Student.cs file.
➔ To define a basic independent struct outside the class for enum types, use a separate source file or the source
file of another class.
➔ A separate source file must be used to specify the interface.
➔ Declarations are made in the following order:
- Declare namespace
20
2.4. Command-line convention
- Should not:
- Should:
- Should:
21
2.5. Source code block
+ Use the brace to draw attention to a piece of source code. Each parenthesis takes up
one line (Exceptions, enum types, neat attributes, or initialization values for arrays may
not be needed).
+ If an if, for, foreach, and so on statement just contains one statement, it may not be
essential to highlight the code block:
- Should not:
- Should:
22
2.7. Note
Should make unclear code or special functions comments. The annotation language must be
consistent across the application. There are two languages to choose from: Vietnamese
Unicode accented or English.
- Regulation caption:
+ To remark, simply use / and /. Use / * * / instead.
+Each source code file has a caption at the top that describes the program, its function,
the creator, and so on.
+ Data processing block: Each class, method, and attribute of the class has comments
that define functions, arguments, and so on.
+ Interface handler: On each non-event method, the Main function, there are comments
detailing the function.
- Types of annotations:
+ Simple notes for:
+ Complex code
+ Describe in the function body
+ Description field
+ The code is modified by non-author
➔ Instead of using the.NET data type, always use the C # data type
- Should not:
23
- Should:
24
REFERENCES
[1] Wikipedia Contributors (2019). Integrated development environment. [online]
Wikipedia. Available at:
https://en.wikipedia.org/wiki/Integrated_development_environment.
[2] What is algorithm? - Definition from WhatIs.com (2019). What is algorithm? -
Definition from WhatIs.com. [online] WhatIs.com. Available at:
https://whatis.techtarget.com/definition/algorithm.
[3] Merriam-webster.com. (2019). Definition of ALGORITHM. [online] Available at:
https://www.merriam-webster.com/dictionary/algorithm
[4] www.edrawsoft.com. (n.d.). What is Algorithm - Definition, Types and Application.
[online] Available at: https://www.edrawsoft.com/algorithm-definition.html.
[5] Codecademy News. (2018). What is Computer Programming? [online] Available at:
https://news.codecademy.com/what- is-
computerprogramming/#:~:text=Computer%20programming%20is%20a%20way.
[6] What is Procedural Programming? Key Features of Procedural Programming (2019).
What is Procedural Programming? Key Features of Procedural Programming. [online]
Hackr.io. Available at: https://hackr.io/blog/procedural-programming.
[7] BBC Bitesize. (2019). What is an algorithm? [online] Available at:
https://www.bbc.co.uk/bitesize/topics/z3tbwmn/articles/z3whpv4.
[8] www.programiz.com. (n.d.). What is an Algorithm? [online] Available at:
https://www.programiz.com/dsa/algorithm
[9] Codecademy News. (2018). What is Computer Programming? [online] Available at:
https://news.codecademy.com/what-is-
computerprogramming/#:~:text=Computer%20programming%20is%20a%20way
[Accessed 9 Oct. 2020].
25
26