SDD Ahsan
SDD Ahsan
for
By
Muhammad Ahsan
F21BDOCS1M01086
Session Fall 2021 – 2025
Supervisor
Mr. Fahad Ali
A
Table of Contents
Introduction ................................................................................................................................................................. 1
Design methodology and software process model ...................................................................................................... 1
Design Methodology: Procedural Programming ..................................................................................................... 1
Process Model: Agile Methodology ........................................................................................................................ 1
System Overview ......................................................................................................................................................... 2
Context and Design: ................................................................................................................................................. 2
Background: ............................................................................................................................................................. 2
Architectural design ................................................................................................................................................. 2
Line Box Diagram ....................................................................................................................................................... 3
Process flow/Representation........................................................................................................................................ 4
Activity Diagram ..................................................................................................................................................... 4
Design models ............................................................................................................................................................. 5
Data Flow Diagram .................................................................................................................................................. 5
Sequence Diagram ................................................................................................................................................... 6
Data design .................................................................................................................................................................. 9
Data dictionary ......................................................................................................................................................... 9
Algorithm & Implementation .................................................................................................................................... 10
Voter Registration .................................................................................................................................................. 10
Voter Login ............................................................................................................................................................ 11
Admin Login .......................................................................................................................................................... 11
Create Ballot .......................................................................................................................................................... 11
Add Candidate ....................................................................................................................................................... 12
Cast Vote................................................................................................................................................................ 12
Display Results ...................................................................................................................................................... 13
Software requirements traceability matrix ................................................................................................................ 13
Human interface design ............................................................................................................................................. 13
Screen images ........................................................................................................................................................ 15
B
Table of Figures
Figure 1: Line Box Diagram ........................................................................................................................................ 3
Figure 2: Activity Diagram.......................................................................................................................................... 4
Figure 3: Data Flow Diagram ...................................................................................................................................... 5
Figure 4: Sequence Diagram ....................................................................................................................................... 6
List of Tables
Table 1: Data Dictionary ............................................................................................................................................. 9
Table 2: Software Traceability Matrix ...................................................................................................................... 13
C
Revision History
Name Date Reason for changes Version
D
Application Evaluation History
Supervised by
Mr. Fahad Ali
Signature
E
Introduction
The scope of this BS Computer Science project is to develop a secure and efficient online
voting system for localized use, enabling users to cast votes remotely through a user-friendly
web-based platform. The system includes key modules such as user registration and login,
candidate management, vote casting, and election result display. Admin functionalities, such
as managing candidates and controlling election timings, ensure fair and organized elections.
Designed with scalability and reliability in mind, the platform prioritizes security, data
integrity, and ease of use to facilitate transparent elections within the specified region.
• Simplicity: For a BS-level project with clearly defined tasks, procedural programming
provides a logical structure that is easy to understand and implement.
• Ease of Debugging: Procedural programming allows for easier testing and debugging
of individual functions, ensuring that each component works as intended before
integrating them.
Process Model: Agile Methodology
Although this project will be developed independently, the Agile Methodology is still a
suitable choice for the following reasons:
• Iterative Development: Agile allows the project to be divided into smaller modules
(e.g., user registration, voting process, result computation), which can be developed,
tested, and refined one step at a time.
• Flexibility: Agile provides the flexibility to adjust and improve the system as new ideas
or minor changes arise during development.
1
System Overview
The Online Voting System is a secure, web-based application designed to simplify the voting
process by allowing users to cast their votes remotely while ensuring privacy, accessibility,
and reliability. Key features include user authentication, vote casting, and transparent result
reporting. The system is tailored for elections, surveys, and organizational decision-making,
addressing the need for digital alternatives to traditional voting methods.
Context and Design:
• Functionality: Provides seamless user registration, login, vote submission, and result
display.
• User Experience: Features a user-friendly interface designed to minimize errors and
improve accessibility for voters.
• Technologies: Built with React.js for the frontend and Node.js for the backend, ensuring
efficient state management and smooth data flow between system components.
Background:
Traditional voting systems, such as paper-based ballots, often face problems like being time-
consuming, costly, and less accessible for many voters. With the rise of technology, there is a
growing need for an online voting system to make the process easier and more efficient. This
system allows users to vote remotely from anywhere while ensuring privacy and security. It
eliminates geographical barriers and reduces the cost and effort of manual vote counting. By
using modern technologies like React.js and Node.js, the system provides a simple, reliable,
and transparent voting experience.
Architectural design
The architectural design of the online voting system is based on a modular structure. Each
module handles a specific aspect of the system's functionality, ensuring efficient management
and scalability. This modular approach enhances maintainability and allows for easier updates
and improvements. The main modules include:
• Voter Registration:
Handles the collection and storage of voter details during the registration process.
• Voter Login:
Manages the authentication of registered voters to provide secure access to the system.
• Admin Login:
Manages the authentication of admins and grants access to administrative
functionalities.
• Ballot Creation:
Allows admins to create and manage election ballots.
• Election Timings
Enables admins to set and manage the election start and end times
• Vote Casting
Facilitates the secure process for voters to cast their votes
• Result Viewing
Displays election results to voters in a user-friendly manner.
2
Module Relationships:
• Voter Registration ↔ Voter Login: Voters must register first using the Voter
Registration module before they can log in through the Voter Login module.
• Admin Login ↔ Ballot Creation, Election Timings: Only authenticated admins can
access the Ballot Creation module to create and manage election ballots. They can also set
and manage election timings using the Election Timings module.
• Ballot Creation, Election Timings: ↔ Vote Casting: Voters use the Vote Casting
module to cast their votes based on the ballots created by admins in the Ballot Creation
module. The Vote Casting module is only available to voters during the election timings
set by admins in the Election Timings module.
• Vote Casting: ↔ Results Viewing: The votes cast by voters through the Vote Casting
module determine the results displayed in the Result Viewing module.
3
Process flow/Representation
In this section, I am going to explain the activity diagram to demonstrate the major processes
on my website and how they flow to achieve the intended goals. An Activity Diagram is a type
of UML diagram that represents the flow of activities or actions in a system, showcasing the
sequence and conditions for coordinating lower-level behaviors. It is used to model the
dynamic aspects of a system.
Activity Diagram
Figure 2 illustrates the step-by-step activity flow for users and admins:
4
Design models
The Online Voting System is designed to simplify and secure the election process for both
voters and administrators. It facilitates the entire process from voter registration, login, and
casting votes to managing election configurations and viewing results. The DFD provides a
clear flow of data between different users, processes, and the central database. The system has
been designed using a procedural approach with a multi-level Data Flow Diagram (Figure
3), extending to Level 2 for clarity and Sequence Diagram (Figure 4). The processes, data
flows, data stores, and external entities have been mapped comprehensively to ensure an
efficient and user-friendly experience.
5
Sequence Diagram
6
Actors and Entities
• Voter (External Entity)
The voter interacts with the system to register, log in, cast their vote, and view the
results.
• Admin (External Entity)
The admin oversees the election process, manages candidates, creates and deletes
ballots, and adjusts election timings.
• Voting System Database (Data Store)
Centralized storage for voter information, login credentials, ballot data, vote records,
and election results.
o Data Flow:
▪ Input: Voter details.
▪ Output: Registration status.
▪ Data Store Interaction: The voter information is stored in the database.
• Login Process
o Process: Login
The voter enters login credentials to access their account.
o Sub-Process: Validate Registration
o Data Flow:
▪ Input: Login credentials.
▪ Output: Login status.
▪ Data Store Interaction: User credentials are validated using data stored
in the database
7
• Voting Process
o Process: Cast Vote
The voter selects their preferred candidate on the ballot.
o Sub-Process: Validate Vote
The system ensures the voter is eligible to cast a vote.
o Data Flow:
▪ Input: Selected candidate.
▪ Output: Vote confirmation.
▪ Data Store Interaction: The vote is recorded in the database.
• Election Management (Admin)
o Process: Manage Candidates
The admin can manage candidates by creating or deleting ballots, as well as
adjusting election timings.
o Sub-Process: Create or Delete Ballots and Set Election Timings
The system ensures the voter is eligible to cast a vote.
o Data Flow:
▪ Input: Ballot configurations.
▪ Output: Updated ballot data.
▪ Data Store Interaction: Ballot configurations are saved to or removed
from the database.
• Results Process
o Process: Display Results
Throughout the election, voter can see the result on click and after election
ends, on click will display final results.
o Data Flow:
▪ Input: Election data from the database.
▪ Output: Election results displayed to voters.
▪ Data Store Interaction: The system dynamically retrieves and
processes the requested data without storing intermediate results.
8
Data design
The information domain of the system is transformed into structured relational data models
stored in a database. The major entities are:
• Ballots: Represents the election events, including their timing and title.
• Votes: Captures the votes cast by voters for specific candidates on specific ballots
Tables
• Voters Table: Stores voter information for registration and authentication.
• Admins Table: Stores admin credentials and roles for managing elections.
• Votes Table: Records votes cast by voters, linking them to ballots and candidates.
• Foreign Keys: Establish relationships between tables (e.g., ballotID links Candidates
to Ballots).
Data dictionary
Below is the list of system entities and their attributes, arranged alphabetically for clarity:
Table 1: Data Dictionary
9
Functions and Parameters
• registerVoter()
o Parameters: name, email, password, Nic
o Description: Registers a new voter and stores their details in the Voters table.
• validateRegistration()
o Parameters: email
o Description: Ensures no duplicate email exists in the system.
• loginVoter()
o Parameters: email, password
o Description: Authenticates a voter and grants access to the voting system.
• loginAdmin()
o Parameters: username, password
o Description: Authenticates an admin and grants access to administrative
functionalities.
• createBallot()
o Parameters: ballotID, title, startTime, endTime
o Description: Creates a new ballot and stores it in the Ballots table.
• addCandidate()
o Parameters: candidateID ,ballotID, candidateName, party
o Description: Adds a candidate to a specific ballot.
• castVote()
o Parameters: voterID, ballotID, candidateID
o Description: Records a voter’s vote in the Votes table.
• validateVote()
o Parameters: voterID, ballotID
o Description: Ensures the voter is eligible to vote and hasn’t already voted on
the same ballot.
• displayResults()
o Parameters: ballotID
o Description: Retrieves and computes the results of the specified ballot.
10
End
Voter Login
Function loginVoter(email, password):
Input: email (String), password (String)
Output: Login success or failure
Begin
1. Check if the email exists in the database.
If not:
Return "Error: Email not found"
2. Retrieve the password from the database.
3. Compare the input password with the password
If passwords do not match:
Return "Error: Incorrect password"
4. Mark the user as logged in (session management).
5. Return "Login successful"
End
Admin Login
Function loginAdmin(Email, Password):
Input: adminEmail (String), adminPassword (String)
Output: Login success or failure
Begin
1. Check if Email exists in the database.
If not:
Return "Error: Admin not found"
2. Verify Password.
If incorrect:
Return "Error: Incorrect password"
3. Allow access to admin functionalities.
4. Return "Admin login successful"
End
Create Ballot
Function createBallot(ballotID, ballotTitle, startTime,
endTime):
Input:
ballotID (String): The ID of the ballot.
ballotTitle(String):The title or name of ballot.
startTime(DateTime):The start time for the ballot.
endTime(DateTime): The end time for the ballot.
Output:
Success or failure message.
Begin
Validate the input:
a. Ensure `ballotTitle` is not empty.
b. Ensure `startTime` is earlier than
`endTime`.
c. If validation fails, Return "Error: Invalid
input."
Check if a ballot with the same id already exists in the
database.
If found:
Return "Error: Ballot id already exists."
11
Save the ballot information (ballotID, ballotTitle,
startTime, endTime) to the database.
Return "Ballot created successfully."
End
Add Candidate
Function addCandidate(ballotID, candidateID,
candidateName, party):
Input: ballotID (String), candidateID(String),
candidateName (String), party (String, optional)
Output: Candidate addition success or failure
Begin
1. Check if ballotID exists in the Ballots table.
If not:
Return "Error: Ballot not found"
3. Insert candidateName, party, and ballotID into
the Candidates table.
4. Return "Candidate added successfully"
End
Cast Vote
Function castVote(voterID, ballotID, candidateID):
Input: voterID (String), ballotID (String),
candidateID (String)
Output: Vote submission success or failure
Begin
1. Check if the voterID exists in the Voters table.
If not:
Return "Error: Voter not found"
2. Check if the ballotID is active and within
voting time.
If not:
Return "Error: Ballot not active or voting
period expired"
3. Verify that the voter has not already voted for
this ballot.
If already voted:
Return "Error: Voter has already cast a
vote"
4. Record voterID, ballotID, and candidateID in
the Votes table.
5. Return "Vote cast successfully"
End
12
Display Results
Function displayResults(ballotID):
Input: ballotID (String)
Output: List of candidates with vote counts
Begin
1. Check if the ballotID exists in the Ballots
table.
If not:
Return "Error: Ballot not found"
2. Retrieve all candidates and their vote counts
for the ballot from the Votes table.
3. Sort candidates by vote count in descending
order.
4. Return the sorted list of candidates with their
respective vote counts.
End
13
• Voter Registration
• Voter Login
o Functionality: Voters log in using their Email and Password.
o Actions: Enter credentials and click Login.
o Feedback: Successful login redirects to the voting page; error message for
invalid credentials.
• Casting Votes
o Functionality: Voters select a candidate from the ballot.
o Actions: Choose candidate and click Vote.
o Feedback: Confirmation message "Vote cast successfully" or error if election
time has ended.
• Admin Login
• Create Ballots
o Functionality: Admins create ballots by entering details (Title, Start/End
Time).
o Actions: Fill out form and click Create Ballot.
14
• Manage Candidates
Screen images
The screen images below represent the expected user interface of the online voting system,
showcasing the main actions for both voters and admins.
Screen Image 1: Login for Admin or Voter Screen Image 2: Voter Registration
15
Screen Image 4: Ballots for Voters
zz
16
Screen objects and actions
• Text Fields (Registration/Login): Users enter personal details or credentials.
17