Esoft Programmin Sem01 Assesment
Esoft Programmin Sem01 Assesment
Assessor Feedback:
LO1. Define basic algorithms to carry out an operation and outline the process of programming an
applicant
LO4. Determine the debugging process and explain the importance of a coding standard.
* Please note that grade decisions are provisional. They are only confirmed once internal and
external moderation has taken place and grades decisions have been agreed at the
assessment board.
1
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Assessor Feedback:
• Please note that grade decisions are provisional. They are only confirmed once
internal and external moderation has taken place and grades decisions have been agreed
at the assessment board.
Important Points:
1. It is strictly prohibited to use textboxes to add texts in the assignments, except for
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes to
2
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
the body except for the before mentioned compulsory information will result in
rejection of your work.
2. Avoid using page borders in your assignment body.
3. Carefully check the hand in date and the instructions given in the assignment. Late
submissions will not be accepted.
4. Ensure that you give yourself enough time to complete the assignment by the due
date.
5. Excuses of any nature will not be accepted for failure to hand in the work on time.
6. You must take responsibility for managing your own time effectively.
7. If you are unable to hand in your assignment on time and have valid reasons such as
illness, you may apply (in writing) for an extension.
8. Failure to achieve at least PASS criteria will result in a REFERRAL grade.
9. Non-submission of work without valid reasons will lead to an automatic RE FERRAL.
You will then be asked to complete an alternative assignment.
10. If you use other people’s work or ideas in your assignment, reference them properly
using HARVARD referencing system to avoid plagiarism. You have to provide both
intext citation and a reference list.
11. If you are proven to be guilty of plagiarism or any academic misconduct, your grade
could be reduced to A REFERRAL or at worst you could be expelled from the course
12. Use word processing application spell check and grammar check function to help
editing your assignment.
13. Use footer function in the word processor to insert Your Name, Subject,
Assignment No, and Page Number on each page. This is useful if individual sheets
become detached for any reason.
3
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Student name: H.W Kaveesha Assessor name:
Nethmini
Plagiarism
Plagiarism is a particular form of cheating. Plagiarism must be avoided at all costs and
students who break the rules, however innocently, may be penalized. It is your
responsibility to ensure that you understand correct referencing practices. As a
university level student, you are expected to use appropriate references throughout and
keep carefully detailed notes of all your sources of materials for material you have used
in your work, including any material downloaded from the Internet. Please consult the
relevant unit lecturer or your course tutor if you need any further advice.
Guidelines for incorporating AI-generated content into assignments: The use of AI-
generated tools to enhance intellectual development is permitted; nevertheless,
submitted work must be original. It is not acceptable to pass off AI generated work as
your own.
Student Declaration
Student declaration
4
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
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.
Assignment Brief
Student Name/ID Number E236837
Unit Tutor
Submission Format
Table of Contents
a. Activity 01 10
1.1 What is Algorithm? 10
5
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
1.2 Properties of good Algorithm 11
1.3 Process of writing and executing a program 12
1.3.1 Problem Definition 12
1.3.2 Problem Analysis 12
1.3.3 Algorithm Development 12
1.3.4 Coding and Documentation 12
1.3.5 Testing and Debugging 12
1.3.6 Maintenance 12
1.4 Potential Challenges Faced 13
1.5 Fibonacci Series 14
1.6 Factorial Value 16
1.7 Creating an application 17
1.8 Dry Run for Fibonacci Series 17
1.9 Dry Run for Factorial Value 18
1.10 What is big O notation? 19
1.11 Role of Big O Notation in Code Optimization 21
1.12 Fibonacci Series into python code 21
1.13 Factorial Value into python code 23
2.Activity 02 24
2.1 What is Paradigm? 24
2.1.1 Procedural Programming 25
2.1.2 Object Oriented Programming 26
2.1.3 Event driven Programming 29
2.1.3.1 Characteristics 29
2.1.4 Relationship among them 30
3.Activity 03 31
3.1 Pseudo code for Application 31
3.2 Database Design 32
3.2.1 Admin Requirements 32
3.2.2 Employee Requirements 33
3.2.3 Relationships 33
6
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
3.3 Conceptual Design 33
3.4 Logical Design 34
3.5 IDE 36
3.6 Advantages OF visual Studio IDE 38
4.Activity 04 39
4.1 Debugging Process 39
4.2 Coding Standards 41
4.3 Advantages of Coding Standards for Teams 42
4.4 Advantages of Coding Standards for Individuals 43
5.References 45
7
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Table of Figures
Figure 1: 3 main steps of an algorithm (Simplilearn, 2024)........................................................................3
8
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
1. Activity 01
This algorithm concept first appeared nearly 40,000 years ago. The Babylonians created the
world's first known mathematical algorithms on clay tablets. ‘The word “algorithm” itself
originated from the name of a 9th-century Persian mathematician, “Muḥammad ibn Mūsā al-
Khwārizmī” ’ (Ellis Horowitz , Sartaj Sahni, Sanguthevar Rajasekaran, 1997) . This is one of the
strongest foundations for the most advanced mathematical, programming, and even in the
medical field, new inventions.
An algorithm is an amazing word that represents most of our activities today. We do things
according to a random algorithm, but we don’t know it. When we are cooking something, we
have several steps which are in procedural order to do. That bunch of well-organized steps is also
an Algorithm. If you and I are cooking the same curry at the same time in the same place, you
could cook in a different method rather than me—the same output but in different steps. So, we
can’t tell what that algorithm means, that procedure must be in the same way. If someone goes to
school by bus and while his neighbor goes to school on foot. They both have their procedure to
go to school. When we consider those incidences, we can understand that most of our
performance in daily routing is based on the concept of algorithm.
As you can see in the above diagram, an algorithm contains main 3 steps. According to
Simplilearn (2024) said,
9
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Process = > After abstracting all the required data via user inputs, CPU analyze them and
executing various logics and convert those data into information.
Output => After the processing activity, it returns valuable information, which we wanted
through the algorithm
According to the Simplilearn (2024), A good algorithm can make things easy and perfect.
There are several qualities in such an algorithm. (1) Efficiency: algorithms should be more
effective. The best output that can be given within a minimum time and minimum usage of
computer memory and CPU, can be identified as a good algorithm. (2) Correctness: We are
using algorithms for different kinds of activities. When we consider a chemical experiment
process, we must deal with dangerous elements. So, the process and its steps should be clear and
correct. So, to be a good algorithm it must have correctness. (3) Simplicity: If we create an
algorithm and no one can understand it, then it will be a big problem. Even if we are correct, our
project can be rejected. So, an algorithm must be simple, well-implemented, and user-friendly.
(4) Maintainability: It must be declared as easy to make modifications without total harm to the
initial process. If this is so, the users can be confused about suddenly changing the whole project,
and this can lead to mistrust. (5) Security: We are fully globalized now. Most of our credentials,
secret details, and bank details are stored, traversing through the internet. So, the Security of an
algorithm has become the most important thing today. (6) Documentation: If we created some
procedure to do an activity, we should keep good comments or separate documentation about
that procedure, what, why, how to use it, and so on. Without a good explanation it will be
worthless. (7) Robustness: It means an algorithm can handle every kind of user input without
crashing the application or stopping the whole process. If it is not so, we can’t get reliable output.
With these features algorithms could be more reliable, effective and advanced.
When we are developing a program, we have predefined several steps to perform which are
affecting for good quality output.
According to gpmanesar.ac ( n.d.), These steps are known as software development life cycle. It
typically consists of 6 phases as,
1. problem definition
2. problem analysis
3. algorithm development
4. coding and documentation
5. testing and debugging
10
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
6. maintenance
In this step, we are evaluating user requirements, what outcomes they are expecting, and what
details we should input to get appropriate outcomes.
In this step we are deciding what are the functions we are using, what are the limitations of our
output, and what are the variables we are using. That means gathering necessary resources to
address the problem outlined in previous step.
In this phase, we design an organized method to resolve the problem based on the
specifications provided in the previous phase. This stage is essential for program development.
Therefore, we express the solution by presenting a series of statements in a sequential manner.
In this phase, a programming language is utilized to write and execute the programming
instructions that were defined in the previous stage. During this stage, we develop an actual
software application. That implies that we develop the software to resolve the specified problem
utilizing programming languages such as C, C#, Java, python and so on.
In this stage we are executing our code again and again with all possible user inputs to ensure
that there are not any possible errors which can crash our program. If we found one, we fix and
re doing the testing process until we satisfy.
1.3.6 Maintenance
During this stage, the program is actively used by the users. If any improvements are
identified during this step, all of the phases must be performed in order to implement the
changes. In the event that the user experiences any difficulties or desires any improvements, it is
necessary to go through all the stages from the beginning in order to resolve the encountered
problem or incorporate the enhancement.
11
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
1.4 Potential Challenges faced
When we are implementing the code, we have to face different kinds of issues. Let’s discuss
about few of them,
1. Syntax errors
• As beginners, we are committing numerous mistakes when coding. Issues with
spelling, absence of covalent bonds, inability to recall the code, and similar difficulties.
Fortunately, we are currently programming using exceptional Integrated Development
Environments (IDEs), which promptly notify us if we make an error.
2. Logical Errors
• If we fail to understand the situation accurately, we may develop incorrect concepts
and produce output that is not relevant to our requirements.
3. Lack Performance
• When we were unable to discover the most optimized code for our challenge, our
program's efficiency decreased. Therefore, the processing time will be longer than our
first estimation.
6. Debugging
• The debugging process is pretty hard because we have to focus on whole code line by
line to find where could be the problem.
7. Sitting of hours
• When programming sometimes we have to spend approximately the whole day sitting
in front of the PC. It will cause lots of medical problems.
8. Syntax errors
As beginners, we are making lots of errors while coding. Spelling problems,
Missing covalent, forgotten the code and so on. Luckily, we are now coding with great
IDE so, it will inform us whenever we did mistake
12
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
9. Logical Errors
When we couldn’t get the problem clearly, we can make wrong concepts and
given output also not related to our requirements.
10. Lack Performance
When we couldn’t find the most optimized code to our problem and then our
programs efficiency become less. So, it will take more time to process than we
thought.
11. Controlling the user Inputs
In any application we shouldn’t give access to the user to enter anything he wants
in our input boxes. We should control only to get what we want from the user. If
it is not so, hackers can inject malicious codes into our program
12. Simplify the code
It is very important that maintaining our code with simple concepts as much as
we can. It will increase the readability, maintainability of our code
13. Debugging
Sometime the debugging process is very difficult and challenging. We had to
consuming lot of time to fix the errors
14. Sitting of hours
When we are engaging with creating an application, we have to dedicate our
time, and other work. We have to work while sitting on a chair for hours.
The Fibonacci Series can be represented by 0, 1, 1, 2, 3, 5, 8, 13, and so on. This is the process of
adding two consecutive numbers and creating a 3rd number. It Starts with 0 and then 1. Step 01:
Step 02: So, we can create 2 variables called a and b and initialize them as a=0 and b=1. As you
can see these 2 variables represent the first two variables of the Fibonacci series. We are
conducting this process by adding 2 variables. Therefore, we need another variable called “sum”
to store the newly created value. It means that the value of the third number of the series. The
user can Input the number he wants that until which number we should display the series. So, we
declare another new variable called “n”. When we are again and again doing this process, we
need to update about the position in the series. Because we should know whether we already
13
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
have displayed n numbers or not. Step 03: Now we need to know the user-defined number which
means n. So, we get user input for that. Step 04: Step 05: As the first 2 numbers of the series, we
can display a and be. Now the actual finding series part begins. Step 06: In step 06 we are doing
steps 07,08,09,10,11 again and again, while the condition of i<=n, is true. When i becomes
greater than n, we stop the loop. Step 07: In this algorithm, we create the 3rd number by adding
the previous 1st and 2nd numbers. So, here we can add a+b and an initialized variable called
“sum” as sum = a+b. Step 08: We need to propagate through the series until we meet the nth
number. So, we can replace the 1st number with be 2nd number by setting a=b. Step 09: In the
previous step we propagate a to the 2nd element, So, now we need to propagate b to the 3rd
element by replacing an as b=sum. Because, because we already know that sum is the newly
created 3rd element. Step 10: We have already displayed a and b before the loop begins. After
that, we didn’t display or take any input from the user. So, we can identify numbers in our series
in the right order. Now, we can display the 3rd number sum Step 11: As I mentioned previously,
we should know the position that we are in. So, in this step, we are updating the position
identifier which is called “i” as i=i+1, because we are propagating one by one. So, until i
becomes greater than n, this process will continue. Step 12: This is the end of the algorithm.
Because we displayed the nth number of the Fibonacci series.
Step 01 – Start
Step 03 – Input n
Step 04 – Display a
Step 05 – Display b
Step 08 – a=b
Step 09 – b = sum
Step 12 – End
14
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
1.6 Factorial Value
Step 01 – Start
Step 08- i = i + 1
Step 10 - End
15
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
1.7 Creating an application
When we create an application there are several main steps we should follow. Such as,
(3) Coding
According to the above steps, the second stage is the creating an algorithm. First, we should
understand what the requirements are we should fulfill through our application. After that we can
create an algorithm to understand how it works. It will be easier to implement the code without
many changes. While implementing the code we should do proper documentation. After you
implement the code, also you have to test it with all possible user inputs and check whether what
can crash our application and we should correct the errors in an optimized way. If all
requirements are covered and there are no possible errors while running, we can publish our
application. But we must maintain our application to UpToDate and if there are new requirement,
we should update the code.
Step 01 – Start
Step 03 – Input n
Step 04 – Display a
Step 05 – Display b
Step 08 – a=b
Step 09 – b = sum
16
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Step 10- Display sum
Step 12 – End
Step 01 – Start
Step 10 – End
When we create a program, we need to know how efficient our application or performance of
our application is. We measure efficiency by considering space complexity and time consumed.
Big O notation is a mathematical language used to describe how the time complexity or space
complexity of an algorithm scales with the size of the input. It specifically targets the worst-case
situation, which refers to the most challenging or lengthiest conceivable input for the algorithm.
Space complexity measures the memory consumed amount by the increasement of size of the
input and time complexity measures the amount of time consumed by the increment of the size
of the input. Big O Notation measures the worst-case scenario. It means the maximum amount of
time or space that can be consumed by our application per input. It helps to gain understand
about performance of our code and help to make optimized program with best performances.
In big O notation there are 7 main types of complexities. I will describe it according to the time.
But the space complexity theory is the same.
1. O(1) => Constant time complexity. The time remains same as every size of inputs
18
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Example: When we want to get the value of array[2], here we know the index, so we
don’t need to traverse through the array. Therefore, if we know an index, amount of time
consuming is same for all results
2. O(log n) => Logarithmic time complexity. The time is also increase logarithmically based
on input size
Example: Binary search algorithm is the best example for this.
3. O(n) => Linear time complexity. Times grow proportional to the input size in linear way
Example: Bubble sort algorithm is the best example for this. Mostly applied on
loops
4. O(n log n) => Linearithmatic time complexity. Times grow proportional to the n log n
5. O(n^2) => Quadratic time complexity. Times grow quadratically according to the input
size
6. O(2^n) => Exponential time complexity
7. O(n!) => Factorial time complexity
(Olawanle, 2022)
According to this chart is shows that the best scenarios in this order,
O(1) - Excellent/Best
O(log n) - Good
O(n) - Fair
19
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
O(n^2), O(2^n) and O(n!) - Horrible/Worst
According to studysmarter.co (2024), Big O notation can be used to optimize our code as
follows.
1. Performance Comparison
It helps programmers compare which algorithm is more suitable for a given
scenario using a simple calculation. Besides that, they have to actually implement
all possible algorithms, and then they have to test them one by one to find the best
algorithm.
2. Scalability Insight
You can predict which algorithms, methods, and design patterns are suitable for
each task based on the variation in dataset sizes. If you have to deal with a large-
scale dataset, you can simply apply the big O notation, find the O(?) value, and
compare each value according to the above graph.
By using this knowledge you can implement more productive and efficient programs. This big O
provides you the capability to predict and manage how your program will perform with the
variations of inputs. Each algorithm possesses its own unique combination of advantages and
disadvantages. There is no universally applicable solution. By utilizing Big O Notation and
conducting algorithm complexity analysis, you can acquire the capacity to identify versatile and
reliable algorithms that are most suitable for your specific scenarios and tasks (studysmarter.co,
2024).
def Fibonacci_Series(n):
#Step 02- Initialized a,b,sum,i
a=0
b=1
sum=0
i=2
#step 06
while i<=n:
sum = a+b #Step 07
a=b #step 08
b = sum #step 09
print(sum) #step 10
i += 1 #step 11
o Step 02-Step 05 => Here is the part of initialization of variables and displaying variables.
Those steps have no loop or binary search, bubble sort or any kind of different time-
consuming steps. So, all steps take constant time. So the big o notation is O(1). Also, in
step 03 input n, but it also not affected to the result
o Step 06-Step 11 => Here is the loop part. Step 07,08,09,10,11 all takes constant time as I
mentioned in above point, but here we are doing these steps again and again (n-1) times
to fulfill while i<=n condition. So, time will proportionally depend on n. The big O
notation is O(n)
o We got 2 notation, but as I mentioned below the diagram, O(n) is worse than O(1).
According to the big O notation we normally take the worst-case scenario. So, Big O of
our program is O(n)
21
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
def Factorial_Series(n):
#Step 04
i=1
#step 05
factorial = n
22
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Activity 02
2.1 What is paradigm?
As developers, we have to deal with different kinds of problems. To solve them in efficient
ways, firstly we should decide the best paradigm which we are using to develop our software.
Because it’s the based foundation of readability, maintainability and efficiency of our code.
Paradigm means the approach or basic structure of the code. As BARTONÍČEK (2014) said, By
the word paradigm, we understand a set of patterns and practices used to achieve a certain goal.
It defines how to work programming languages, their rules, principles and concepts. In the
practical world a single language can have multiple types of paradigms. There are lots of
paradigms, but only a few of them are mainly used in the software development field. As
examples,
Imperative programming (Procedural programming)
Declarative programming
Object-oriented programming
Event-driven programming
Functional programming
Logic programming
Reflection programming
Generic programming…etc. (BARTONÍČEK, 2014)
#include <stdio.h>
void greeting() {
printf("Hello, World!");
}
int main() {
greeting();
return 0;
}
24
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
This is a simple code snippet of c language which represents a simple function to greet
someone. The main function is the first block which executes, then it meets greeting ()
function. So, the interpreter goes to void greeting code block and after executing it,
simply returns from the main function.
The flow is clearly from top to bottom, but always starts with the main function.
Separate functions are used to reduce the complexity of the code.
As well as function, we can use repetitions and selections to do various tasks.
While we used the main function as int main (), return 0 is must.
Encapsulation => which means preventing direct access to the variables and methods in
parent class by applying access modifiers like public, private, protected. It wraps up data
into a single unit. Developers can choice whether they should be public, private or
protected.
Inheritance => Which means sub-classes can inherit all the properties and methods in
parents’ classes by extending to parent class. But only can have access according to the
access modifiers visibilities. As TECHNOLOGY (2023) said, Inheritance is the
mechanism via which objects from one class gain the characteristics of objects from
another class. It embraces the notion of hierarchical classification. In object-oriented
25
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
programming (OOP), the concept of inheritance allows for the reuse of code. This
implies that we have the ability to incorporate supplementary functionalities to an
already existing class without making any alterations to it. It is crucial because it
reinforces the notion of categorization. C++ facilitates various forms of inheritance,
including single inheritance, multiple inheritance, multilevel inheritance, and
hierarchical inheritance.
Polymorphism => Which means the ability to override methods of parent classes at
subclasses. As well as overload methods in same class, with same name methods but
different types of parameters. According to TECHNOLOGY (2023), Polymorphism,
derived from the Greek language, refers to the capacity to assume multiple forms. A
given procedure may manifest varying behavior in different cases. The behavior is
contingent upon the sorts of data utilized in the procedure. The fundamental notions of
polymorphism are operator overloading and function overloading.
Abstraction => Abstraction means we are creating complex logics by hiding them from
users to make the application user friendly. Which means the users can only do their
tasks without knowing the whole internal process. According to TECHNOLOGY (2023),
Abstraction is the process of describing the fundamental characteristics of something
without introducing unnecessary details or explanations. Classes employ the principle of
abstraction and are characterized as a collection of abstract characteristics such as size,
weight, and cost, together with functions to manipulate these characteristics. The
attributes are referred to as data members as they store information. The operations that
manipulate these data are referred to as member functions.
Objects and classes => Objects are the instances of parent class while classes are the
main structure code of the object, which consists of methods and properties of the
significant object. Objects are able to engage without possessing knowledge of the
specific intricacies of each other's data or code. An object is a delineated region of
computer memory that stores data and a collection of functions capable of accessing that
data. A class is a grouping of items which share the same types of properties. Every
object is linked to a specific class that used to construct it (TECHNOLOGY, 2023).
26
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Figure 8: Example for Classes and Objects (TECHNOLOGY, 2023)
27
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
?>
This small code snippet is consistent with parent class Animal and its sub class which inherit
with animal class called Dog. In Animal class there is a property called sound and a function
called makeSound(). The other function is the constructor of the class which is created when we
initialized an object.
We can override makeSound() function at subclass, so the return string can change according to
the object type. Eg-> dog: bow-bow, cat: meow
But makeSound is a parent class function and all kinds of objects relevant sound can call through
make sound function, without implementing separate functions for each.
Here you can see, we could prevent redundant codes by using inheritance of classes.
Also, can secure our application by encapsulation
Make code more readable, maintainable
Abstraction makes user-friendly applications
2.1.3 Event-driven programming
Today we are mostly using real-time application with user interactions which have GUI. So,
event-driven programming is used in these applications. If we click a button, key up, key down,
scroll down like wise all the types of user information can be identified by listener which
attached to the relevant part. Example languages are c#,js,etc…
An event-driven program is a program that operates based on the occurrence of external events,
determining the flow of control within the program. Event-driven software typically continues in
a state of waiting for events, selecting which events to reply to, responding to them, and then
returning to its waiting state. Event-driven programs require both an event recognition
mechanism and an event handling mechanism. Event-driven programs are required to function
accurately in an environment where unforeseen, dynamic, external stimuli originate from many
sources such as people, hardware, or other processes (cs.hunter.cuny.edu, n.d.).
2.1.3.1 Characteristics:
Event Listener: Monitors for specific events.
Event: An action or occurrence detected by the program.
Event Source: The origin of the event.
Event Loop: Keeps checking for new events and triggers corresponding handlers.
document.getElementById("myButton").addEventListener("click", function() {
alert("Hello, World!");
28
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
});
This is a javascript code which has a button called myButton and it has attached an eventListner.
When we click the button, there will be an alert with the text hello world. In event-driven
programming, it happens again and again whenever trigger the eventListner. It can be mouse
click, mouse hover, keyup, keydown or whatever user interaction or sensor detection.
Here is a small code snippet of C#,
private void btnBack_Click(object sender, EventArgs e)
{
wfAdminHome wfAdminHome = new wfAdminHome(pass,id);
wfAdminHome.Show();
this.Hide();
}
2.1.4 Relationship among them
29
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Activity 03
3.1 Pseudocode for Application
Step 01=> Start
Step 02=> Input empID (Input (“EmployeeID: ”))
Step 03 => Select Leave_Type
Step 04=> IF (Leave_Type ==(“Annual Leaves”))
Step 05=> Then Select Leave_Date
Step 06=> IF (Leave_Date – Today) >7)
Step 07=> IF ((Already_Got_Leaves <14)
Step 08=> Then Apply Leaves
Step 09=> Else
Step 10=> Display (“You have Already taken 14 leaves per year”)
Step 11=> End IF
Step 12=> Else
Step 13=> Display (“Please Apply before 7 days”)
Step 14=> End IF
Step 15=> Else IF (Leave_Type ==(“Casual Leaves”))
Step 16=> Then Select Leave_Date_Time
Step 17=> IF (Roaster Time != Leave_Date_Time)
Step 18=> IF ((Already_Got_Leaves <7)
Step 19=> Then Apply Leaves
Step 20=> Else
Step 21=> Display (“You have Already taken 7 leaves per year”)
Step 22=> End IF
Step 23=> Else
Step 24=> Display (“Please Apply before start your roaster”)
30
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Step 25=> End IF
Step 15=> Else IF (Leave_Type ==(“Short Leaves”))
Step 16=> Then Select Leave _Time
Step 17=> IF (Leave_Time > Now)
Step 18=> IF ((Already_Got_Leaves_In_Month <2)
Step 19=> Then Apply Leaves
Step 20=> Else
Step 21=> Display (“You have Already taken 2 leaves per month”)
Step 22=> End IF
Step 23=> Else
Step 24=> Display (“Please Select on of Upcoming Slots”)
Step 25=> End IF
Step 26=>Else
Step 27=> Display(“Not a Valid Leave Type”)
Step 28=>EndIF
Step 29=>End
3.2 Database Design
3.2.1 Admin Requirements
Admin details should be stored in DB to validate login. (name, id, password)
Register new employees to system (employeeName, employeeID, password)
Assign number of leaves for each employee (employeeID, leaveType, numberOfLeaves)
Assign roaster to each employee (employeeID, startTime, endTime, Date)
Approve or reject applied leaves (employeeID, appliedID, Status(approve/reject))
View leave history of each employee in given date range
View leave history for all employee in given date range
3.2.2 Employee Requirements
Employee login
Apply leaves => short leaves (employeeID, leaveDate, StartTime, endTime)
Apply leaves => casual, annual (employeeID, LeaveDate, leaveType)
View leave status of applied leaves
31
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Delete applied leaves
View Remaining leaves
3.2.3 Relationships
Employee Apply ApplyShortLeaves (1:M)
Employee Apply ApplyLeaves (1:M)
Employee have roasterDb (M:M)
ApplyLeaves CheckedLeaves ApprovedLeaves (1:1)
ApplyShortLeaves CheckedShortLeaves ApprovedLeaves (1:1)
3.3 Conceptual Design
use Leaves;
33
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
CREATE TABLE Apply (
applyLeaveID int NOT NULL,
applyShortLeaveID int NOT NULL,
FOREIGN KEY (applyLeaveID) references ApplyLeaves ON UPDATE CASCADE,
FOREIGN KEY (applyShortLeaveID) references applyShortLeaves ON UPDATE
CASCADE,
PRIMARY KEY (applyShortLeaveID, applyLeaveID)
);
3.5 IDE
Integrated Development Environment is the best option for developers to make their work
easier, perfect, optimized and readable. There are bunch of different kind of tools are in IDE to
do that. Now a days there are number of IDE are also can be found for different programming
languages. Most of them has below features to make programmers’ lives easier.
As Chicago (2005) mentioned, for instance, numerous Integrated Development Environments
(IDEs) provide utilities that facilitate the creation of graphical interfaces for our personal
programs, commonly referred to as "UI designers". The user can engage with all of these tools
(editor, compiler, etc.) through an interface that typically (but not always) takes the form of a
user-friendly graphical interface. The primary benefit of utilizing an Integrated Development
Environment (IDE) is that it allows the programmer to perform all tasks within a unified
interface, eliminating the need for frequent switching between several tools.
Some popular examples are: -
1. IntelliJ IDEA — Best for Java development
2. PyCharm — Best for smart Python code editing
3. JupyterLab — Best for data science with Python
4. WebStorm — Best for web development with JavaScript
5. NetBeans — Best Maven support
6. Xcode — Best for Apple development
7. RStudio — Best for R
8. Visual Studio Code — Best for Windows application development
9. Android Studio — Best for Android development
10. Selenium IDE — Best test automation features
As geeksforgeeks.org (2024) mentioned at his website most of IDEs contains,
35
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
1. Debugger
Debugger is one of most important parts of modern IDEs. When we get an error
with our code, we can add a simple break point before the part we assume would
be the error and simply start debugging. Then the IDE interpreted our code line by
line. So, we can clearly identify by which line we catch the error and also IDE
gives us an exception according to the error type.
2. Auto Compilation
If we are dealing with a compiler-based language, we have to compile our code at
every change. The very depressing part is that while we concentrate to the code,
we might forget to compile the code. As a solution modern IDE gives us build
option to auto compile while starting our program.
3. Show Syntax Errors
If we have made some syntax errors, The IDE mention them all. So, we don’t
need to worry about it and can implement our code relaxed. If IDE mention and
error, we need to simply go to error line and the error message which highlighted
by red underscore.
4. Version Control Integration
In moder IDEs we can Integrate our VCS like git, through our IDE terminal as
well as some IDE has a button to simply push our code to GitHub. We have to
only connect our git and GitHub profile into our IDE. So, you don’t have worry
about every time git add, git push commands
5. Collaboration Feature
There is a feature to live share our code with other developers. It will make our
works easier because we can make sure our coding part can run with other
developers’ codes
6. Cross-Platform Development
IDEs can develop applications for web, mobile, desktop as well as when
considering mobile applications both android and iOS. And support for most of
programming languages
7. Extensions / Plugins
New features can be added to our IDE as extension or plugin. So, we can
customize our IDE to do different kinds of activities as we want
8. Refactoring
Can make our code more readable and maintainable by refactoring without
impacting to our external behavior
9. Terminal
Provide integrated terminal for developers to execute commands withing our
IDEs. So, we don’t need to worry about our host OS, windows or whatever we
can try Linux based terminal in our IDE.
10. GUI design Tools
Visual Studio IDE is most important to create GUI applications without applying
thousands of code-lines. We can simply drag and drop desktop application design.
We only need to do coding part for development the behaviors of our application.
11. Database connection
36
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
IDEs provide us with database connection for both in localhost as well as cloud
based or remote systems. It is very easy to manage complex applications with this
feature.
3.6 Advantages OF visual Studio IDE
As Quoy (2024) mentioned at her page there are several advantages of using Visual Studio IDE
for coding process,
IntelliSense provides intelligent code suggestions, greatly improving coding
efficiency, especially for languages like C++.
Sophisticated Code Profiling allows for a detailed analysis of code and precise
adjustments to enhance performance.
Collaboration within a team is improved with specific features designed for group
work, which is ideal for bigger projects.
Activity 04
4.1 Debugging Process
37
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Visual studio is a tool that makes our programming experience easier. One of the main features
in VS is debugging. If you are having a problem with your code, debugging helps you to identify
the problem. VS IDE has a bunch of debugging features which are relevant to different kinds of
situations. You can enter debugging mode by pressing F5 or simply click start debugging button
in the debug toolbar.
Features of debugging in VS IDE
According to microsoft (2023) said,
Breakpoints
o It has an option called breakpoint, which helps you to pause the execution
at any point that you want. Then you can observe the behavior of your
code, line by line or whatever relevant debugging method. In Visual
Studio, you can quickly set a breakpoint by clicking in the left margin next
to the line of code or place the cursor on a line and press F9 (microsoft,
2023).
Watch Window
o After you set breakpoint, click the debugging option. Then in the
debugging menu, you can see watch option under windows. By adding a
watch window, you can actively see what the values of each variable are
assigned at every step and the running expressions.
Immediate Window
o This window can be found in the debug menu, then under the windows
option. You can type your functions names here and can run them
immediately without clicking the play button. This is useful to run small
bits of codes.
Call Stacks
o This window will show you all the functions you executed till this ongoing
execution point. It is using to understand what the structure of our journey
is
Locals Window
o The Autos window shows variables used on the current line that the
debugger is at and the preceding line. The Locals window shows variables
defined in the local scope, which is usually the current function or method.
(debug, 2023)
Step into, Step over, Step Out
o When debugging, these instructions govern how you navigate around your
code. Step Over" executes the current line and continues to the next, "Step
Out" completes the current function and pauses when it returns to the
caller, and "Step Into" takes you inside the functions called on the current
line.
Hot Reload
38
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
o You have another super crazy option called hot reload to run your
application again after saving some changes without restarting it.
Through these options you can have further idea of the problem in your code. After the
execution IDE will be stuck at exception point which is the place where the problem can be
found. Please go through the code again and again with some breakpoints which are relevant to
your assumptions.
Here is a small code snippet of java, I took that screenshot after debugging it. You can clearly see
that VS code automatically provides us and exception called ArrayIndexOutOfBoundsException.
And the error code line was highlighted. I have tried to call the index 11 item of array, but there
were only 10 indexes. That was the error in my code and VS code helped me to find the error.
If we haven’t debugger options and had to build large scale software, there may be thousands
of various kinds of errors which were not identified through test cases. We don’t know about
them so; we published our application without fixing them. Then our application will make our
carrier reputation to the ground level. Users are different to each other. So, there requirements are
also differed. So, different kinds of user inputs, unhandled errors can crash our application. So,
it’s very important that debugging facility in IDE.
Let’s find out how to debug correctly. As microsoft (2023) has marked at their site,
1. Preventing and Fixing bugs
39
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
You can add breakpoints to logic code lines and do testing again and again with
all possible user inputs, and scenarios.
This prevents transfer bugs into the final project and preventing crash the
application
2. Enhancing Security
While you are trying all possible scenarios, there aren’t any vulnerabilities that
can remain in our applications. So, it is more secure than normal applications.
Especially when we are validating authentication, observe thoroughly if
credentials are exchanged securely, whether cookies, sessions are matching like
wise.
3. Improving performance
While testing our code, we can refactor it into more efficient, readable and
maintainable versions. It will optimize our application performance. During the
debugging process, you can find areas of your code that are sluggish or
inefficient. You may enhance the overall functionality of your application and
make it more resilient and responsive by optimizing these components.
Debugging enables you to keep an eye on how your program utilizes CPU and
memory on the machine. This guarantees that memory leaks and excessive
resource usage won't affect your application's performance.
4.2 Coding Standards
Coding Standards are the best performance standards that should be followed by programmers.
But they are not strict to do. Coding Standards are like ethics. It will increase readability,
maintainability and security of your code. Reduced errors and optimized the application well.
Another "easier said than done" goal is to always develop high-quality code that is simple to
maintain and build upon. As per a recent analysis published by CISQ, the minimum cost of
substandard software in the United States in 2022 was projected to be $2.41 trillion (Anon.,
2023).
Development teams need to follow rules and best practices that help them write better code more
consistently to maintain clean and healthy code. These methods, approaches, and acknowledged
best practices are referred to as coding standards (Anon., 2023).
Well Structured Naming conventions
Variable naming conventions => Use camelCase or snake Case naming
conventions.
Functions => Use camelCase or snake Case naming conventions.
Classes => First letter capital (use pascal Case)
Constants => Upper case names
Code formatting
Use proper indentations and try to use short methods. Use braces neatly
40
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
Documentation
Your code not for only you, so you have to document your theory in brief by
commenting or you can create separate files for explaining the process with examples
Don’t commenting in long
Code Structure
Modularity => Breakdown code into reusable classes or functions
Single responsible principle => One class can only have one responsibility
Files management => Place same kinds of files separately at same folder
Error handling
Use to wrap your code inside try-catch blocks
You can test your code by console logging the output
Version control
Try to always work with git or any version controller to not to lose your code or can
be easy to restore to previous versions if new version is worst
If we are coding according to the coding standards it is very easy for everyone who review our
code as well as the team that we are working with.
4.3 Important for coding standards for Teams
As mentioned by Yan (2024),
Following coding standards is crucial for both teams and individual developers, as they
provide a set of rules and principles that improve the overall success and efficiency of software
development projects. Implementing coding guidelines establishes a structured framework for
writing code that is easier to read and maintain. Developers discover coding is easier to grasp
and get through by adhering to uniform guidelines and a cohesive format. Prioritizing
organization and minimizing errors is crucial. The importance of adhering to coding standards is
more apparent in a team environment. Through the establishment of a collaborative atmosphere,
they ensure that every team member consistently contributes to the codebase. Consistency in
code is crucial for effective evaluation and collaboration among team members. It simplifies the
process and enhances understanding as a group.
1. Collaboration => we can’t work alone. We should collaborate with other team
members and our code should be clear, well-structured for good understanding for them.
So, we should follow the same principles to code.
2. Code quality => It will increase our code quality and should be readable, maintainable
3. Onboarding => New team members can also get the principles and procedures in your
team quickly. Because coding standards are common to everyone.
41
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
4. Simplify debugging => anyone can understand the code and what happened there, so
they can make assumptions about what should be the error. It makes the debugging
process quicker.
5. Name conventions => quality name conventions make other team members works easier
because, they can get the correct idea of the variables, functions, events etc.
6. Refactoring => Anyone can refactor the code if he has good idea easily
It secures time wasting and easy to maintain the code. If we want to refactor or re-implement our
code with new features, it will not be more complex. Following coding standards improves a
developer's ability to write better code, increasing their value to their team and potential
employers. Coding standards save time by giving developers a clear set of guidelines to follow
when naming variables or formatting code. This enables developers to concentrate more on
finding solutions.
4.4 Important for coding standards for Individuals
As mentioned by Yan (2024),
Enforcing coding standards can greatly simplify code reviews by providing a standardized set of
criteria. By actively identifying problems and incorporating optimal methods into the
development process, the review process improves efficiency, and the code quality is elevated.
Following coding conventions is crucial to ensure the project's scalability
1. Professional growth => Following coding standards will help to achieve your carrier
goals by improving coding skills and can implementing more creative codes
2. Quickly Debugging => You don’t need to spend more time to solve your problems in the
code
3. Efficient code => Your code is more optimized so, efficient applications can be made
4. Code reviews => Reviewers will appreciate you and give good feedback because,
readability of the code
5. Code quality => It will increase our code quality and should be readable, maintainable
6. Easy to Update => you can easily update some features of your code without changing
lots of codes. Eg=> Reusable sections, functions, modules
42
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
7. Mind Relaxing => It is very pleasant when code is well structured, so you can deal it
with more time rather than unstructured code
43
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01
References
Anon., 2017. What is an Algorithm?, s.l.: s.n.
Anon., 2023. Coding Standards: What Are They and Why Are They Important?. [Online]
Available at: https://blog.codacy.com/coding-standards
BARTONÍČEK, J., 2014. Programming Language Paradigms & The Main Principles of Object-Oriented
Programming. [Online]
Available at:
https://www.researchgate.net/publication/272577347_Programming_Language_Paradigms_The_Main_
Principles_of_Object-Oriented_Programming
[Accessed 10 08 2024].
debug, m., 2023. Tutorial: Learn to debug C# code using Visual Studio. [Online]
Available at: https://learn.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-debugger?toc=
%2Fvisualstudio%2Fdebugger%2Ftoc.json&view=vs-2022
Dourish, P., 2016. Algorithms and their others:, Irvine: Big Data & Society.
Ellis Horowitz , Sartaj Sahni, Sanguthevar Rajasekaran, 1997. Computer Algorithms. 1 ed. New York: W.H
Freeman and Company.
Olawanle, J., 2022. Big O Cheat Sheet – Time Complexity Chart. [Online]
Available at: https://www.freecodecamp.org/news/big-o-cheat-sheet-time-complexity-chart/
Quoy, L., 2024. Visual Studio vs Visual Studio Code: What’s the Key Difference?. [Online]
Available at: https://distantjob.com/blog/visual-studio-vs-visual-studio-code/#:~:text=Comprehensive
%20Development%20Environment%3A%20Visual%20Studio,interactive%20debugging%2C%20and
%20code%20profiling.
[Accessed 10 08 2024].
Yan, W., 2024. Coding standards are crucial for teams and individual developers. Mandalay: studocu.
45
H.W Kaveesha Nethmini
Unit 01 – Programming
Assignment 01