You are on page 1of 39

Higher Nationals in Computing

Unit 1: Programming
ASSIGNMENT 2

Learner’s name: Nguyen Phu Quang


ID: GCS200396
Class: GCS0905A
Subject code: 1618
Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:


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 Nguyen Phu Quang Student ID GCS 200396

Class GSC0905A Assessor name Phan Minh Tam

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:

Signature & Date:


Assignment Brief 2 (RQF)
Higher National Certificate/Diploma in Computing

Student Name/ID Number:


Unit Number and Title: Unit 1: Programming
Academic Year: 2021 – 2022
Unit Assessor: Phan Minh Tam
Assignment Title: Application development with IDE
Issue Date: 27 September 2021
Submission Date:
Internal Verifier Name:
Date:

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.

Unit Learning Outcomes:

LO2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct an
analysis of a suitable Integrated Development Environment (IDE)

LO3 Implement basic algorithms in code using an IDE


LO4 Determine the debugging process and explain the importance of a coding standard

Assignment Brief and Guidance:

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

Hotel Management System:


A Hotel Management System is a software built to handle all online hotel activities easily and safely. This
System will give the hotel management power and flexibility to manage the entire system from a single
online portal. The system allows the manager to keep track of all the available rooms in the system as well
as to book rooms and generate bills.
1. The system should support the booking of different room types like standard, deluxe, family suite, etc.
2. Guests should be able to search the room inventory and book any available room.
3. The system should be able to retrieve information, such as who booked a particular room, or what rooms
were booked by a specific customer.

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

Movie Ticket Booking System


An online movie ticket booking system facilitates the purchasing of movie tickets to its customers. E-
ticketing systems allow customers to browse through movies currently playing and book seats, anywhere
and anytime.
1. Each cinema can have multiple halls and each hall can run one movie show at a time.
2. Each Movie will have multiple shows.
3. Customers should be able to search movies by their title, language, genre, release date, and city name.
4. The customer should be able to select a show at a particular cinema and book their tickets.

Airline Management System


An Airline Management System is a managerial software which targets to control all operations of an airline.
Airlines provide transport services for their passengers. They carry or hire aircraft for this purpose. All
operations of an airline company are controlled by their airline management system.
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).

Restaurant Management System


A Restaurant Management System is a software built to handle all restaurant activities in an easy and safe
manner. This System will give the Restaurant management power and flexibility to manage the entire
system from a single portal. The system allows the manager to keep track of available tables in the system
as well as the reservation of tables and bill generation.
1. The waiter should be able to create an order for a table and add meals for each seat.
2. Each meal can have multiple meal items. Each meal item corresponds to a menu item.
3. The system should be able to retrieve information about tables currently available to seat walk-in
customers.
4. The system should support the reservation of tables.

Learning Outcomes and Assessment Criteria

Pass Merit Distinction

LO2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct
an analysis of a suitable Integrated Development Environment (IDE)

P2 Give explanations of what M2 Analyse the common features D2 Critically evaluate the source
procedural, object-oriented and that a developer has access to in code of an application which
event-driven paradigms are; an IDE. implements the programming
their characteristics and the paradigms, in terms of the code
relationship between them. structure and characteristics.

LO3 Implement basic algorithms in code using an IDE

P3 Write a program that M3 Use the IDE to manage the D3 Evaluate the use of an IDE
implements an algorithm using development process of the for development of applications
an IDE. program. contrasted with not using an
IDE.
LO4 Determine the debugging process and explain the importance of a coding standard

P4 Explain the debugging M4 Evaluate how the debugging D4 Critically evaluate why a
process and explain the process can be used to help coding standard is necessary in
debugging facilities available in develop more secure, robust a team as well as for the
the IDE. applications. individual.

P5 Outline the coding standard


you have used in your code.
Table of Content

s
P2 Give explanations of what procedural, object-oriented and event-driven paradigms are; their
characteristcs and the relationship between them...............................................................................................1
1. Object-oriented programming:.......................................................................................................................1
1.1. Definition:................................................................................................................................................1
1.2. Characteristics:........................................................................................................................................1
2. Procedural programming:...............................................................................................................................6
2.1. Definition:................................................................................................................................................6
2.2. Characteristics:........................................................................................................................................7
3. Event-driven programming:............................................................................................................................8
3.1. Definition:................................................................................................................................................8
3.2. Characteristics:........................................................................................................................................8
4. The relationship between procedural, object and event driven paradigms:...................................................9
P3 Write a program that implements an algorithm using an IDE..........................................................................9
1. Use case:.........................................................................................................................................................9
2. Code:.............................................................................................................................................................10
3. Application Screenshots:...............................................................................................................................15
3.1. Add new:...............................................................................................................................................16
3.2. Remove:................................................................................................................................................16
3.3. Show:.....................................................................................................................................................16
3.4. Search:...................................................................................................................................................17
3.5. Update:..................................................................................................................................................17
P4 Explain the debugging process and explain the debugging facilities available in the IDE............................17
1. What is debug?..............................................................................................................................................17
2. The debugging processes..............................................................................................................................18
3. How to run debug in Visual Studio IDE..........................................................................................................19
3.1. Breakpoint:............................................................................................................................................19
3.2. Step Over:..............................................................................................................................................20
3.3. Simply Inspect Variables:.......................................................................................................................20
3.4. Step Into:...............................................................................................................................................21
3.5. Step Out:...............................................................................................................................................21
3.6. Run To Cursor:.......................................................................................................................................21
3.7. Inspect Variables:..................................................................................................................................21
3.8. Debug Tips:............................................................................................................................................22
P5 Outline the coding standard you have used in your code..............................................................................23
1. Coding standard and naming convension......................................................................................................23
1.1. Coding standard:...................................................................................................................................23
1.2. Purpose of Having Coding Standards:....................................................................................................23
1.3. Naming Convention:..............................................................................................................................23
2. Apply coding standard in my code................................................................................................................25
REFERENCES......................................................................................................................................................28
ASSIGNMENT 2 ANSWERS
P2 Give explanations of what procedural, object-oriented and event-
driven paradigms are; their characteristcs and the relationship between
them
1. Object-oriented programming:

1.1. Definition:
- Object-oriented programming (OOP) is a computer programming model that
organizes software design around data, or objects, rather than functions and logic. An
object can be defined as a data field that has unique attributes and behavior.
- OOP focuses on the objects that developers want to manipulate rather than the
logic required to manipulate them. This approach to programming is well-suited for
programs that are large, complex and actively updated or maintained. This includes
programs for manufacturing and design, as well as mobile applications; for example,
OOP can be used for manufacturing system simulation software.

1.2. Characteristics:
 Objects
-Objects are the basic run-time entities in an object-oriented system. They may
represent a person, a place, a bank account, a table of data or any item that the

Page |1
program must handle.The fundamental idea behind object oriented approach is to
combine both data and function into a single unit and these units are called objects.

-The term objects means a combination of data and program that represent
some real word entity.

-When a program executed, the object interact by sending messages to one


another. Each object contain data, and code to manipulate the data.

 Class

-A group of objects that share common properties for data part and some
program part are collectively called as class. In C ++ a class is a new data type that
contains member variables and member functions that operate on the variables.

-The entire set of data and code of an object can be made a user-defined data
type with the help of a class. Objects are variable of the type class. Once a class has
been defined, we can create any number of objects belonging to that class.

Page |2
 Encapsulation

-Wrapping of data and functions together as a single unit is known as encapsulation.


By default data is not accessible to outside world and they are only accessible through
the functions which are wrapped in a class. Prevention of data from direct access by the
program is called data hiding or information hiding.

 Data Abstraction

-Abstraction refers to the act of representing essential features without including


the back ground details or explanation. Classes use the concept of abstraction and
Page |3
are defined as a list of attributes such as size, weight, cost and functions to operate
on these attributes. They encapsulate all essential properties of the object that are
to be created. The attributes are called as data members as they hold data and the
functions which operate on these data are called as member functions.

-Class use the concept of data abstraction so they are called abstract data type
(ADT).

 Inheritance

Inheritance is the mechanism by which one class can inherit the properties of
another. It allows a hierarchy of classes to be build, moving from the most general to
the most specific. When one class is inherited by another, the class that is inherited
is called the base class. The inheriting class is called the derived class. In general, the
process of inheritance begins with the definition of a base class. The base class
defines all qualities that will be common to any derived class. . In OOPs, the concept
of inheritance provides the idea of reusability. In essence, the base class represent
the most general description of a set of traits. The deriv ed class inherits those general
traits and adds properties that are specific to that class.

Page |4
 Polymorphism

-Polymorphism comes from the Greek words “poly” and “morphism”. “poly” means
many and “morphism” means form i.e.. many forms. Polymorphism means the ability to
take more than one form. For example, an operation have different behavior in different
instances. The behavior depends upon the type of the data used in the operation.

-Different ways to achieving polymorphism in C++ program:

1) Function overloading

2) Operator overloading

-It is able to express the operation of addition by a single operater say ‘+’. When this
is possible you use the expression x + y to denote the sum of x and y, for many different
types of x and y; integers , float and complex no. You can even define the + operation for
two strings to mean the concatenation of the strings.

Page |5
2. Procedural programming:
2.1. Definition:
-Procedural Programming may be the first programming paradigm that a new
developer will learn. Fundamentally, the procedural code is the one that directly
instructs a device on how to finish a task in logical steps. This paradigm uses a
linear top-down approach and treats data and procedures as two different
entities. Based on the concept of a procedure call, Procedural Programming
divides the program into procedures, which are also known as routines or
functions, simply containing a series of steps to be carried out.
-Simply put, Procedural Programming involves writing down a list of instructions
to tell the computer what it should do step-by-step to finish the task at hand.

Page |6
2.2. Characteristics:

 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.

Page |7
 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’.

3. Event-driven programming:
3.1. Definition:

-Event-driven programming is a programming paradigm in which program


execution is determined by new user events (mouse clicks, keypresses), sensor
outputs, or message passing from other programs. Programmers use Event-
driven programming in graphical user interfaces and other applications that
focus on performing user actions in response to user input (user clicks).

-We can also define event-driven programming as a way of building a computer


program, in which, in the essential function of the program, the main event loop
of the application is explicitly highlighted in the code, the body of which consists
of two parts: fetching the event and event handling. In an event-driven
application, the main loop listens for events and triggers a callback function
when one of those events is detected.

3.2. Characteristics:

Central to event-driven programming is the stream of data or events. It is


intended for push (reactive) but can be used for pull as well. It is lazy rather than
eager and it is usually used asynchronously. And it can represent 0, 1, many, or
Page |8
infinite values or events over time. Let’s break this statement down to its basic
parts.

4. The relationship between procedural, object and event driven paradigms:


 Procedural programming means that you define a program and its subprograms
as a series of steps. In contrast, declarative programs try to describe the result
without regard to the steps taken to computer it but rather some description or
denotation of the desired result.
 Object oriented programming is a way of organizing code around the principles of
encapsulation, inheritance, substitution, programming to interfaces, and so on.
Object oriented programs are usually mostly procedural.
 Event based programming is about writing event handling procedures and having
the core event loop provided by the underlying system. In this way you can save
the trouble of writing your own event loop and benefit from various libraries that
already work with the system provided event loop. Event based programs are
very often writing using object oriented style, but not always.
 These three categories are thus not related strictly hierarchically, but in common
usage they are mostly nested within one another.
P3 Write a program that implements an algorithm using an IDE.
Hotel Management System
1. Use case:

Page |9
Exlanation:

Customers can make bookings and search for rooms.

Manager can manage customers and manage booking.

2. Code:

P a g e | 10
P a g e | 11
P a g e | 12
P a g e | 13
P a g e | 14
3. Application Screenshots:

P a g e | 15
3.1. Add new:

3.2. Remove:

3.3. Show:

P a g e | 16
3.4. Search:

3.5.Update:

P4 Explain the debugging process and explain the debugging facilities


available in the IDE.
1. What is debug?
 Debugging is the process of finding out the error or the cause of the error (where
the bug is) to have a direction to fix the error (fix the bug). Error control of many
lines of code is not easy for inexperienced programmers.
 It is normal for any programmer to have errors in thousands of lines of code. The
program may not run according to the programmer's intention, or run the wrong
function it is prescribed, causing the program to be rated shoddy. So when there
is an error, the programmer must debug to fix the error to make the program run
well.
P a g e | 17
2. The debugging processes

 Identify Error:
- Identifying errors at an early stage can save a lot of time. If we make a
mistake in identifying an error, it leads to a lot of time wastage. Error or bugs
occur at a customer site is hard to find. Identifying the right error is import to
save time and avoid errors at the user site.

P a g e | 18
 Identify the Error Location
- After identifying an error, we need to identify the exact location in the
code where an error occurs. Identifying an exact location that leads error can
help to fix the problem faster.
 Analyze Error
- In this stage, you have to use an appropriate approach to analyze the
error. This will help you to understand the problem. This stage is very critical
as solving one error may lead to another error.
 Prove the Analysis
- Once the identified error has been analyzed, you have to focus on other
errors of the software. This process involves test automation where you need
to write the test cases through the test framework.
 Cover Lateral Damage
- In this stage, you have to do unit testing of all the code where you make
the changes. If all test cases pass the test, then you can move to the next
stage or else you have to resolve the test case that doesn’t pass the test.
- Fix and validate: this is the final stage of the debugging process, where
you need to fix all the bugs and test all test script.
3. How to run debug in Visual Studio IDE
 Often, you start a debugging session using F5 (Debug / Start Debugging). This
command starts your app with the debugger attached.
 The green arrow also starts the debugger (same as F5).
3.1. Breakpoint:
- Breakpoint is used to notify debugger where and when to pause the execution of
program.
- You can put a breakpoint in code by clicking on the side bar of code or by just
pressing F9 at the front of the line.

P a g e | 19
3.2. Step Over:
- After debugger hits the breakpoint, you may need to execute the code line by
line.
- "Step Over" or F10 command is used to execute the code line by line.

3.3. Simply Inspect Variables:


You can hover over a variable to view the current value in a data tip.

P a g e | 20
3.4. Step Into:
- This is similar to Step Over. The only difference is, if the current highlighted
section is any methods call, the debugger will go inside the method.
- Shortcut key for Step Into is "F11".

3.5. Step Out:


- This is related when you are debugging inside a method.
- If you press the Shift - F11 within the current method, then the execution will
complete the execution of the method and will pause at the next statement from
where it called.
3.6. Run To Cursor:
- Run to the cursor location.
- To run to the cursor location, place the cursor on an executable line of code in a
source window. On the editor's context menu (right-click in the editor), choose
Run to Cursor. This is like setting a temporary breakpoint.
3.7. Inspect Variables:
- The Locals (CTRL+ALT+V,L) window displays variables that are defined in the local

P a g e | 21
scope, which is generally the function or method that is currently being executed.

- The Autos (CTRL+ALT+V, A) window displays variables used around the current
line (the place where the debugger is stopped). Exactly which variables displayed
is different in different languages

- You can use the Watch (Debug / Windows / Watch / Watch (1, 2, 3, 4)) and
QuickWatch (right-click on variable / Debug / QuickWatch) windows to watch
variables and expressions during a debugging session.
- The difference is that the Watch window can display several variables, while the
QuickWatch window displays a single variable at a time.

3.8. Debug Tips:


- Determine potential error area. Set breakpoint before enter it.
- Use Step Over if you are really sure that function is correct, otherwise use Step
Into.
- Use Step Out if you are really sure that the rest of function is correct, otherwise
use Step Over / Step Into.
P a g e | 22
- Remove unnecessary breakpoints to skip “clear” areas.

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


1. Coding standard and naming convension
1.1. Coding standard:
Coding conventions are a set of guidelines for a specific programming language that
recommend programming style, practices, and methods for each aspect of a program
written in that language. These conventions usually cover file organization, indentation,
comments, declarations, statements, white space, naming conventions, programming
practices, programming principles, programming rules of thumb, architectural best
practices, etc. These are guidelines for software structural quality. Software
programmers are highly recommended to follow these guidelines to help improve the
readability of their source code and make software maintenance easier. Coding
conventions are only applicable to the human maintainers and peer reviewers of a
software project. Conventions may be formalized in a documented set of rules that an
entire team or company follows,[1] or may be as informal as the habitual coding
practices of an individual. Coding conventions are not enforced by compilers.
1.2. Purpose of Having Coding Standards:
 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.
1.3. Naming Convention:
 In computer programming, a naming convention is a set of rules for choosing the
character sequence to be used for identifiers which denote variables, types,
functions, and other entities in source code and documentation.
 Reasons for using a naming convention (as opposed to allowing programmers to
choose any character sequence) include the following:
- To reduce the effort needed to read and understand source code.
- To enable code reviews to focus on issues more important than syntax and
P a g e | 23
naming standards.
- To enable code quality review tools to focus their reporting mainly on
significant issues other than syntax and style preferences.
 The choice of naming conventions can be an enormously controversial issue, with
partisans of each holding theirs to be the best and others to be inferior.
Colloquially, this is said to be a matter of dogma. Many companies have also
established their own set of conventions.

 PascalCase
PascalCase is a naming convention in which the first letter of each word in
a compound word is capitalized. Software developers often use PascalCase when
writing source code to name functions, classes, and other objects. PascalCase is
similar to camelCase, except the first letter in PascalCase is always capitalized.
Example do use PascalCasing for class names and method names:

P a g e | 24
 CamelCase
CamelCase is a naming convention in which a name is formed of multiple
words that are joined together as a single word with the first letter of each of the
multiple words capitalized so that each word that makes up the name can easily
be read.
Example do use camelCasing for method arguments and local variables:

2. Apply coding standard in my code


I applied coding standards and naming convension in P3 section 2 above

P a g e | 25
P a g e | 26
P a g e | 27
REFERENCES
From Collegenot https://www.collegenote.net/curriculum/object-oriented-programming/67/358/
[Accessed October 27, 2021]

From Hackr https://hackr.io/blog/procedural-programming[Accessed October 27, 2021]

From Learncomputerscienceonline https://www.learncomputerscienceonline.com/procedural-


programming/[Accessed October 27, 2021]

From Quora https://www.quora.com/What-are-the-relationships-between-programming-procedural-


object-oriented-and-event-driven-paradigms[Accessed October 27, 2021]

From Studybay https://studybay.com/blog/event-driven-development-features/[Accessed October 27,


2021]

From Wikipedia https://en.wikipedia.org/wiki/Procedural_programming[Accessed October 27, 2021]

From Educba https://www.educba.com/what-is-debugging/[Accessed October 27, 2021]

From Wikipedia https://en.wikipedia.org/wiki/Coding_conventions[Accessed October 27, 2021]

From Wikipedia https://en.wikipedia.org/wiki/Naming_convention_(programming) [Accessed October 27,


2021]

P a g e | 28

You might also like