Professional Documents
Culture Documents
University of Leicester
CO7201 Individual Project
Preliminary Report
Online judge system for programming competitions
[Your name]
[Your email address]
[Your student ID]
1 Contents
2
Abstract 3
1. Aims and Objectives 3
1.1. Aim 3
1.2. Objective 3
2. Requirements 4
2.1. Input/output stream 4
2.2. Signal interaction mechanism 4
2.3. Message box technique 5
2.4. Sandbox connecting manager 5
2.5. Sandbox Business Manager 5
2.6. Parallel judgment 6
3. Technical Specification 6
4. Requirements Evaluation Plan 6
5. Background Research and Reading list 7
6. Time-plan and Risk Plan 8
7. References 9
Abstract
1. Introduction
1.1. Background
An online judge system for programming competitions (OJS) is a distributed system for
executing and (to some point) systematising a programming competition. The system is
developed to be universal and to handle numerous different types of contests, tasks, and
scorings. Besides, OJS has been explicitly developed to be utilised in students and college
competitions in Informatics. The candidate's code can be compiled and executed by the
system and user’s scripts scrutinised with pre-constructed results. Users can execute the
submitted code with limitations, comprising time and memory limits, security limits, and
much more (Chang et al., 2014). The scrips output will be documented by the computer, and
the normal output will be assessed Then the machine will return the result. After flaws in a
standard production have been noticed, the system would be unsuccessful. Some errors in the
code should be modified and resubmitted for re-examination.
The script output would be obtained by the system and associated with the standard output.
The system will then return the result. When mistakes were determined in a typical output,
pre-evaluation utilising the same method must be created. The entire script tasks are resolved
using a virtual machine. The OJS system is created with a container that incorporates an
original memory, having a pre-set network authorisation, Time limit for the system container.
All the system functions are considered by the virtual machine. System users can concentrate
on the other roles (Wirawan et al., 2017).
In this application, the entire online coding judging procedure is the most essential aspect.
Therefore, to make the judging system work, the process carefully listens to the principles of
an operating system and its functions. Besides, the principle of each programming language
such as calling and declaring a variable and executing commands. The software will be a
(PHP: Hypertext Pre-processor (PHP) application that would be capable of parsing codes
comprised of JAVA, Perl, C++, and python content, obtain web services descriptions, outputs
and show them as outputs activity scores for assessment. Finally, the software application can
handle submission queues, and download submitted codes in readable file formats such as
Excel. The solutions to the problem are to create can handle numerous user roles such as
admin, head instructors students, and instructors and sandboxing for Java, cheat detention
such as script similarity identification, and a custom rule for grading late submission. This
paper describes the requirements, features, application concepts, and computer technologies
used in the project as well as the design and implementation detail of the online judging
application.
1.2. Project Aim
The main task of this project is to implement a judging system, which contains a cross-
platform online judge system based on spring MVC framework and Active MQ. Online judge
system being the optimum online web application for online programming competitions.
With the increasing online programming competitions globally, there should be a technical
solution that selects the competition winner fairly and transparently. The Online judge system
would be the most used online software functionality for determining a winner of the
programming competition hosted with a database and security features such as sandbox to
mitigate hacking. The project aims to obtain a fair judging process by designing features for
online instant judging abbreviated as "OJS". The software aims at achieving an easier
judgement matrix using a sandbox judge interface and the client-side website interface. The
sandbox design would have features of instantly compiling and executing the tested scripts,
producing assessment scores, and subsequent analysis reports with the programming winner
(s). This software development project also aims at using thread pools to realize parallel tests,
and implement database optimisation techniques; for instance, parallel split tables.
1.3. Project Objective
To obtain the study aim, the key project objectives are as follows;
ii. To design a web and server-side client using the MVC procedure
The MVC procedure provides control, business logic, and service layers to support
the system interface based on functionality being performed. In order to streamline
retrieval, the server-side would offer a parallel table split to store the submitted
codes.
iii. To integrate the OJS web application with sandbox
Since similar systems are exposed to hacking, PHP offers a sandbox architecture design
to mitigate malicious coding and hacking during analysis and protect the system from
hacking (Coker et al., 2015).
2. Requirement Analysis
2.1. Functional Requirements
Functional requirements are essential to meet system objectives. The functional requirements
of the OJS are designed according to the review of similar existing applications and research
conducted in the introduction chapter. The OJS system provides functions of question
management, user management, system management for the administrator, and provides
functions of joining the competition and checking the score for the user. The overall system
architecture for functional requirements is illustrated in Figure 1.
Database data should easily be updated by the system administrator while ensuring site
availability.
2.2.4. Security Access Requirement
The web application shall ensure data protection using password and username before access
to the system to perform different roles. Therefore, the fit criteria will require user roles
(Actors) to have access to allowed sections as labelled in the section.
2.2.5. Privacy Requirements
The web application should inform the system used to collect competitors' consents to utilise
their use cases on the system.
2.2.6. Cultural Requirement
The web application shall not be offensive to religious and ethnic groups. All contents should
conform to diversity and cultural appropriateness.
2.2.7. Legal Compliance Requirement
The implementation for the competition submission by each candidate shall conform to the
Data Protection Act. Users should ensure they obtain attorney's opinion that the web
application does not violate any regulations and policies.
2.3. High-level Function
The OJS web application provides specific high-level functions such as linking programming
competition and examining test scores and display the score of each candidate in the
competition. To obtain the technical functions listed, the judging web application comprise
five fundamental modules, consisting of quiz module, competition module, system user
module, a messaging module as well as software module. All the module tests of programs in
coding contests, recruiters can conduct hiring challenges and for intra-inter student coding
competitions.
2.4. Low-level Requirements
The online judging system contains the following entities: users; programming contest;
question; submissions; registrations; question test cases; cumulative leader boards
2.4.2. Entity Relationships
A user entity has_many competitions via participations — user. competitions—
utilised for queries for instance “Get all competitions userA registered for”
A competition entity has_many users through participations — competition.users —
“Get all the users registered for competitionA”
A competition entity has_many questions — competition.questions — “Get all the
question for challengeA”
A question entity belongs_to contest — question.competition — “What competition
questionA appeared in?”. belongs_to relationship suggests that the question entity has
a foreign key of competition_Id
A question has_may submissions — question.submissions — “obtains all the
submissions of questionA” or “Gets all the submissions of questionA by userA”
A submission belongs_to user — suggests that submission has a foreign key of userId
A submission belongs_to question — suggests that submission has a foreign key of
questionId
A participation belongs_to user- suggest that participation has a foreign key of userId
A participation belongs_to competition – suggests that participation has a foreign key
of competition_Id
2.4.3. Data Modelling
Table 1 presents database entities (along with their attributes) and data types in bytes for each
column (Utilising SQL storage data).
Entity Attributes
Users userId(36), name(150), dateOfBirth(3), email(30), college(30),
username(20),
password cumulativeScore(8), addedAt(8), updatedAt(8)
Programming in Java input and output streams are used to handle software inputs and
outputs. The streams allow the program to consistently communicate with numerous sources
of data; for example, network connections and memory blocks. In the case of project
software, the streams can be used to execute test cases (O'Reilly, 2021). The inputStream in
the system would read the codes submitted, the outputStream would be used to write the code
to a destination. This will further be strengthened by split function to eliminate concurrency
issues.
The input and output stream of a file stream of System.seIn () method can halt some threads
from getting the input stream or possibly retrieve the input stream from other threads
(O'Reilly, 2021). Obstructing some threads might interfere and jeopardise the validity of the
judgment process as well as the output stream. In a multi-thread setup, when multiple test
cases output the results to the same output stream redundancy might occur hence impacting
the validity and reliability of the judging output. The standard of separating input and output
stream is illustrated in Figure 6.
Figure 6: Input and output stream
The system would need both the client-side interface and sandbox to listen to each other
based on the defined signals in the network. Therefore, the system will have a detailed
communication protocol for signal and winning rules. Also, a fundamental test process that
forms the sandbox specification and abstraction. Ideally, the signal communication technique
offers data needed for interaction across the two interfaces. Further, it forms the base on
which the sandbox is informed via signals such as if the client-side needs to ensure the
services being offered by the sandbox side. Also, the type of function to achieve, as well as
the technique to send the information. The system will have main signals for judging
requests, get the sandbox status, and exit the sandbox to mention a few. For instance, if the
client-side sends requests from the end judge, the system will stock judge signals to the
required information Also, the sandbox-side gets the request, assesses it, and interprets the
remaining information like the required data for the judgement procedures. Thereafter,
utilises the data as the source code in order to compile, execute and finally summarise the
operation output, and return the request result to the client-side interface.
3.2.4. Message box technique
Given that interaction between client-side and sandbox via network connection might be
slow, there is a need to use asynchronous mechanism to the client-side when waiting for the
sandbox side to respond to the result. Also, if the thread sends judgment requests to the
sandbox and inspects the request the communication selected might halt the order of the
request array and return output with errors or possibly using a lot of time. Therefore, the
message box technique can eliminate the interference and enhance data efficacy during the
interaction. Each sandbox data contains a unique message identifier ID that helps to return
back the sandbox message using the unique ID. As such the system would obtain accurate
information verified with the unique message ID.
3.2.5. Sandbox connecting manager
The Sandbox connecting manager will maintain the status of each sandbox to obtain optimum
load balancing between the sandbox and the client-side interface. The connecting manager
will also maintain the queues of the sandbox and judging requests. Since the requests are
being received in bulk the manager will use the FITO (First in First out) procedure to sort out
the queue and finish the task. Also, to ensure efficiency, the queue will be protected, and keep
each sandbox inside the queue to make sure that the subsequent sandbox completes the
assignment based on the sorted order. Java sandbox is supported by default in Java Security
Manager (Coker et al., 2015).
3.2.6. Sandbox Business Manager
The requirement will be exerted to handle sandboxes that get and update the information of
the cache of the sandbox existing condition systematically. The sandbox business manager
streamlines fairness in the buffer layers on the client-server interface. The sandbox business
manager will ensure that each sandbox condition is cached in the memory to improve general
system performance (Liang et al., 2017).
3.2.7. Parallel judgment
Java code contains a single static main method after compilation, and during judgement, the
judging application calls the main method to get the output of the software via the reflection
technique of the Java program. The program should consist of several test cases on which
each test case is also autonomous of the others. The thread of the judging program is
integrated with a dynamic cached thread pool of Java codes. Besides, each dynamic cached
thread can be executed on its own and minus any meddling and deadlocks. As such, the
parallel judgment can enhance efficiency in the system execution. Likewise, the cached
thread pool of the system would call back and release the memory in order to streamline
memory functions when the thread is not being used for more than one minute.
3.3. System Sequence Diagram
The following sequence diagram in Figure 7 is used to highlight the communication of the
OJS’s entities for a specific case. The use case illustration shows the sequence of events
required for the entire OJS user to login, participate in a competition and submit codes for
further processing.
Below is a class diagram of the online judging system and provides a static outlook of the
project implementation. This diagram complies with the software architecture, sequence
diagram, and problem field, as elaborated in previous sections.
4. System Implementation
References
Barr, A. (2018). Secure Programming: Writing Testable Code. New Hampshire: Skillsoft
Ireland Limited
Coker, Z., Maass, M., Ding, T., Le Goues, C. and Sunshine, J., 2015, December. Evaluating
the flexibility of the Java sandbox. In Proceedings of the 31st Annual Computer Security
Applications Conference (pp. 1-10).
Chang, W.Y. and Kim, S.S., 2014. Development and application of algorithm judging
system: analysis of effects on programming learning. The Journal of Korean
association of computer education, 17(4), pp.45-57.
Homès, B., 2013. Fundamentals of software testing. London: John Wiley & Sons.
Knodel, J., & Naab, M. (2016). Pragmatic Evaluation of Software Architectures. Cham:
Springer International Publishing: Imprint: Springer https://doi.org/10.1007/978-3-
319-34177-4.
Mizuno, T. and Nishizaki, S.Y., 2014. Distributed Online Judge System for Interactive
Theorem Provers. In EPJ Web of Conferences (Vol. 68, p. 00016). EDP Sciences.
Nidhra, S. and Dondeti, J., 2012. Black box and white box testing techniques-a literature
review. International Journal of Embedded Systems and Applications (IJESA), 2(2),
pp.29-50.
Langr, J., Hunt, A., & Thomas, D. (2015). Pragmatic Unit Testing in Java 8 with JUnit.
Raleigh, Pragmatic Programmers.
Liang, H., Chen, C., Zhong, X. and Chen, Y., 2017, June. Design and implementation of
online automatic judging system. In IOP Conference Series: Earth and Environmental
Science (Vol. 69, No. 1, p. 012091). IOP Publishing.
Wirawan, I.M., Taufani, A.R., Wahyono, I.D. and Fadlika, I., 2017, October. Online judging
system for programming contest using UM framework. In 2017 4th International
Conference on Information Technology, Computer, and Electrical Engineering
(ICITACEE) (pp. 230-234). IEEE.