Encoder Program Development Report
Encoder Program Development Report
COURSEWORK
Word Count: 5222 words
Table of Figures
Figure 1 Encoder Winform Version ................................................................................ 22
Figure 2 String Processing Class Diagram ...................................................................... 25
Figure 3 String Processing Use Case Diagram ................................................................ 26
Figure 4 Encoder Class Diagram ................................................................................... 27
Figure 5 Encoder Use Case Diagram ............................................................................. 28
Version 1: StringProcessing
Goal: Implement a foundational class for encoding capital-letter strings using a Caesar
Cipher, with validation, encapsulation, and comprehensive testing.
This helps focus on reliable input handling and helps meet the criteria for
data validation, user guidance, and program robustness.
o Explanation: The Print method simply returns the last encoded string stored
in the private encoded field.
o
o Explanation: This method converts each character of input S to its ASCII
code then return it. This feature helps meet the Requirements criteria on
ASCII input for analysis.
o Explanation: The OutputCode method returns ASCII codes for the encoded
string, handling the case where no encoding has occurred by returning an
empty array. This feature helps meet the Requirements criteria on ASCII
output and data validation for analysis.
o This robust validation aligns with the Description of the System’s focus on
input integrity.
Version 2: Encoder
Goal:
Extend StringProcessing into a versatile Encoder class supporting multiple encoding
algorithms for strings and numbers, with history logging, Excel export, and integration
hooks for a GUI.
Design and Implementation
• Constructor:
o Sets up private fields: history list, Excel path, sorted flag, original input.
o
o Explanation: The constructor initializes private fields: historyItems
(encoding history list), historyExcelPath (Excel file path), isSorted (sorting
flag), and originalInput (raw input).
o Explanation: The OutputCode method displays the encoded result and its
ASCII codes, providing a clear output summary. This functionality supports
the Description of the System’s emphasis on result presentation.
<<ProcessNumberEncoding>>
Description:
The interface is organized into clearly defined sections:
• Input Type: Allows users to select between String or Number inputs, with optional
sorting for strings.
• Encoding Options: Users can choose the desired encoding method from a
dropdown list.
• Parameters: Includes input fields for Shift Value, Target Base, and Key Value
depending on the selected encoding type.
• Output: Displays the encoded/decoded result, along with its ASCII representation.
• History: A list box (lstHistory) logs previously processed entries for reference.
• Generate Button: Executes the encoding process using the selected options and
input parameters.
Figure 1 Encoder Winform Version
2. Overall Description
2.1. Product
The Encoder Program processes uppercase A–Z strings and integers, offering encoding
methods like Caesar Cipher, XOR, Atbash, Base Conversion, and more. It maintains an in-
memory encoding history, exportable to Excel, and provides a WinForms interface for
intuitive interaction, reusing console logic for reliability.
2.2. Users
The primary users are students, educators, and hobbyists interested in basic encoding
techniques. They require an accessible tool for learning or applying simple data
transformations, with minimal technical expertise assumed.
3. System Features
3.1. Description
The system supports encoding strings (e.g., Caesar Cipher, XOR) and numbers (e.g., Base
Conversion, Bitwise NOT), with optional string sorting and ASCII code display. It logs
encoding operations and exports history to Excel, with a GUI for user interaction.
• FR2: Encode integers (≤40 digits) using Base Conversion, XOR, Bitwise NOT, or
Binary Formatter.
• FR3: Validate inputs, rejecting non-uppercase letters for strings or non-integers for
numbers.
• FR5: Export history to an Excel file, appending new entries without overwriting.
• FR6: Provide a WinForms GUI to input data, select encoding types, view results, and
display history.
5. Platform Requirements
The program requires Windows 10 or later, .NET Framework 4.7.2+, and the
[Link] library. It needs 100 MB of storage for the application and
Excel files, with 512 MB RAM for smooth operation.
6. Quality Attributes
6.1. Performance
The system must process encodings in <1 second for inputs ≤40 characters/digits and
export history to Excel in <2 seconds for up to 100 entries.
6.2. Security
Input validation prevents invalid data from corrupting the system. History files are stored
locally without encryption, suitable for non-sensitive educational use.
6.3. Safety
The program poses no safety risks, handling only user-provided data without external
network access or critical system interactions.
Part 3: UML Diagram
The following UML diagrams represent the design of the StringProcessing Program and
Encoder Program, as developed in Part 1. The StringProcessing Program focuses on
basic Caesar Cipher encoding, while the Encoder Program supports multiple encoding
methods, history tracking, and a WinForms GUI. These diagrams align with the Description
of the System, reflecting the evolution from a simple encoder to a versatile system with a
user-friendly interface.
Version 1: StringProcessing
[Link]
Caption: The Class Diagram for the StringProcessing Program illustrates a simple
structure with the StringProcessing class encapsulating Caesar Cipher logic and the
Program class driving the console-based testing.
The StringProcessing class includes private fields (s, n, encoded) with validated public
properties (S, N) and methods for encoding, sorting, and ASCII code display. The Program
class depends on StringProcessing, instantiating it in the Main method to execute the
program’s functionality, aligning with the Description of the System’s focus on basic string
encoding.
2. UseCaseDiagram
Caption: The Use Case Diagram for the StringProcessing Program depicts user
interactions with a basic encoding system. The primary use case, Apply Caesar Cipher,
allows the user to encode an uppercase A–Z string, optionally sorting it first (Sort String
Input). It includes sub-actions to view the input and output ASCII codes (View Input ASCII
Codes, View Output ASCII Codes) and the encoded result (View Encoded Output). This
reflects the Description of the System’s emphasis on a foundational Caesar Cipher tool
with supporting features for analysis and preprocessing.
Version 2-3: Encoder
[Link] Diagram
Caption: The Class Diagram for the Encoder Program showcases a modular design with
the Encoder class as the core, managing multiple encoding methods and history tracking
via EncodeHistoryItem. The Program class drives the console interface, depending on
Encoder to execute encoding tasks, while WinFormsApp extends this functionality with a
GUI, reusing Encoder’s logic. This structure supports the Description of the System’s
narrative of an advanced encoder with history logging and a user-friendly interface.
2. UseCaseDiagram
Caption: The Use Case Diagram for the Encoder Program illustrates a comprehensive
encoding system. The central Encode use case enables users to encode strings or
numbers, involving sub-actions like Input String, Input Number, Select Input Type, Select
Encoding Type, Set Encoding Parameters, and viewing results (View Input ASCII Codes,
View Output ASCII Codes, View Encoded Output). Optional sorting (Sort String Input) and
automatic history export (Export History to Excel) enhance functionality, while View History
allows history review. This aligns with the Description of the System’s focus on a versatile
encoder with history tracking and GUI support.
4. Testing
[Link]
Test ID Sub
Big Test
Test Case Test Input Expected Evidence Pass/Fail
Case
Case
String SE-01 Input Valid Proceed to shift Evidence
"HELLO" Pass
Encoding String Input 1 value prompt
SE-02 "ABCDEFGHIJ Evidence
Valid Proceed to shift
KLMNOPQRS Pass
Input 2 value prompt
TUVWXYZ"
SE-03 Inform Error and Evidence
Empty
"" reask for string Pass
Input
input.
SE-04 Special Inform Error and Evidence
Charac "HELLO!" reask for string Pass
ters input.
SE-05 Inform Error and Evidence
Digits
"HELL0" reask for string Pass
in Input
input.
SE-06 Non- Inform Error and Evidence
Capital "hello" reask for string Pass
Letters input.
SE-07 Exceed Evidence
Inform Error and
s 40
"A" * 41 reask for string Pass
Charac
input.
ters
SE-08 Valid Proceed to Evidence
Input Shift
Shift "5" encoding -> Pass
Value
Value 1 encoded Output
SE-09 Valid Proceed to Evidence
Shift "-5" encoding -> Pass
Value 2 encoded Output
SE-10 Empty Evidence
Prompt to enter a
Shift "" Pass
valid Integer.
Input
SE-11 Non- Prompt to enter a Evidence
"abc" Pass
Integer valid Integer..
Shift
Input
SE-12 Shift Evidence
Prompt value
Outsid
must be an
e "26" Pass
integer between -
Bounda
25 and 25.
ry 1
SE-13 Shift Print "Shift value Evidence
Outsid must be an
e "-26" integer between - Pass
Bounda 25 and 25." and
ry 2 reask.
SE-14 Return: Evidence
Original="HELLO",
Shift=5, ASCII
Input=[72,69,76,7
Valid Input: 6,79],
Program Encoding
Encodi "HELLO", Sorted="EHLLLO", Pass
Output Output
ng 1 Shift: "5" ASCII
Output=[77,74,81,
81,84],
Encoded="MJQQT
".
SE-15 Return: Original=" Evidence
ABCDEFGHIJKLM
NOPQRSTUVWXY
Z ", Shift=-5,
ASCII Output =
[86, 87, 88, 89, 90,
65, 66, 67, 68, 69,
70, 71, 72, 73, 74,
75, 76, 77, 78, 79,
80, 81, 82, 83, 84,
85],
Encoded="VWXYZ
ABCDEFGHIJKLM
NOPQRSTU".
2. Encoder
Big Test TestID Test Sub Test Input Expected Evidence Pass/Fail
Case Case Case
Choose EC-1 Input Valid Input "HELLO" Proceed to sort Evidence Pass
1: Encode String prompt
String
EC-2 Empty "" Print "Input cannot Evidence Pass
Input be empty." and
reprompt.
EC-3 Special "HELLO!" Print "String input Evidence Pass
Character should not contain
s digits or any special
character." and
reprompt.
EC-4 Digits in "HELL0" Print "String input Evidence Pass
Input should not contain
digits or any special
character." and
reprompt.
EC-5 Non- "hello" Print "String input Evidence Pass
Uppercase must contain only
Letters uppercase letters
(A–Z)." and
reprompt.
EC-6 Exceeds "A" * 41 Print "String must be Evidence Pass
40 40 characters or
Character fewer." and
s reprompt.
EC-7 Sort Valid Yes "yes" or "y" Sort string Evidence Pass
Input Response alphabetically, print
Prompt "Sorted Value:
[sorted string]",
display ASCII codes,
set isSorted=true,
proceed to
encoding.
EC-8 Valid No "no" or "n" Display ASCII codes Evidence Pass
Response of original string, set
isSorted=false,
proceed to
encoding.
EC-9 Empty "" Print "Invalid Evidence Pass
Input response. Please
enter 'yes', 'y', 'no', or
'n'." and reprompt.
EC-10 Invalid "maybe" Print "Invalid Evidence Pass
Response response. Please
enter 'yes', 'y', 'no', or
'n'." and reprompt.
EC-11 Select Empty "" Print " Invalid Evidence Pass
Encodin Input encoding type.
g Type Please try again”
and reprompt
EC-12 Invalid "50" Print " Invalid Evidence Pass
Input encoding type.
Please try again”
and reprompt.
EC-13 Encodin Valid Shift "5" Encode to "MJQQT", Evidence Pass
g Type: Value print ASCII codes,
Caesar save to history,
Cipher update Excel, save
into history, return
to main menu.
EC-14 Empty "" Print "Shift value Evidence Pass
Shift Input must be a valid
integer." and
reprompt.
EC-15 Invalid "26" Print "Shift value Evidence Pass
Shift Value must be an integer
1 between -25 and
25." and reprompt.
EC-16 Invalid "abc" Print "Shift value Evidence Pass
Shift Value must be a valid
2 integer." and
reprompt.
EC-17 Encodin Valid Key "10" Perform XOR, print Evidence Pass
g Type: Value encoded result and
XOR ASCII codes, save to
Cipher history, update
Excel, save into
history, return to
main menu.
EC-18 Empty Key "" Print "Key value Evidence Pass
Input must be a valid
integer." and
reprompt.
EC-19 Invalid Key "256" Print "Key value for Evidence Pass
Value 1 XOR Cipher must be
between 0 and 255."
and reprompt.
EC-20 Invalid Key "abc" Print "Key value Evidence Pass
Value 2 must be a valid
integer." and
reprompt.
EC-21 Encodin No "HELLO" Encode to "OLLEH", Evidence Pass
g Type: Parameter print ASCII codes,
Reverse save to history with
Text parameter=0,
update Excel, save
into history, return
to main menu.
EC-22 Encodin No "HELLO" Encode to "SVOOL", Evidence Pass
g Type: Parameter print ASCII codes,
Atbash save to history with
Cipher parameter=0,
update Excel, save
into history, return
to main menu.
Choose EN-1 Input Valid Input "12345" Display ASCII codes Evidence Pass
2: Encode Number of input string,
Number proceed to encoding
options.
EN-2 Empty "" Print "Input cannot Evidence Pass
Input be empty." and
reprompt.
EN-3 Non- "12.34" Print "Input must be Evidence Pass
Integer a valid integer." and
Input 1 reprompt.
EN-4 Non- "abc" Print "Input must be Evidence Pass
Integer a valid integer." and
Input 2 reprompt.
EN-5 Exceeds 214748364 Print "Input must be Evidence Pass
Int32 Limit 8 a valid integer." and
reprompt..
EN-6 Select Empty "" Print "Please enter a Evidence Pass
Encodin Input valid option." and
g Type reprompt.
EN-7 Invalid "5" Print "Invalid choice. Evidence Pass
Input Please select from 1
to 4." and reprompt.
EN-8 Encodin Valid "16" Encode to "3039" Evidence Pass
g Type: Target (hex), print ASCII
Base Base codes, save to
Convers history, update
ion Excel, save into
history, return to
main menu.
EN-9 Empty "" Print "Target base Evidence Pass
Base Input must be a valid
integer." and
reprompt.
EN-10 Invalid "10" Print "Target base Evidence Pass
Base 1 must be one of 2, 4,
8, 16, or 32." and
reprompt.
EN-11 Invalid "abc" Print "Target base Evidence Pass
Base 2 must be a valid
integer." and
reprompt.
EN-12 Encodin Valid Key "10" Perform XOR, print Evidence Pass
g Type: Value encoded result and
XOR ASCII codes, save to
Cipher history, update
Excel, save into
history, return to
main menu.
EN-13 Empty Key "" Print "Key value Evidence Pass
Input must be a valid
integer." and
reprompt.
EN-14 Invalid Key "256" Print "Key value for Evidence Pass
Value 1 XOR Cipher must be
between 0 and 255."
and reprompt.
EN-15 Invalid Key "abc" Print "Key value Evidence Pass
Value 2 must be a valid
integer." and
reprompt.
EN-16 Encodin No "12345" Perform Bitwise Evidence Pass
g Type: Parameter NOT, print encoded
Bitwise result and ASCII
NOT codes, save to
history with
parameter=0,
update Excel, save
into history, return
to main menu.
EN-17 Encodin No "12345" Perform binary Evidence Pass
g Type: parameter encoding (e.g.,
Binary convert to ASCII
Formatt codes and then to
er binary), print
encoded result and
ASCII codes, save to
history with
parameter=0,
update Excel, save
into history, return
to main menu.
Choose VH-1 View History Select Display history Evidence Pass
3: View History Display option 3 entries in format
History (while after "[Timestamp]
running - encoding
temporary operations
)
VH-2 History Open Excel Display Total History Evidence Pass
Display in File in entries so far
Excel Debug
(permane Folder
ntly)
Choose E-1 Exit Valid Exit "0" Terminate program. Evidence Pass
0: Exit Progra
m
Main MM-1 Invalid Empty "" Reprompt Selection Evidence Pass
Menu Menu Input Choice
Input Choice
MM-2 Invalid "4" Reprompt Selection Evidence Pass
Option 1 Choice
MM-3 Invalid "abc" Reprompt Selection Evidence Pass
Option 2 ChoiceHE
Big Test TestID Test Sub Test Input Expected Evide Pass/F
Case Case Case nce ail
Choose W- Enable Select Click rbString txtInputString is Evide Pass
1: EC-1 String String enabled, nce
Encode Text Box Radio txtInputNumber is
String Button disabled,
cmbEncodingType
is enabled,
chkSortInput is
enabled.
W- Enable Check Click rbString, txtSortedInput Evide Pass
EC-2 Sort Sort enter "HELLO" in displays nce
Checkbox txtInputString, "EHLLLO",
check chkSortInput
chkSortInput remains checked,
UI remains
responsive.
W- Uncheck Click rbString, txtSortedInput is Evide Pass
EC-3 Sort enter "HELLO" in cleared, nce
Checkbox txtInputString, txtInputString
check then shows original
uncheck "HELLO",
chkSortInput
chkSortInput is
unchecked.
W- Fill Populate Click rbString cmbEncodingType Evide Pass
EC-4 Encodin Encoding contains ["None", nce
g Option Dropdown "Caesar Cipher",
"XOR Cipher",
"Reverse Text",
"Atbash Cipher"],
defaults to "None".
W- Encodin Enable Click rbString, txtShiftValue and Evide Pass
EC-5 g Type: Shift Value select "Caesar lblShiftValue are nce
Caesar TextBox Cipher" in enabled,
cmbEncodingTyp txtKeyValue,
e txtTargetBase,
txtWidth remain
disabled,
[Link]
is "Shift Value".
W- Encodin Select Click rbString, txtKeyValue and Evide Pass
EC-6 g Other XOR select "XOR lblKeyValue are nce
Type Cipher Cipher" in enabled,
cmbEncodingTyp txtShiftValue,
e txtTargetBase,
txtWidth remain
disabled,
[Link] is
"Key".
W- Select Click rbString, No parameter Evide Pass
EC-7 Reverse select "Reverse textboxes enabled nce
Text Text" in (txtShiftValue,
cmbEncodingTyp txtKeyValue,
e txtTargetBase,
txtWidth
disabled).
W- Select Click rbString, No parameter Evide Pass
EC-8 Atbash select "Atbash textboxes enabled nce
Cipher Cipher" in (txtShiftValue,
cmbEncodingTyp txtKeyValue,
e txtTargetBase,
txtWidth
disabled).
Choose W- Enable Select Click rbNumber txtInputNumber is Evide Pass
2: EN-1 Number Number enabled, nce
Encode Text Box Radio txtInputString is
Number Button disabled,
cmbEncodingType
is enabled,
chkSortInput is
disabled and
unchecked,
txtSortedInput is
cleared.
W- Fill Populate Click rbNumber cmbEncodingType Evide Pass
EN-2 Encodin Encoding contains ["None", nce
g Option Dropdown "Base
Conversion", "XOR
Cipher", "Bitwise
NOT", "Binary
Formatter"],
defaults to "None".
W- Encodin Select Click rbNumber, txtTargetBase and Evide Pass
EN-3 g Type Base select "Base lblTargetBase are nce
Paramet Conversio Conversion" in enabled,
ers n cmbEncodingTyp txtShiftValue,
e txtKeyValue,
txtWidth remain
disabled,
[Link]
is "Target Base
(2,4,8,16,32)".
W- Select Click rbNumber, txtKeyValue and Evide Pass
EN-4 XOR select "XOR lblKeyValue are nce
Cipher Cipher" in enabled,
cmbEncodingTyp txtShiftValue,
e txtTargetBase,
txtWidth remain
disabled,
[Link] is
"Key".
W- Select Click rbNumber, No parameter Evide Pass
EN-5 Bitwise select "Bitwise textboxes enabled nce
NOT NOT" in (txtShiftValue,
cmbEncodingTyp txtKeyValue,
e txtTargetBase,
txtWidth
disabled).
W- Select Click rbNumber, txtWidth and Evide Pass
EN-6 Binary select "Binary lblWidth are nce
Formatter Formatter" in enabled,
cmbEncodingTyp txtShiftValue,
e txtKeyValue,
txtTargetBase
remain disabled,
[Link] is
"Width (default 8)".
Click on W- Invalid Empty Click rbString, MessageBox: Evide Pass
Generate CL-1 Input String leave "Input cannot be nce
Button Message Input txtInputString empty.",
Box empty, select txtInputString
Work "Caesar Cipher", remains focused.
click btnGenerate
W- Invalid Click rbString, MessageBox: Evide Pass
CL-2 String enter "hello" in "String input must nce
Input txtInputString, contain only
select "Caesar uppercase letters
Cipher", click (A–Z).",
btnGenerate txtInputString
remains focused.
W- Empty Click rbNumber, MessageBox: Evide Pass
CL-3 Number leave "Input cannot be nce
Input txtInputNumber empty.",
empty, select txtInputNumber
"Base remains focused.
Conversion", click
btnGenerate
W- Invalid Click rbNumber, MessageBox: Evide Pass
CL-4 Number enter "12.34" in "Input must be a nce
Input txtInputNumber, valid integer.",
select "Base txtInputNumber
Conversion", click remains focused.
btnGenerate
W- Invalid Click rbString, MessageBox: Evide Pass
CL-5 Shift Value enter "HELLO" in "Shift value must nce
txtInputString, be an integer
select "Caesar between -25 and
Cipher", enter 25.", txtShiftValue
"26" in remains focused.
txtShiftValue,
click btnGenerate
W- Invalid Click rbNumber, MessageBox: Evide Pass
CL-6 Base enter "12345" in "Target base must nce
Value txtInputNumber, be one of 2, 4, 8,
select "Base 16, or 32.",
Conversion", txtTargetBase
enter "10" in remains focused.
txtTargetBase,
click btnGenerate
W- Display Valid Click rbString, txtOutput displays Evide Pass
CL-7 Result String enter "HELLO" in "MJQQT", nce
Work Encoding txtInputString, txtAsciiInput
select "Caesar displays "72 69 76
Cipher", enter "5" 76 79",
in txtShiftValue, txtAsciiOutput
click btnGenerate displays "77 74 81
81 84", UI remains
ready.
W- Valid Click rbString, txtOutput displays Evide Pass
CL-8 String enter "HELLO" in "JMQQT", nce
Encoding txtInputString, txtAsciiInput
with Sort check displays "72 69 76
checked chkSortInput, 76 79",
select "Caesar txtAsciiOutput
Cipher", enter "5" displays "74 77 81
in txtShiftValue, 81 84", UI remains
click btnGenerate ready.
W- Valid Click rbNumber, txtOutput displays Evide Pass
CL-9 Number enter "12345" in "3039", nce
Encoding txtInputNumber, txtAsciiInput
select "Base displays "49 50 51
Conversion", 52 53",
enter "16" in txtAsciiOutput
txtTargetBase, displays "51 48 51
click btnGenerate 57" , UI remains
ready.
5. Future Development:
Future enhancements of the Encoder Program aim to significantly expand both
functionality and user experience. A key improvement would be integrating a database to
persistently store encoding history, enabling users to search for specific past entries
quickly and reliably. Additionally, the UI could be transformed into a more interactive,
modular environment where users can drag and drop blocks representing different
encoding types, chaining them together to apply multiple transformations in sequence.
This visual flow-based approach would not only offer greater flexibility but also make
complex encoding operations more intuitive and customizable. These developments would
elevate the application from a simple utility to a powerful and extensible encoding
platform.
6. Appendix
1. Encoder
1.1. SaveHistoryCode
1.2. ProcessStringEncoding
1.3. ProcessNumberEncoding
2. TestCase Evidence
2.1. String Processing
2.1.1. Test Case Input String
[Link]. Input String - Valid Input 1
[Link]. Input String – Valid Input 2
[Link]. Invalid String Input (Empty Input, Special Characters, Digits in Input,
Non-Capital Letters, Exceeds 40 Characters)
2.2. Encoder
2.2.1. Invalid Menu Choice
2.2.2. Encode String
[Link]. Invalid Input
2. If No
(continue test 1)
[Link]. Encoding Type
[Link].1. Empty choice, Invalid choice
2.3. Winform
2.3.1. Encode String
[Link]. Enable String TextBox, Enable Sort, Fill Encoding Option
[Link]. Select Encoding Type Caesar Cipher