Professional Documents
Culture Documents
Unit 1: Programming
ASSIGNMENT 2
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:
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.
● 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.
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
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.
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.
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.
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
Data Abstraction
-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.
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:
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.
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:
3.2. Characteristics:
Page |9
Exlanation:
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:
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.
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".
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.
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:
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]
P a g e | 28