Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

Software Engineering - CSYM026

Group Report Stage 2

Junaid Maqsood Chishti (Student ID: 22833484)


Mohammad Akber Mirza (Student ID: 22846792)
Abdulwahab Anifowose (Student ID: 22426388)

1
2
Contents
Brief Explanation of Functionality and Limitations........................................................................4
UML Class Diagram..................................................................................................................... 4
Threads in Application.................................................................................................................6
Pattern in Application...................................................................................................................6
Extensions in Application............................................................................................................. 6
Git Commit History....................................................................................................................... 6
Development Report.................................................................................................................... 8
Iteration 1................................................................................................................................. 9
Iteration 2................................................................................................................................. 9
Iteration 3................................................................................................................................. 9
Application UI............................................................................................................................ 10
Technical Report........................................................................................................................ 12
Introduction............................................................................................................................ 12
Functionality........................................................................................................................... 12
Architecture............................................................................................................................ 13
Class and Code Explanation..................................................................................................13
Usage of Threads................................................................................................................... 13
Usage of Design Patterns......................................................................................................14
Extensions to the Application.................................................................................................14
Development Process............................................................................................................ 14
Evaluation of the Agile Approach...........................................................................................14
Conclusion............................................................................................................................. 14
Code Snippet............................................................................................................................. 15

3
Brief Explanation of Functionality and Limitations
The application is designed to handle the distribution of parcels to customers. It reads
customer data from a file, displays the data in tables, and then proceeds with the
distribution process. The core functionality of the application includes the following
steps:

1. Reading Data: The application reads customer data from a file, which typically
contains information such as customer names, parcel IDs, parcel weights, and
parcel fees.
2. Displaying Data: After reading the data, the application displays it in tables,
allowing users to visualize the customer details and the parcels associated with
each customer. This provides a convenient overview of the distribution process.
3. Distribution Process: The application uses threads to process customers
concurrently. Each customer is processed in a separate thread, enabling parallel
processing and efficient utilization of computing resources.
4. Fee Calculation: For each customer, the application calculates the fee for their
parcel based on certain criteria or business rules. The calculated fees are then
associated with the corresponding parcels and updated in the tables.
5. Updating Tables: As the distribution process progresses, the application
updates the tables by removing customers and parcels that have been
processed. This ensures that the tables accurately reflect the current state of the
distribution.
6. Pause and Resume: The application includes functionality for pausing and
resuming the distribution process. This allows users to temporarily halt the
processing, perhaps to handle other tasks or address any issues, and then
resume from where they left off.

4
UML Class Diagram

5
Threads in Application
Threads are used in the application to handle the distribution process concurrently. The
log entries indicate that the application is taking customers from a queue, processing
their information, and calculating fees for their parcels. This suggests that each
customer is processed in a separate thread, allowing multiple customers to be handled
simultaneously.

Using threads can improve the efficiency and responsiveness of the application. Instead
of processing customers sequentially, which could result in waiting times for each
customer, threads allow for parallel processing.

By using threads, the application can take advantage of multi-core processors and
utilize available computing resources more effectively. However, it's important to ensure
proper synchronization and thread safety when accessing shared data or resources to
avoid conflicts and inconsistencies.

Pattern in Application

The singleton pattern is used in the application. The singleton pattern ensures that
only one instance of a class exists throughout the application's execution. In the context
of your application, it's likely that the singleton pattern is used among the resources or
components.
For example, in our application logging process is implemented as a singleton. This
ensures that only one instance of the log for entries exists, and it can be accessed from
multiple parts of the application without creating multiple instances.

Extensions in Application
1. Delivery of more parcels arrives
2. Show worker taking break

Git Commit History


As for git commit history, we first maintained our repository on GitLab and have our
commits there and afterward transferred to GitHub We mailed Professor Ali and
explained the confusion, he said its ok to move the rest of development in Github, so
attached below are both places commit.

6
7
 GitLab:

8
 GitHub:

Development Report
Agile development is an iterative and incremental approach to software development
that emphasizes collaboration, adaptability, and customer satisfaction. It promotes
flexibility and responsiveness to changing requirements, allowing for faster delivery of
valuable software.

In an agile development process, work is divided into small, manageable increments


called iterations or sprints. Each iteration typically lasts for a fixed duration, such as one
or two weeks. During each iteration, a subset of features or user stories is selected from
the overall project backlog and developed, tested, and delivered.

The specific features included in each iteration are determined based on several
factors, including priority, complexity, and dependencies. The goal is to deliver the most
valuable and essential functionality to the customer at the end of each iteration.
The success of the agile approach depends on various factors, including effective
communication, collaboration, and adaptability. By involving stakeholders and

9
customers throughout the development process, agile methodologies promote
transparency and align the software with customer expectations.

Here are some potential features that could have been included in the iterations of your
program:

Iteration 1
 Reading data from a file and parsing it into customer and parcel objects.
 Displaying the customer data in tables.

Iteration 2
 Implementing threads to process customers concurrently.
 Calculating fees for each parcel based on specific criteria.
 Updating the tables to reflect the processed customers and parcels .

Iteration 3
 Adding pause and resume functionality to allow users to control the distribution
process.
 Implementing basic error handling and logging mechanisms.

The success of the agile approach can be evaluated based on factors such as customer
satisfaction, adherence to project timelines, flexibility to accommodate changes, and
overall product quality. It is important to conduct regular retrospectives and gather
feedback from stakeholders to continuously improve the development process.

10
Application UI

 Before Starting:

11
 After start button clicks:

 After Break button clicks:

12
 After Finish button clicks:

Technical Report

Introduction
The solution is designed to automate the process of distributing parcels to customers based on
specific criteria. This technical report provides an overview of the functionality, architecture,
design patterns, extensions, and development process of the application.

Functionality
Aims to efficiently distribute parcels to customers by implementing the following functionalities:

a) Reading Data: The application reads customer and parcel data from a file.

b) Displaying Data: The data is displayed in tables, allowing users to view customer and
parcel information.

13
c) Threads: The application uses threads to enable concurrent processing of parcels,
hence improving performance.

d) Calculating Fees: The application calculates fees for each parcel based on specified
criteria.

e) Generating Reports: The application generates reports summarizing customer


information and fees.

f) Error Handling and Logging: Basic error-handling mechanisms have been


implemented to catch and handle exceptions during the distribution process.
Additionally, a logging mechanism has been introduced to record important events and
generate log files for troubleshooting and analysis.

Architecture
The application follows a modular architecture, consisting of the following classes:

a) Customer: Represents customer information such as name and parcel details.


b) Parcel: Represents individual parcels with attributes like ID, weight, and fee.

Class and Code Explanation

a) Customer Class: The Customer class encapsulates customer information. It has


attributes such as a name and a list of parcels. The class provides methods to access
and modify customer details.

b) Parcel Class: The Parcel class represents individual parcels with attributes like ID,
weight, and fee. It provides getters and setters for accessing and modifying parcel
attributes.

Usage of Threads
Threads are utilized in the application to enable concurrent processing of customers. By
employing multiple threads, the application can distribute parcels efficiently, improving overall
performance. In our application thread is responsible for processing a customer and his/her
respective parcel(s).

14
Usage of Design Patterns
The application utilizes the Singleton design pattern for the Log.java class. Only one instance is
used to save records & at the end, saved into a file to be viewed. By implementing the class as
a Singleton, only one instance of the queue exists, providing a global point of access throughout
the application. This pattern ensures consistent access to the queue without the need for
multiple instances.

Extensions to the Application


1. Delivery of more parcels arrives: Once the refresh button is clicked above the parcel
list, new data is added into the parcel list to be processed.

2. Show the worker taking a break: The application allows users to pause and resume
the distribution process. Once pause button is clicked, the thread waits for the signal to
resume the process This feature provides flexibility and control over parcel distribution,
enabling users to manage interruptions or make adjustments as needed.

Development Process
The development process followed agile principles to ensure flexibility, adaptability, and
customer satisfaction. The application was developed in iterations, with each iteration delivering
a subset of features or user stories. The features were prioritized based on value and
complexity. Regular communication and collaboration with stakeholders and customers ensured
transparency and alignment with their expectations.

Evaluation of the Agile Approach


The agile development approach proved successful in delivering the application. It facilitated
frequent customer feedback, allowing for adjustments and refinements throughout the
development process. The use of iterations enabled incremental development and early delivery
of valuable functionality. The team's flexibility and adaptability ensured the ability to
accommodate changes in requirements and respond to evolving customer needs.

Conclusion
The Parcel Distribution Application provides an automated solution for efficient parcel
distribution. It employs multithreading, design patterns, and extensions to enhance
performance, usability, and control. The application successfully meets the specified
requirements. The modular architecture and utilization of threads enable concurrent processing,
improving efficiency. The Singleton pattern ensures consistent access to the distribution queue.
The agile development approach allowed for iterative development, resulting in a successful
outcome.

15
Code Snippet
DepotController.java
private void initialize() {
log = Log.getInstance();
// creating handlers for customer & parcel lists
this.readData();
log.generateLogEntry("Reading Data from file.");

// set columns to class attributes


this.parcelId.setCellValueFactory(new PropertyValueFactory<Customer, String>("parcelID"));
this.fullName.setCellValueFactory(new PropertyValueFactory<Customer, String>("fullName"));
this.customerDisplayTable.getItems().clear();
this.customerDisplayTable.setItems(FXCollections.observableList(threadCustomerList));

// set columns to class attributes


this.id.setCellValueFactory(new PropertyValueFactory<Parcel, String>("parcelID"));
this.daysInDepot.setCellValueFactory(new PropertyValueFactory<Parcel, String>("daysInDepot"));
this.weight.setCellValueFactory(new PropertyValueFactory<Parcel, String>("weight"));

16
this.dimensions.setCellValueFactory(new PropertyValueFactory<Parcel, String>("fullName"));

this.dimensions.setCellValueFactory(cellData -> new SimpleObjectProperty<>(cellData.getValue().getLength()


+ " x " + cellData.getValue().getWidth() + " x " + cellData.getValue().getHeight()));

this.parcelDisplayTable.getItems().clear();
this.parcelDisplayTable.setItems(FXCollections.observableList(threadParcelList));

log.generateLogEntry("Data displayed in tables.");

// creating a thread to run distribution


executorService = Executors.newSingleThreadExecutor();

// setting up booleans for pausing & stopping thread


isPaused = false;
isStopped = false;

reportBuilder = new StringBuilder();

// setting up on button click


breakButton.setOnAction(e -> pauseDistribution());
startButton.setOnAction(e -> startDistribution());
finishButton.setOnAction(e -> finishDistribution());
refreshParcelDataButton.setOnAction(e -> refreshParcels());
}

private void readData() {


this.customerHandler = new CustomerCollection(Utility.readCustomers());
this.customerHandler.sortCustomers();
this.parcelHandler = new ParcelCollection(Utility.readParcels(false));

threadCustomerList = Utility.readCustomers();
threadParcelList = Utility.readParcels(false);
threadCustomerList.sort(Comparator.comparingInt(Customer::getSequence));
}

public Double calculateParcelFee(Parcel parcel) {


log.generateLogEntry("Calculating fee for parce " + parcel.getParcelID() + " .");
Double fee = (double) (basicFee + (parcel.getWeight() * packageFee) + (parcel.getVolume() * dimensionFee)
+ (parcel.getDaysInDepot() * perDayFee));
return fee;
}

@FXML
private synchronized void pauseDistribution() {
if (isPaused) {
log.generateLogEntry("Resume button clicked.");
breakButton.setText("Break");

17
isPaused = false;
messageTxt.setText("Working!");
notify();
} else {
log.generateLogEntry("Pause button clicked.");
breakButton.setText("Resume");
isPaused = true;
messageTxt.setText("Taking a break!");
}
}

@FXML
private void finishDistribution() {
log.generateLogEntry("Finish button clicked.");
isStopped = true;
executorService.shutdown();
startButton.setDisable(true);
breakButton.setDisable(true);
finishButton.setDisable(true);
messageTxt.setText("Finishing the work!");
}

18

You might also like