Uploaded by Ishanka Anuruddha

Unit-01 Programming Assignment-G.I.A.Nandasiri(E159212) Re-Submission

advertisement
Higher Nationals
Internal verification of assessment decisions – BTEC (RQF)
INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title
Assessor
Unit(s)
Assignment title
Student’s name
Higher National Diploma in Computing
Mrs. Vishmi Embuldeniya
Internal Verifier
Unit-01 Programming
Design &Implement a GUI based system using a suitable Integrated Development
Environment
G. Ishanka Anuruddha Nandasiri (E159212)
List which assessment criteria
the Assessor has awarded.
Pass
Merit
Distinction
INTERNAL VERIFIER CHECKLIST
Do the assessment criteria awarded match
those shown in the assignment brief?
Is the Pass/Merit/Distinction grade awarded
justified by the assessor’s comments on the
student work?
Has the work been assessed
accurately?
Is the feedback to the student:
Give details:
• Constructive?
• Linked to relevant assessment criteria?
• Identifying opportunities for
improved performance?
• Agreeing actions?
Does the assessment decision need
amending?
Y/N
Y/N
Y/N
Y/N
Y/N
Y/N
Y/N
Y/N
Assessor signature
Date
Internal Verifier signature
Date
Programme Leader signature (if required)
Date
Confirm action completed
Remedial action taken
Give details:
Assessor signature
Internal Verifier signature
Programme Leader signature (if
required)
Date
Date
Date
Higher Nationals - Summative Assignment Feedback Form
Student Name/ID
G. Ishanka Anuruddha Nandasiri (E159212)
Unit Title
Assignment Number
Submission Date
Re-submission Date
01
15/11/2023
Mrs. Vishmini Embuldeniya
Assessor
Date Received 1st
submission
Date Received 2nd
submission
08.12.2023
Assessor Feedback:
LO1. Define basic algorithms to carry out an operation and outline the process of programming an application.
Pass, Merit & Distinction Descripts
P1
M1
D1
LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis of a suita
Integrated Development Environment (IDE).
Pass, Merit & Distinction Descripts
P2
M2
D2
M3
D3
LO3. Implement basic algorithms in code using an IDE.
Pass, Merit & Distinction Descripts
P3
LO4. Determine the debugging process and explain the importance of a coding standard.
Pass, Merit & Distinction Descripts
Grade:
P4
P5
M4
Assessor Signature:
Date:
Assessor Signature:
Date:
D4
Resubmission Feedback:
Grade:
Internal Verifier’s Comments:
Signature & Date:
* 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.
Assignment Feedback
Formative Feedback: Assessor to Student
Action Plan
Summative feedback
Feedback: Student to Assessor
Assessor
signature
Date
Student
signature
Date
Pearson Higher Nationals in
Computing
Unit 01: Programming
Assignment 01
General Guidelines
1. A Cover page or title page – You should always attach a title page to your assignment.
Use previous page as your cover sheet and make sure all the details are accurately filled.
2. Attach this brief as the first section of your assignment.
3. All the assignments should be prepared using a word processing software.
4. All the assignments should be printed on A4 sized papers. Use single side printing.
5. Allow 1” for top, bottom , right margins and 1.25” for the left margin of each page.
Word Processing Rules
1.
2.
3.
4.
The font size should be 12 point, and should be in the style of Time New Roman.
Use 1.5 line spacing. Left justify all paragraphs.
Ensure that all the headings are consistent in terms of the font size and font style.
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.
5. Use word processing application spell check and grammar check function to help editing
your assignment.
Important Points:
1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the
compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body
except for the before mentioned compulsory information will result in rejection of your
work.
2. Carefully check the hand in date and the instructions given in the assignment. Late
submissions will not be accepted.
3. Ensure that you give yourself enough time to complete the assignment by the due date.
4. Excuses of any nature will not be accepted for failure to hand in the work on time.
5. You must take responsibility for managing your own time effectively.
6. 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.
7. Failure to achieve at least PASS criteria will result in a REFERRAL grade .
8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will
then be asked to complete an alternative assignment.
9. 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 in-text citation
and a reference list.
10. 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
Student Declaration
I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present
it as my own without attributing the sources in the correct way. I further understand what it means
to copy another’s work.
1. I know that plagiarism is a punishable offence because it constitutes theft.
2. I understand the plagiarism and copying policy of the Edexcel UK.
3. I know what the consequences will be if I plagiaries or copy another’s work in any of the
assignments for this program.
4. I declare therefore that all work presented by me for every aspects of my program, will be
my own, and where I have made use of another’s work, I will attribute the source in the
correct way.
5. I acknowledge that the attachment of this document signed or not, constitutes a binding
agreement between myself and Edexcel UK.
6. I understand that my assignment will not be considered as submitted if this document is not
attached to the attached.
E159212@esoft.academy
Student’s Signature:
(Provide E-mail ID)
Date:15.11.2023
(Provide Submission Date)
Higher National Diploma in Computing
Assignment Brief
Student Name /ID Number
G. Ishanka Anuruddha Nandasiri (E159212)
Unit Number and Title
Unit 01: Programming
Academic Year
2021/22
Unit Tutor
Assignment Title
Design &Implement a GUI based system using a suitable
Integrated Development Environment
Issue Date
Submission Date
IV Name & Date
Submission Format
This submission will have 3 components
1. Written Report
This 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. (The
recommended word count is 1,500–2,000 words for the report excluding annexures)
2. Implemented System (Software)
The student should submit a GUI based system developed using an IDE. The system should connect with a
backend database and should have at least 5 different forms and suitable functionality including insert,
edit and delete of main entities and transaction processing.
3. Presentation
With the submitted system student should do a presentation to demonstrate the system that was
developed. Time allocated is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while doing the
presentation, but live demonstration of the system is required. Evaluator will also check the ability to
modify and debug the system using the IDE.
Unit Learning Outcomes:
LO1. Define basic algorithms to carry out an operation and outline the process of
programming an application.
LO2. Explain the characteristics of procedural, object-orientated 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:
Activity 1
A. The Fibonacci numbers are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence
relation.
Fn = F n-1 + F n-2
B. Factorial of a non-negative integer, is multiplication of all integers smaller than or equal
to n. For example, factorial of 6 is 6*5*4*3*2*1 which is 720.
n! = n * (n - 1) * …….. 1
Define what an algorithm is and outline the characteristics of a good algorithm. Write the
algorithms to display the Fibonacci series and the factorial value for a given number using
Pseudo code. Determine the steps involved in the process of writing and executing a
program.
Take a sample number and dry run the above two algorithms. Show the outputs at the end
of each iteration and the final output. Examine what Big-O notation is and explain its role in
evaluating efficiencies of algorithms. Write the Python program code for the above two
algorithms and critically evaluate their efficiencies using Big-O notation.
Activity 2
2.1
Explain what is meant by a Programming Paradigm and the main characteristics
of Procedural, Object oriented and Event-driven paradigms and the relationships
among them. Write small snippets of code as example for the above three
programming paradigms using a suitable programming language(s). you also need to
critically evaluate the code samples that you have given above in relation to their
structure and the unique characteristics.
Activity 3 and Activity 4 are based on the following Scenario.
Ayubo Drive is the transport arm of Ayubo Leisure (Pvt) Ltd, an emerging travel & tour
company in Sri Lanka. It owns a fleet of vehicles ranging from cars, SUVs to vans.
The vehicles that it owns are hired or rented with or without a driver. The tariffs are based on
the vehicle type. Some of the vehicle types that it operates are, small car, sedan car, SVUs, Jeep
(WD), 7-seater van and Commuter van. New vehicle types are to be added in the future.
Vehicle rent and hire options are described below.
1. Rent (With or without driver) – For each type of vehicle rates are given per day, per week
and per month. Rate for a driver also given per day. Depending on the rent period the total
rent amount needs to be calculated. For example: if a vehicle is rented for 10 days with a
driver, total amount to be calculated as follows:
Total rent = weeklyRent x 1 + dailyRent x 3 + dailyDriverCost x 10
2. Hire (with driver only) – These are based on packages such as airport drop, airport pickup,
100km per day package, 200km per day package etc. Standard rates are defined for a
package type of a vehicle typeif that is applicable for that type of vehicle.For each package
maximum km limit and maximum number of hours arealso defined. Extra km rate is also
defined which is applicable if they run beyond the allocated km limit for the tour. For day
tours if they exceed max hour limit,a waiting charge is applicable for extra hours. Driver
overnight rate and vehicle night park rate also defined which is applicable for each night
when the vehicle is hired for 2 or more days.
Activity 3
Function 1: Rent calculation.
Return the total rent_value when vehicle_no, rented_date, return_date, with_driver
parameters are sent in. with_driver parameter is set to true or false depending whether the
vehicle is rented with or without driver.
Function 2: Day tour - hire calculation.
Calculate total hire_value when vehicle_no, package_type, start_time, end_time,
start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge,
waiting_charge and extra_km_charge as output parameters.
Function 3: Long tour - hire calculation.
Calculate total hire_value when vehicle_no, package_type, start_date, end_date,
start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge,
overnight_stay_charge and extra_km_charge as output parameters.
Write suable algorithms for vehicle tariff calculation for rents and hires. Ideally 3
functions should be developed for this purpose as above. Use the visual studio IDE
(using C#.net) to Implement the above algorithms and design the suitable database
structure for keeping the tariffs for vehicle types and different packages which must be
used for implementing the above functions.
Analyze the features of an Integrated Development Environment (IDE) and explain how
those features help in application development. Evaluate the use of the Visual
StudioIDE for your application development contrasted with not using an IDE.
Activity 4
4.1 Design and build a small system to calculate vehicle hire amounts and record them in a
database for customer billing and management reporting forAyubo drive. This includes the
completing the database design started in 3.2 and implementing one or more GUIs for
vehicle, vehicle type, and package add/edit/delete functions. It essentially requires an
interface for hire calculation and recording function described above. Generating customer
reports and customer invoices are not required for this course work.
4.2 Explain debugging process and the features available in Visual studio IDE for debugging
your code more easily. Evaluate how you used the debugging process to develop more
secure, robust application with examples.
4.3 Outline the coding standards you have used in your application development. Critically
evaluate why a coding standard is necessary for the team as well as for the individual.
Grading Rubric
Grading Criteria
LO1 Define basic algorithms to carry out an operation
and outline the process of programming an
application.
P1Provide a definition of what an algorithm is and outline
the process in building an application.
M1Determine the steps taken from writing code to
execution.
D1 Evaluate the implementation of an algorithm in a suitable
language. Evaluate the relationship between the written
algorithm and the code variant
Achieved
Feedback
LO2 Explain the characteristics of procedural,
objectorientated and event-driven programming,
conduct an analysis of a suitable Integrated
Development Environment (IDE)
P2Give explanations of what procedural, objectorientated,
and eventdriven paradigms are; their characteristics and the
relationship between them.
M2 Compare and contrast the procedural, object
orientated and event driven paradigms used in given
source code of an application
D2Critically evaluate the source code of an application which
implements the programming paradigms, in terms of the
code structure and characteristics.
LO3Implement basic algorithms in code using an IDE.
P3Write a program that implements an algorithm using an
IDE.
M3Use the IDE to manage the development process of the
program.
D3Evaluate the use of an IDE for development of
applications contrasted with not using an IDE.
LO4 Determine the debugging process and explain
the importance of a coding standard
P4Explain the debugging process and explain the debugging
facilities available in the IDE.
P5Outline the coding standard you have used in your code.
M4Evaluate how the debugging process can be used to
help develop more secure, robust applications.
D4 Critically evaluate why a coding standard is necessary in
a team as well as for the individual.
Table of Contents
Acknowledgement............................................................................................................................ 2
Fibonacci Numbers ........................................................................................................................ 3
Definition of an Algorithm: ........................................................................................................... 4
Characteristics of a Good Algorithm: ............................................................................................ 4
General examples for Algorithm (day today life examples for the algorithms) ............................ 5
Pseudocode .................................................................................................................................... 7
Three control constructs................................................................................................................. 7
Fibonacci series.............................................................................................................................. 8
Factorial value................................................................................................................................ 8
Pseudo code for displaying the Fibonacci series: .......................................................................... 9
Pseudo code for calculating the factorial of a number: .................................................................. 9
Steps Involved in the Process of Writing and Executing a Program: .......................................... 10
Potential Challenges Faced in Writing Code: .............................................................................. 11
Sample Run of Fibonacci and Factorial Algorithms:................................................................... 12
..................................................................................................................................................... 14
Software Development Life Cycle ................................................................................................ 16
Big-O Notation: ........................................................................................................................... 18
Efficiency Analysis using Big-O Notation: ................................................................................. 19
Python .......................................................................................................................................... 19
Python Code for Fibonacci and Factorial Algorithms: ................................................................. 20
Programming Paradigm: .............................................................................................................. 21
Procedural Programming: ............................................................................................................ 21
Object-Oriented Programming: ................................................................................................... 22
Event-Driven Programming:........................................................................................................ 22
Critique of the Code Samples: ..................................................................................................... 23
Pseudocode for Salary Component: ............................................................................................ 24
Database Structure: ..................................................................................................................... 25
IDE ................................................................................................................................................ 26
Features of an Integrated Development Environment (IDE): ...................................................... 26
Evaluation of Using Visual Studio IDE:........................................................................................ 27
Debugging .................................................................................................................................... 27
Debugging process ....................................................................................................................... 28
The features available in visual studio for the debugging process .............................................. 29
Design And build a small system to calculate. ............................................................................. 53
Coding Standards I have used in my code .................................................................................. 56
References ................................................................................................................................... 59
1|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
Acknowledgement
I would like to thank all who supported me in completing my 1st assignment of
Programming assignment. I’m really happy about my friends because they always
encouraged me until I finished my project. I am sincerely grateful to them for sharing their
knowledge with me. Also, I would like to give my special thanks to my friend Radeesh. He
used to point out any mistake when he is seen.
I take this opportunity to express my sincere gratitude to our lecturer Mrs. Vishmi for her
support and guidance throughout this assignment. Also, her kindness and friendliness
with the students were a great help to us. Finally, I would like to extend my deep
gratitude towards my mother and my sister for their support in carrying out this work.
successfully.
Thank all,
Ishanka Anuruddha
2|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
Fibonacci Numbers
The Fibonacci numbers are a sequence of integers that starts with 0 and 1, where each
number is the result of multiplying the two preceding numbers. The cumulative sum of
the two preceding numbers and all subsequent numbers in the series. The series begins
with the numbers 0 and 1.
The variable n represents the location of a number in the
series, while Fn is commonly used to represent the sequence.
The Fibonacci sequence is determined by the subsequent recurrence connection:
Figure 1 - Fibonacci Sequence
The provided values are the initial values.
The sequence can be calculated iteratively by initialising F0 = 0 and F1 = 1, and then
using the recurrence relation to calculate each successive term. As an illustration, we
may calculate the initial terms of the series in the following manner:
et etc.
The Fibonacci sequence possesses a multitude of fascinating properties and applications
in the fields of mathematics, physics, and computer technology.
The phenomenon of
self-similarity can be observed in nature, exemplified by the branching patterns of trees,
the arrangement of leaves on stems, and the spiral formations of shells and galaxies. The
series is a fundamental instrument employed in the fields of encryption, search algorithms,
and sort algorithms within the realm of computer science.
3|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
Definition of an Algorithm:
An algorithm can be defined as a collection of succinct rules that are used to perform a
certain task or solve a particular problem (Cormen et al., 2009, p. 5).
According to
Kleinberg and Tardos (2006), a methodical technique is a systematic approach created to
achieve a particular purpose or target. Algorithms are utilised in numerous domains of
science, engineering, and computer science to execute intricate calculations and
mechanise activities (Dasgupta et al., 2006, p. 1).
Characteristics of a Good Algorithm:
1. Well-defined: An algorithm's steps must be explicitly stated and free from any
ambiguity. It signifies that the instructions or procedures employed in an algorithm
have to be unambiguously delineated and comprehensible to any reader.
The
algorithm must exhibit a high level of precision, leaving no space for any form of
interpretation or ambiguity.
2. Precise: The algorithm must exhibit precision and accuracy. The precision of an
algorithm refers to the level of accuracy and specificity required in defining its
stages.
The algorithm must exhibit a high level of precision, ensuring that it
eliminates any potential for ambiguity or uncertainty.
3. Effective: The algorithm should efficiently and effectively solve the problem or
complete the task. An algorithm must exhibit efficiency in terms of time and space
complexity, indicating that it requires the minimum amount of steps and memory
to execute the process.
Additionally, it must be efficient in terms of generating
the intended result or accurately resolving the provided issue.
4. Finiteness: The algorithm must possess a finite amount of sequential operations that
will ultimately come to an end.
This attribute necessitates that the algorithm
possesses a distinct point at which it stops or a circumstance that causes it to
4|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
terminate. The method should be devised to avoid infinite looping or redundant
iterations.
5. Input/Output: The algorithm should receive input from the user and deliver output
to the user. The algorithm's input and output should be precisely described, and it
must yield the accurate output for the provided input.
6. Uniqueness: The algorithm should consistently generate same results for identical
inputs, irrespective of the user's identity.
The algorithm must be deterministic, meaning it must produce the same output for the
same input, regardless of the user or the context in which it is employed. This attribute
is crucial in guaranteeing the dependability and uniformity of the algorithm.
General examples for Algorithm (day today life examples for the
algorithms)
1) Recipe: A recipe exemplifies an algorithm that presents a sequential procedure for
preparing a meal. The ingredients list serves as the input, while the prepared food
serves as the output. Every step in the recipe is well defined, accurate, and yields
the intended outcome when executed accurately.
1. Collect all the necessary ingredients and kitchen utensils.
2. Set the oven to the preferred temperature in advance.
3. Combine the dry ingredients in a bowl.
4. Combine the liquid components in a distinct container.
5. Mix the moist and dry components together.
6. Transfer the mixture into a baking dish.
7. Cook the meal in the oven for the designated duration.
8. Remove the dish from the oven and allow it to cool.
9. 9. Present the food..
5|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
2) Directions: When navigating to an unfamiliar location, we frequently rely on
algorithms in the form of directions to successfully arrive at our intended
destination. The input consists of the starting location and the destination, while
the output is the route to be taken. The directions offer explicit, unequivocal, and
efficient guidance to reach the location, guaranteeing that we avoid getting lost or
making any incorrect turns.
1) Input the origin and destination into a navigation application or website.
2) The algorithm produces a route by taking into account the existing traffic conditions
and the distance to be covered.
3) Adhere to the directions given by the application or website in order to arrive at the
desired location.
4) Follow the designated crossroads or streets for your turns.
5) Adhere to the prescribed speed limit and obey traffic lights.
Arrive at the destination.
6) Banking transactions, such as the act of withdrawing money from an ATM, also
rely on algorithms. The input represents the specified quantity to be withdrawn,
while the output corresponds to the actual amount of cash that is dispensed. The
ATM algorithm must be accurate, effective, and yield the intended result by
subtracting the specified amount from the user's account and dispensing the cash.
The process must be limited in number and well defined, guaranteeing the
successful completion of the transaction.
1) Place the ATM card into the machine.
2) Please provide your personal identification number (PIN)
3) Choose the cash withdrawal option.
4) Please input the desired withdrawal amount.
5) The algorithm validates the account balance and subtracts the specified amount.
6|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
6) The machine distributes the currency.
7) Retrieve the currency from the automated teller machine.
8) Retrieve the ATM card from the machine.
9) Retrieve the transaction receipt (if desired)
Pseudocode
Pseudocode, as described by Aman and Muniandy (2017), is a form of algorithmic
explanation that combines elements of normal language with informal programming
language syntax. It is utilised to assist programmers in strategizing and visualising an
algorithm or code prior to implementing it in a particular programming language.
Pseudocode is frequently employed in the first phases of software development to
facilitate communication and collaboration among project participants, including
developers, stakeholders, and consumers.
Pseudocode aims to offer a lucid and
unequivocal depiction of the algorithm or programme logic, devoid of the necessity for
any particular programming language syntax or syntax rules.
Three control constructs
Control structures in computer programming are utilised to determine the sequence in
which programme statements are performed. The three primary control structures are
selection, sequence, and repetition.
1. Selection: Selection refers to the act of deciding amongst multiple courses of
execution, depending on the result of a conditional expression. To clarify, selection
enables the programme to make determinations.
An instance of selection is
demonstrated by the if-else sentence. The feature enables a programme to run a
specific block of code when a condition is evaluated as true, and a different block
of code when the condition is evaluated as false.
7|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
2. Sequence: A fundamental control structure is known as a sequence, which defines
the specific order in which statements are executed. A sequence of assertions is
executed in the order they appear in the programme. This is commonly referred to
as linear programming.
3. Repetition: Repetition refers to the act of carrying out a set of instructions many
times. This is beneficial when you desire to do the identical operation repeatedly
with varying input values. The loop is the most prevalent kind of repetition. The
for loop and the while loop are two distinct types of loops. The while loop executes
a set of statements as long as a condition remains true, whereas the for loop
iteratively runs a group of statements.
Fibonacci series
Each subsequent number in the Fibonacci series is the sum of the two preceding numbers.
To clarify, the sequence begins with 0 and then progresses through the numbers 1, 2, 3, 5,
8, 13, 21, 34, 55, 89, 144, and so forth. The series is named after Leonardo Fibonacci, an
Italian mathematician who gained popularity in the Western world by the publication of his
work Liber Abaci in 1202.
The Fibonacci sequence is commonly observed in natural
phenomena, such as the branching structures of trees and the spiral formations of shells,
and it possesses other intriguing mathematical properties.
Factorial value
The mathematical concept of "factorial value" refers to the sum of all positive integers
from 1 to a specific number. The factorial of 5 is computed using the following method:
The factorial of 5, denoted as 5!, is equal to the product of all positive integers from 5 to
1, which is 120.
Factorial values are utilised in various mathematical and scientific processes, including
permutations, combinations, and probability calculations.
8|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
Pseudo code for displaying the Fibonacci series:
Figure 2 - Pseudo code for Fibonacci Series
Pseudo code for calculating the factorial of a number:
Figure 3 - Pseudo for calculating factorial
9|Page
Unit 01|Programming|Ishanka Anuruddha (E159212)
Steps Involved in the Process of Writing and Executing a Program:
1. Problem statement: This step entails the identification of the problem or task that
necessitates resolution through the utilisation of the programme.
It is crucial to
precisely articulate the problem statement and ascertain the needs and limits that
must be considered.
2. Algorithm design: During this stage, the issue is divided into smaller subproblems, and a specific method is devised to address each sub-problem. The
algorithm must possess a clearly delineated and unambiguous structure, with
explicitly described inputs and outputs.
3. Coding: After the algorithm is formulated, it is put into action in a computer
language through the process of coding.
The code should be arranged and
systematised in a manner that is readily comprehensible and sustainable.
4. Testing: The programme undergoes rigorous testing to verify its ability to generate
the anticipated output and operate as intended. Different forms of testing can be
conducted, including unit testing, integration testing, and acceptance testing.
5. Debugging: If any faults or issues are detected during the testing process, it is
imperative to identify and rectify them. Debugging is the process of identifying
the underlying cause of an issue and implementing modifications to the code in
order to fix it.
6. Documentation: It is crucial to record the programme and its characteristics for
future consultation.
This encompasses the process of recording the program's
operational capabilities, the algorithms employed, and instructions on how to utilise
the programme.
7. Maintenance: After the programme is implemented, it could necessitate upgrades
or maintenance to rectify errors, incorporate more functionalities, or accommodate
evolving demands. Maintenance encompasses the act of modifying both the code
and documentation in order to ensure the programme continues to operate
accurately
10 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Potential Challenges Faced in Writing Code:
1. Syntactic errors: Syntax errors occur when the code does not conform to the
syntactic rules of the programming language.
These errors could stem from
incorrect spelling, absent or incorrectly placed punctuation, or bad formatting. The
compiler typically identifies syntax mistakes and provides error messages that
specify the line number and type of error. Once detected, these problems can be
easily rectified.
2. Logical errors: Detecting logical mistakes is more challenging compared to syntax
problems due to the fact that the programme continues to execute without any
crashes, however it yields inaccurate results or output. Logical mistakes arise when
there is a defect in the program's reasoning, such as employing an inappropriate
operator, an erroneous sequence of operations, or an inaccurate loop condition. To
identify logical mistakes, one must possess a comprehensive comprehension of the
program's intended functioning and conduct a meticulous review of the code. An
effective method for identifying logical problems involves utilising a debugger or a
trace log, which enables the programmer to systematically analyse the code,
examining each line individually.
3. Runtime errors: Runtime errors arise during programme execution and can result
from various causes, including memory overflow, division by zero, or accessing an
invalid pointer. These errors could lead to a programme malfunction or unexpected
results. Runtime mistakes occur during programme execution and are not detected
by the compiler, making them more difficult to identify. Resolving runtime issues
typically requires examining error messages and utilising debugging tools like stack
traces to identify the underlying cause of the issue..
11 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Sample Run of Fibonacci and Factorial Algorithms:
Sample dry run for Fibonacci series with n = 8:
12 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
13 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
14 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
15 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Software Development Life Cycle
Software development teams employ the Software Development Life Cycle (SDLC)
methodology to strategize, construct, validate, and disseminate top-notch software
products (Mallikarjun and Kulkarni, 2020). Every individual step that is crucial for the
effective culmination of a software project is an integral component of a structured
methodology for software development.
Figure 4 - SDLC Phases
The SDLC process typically includes the following phases:
1. Requirements Gathering and Analysis: This stage entails collecting pertinent
information regarding the project needs from the stakeholders. The development
team scrutinises the criteria to guarantee their comprehensiveness, lucidity, and lack
of ambiguity. This stage facilitates the establishment of clear project objectives
and scope, enabling the team to build a comprehensive project plan for subsequent
stages.
2. Design: During this stage, the development team generates an elaborate design
document that delineates the software's structure, system elements, and their
interconnections. During the design phase, the software blueprint, system models,
flowcharts, diagrams, and other documentation are created to provide guidance for
the development process.
This phase is crucial for ensuring that the software
solution is meticulously created and fulfils both the functional and non-functional
criteria of the project.
16 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
3. Implementation: During this stage, the software undergoes the process of coding
and development. Developers compose the code, arrange software components,
and incorporate the programme into the current systems. The development team
adheres to the design documentation and coding standards in order to create
software of exceptional quality.
This stage represents the point at which the
software starts to materialise and transform into a fully operational product.
4. Testing: During this stage, the programme undergoes rigorous testing to guarantee
its absence of faults or errors. The development team does unit testing, integration
testing, system testing, and acceptance testing in order to detect and rectify errors.
The testing process verifies that the programme satisfies the client's specifications,
is reliable, and functions as anticipated.
5. Deployment: During this stage, the programme is deployed to the production
environment and accessible to the end-users or customers. The development team
deploys the software, conducts any required configurations, and verifies its
seamless operation. This phase encompasses the training of end-users or customers
in the utilisation of the software, as well as the provision of continuous support.
6. Maintenance: During this stage, the software is closely monitored and maintained
to ensure that it consistently satisfies the client's requirements and operates well.
The development team may be required to rectify software defects, provide
enhancements, or adapt the software to accommodate evolving specifications. This
phase guarantees the software's reliability, security, and currenc
17 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Big-O Notation:
Big-O notation is a mathematical notation used to describe the efficiency or time
complexity of an algorithm (Cormen et al., 2009). It demonstrates the correlation between
the running time of an algorithm and the growth in input size. In Big-O notation, just the
most significant term in the algorithm's execution time equation is taken into account. For
example, a polynomial equation provides an accurate estimation of the duration of an
algorithm's execution (Oliveira et al., 2018). The temporal complexity of the Fibonacci
algorithm is O(2^n) due to the necessity to calculate the sum of the preceding two integers
for each number in the sequence. This leads to an exponential growth in the number of
computations necessary as n increases (Sedgewick and Wayne, 2011).
The temporal complexity of the factorial algorithm is O(n) due to the necessity of doing n
multiplications.
1. Linear Search Algorithm: Linear search is a basic searching technique that
examines each element of a list or array sequentially until it locates the desired
element. The temporal complexity of linear search is O(n) in both the best-case
and worst-case scenarios.
•
Best Case: The desired element is located at the start of the list, requiring only
a single comparison. The temporal complexity in this instance is O(1).
•
Worst Case: The target element is either absent from the list or positioned near
the list's conclusion. In this scenario, the number of comparisons required is n,
and the time complexity is O(n).
2. Bubble Sort Algorithm: Bubble sort is an uncomplicated sorting algorithm that
iteratively traverses the list to be sorted, compares each adjacent pair of items, and
exchanges them if they are not in the correct order.
Bubble sort has a time
complexity of O(n^2) in both the best and worst-case scenarios.
•
Best Case: The list is already arranged in a sorted order, and there is no
requirement for any exchanges. The temporal complexity in this instance is
O(n).
•
Worst Case: The list is arranged in reverse sequential order, necessitating the
swapping of each entry with every other element. In this scenario, a total of
n^2 swaps are required, resulting in a temporal complexity of O(n^2).
18 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Efficiency Analysis using Big-O Notation:
The Fibonacci algorithm has an exponential time complexity of O(2^n), indicating that
the execution time grows exponentially with the size of the input. The efficiency of this
technique diminishes significantly for larger values of n due to the exponential growth in
the number of computations required.
The factorial algorithm exhibits a time complexity of O(n), indicating that the execution
time increases linearly as the input size increases.
This algorithm demonstrates high
efficiency when used to small and moderate values of n, but its performance may
deteriorate significantly when dealing with exceedingly large values of n.
It is crucial to assess the efficiency of algorithms using Big-O notation to guarantee their
effectiveness and adaptability for various input sizes. Through the examination of the
temporal complexity of an algorithm, we can ascertain its ability to handle substantial
input sizes and assess the potential for optimising its performance.
Python
Python is a programming language that operates at a high level and is interpreted. It was
first developed in 1991 by Guido Van Rossum. The intention is for the text to be easily
readable and writable, with a direct and uncomplicated syntax (Pierce, 2009). Python is a
versatile programming language that may be applied to various domains such as web
development, scientific computing, data analysis, artificial intelligence, machine learning,
and more (Géron, 2017). Python is extensively utilised in both industry and academics
because to its substantial and dynamic developer community, which actively contributes to
its libraries and ecosystem (Hetland, 2010).
19 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Python Code for Fibonacci and Factorial Algorithms:
Fibonacci Algorithm:
Figure 5 - Fibonacci Algorithm
Factorial Algorithms:
Figure 6 - Factorial Algorithms
20 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Programming Paradigm:
A programming paradigm is a foundational methodology or approach to programming that
dictates the structure and execution of programmes.
The term refers to a collection of
fundamental principles, methodologies, and ideas that establish a structure for constructing
computer programmes (Oliveira and Silva, 2018). Multiple programming paradigms exist,
each possessing distinct characteristics and advantages. Procedural, object-oriented, and
event-driven are the programming paradigms that are most frequently utilised (Deitel et al.,
2017).
Procedural Programming:
Procedural programming is a programming paradigm that emphasises the activities or
procedures used to alter data. The programme employs a hierarchical structure, where
the primary function invokes other functions as required.
The data is often saved in
global variables that are accessible by any function. C, Fortran, and Pascal are among
the widely used programming languages that adhere to this programming paradigm
(Elmasri and Navathe, 2016).
Below is an illustration of a procedural code snippet written in the C programming
language:
The procedural paradigm is characterised by the organisation of the programme around
functions that carry out specified tasks.
The provided code snippet demonstrates the
utilisation of functions to execute tasks and the program's adherence to a top-down
methodology.
21 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Object-Oriented Programming:
Object-oriented programming (OOP) is a programming paradigm that prioritises the use
of objects to embody data and action. An object is a concrete manifestation of a class,
encompassing both data and operations that may be performed on that data.
The
programme employs a bottom-up methodology, wherein objects interact with one another
to accomplish tasks. Java, Python, and C++ are among the widely used programming
languages that adhere to this programming paradigm (Eckel, 2005).
Below is an illustration of a code piece written in Python that follows the object-oriented
programming paradigm:
The key characteristic of the object-oriented paradigm is the organisation of the
programme based on objects that encapsulate both data and behaviour.
The provided
code snippet demonstrates the utilisation of objects to encapsulate both data and
behaviour. Additionally, the programme adheres to a bottom-up methodology.
Event-Driven Programming:
Event-driven programming is a programming paradigm that emphasises the utilisation of
events to initiate actions (Knoernschild, 2015). An event is a discernible incident that
can be identified by the programme, such as a mouse click or a keyboard stroke. The
programme is organised based on events and its corresponding reactions to them.
JavaScript and Python are prominent programming languages that adhere to this paradigm
(Wang & Zhang, 2013).
22 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Here's an example of an event-driven code snippet in Python:
The defining feature of the event-driven paradigm is the organisation of the programme
based on events and its corresponding reactions to them.
The above code sample
demonstrates the utilisation of events to initiate activities and the subsequent program's
response to these occurrences.
Critique of the Code Samples:
The code samples above illustrate the characteristics of the procedural, object-oriented,
and event-driven programming paradigms (Laudon & Laudon, 2016). The above code
snippet demonstrates the utilisation of functions to execute certain tasks, while adhering
to a top-down programming methodology (Deitel & Deitel, 2015). One of the benefits
of this paradigm is its simplicity in comprehension and maintenance. Nevertheless, when
programmes increase in size and complexity, procedural programming can become
intricate and challenging to handle. Additionally, it can lead to the replication of code
and a deficiency in code reusability (Deitel & Deitel, 2015). The provided code snippet
demonstrates the utilisation of objects to encapsulate both data and behaviour.
Additionally, the programme adheres to a bottom-up methodology. An advantage of this
paradigm is its promotion of code reuse and modularity.
Nevertheless, acquiring and
comprehending it can pose more challenges, particularly for novices (Gamma et al.,
1995). The provided code snippet demonstrates the utilisation of events to initiate actions
and the subsequent programme response to these events.
This approach is frequently
employed in graphical user interface (GUI) programming and can simplify the
management of user input and the handling of programme environment modifications.
Nevertheless, inadequate design can result in intricate and challenging-to-handle code
(Stefik et al., 1986).
23 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Typically, the selection of a programming paradigm is contingent upon the particular
project needs and the programmer's own preferences. It is frequently feasible to combine
and interchange paradigms inside a single programme, based on the requirements of
different sections of the code (Laudon & Laudon, 2016).
Pseudocode for Salary Component:
1) The user provides a range of dates for the calculation of salary.
2) The system verifies whether the input date range is within the specified salary cycle
date range.
3) If the condition is not met, present an error message.
4) The user provides the count of absences recorded by the employee within the
designated time frame.
5) The user provides the number of days they were absent within a specific calendar
range.
6) The user provides the number of holidays within the selected date range.
7) The user provides the quantity of additional hours worked within the specified
timeframe.
8) The system computes the value of No-pay by utilising the following formula: The
value of No_pay_value is calculated by multiplying the ratio of Total_Salary to the
salary_cycle_date_range by the number of absence days, No_of_absent_days.
9) The system computes the Base Pay value by applying the formula: Base_Pay_value
= Monthly_Salary + Allowances + (Over_time_rate*no_of_overtime_hours)
10) The system computes the Gross Pay by subtracting the sum of the No Pay value and
the product of the Base Pay value and the government tax rate from the Base Pay
24 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
value. The formula is: Gross_Pay = Base_Pay_value – (No_pay_value +
Base_Pay_value*government_tax_rate)
11) The system stores the No-pay value, Base Pay value, and Gross Pay value in the
database for each employee on a monthly basis.
Database Structure:
The database should include three tables: one for Employee details, one for Salary details,
and one for Settings details.
Employee Table:
•
Employee Name
•
Overtime Rate (hourly)
•
Monthly Salary
•
Employee ID
•
Allowances
Salary Table:
•
Month
•
No. of Absent Days
•
No. of Leaves
•
No. of Holidays
•
No-pay value
•
Base Pay value
•
Employee ID (foreign key)
•
Year
•
No. of Overtime Hours
•
Gross Pay value
Settings Table:
•
Salary cycle begin date
•
No. of Leaves per year
•
Date Range for a salary cycle
•
Salary cycle end date
25 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
IDE
An IDE is an acronym for Integrated Development Environment.
This software
application offers extensive resources to computer programmers for the development of
software. An Integrated Development Environment (IDE) generally comprises a code
editor, a compiler or interpreter, and a debugger, all accessible via a unified graphical user
interface (GUI). The code editor offers syntax highlighting, auto-completion, and many
functionalities to enhance the productivity of programmers when writing code.
A
compiler or interpreter is employed to transform the code into a format that can be
understood by a machine.
flaws in their code.
The debugger enables programmers to identify and rectify
Integrated Development Environments (IDEs) are extensively
utilised in software development across several programming languages such as Python,
Java, C++, and numerous more.
Features of an Integrated Development Environment (IDE):
1. Code Editor: A code editor is a software tool utilised for the purpose of composing,
modifying, and organising source code.
The platform offers a framework for
composing and modifying code, incorporating features such as syntax highlighting,
auto-completion, and code navigation. Code editors are specifically engineered to
possess a low weight and high speed, and they frequently include plug-ins and
extensions to enhance their capabilities.
2. Debugging Tools: Debugging tools facilitate the identification and resolution of
faults in the code. These tools enable developers to sequentially execute the code,
define stopping points, and inspect the program's status as it is running. Debugging
tools are crucial for detecting and rectifying logical mistakes, runtime errors, and
other difficulties that may occur throughout the development process.
3. Build and Compilation Tools: Build and compilation tools streamline the process
of compiling and constructing the code, as well as packaging the application for
deployment. These tools are accountable for transforming the source code into an
executable programme or library. In addition, they have the capability to manage
dependencies, handle build configurations, and automate the process of building.
4. Version Control Integration: Version control integration enables developers to
effectively manage and monitor modifications to code and collaborate with their
team members. Version control solutions such as Git and SVN enable developers
to monitor code modifications, create code branches for new functionalities, and
26 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
integrate code changes from multiple team members.
Integration with Version
control solutions are essential for the management and maintenance of major
software projects
..
5. Project Management Tools: Project management tools facilitate the management of
project files, dependencies, and configurations. These technologies are capable of
monitoring tasks and issues, overseeing project milestones, and producing reports
on project advancement. Project management tools are crucial for guaranteeing
timely and cost-effective project completion.
Evaluation of Using Visual Studio IDE:
The Visual Studio IDE offers a comprehensive range of tools for the development, testing,
and deployment of software applications. The software features a resilient code editor,
debugging utilities, and build and compilation tools that streamline the development
process.
Additionally, it provides support for integrating version control and project
management applications, which facilitate collaborative work among team members.
The utilisation of Visual Studio IDE for application development enhances efficiency,
diminishes the duration of development, and facilitates the delivery of software products
of superior quality.
Conversely, abstaining from utilising an Integrated Development
Environment (IDE) would necessitate developers to employ distinct tools for each phase
of development, resulting in a potential waste of time and an increased likelihood of
mistakes.
Hence, employing an Integrated Development Environment (IDE) such as
Visual Studio proves to be a more proficient and impactful approach to software
application development.
Debugging
Debugging is the systematic procedure of detecting and rectifying faults, bugs, or flaws
in software programmes. The process include identifying the underlying cause of the
issue and implementing necessary adjustments to achieve optimal and expected
performance of the programme. Debugging can be performed manually by sequentially
examining the code, or by utilising debuggers, which enable developers to establish
27 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
breakpoints and monitor variables during programme execution. Proficient debugging is
a crucial aptitude for developers to possess, as it guarantees the excellence and
dependability of software systems.
Debugging process
The process of debugging involves identifying, isolating, and rectifying software
vulnerabilities or errors. The debugging process often involves the following steps:
1. Reproduce the problem: Initially, it is imperative to replicate the issue within a
regulated setting.
This may entail executing the programme under identical
circumstances that led to the issue, encompassing the utilisation of the same input
data, operating system, and software environment.
2. Identify the problem: Once the problem has been replicated, the subsequent step is
to identify the exact issue or flaw. In order to identify the problem in the code, it
may be necessary to examine error messages, review logs, and make use of
debugging tools.
3. Diagnose the problem: Identifying the root cause is the subsequent action once the
problem has been recognised.
To accomplish this, it may be imperative to
scrutinise the code, identify any logical flaws, and employ debugging tools to
systematically analyse the code and pinpoint the problem.
4. Isolate the problem: After determining the underlying cause of the problem, the
subsequent action involves isolating the issue by pinpointing the particular module
or component in the software responsible for the problem.
5. Fix the problem: After identifying the problem, the subsequent course of action is
to rectify it. This may entail making alterations to the code, altering configuration
files, or implementing a patch or upgrade to the software.
6. Verify the fix: Once the problem has been rectified, it is crucial to verify that the
solution has effectively resolved the issue and that the software is operating
accurately.
This may entail conducting tests and simulations to verify that the
software is functioning according to the expected standards.
7. Document the fix: It is imperative to document the solution so that future developers
or support workers can make reference to it. In order to aid users in overcoming
28 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
similar issues, this may involve updating the documentation, annotating the code,
or creating a knowledge base article.
The features available in visual studio for the debugging process
Visual Studio is an influential Integrated Development Environment (IDE) that provides
an extensive array of options for the debugging process.
Notable characteristics
encompass:
1. Breakpoints: Breakpoints serve as a debugging mechanism that allows
programmers to halt the execution of their code at specific lines or points. This
enables them to systematically analyse the code and examine variables. To set
breakpoints, simply click on the line number in the code editor. These breakpoints
may be easily toggled on or off as required. This functionality is especially valuable
for pinpointing and segregating particular sections of code that could be responsible
for mistakes or problems.
2. Watch Windows: Watch windows enable developers to observe variables and
expressions in real-time throughout the execution of their code. This functionality
allows developers to monitor the values of crucial variables and expressions as they
undergo modifications, aiding them in detecting problems and debugging their code
with greater efficiency. Observation windows can be launched and personalised to
exhibit particular variables or expressions, and they can be automatically refreshed
while the code is executed.
3. Call Stack Window: The call stack window exhibits the present call stack, allowing
developers to observe the sequence of steps that their code has followed to reach
the current position. This functionality is especially valuable for pinpointing flaws
or problems in the code, since it enables engineers to track the sequence of function
calls and comprehend the code's execution process.
4. Immediate Window: The instant window is a debugging tool that enables
developers to execute code and assess expressions in real-time throughout the
debugging process.
This functionality is especially advantageous for testing
concise sections of code or for rapidly assessing expressions to comprehend their
values. The current window can be easily accessed and dismissed as required, and
it can be personalised to exhibit the output of particular commands or phrases.
29 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
5. Debugging Toolbar: The debugging toolbar offers convenient access to a range of
debugging instructions, including code stepping, breakpoint toggling, and
debugging process restart. This functionality facilitates developers in navigating
the debugging process with greater efficiency, enabling them to concentrate on
particular sections of the code that might be responsible for bugs or errors.
6. Exception Settings: Exception settings enable developers to customise the
exceptions that will be intercepted throughout the debugging process, facilitating
the identification of faults and bugs. This functionality empowers developers to
manage the categories of errors that are detected and managed by the debugger,
facilitating their concentration on particular sections of the code that might be
responsible for problems.
7. IntelliTrace: IntelliTrace is a debugging functionality that enables developers to
capture and subsequently replay debugging sessions.
This functionality is
especially valuable for detecting and replicating software defects, as it allows
developers to systematically analyse their code and comprehend its execution at
various time intervals. IntelliTrace is a tool that aids in the analysis of intricate
faults or failures. It assists developers in identifying issues that may be arduous to
reproduce or diagnose.
Procedural, Object-orientated and Event-driven paradigms
The Procedural, Object-Oriented, and Event-Driven paradigms are distinct programming
paradigms that offer diverse methodologies for software organization and development.
Although each of these has distinct attributes, they are not mutually exclusive and can be
interconnected in various ways.
Procedural Paradigm
The procedural paradigm arranges code into functions or processes that can be called in a
sequential manner (Szyperski, 2006, p. 11). The statement emphasizes the necessity of
30 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
decomposing the software into smaller, reusable elements to achieve modularization and
enhance the clarity of the code. Variables and functions are often discussed as distinct
entities, with the main focus being on modifying data using procedures. This paradigm is
most appropriate for occupations that can be dissected into a sequence of tasks.
Characteristics of Procedural Paradigm
•
Focus on Procedures: Programs are organized based on procedures or functions that
carry out distinct tasks.
•
Top-Down Design: Programs are created by decomposing the problem into smaller
sub-procedures, establishing a hierarchical structure of execution.
•
Global Data: Depends on global variables to store data, which might result in data
coupling and maintenance problems.
•
Limited Reusability: Functions are reusable, but the paradigm lacks the inherent
modularity provided by object-oriented programming.
•
Emphasis on Algorithms: The primary emphasis is on algorithms and data
manipulation, with a reduced emphasis on representing real-world phenomena.
•
Procedural Abstraction: Highlights the process of converting complex operations
into functions to enhance the clarity and manageability of the code.
Example Languages: C, Pascal, Fortran.
Object-oriented Paradigm
The object-oriented paradigm is centered around the notion of objects, which are specific
instances of classes that embody both data (attributes) and behavior (methods) related to a
singular entity (Szyperski, 2006, p. 13). It promotes the organization of code based on
tangible objects or abstract ideas, enhancing the ability to separate and reuse components.
Objects can establish communication with one another through well specified interfaces.
Inheritance and polymorphism facilitate the creation of hierarchical structures and shared
functionalities. Object-oriented programming (OOP) is highly effective in representing
intricate systems and facilitating code reusability.
Characteristics of Object-Oriented Paradigm
31 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
•
Objects and Classes: Programs are organized based on objects, which are instances
of classes that include both data and behavior.
•
Data Abstraction: Centers on the representation of tangible objects in the real world
through the abstraction of their characteristics and actions into classes.
•
Encapsulation: Classes encapsulate both data and methods, ensuring regulated
access to them.
•
Inheritance: Enables the creation of novel classes by inheriting the characteristics
and behaviors of existing classes.
•
Polymorphism: Enables objects from different classes to be treated as instances of
a common base class, simplifying the reuse of code.
•
Message Passing: Objects engage in communication by transmitting messages to
invoke methods on other objects.
Example Languages: Java, C++, Python.
Event-Driven Paradigm
The event-driven paradigm is centered around the handling and processing of events that
occur in the software's environment, such as user interactions, sensor inputs, or other
occurrences (Szyperski, 2006, p. 15). It involves organizing the program's sequence of
actions based on events and their corresponding event handlers.
This paradigm is
commonly employed in graphical user interfaces (GUIs), where user inputs trigger specific
actions.
Event-driven programming streamlines the handling of asynchronous
programming tasks, facilitating the management of complex interactions and concurrent
activities.
Characteristics of Event-driven Paradigm
•
Event Handling: Programs are organized based on their ability to react to events
that are initiated by user actions or system events.
•
Event-Listener Model: Components autonomously subscribe to specific events,
enabling asynchronous execution.
•
User Interaction: Emphasizes the development of user interfaces that are both
interactive and responsive.
32 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
•
Event Propagation: Events are sent to suitable listeners, typically using a hierarchy
or bubbling method.
•
Loose Coupling: Modularity is enhanced by decoupling components using eventbased communication.
•
Asynchronous: Events can be processed autonomously from the main program
flow, resulting in interfaces that are prompt and responsive.
Example Frameworks: Windows Forms, JavaFX, JavaScript/HTML5 for web applications.
Relationship between Procedural, Object-orientated and Event-driven paradigms
Procedural and Object-Oriented
These paradigms can be employed collaboratively by encapsulating procedural code within
object methods (Szyperski, 2006, p. 16). Within an object-oriented program, it is possible
to have procedural processes that directly manipulate the data properties of objects. This
combination facilitates the development of modular and reusable code while maintaining
the procedural approach for specific tasks.
Event-Driven and Object-Oriented
Event-driven programming often relies on the principles of object-oriented programming
(Szyperski, 2006, p. 17). GUI frameworks commonly incorporate the generation of objects
(widgets) that react to user events through event handlers (methods). The Object-Oriented
Programming (OOP) paradigm enables the consolidation of event-related actions and data
within objects, leading to the development of well-organized and modular event-driven
programs.
Event-Driven and Procedural
In order to manage the sequence of events, it is possible to combine the procedural
paradigm with the event-driven paradigm (Szyperski, 2006, p. 18). Event-driven systems
sometimes utilize procedural code within event handlers to perform specific event-related
tasks, such as data validation or change.
While each paradigm possesses unique characteristics, they are not mutually exclusive.
Due to these associations, developers are able to create software architectures that are well33 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
organized, modular, and adaptable, effectively catering to the many requirements of
modern applications.
Activity 3
Procedure for implementing the function using an algorithm
Step 01: Commence
Step 02: Choose the category of car rental “with or without Driver”
Step 03: Retrieve customer data by inputting their National Identification Card (NIC)
number
Step 04: Align the beginning and ending dates of the employment
Step 05: Assess the availability of drivers and choose an appropriate one for the tour
Step 06: Determine the number of days using
Step 07: Calculation of the number of weeks/months
Calculation of weeks ( No. of days/7)
Month calculation (No. of days/30)
Step 08: Rent Calculation Summation
34 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Total rent = daily charge +monthly charge + weekly charge + driver charge
Pseudo code
Function RentCalculation (RentedDate, ReturnDate, RegNo, WithDriver)
NoDays= ReturnDate-RenteDate
Months= NoDays/30/*Assumed 30 days per Month */
Remainder= months%30
Weeks = remainder /7
Days= remainder%7
Find the required vehicle record from vehicle table
35 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
If (found) then
b. Algorithm Steps for Day tour Calculation
Step 01: Start
Step 02: Retrieve the clients' information by utilizing their National Identification Card
(NIC) number.
Step 03: Choose the package that the consumer desires to purchase
Step 04: Choose the car number and vehicle type based on the customer's request
Step 05: Choose the appropriate driver based on its availability
Step 05: Please provide the start and end dates for the rental period
Step 06: Calculate the No.of days using
36 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Step 07: Record the initial and final kilometer readings
Step 08: Determine the cost for each additional kilometer
Charge for extra Km = (No.Km driven – package limit) * extra Km rate
Step 09: Determine the fee for additionaal duration utilized
Charge for extra time = (total time – package limit time) * extra time rate
Step 10: Total rent calculation
Package rate + Extra Km Charge + Extra time charge
Pseudocode
Function DayHireCal (packID, StartTime, Endtime, StartKm, EndKm)
Find the required package record from packagetable
If(found) then
37 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
c. Algorithm Steps to Long tour – hire calculation
Step 01: Start
Step 02: Get the customers details using their NIC number
Step 03: Select the package the customer wants to buy
Step 04: Select the vehicle number and vehicle type according to the customer preference
Step 05: Select the suitable driver according to the availability
Step 06: Enter the start & end date of the hire
Step 07: Calculate the No.of days using
Step 08: Mark the Start & end Km reading
Step 09: Calculate the charge for extra Km
38 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
39 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Rental Management Interface and the code
40 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
41 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
42 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
43 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
44 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
45 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
46 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
47 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
48 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Features of the IDE tool
1) Code editor
Practically all IDEs include a text editor specifically built for writing and manipulating
source code. While several tools may have visual elements for the purpose of dragging
and dropping front-end components, the majority of tools feature a straightforward
interface that includes syntax highlighting specific to the programming language being
used. The code editor facilitates the detection of syntax mistakes in various programming
languages and provides recommendations for correct coding practices.
below suggests that it is advisable to replace the wrong term.
49 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
The graphic
2. Debugger
This feature facilitates the process of discovering, isolating, and rectifying a problem, or
alternatively, finding an alternative method to address it.
detecting and resolving issues inside source code.
Debugging tools aid users in
Frequently, they replicate genuine
situations to evaluate the functionality and performance.
Programmers and software
engineers typically have the ability to test different sections of code and detect faults prior
to the release of the application.
50 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
3. Compiler
Compilers are software components that convert programming language into machinereadable form, typically binary code. An analysis is conducted on the machine code to
verify its precision.
Subsequently, the compiler analyzes and optimizes the code to
enhance performance.
4. Designing
Windows Forms is utilized for constructing graphical user interface (GUI) programs. The
layout can be managed by binding the display data to data sources such as databases or
queries.
51 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Evaluation between programming with IDE and programming without IDE
1. Testing is essential to ensure that your user does not encounter a scenario
where the code fails to handle a specific fault and causes the program to
crash. Debugging allows you to execute the program, pausing the code at
specific places to examine the values of variables or other relevant
information, in order to confirm that the code and functions are operating
correctly.
2. Although an Integrated Development Environment (IDE) is not strictly
necessary for writing a program, the additional functions it offers are highly
advantageous.
Code insight is a valuable feature offered by an IDE,
allowing the application to comprehend the entered code and provide helpful
suggestions. The program has the capability to modify the color of text in
order to visually distinguish between various classes, functions, and
variables.
3. IDEs provide type clues whenever feasible, making it advantageous to utilize
type annotations in Python. In a small application, the significance of this
is minimal, as you can likely recall or readily search for the specific type of
a given variable.
4. To handle the increasing complexity of a software application, it is necessary
to effectively manage the compilation order of files, external library
dependencies, and the removal of intermediate files.
Developing
compilation scripts and configuring the environment for intricate programs
can be a challenging endeavor, but entrusting this activity to an Integrated
Development Environment (IDE) can significantly reduce the time and effort
required.
From my perspective, utilizing an Integrated Development
Environment (IDE) is the superior choice for novice individuals based on the
aforementioned considerations.
However, a proficient programmer is
capable of coding without relying on an Integrated Development
Environment (IDE). They typically work with a text editor frequently.
52 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Design And build a small system to calculate.
The Features that are offered by debugging
1. Hover mouse to evaluate expression
Debugging might provide a significant challenge for novice individuals.
Analyzing a
function to identify the cause of an error, examining the call stack to determine the origin
of a specific value.
The debugger serves a broader purpose than merely investigating
crashes and unusual behavior. To prevent many errors, it is advisable to systematically
analyze a newly created function by walking through it and verifying that it performs as
intended. Typically, it does not entail modifying the code and then rebooting the system.
53 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
2. Change values on the fly
The debugger serves a broader purpose beyond its function of examining crashes and
unusual behavior. To minimize the occurrence of defects, it is advisable to meticulously
examine a newly developed function by systematically evaluating its behavior to ensure it
aligns with the intended expectations.
In the majority of circumstances, it does not
necessitate modifying the code and initiating a restart.
To modify a variable, simply
position the mouse cursor over it, perform a double-click action on the value, and enter the
desired replacement.
3. Set next statement
An example of a common debugging scenario involves determining the cause of a function
call failure by examining the error returned by another function that was called. Would
you like to initiate the process of identifying and resolving errors in the program?
An
alternative suggestion is to move the yellow statement marker to the desired line of
execution, such as the function that has encountered an error, and proceed by stepping in.
Is it not straightforward?
54 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
4. Threads window with stacks
Debugging multi-threaded apps can be a challenging and arduous task. Alternatively, it
can be enjoyable. The answer to your question is contingent upon the specific debugger
you are using. An excellent attribute of Visual Studio 2010 is the stack view present in
the threads panel. From the window, you can easily see a comprehensive overview of all
your threads and instantly browse through their call stacks.
The provided screenshot
displays two concurrent processes of a MacOS program. One of the threads is currently
in a state of waiting for a specific event to occur.
5. Setting breakpoints on the fly
Visual Studio has a convenient functionality that allows users to establish and remove
breakpoints during program execution, resulting in time savings. VisualGDB facilitates
this process by smoothly halting the debugged program upon the addition or removal of a
breakpoint, and promptly resuming its execution thereafter.
In addition, the Enterprise
edition provides the capability to customize the approach that VisualGDB should employ
to halt the target, such as issuing an interrupt command or executing a custom script.
55 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Coding Standards I have used in my code.
During the development of this application, I have adhered to various coding standards.
These include implementing a well-organized file structure, incorporating descriptive
comments, following consistent indentation patterns, and properly declaring variables.
Nevertheless, these coding standards are highly valuable and essential for my Ayubo drive
application.
Use of comments
A comment is a textual annotation within the source code of a computer program that is
intended for the understanding of programmers. They are included in order to enhance the
readability of the source code for humans and are typically disregarded by compilers and
interpreters. Nevertheless, I have employed comments to elucidate the calculations that
occur.
Renaming of the tables
When creating databases, the tables have been renamed based on the name of the
corresponding form.
56 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Variable declaration
The variables are declared at the beginning of each code block to explicitly specify the
data type that can be inputted into the corresponding field. All variables must be declared
using their full names for clarity and ease of understanding.
Indentation patterns
Indentation is a crucial element in all programming domains. Indentation refers to the act
of positioning text either to the right or left in order to create a visual separation from the
surrounding text. Indent style refers to a set of rules that dictate how blocks of code should
be indented in order to clearly represent the structure of a program.
57 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Coding standard for team
When working on application development as a team, it is crucial to establish and adhere
to coding standards. Coding guidelines facilitate the development process by enabling
software development teams to produce uniform code that is comprehensible and legible
to all team members. Implementing such guidelines can pose challenges if executed
incorrectly, but it can greatly benefit the entire team if executed properly. The
implementation of coding standards within a team serves to mitigate the potential for
project failure. Additionally, adherence to these coding standards aids developers in the
ongoing maintenance of the software. The coding standards within a team serve to
mitigate the risk of project failure and decrease complexity. Another significant advantage
for a team is the ability to recognize the continuous progress of fellow team members who
may be working on different components of the same application. If a team consistently
adheres to a coding standard, it enables seamless team switching as everyone is wellversed in the development process. Following coding standards facilitates the process of
making necessary code modifications. Coding standards are crucial and beneficial for a
team.
Coding standard for individual
Adhering to a coding standard is of utmost importance when working independently. The
process of developing a program by a team differs from how an individual would develop
it. Adhering to coding standards is beneficial for individuals as it provides a
comprehensive understanding of the code and facilitates seamless collaboration with
other developers. Furthermore, a significant advantage is the seamless transferability of
the project to another programmer. This can be accomplished without any confusion, as
the coding is easily comprehensible when a consistent pattern is adhered to throughout
the program. Adhering to coding standards during personal development facilitates the
individual's ability to embrace changes and adopt contemporary methodologies. By
adhering to appropriate coding standards, it is feasible to modify the system in a manner
that is comprehensible to anyone. The coding standards are of utmost importance for
individuals.
58 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
References
1. Microsoft documentation: https://docs.microsoft.com/enus/visualstudio/debugger/debugging-in-visual-studio?view=vs-2022
2. YouTube video tutorial: https://www.youtube.com/watch?v=CWY9viEiZf4
3. Microsoft documentation: https://docs.microsoft.com/en-us/dotnet/csharp/
4. C# Station tutorials: http://csharp-station.com/tutorial.aspx
5. Microsoft documentation: https://docs.microsoft.com/enus/dotnet/framework/data/adonet/sql-server-connection-pooling
6. C# Corner tutorial: https://www.c-sharpcorner.com/article/c-sharp-and-sql-serverconnection/
7. Microsoft documentation: https://docs.microsoft.com/enus/dotnet/desktop/winforms/?view=netdesktop-5.0
8. YouTube video tutorial: https://www.youtube.com/watch?v=x9XZHmzLLDI
9. Microsoft documentation: https://docs.microsoft.com/enus/dotnet/csharp/programming-guide/concepts/object-oriented-programming
10. TutorialsPoint tutorial:
https://www.tutorialspoint.com/csharp/csharp_object_oriented.html
11. Microsoft documentation: https://docs.microsoft.com/enus/dotnet/csharp/programming-guide/concepts/linq/
12. C# Corner tutorial: https://www.c-sharpcorner.com/UploadFile/8911c4/linqtutorial-in-C-Sharp/
13. Microsoft documentation: https://docs.microsoft.com/en-us/aspnet/mvc/
14. YouTube video tutorial: https://www.youtube.com/watch?v=E7Voso411Vs
15. Microsoft documentation: https://docs.microsoft.com/en-us/ef/
16. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to
algorithms. MIT Press. Dasgupta, S., Papadimitriou, C. H., & Vazirani, U. V.
(2006). Algorithms. McGraw-Hill Education. Kleinberg, J., & Tardos, É. (2006).
Algorithm design. Pearson Addison-Wesley.
59 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
17. Aman, F. A., & Muniandy, S. (2017). Pseudocode-Based Learning Tool for
Programming Fundamentals: A Review. Advanced Science Letters, 23(9), 85268530. doi: 10.1166/asl.2017.10113
18. Mallikarjun, S., & Kulkarni, A. (2020). An implementation of software
development life cycle phases. International Journal of Scientific & Engineering
Research, 11(6), 926-931.
19. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to
algorithms. MIT press.
20. Oliveira, L. M., Nascimento, L. D., & Junior, P. R. P. (2018). Comparison of
Sorting Algorithms: An Application with Java Language. Brazilian Journal of
Development, 4(5), 2898-2910.
21. Sedgewick, R., & Wayne, K. (2011). Algorithms (4th ed.). Addison-Wesley
Professional.
22. Van Rossum, G. (1995). Python tutorial. Technical Report CS-R9526,
Amsterdam, The Netherlands: Centrum voor Wiskunde en Informatica.
23. Pierce, J. (2009). Python programming: An introduction to computer science.
CreateSpace Independent Publishing Platform.
24. Géron, A. (2017). Hands-On Machine Learning with Scikit-Learn and
TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems.
O'Reilly Media, Inc.
25. Hetland, M. L. (2010). Python for beginners: A Python tutorial. Lulu. com.
26. Deitel, P., Deitel, H., & Choffnes, D. R. (2017). Operating systems: principles and
practice. Pearson. Elmasri, R., & Navathe, S. B. (2016). Fundamentals of database
systems. Pearson. Oliveira, P., & Silva, H. (2018). Programming Paradigms: A
Survey on the Main Categories. IEEE Revista Iberoamericana de Tecnologías del
Aprendizaje, 13(1), 14-22.
27. Eckel, B. (2005). Thinking in Java. Prentice Hall.
28. Knoernschild, K. (2015). Java Application Architecture: Modularity Patterns with
Examples Using OSGi. O'Reilly Media, Inc.
29. Wang, Y., and Zhang, J. (2013). A practical event-driven programming course. In
2013 IEEE International Conference on Teaching, Assessment and Learning for
Engineering (TALE) (pp. 216-220). IEEE.
60 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
30. Deitel, P. J., & Deitel, H. M. (2015). Java: How to Program, Early Objects (10th
ed.). Pearson. Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1995). Design
Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley.
31. Laudon, K. C., & Laudon, J. P. (2016). Management Information Systems:
Managing the Digital Firm (14th ed.). Pearson.
32. Stefik, M., Bobrow, D. G., Kahn, K., & Lanning, S. (1986). Intermedia: The
Architecture and Construction of an Object-Oriented Environment and its User
Interface. IEEE Computer, 19(1), 31-42.
61 | P a g e
Unit 01|Programming|Ishanka Anuruddha (E159212)
Download