📚 KS3 WJEC Computer Science: Case Study Practical Exercises | KS3 WJEC 计算机:案例分析实战演练
Case studies are a brilliant way to connect the different topics in KS3 WJEC Computer Science. In this article, we walk through a practical scenario — designing a school library system — step by step. You will see how hardware, software, data representation, algorithms, and testing come together to solve a real-world problem. By working through this case study, you will strengthen your computational thinking skills and be better prepared for both written assessments and project work.
案例研究是将 KS3 WJEC 计算机科学中不同主题串联起来的绝佳方式。在本文中,我们将逐步演练一个实际场景——设计一个学校图书馆系统。你将看到硬件、软件、数据表示、算法和测试如何协同解决真实世界的问题。通过完成这个案例研究,你将加强计算思维能力,更好地应对书面评估和项目任务。
1. Introduction to the Case Study | 案例介绍
Our school librarian has asked us to develop a digital system to manage the library’s book catalogue and handle borrowing and returning of books. Currently, everything is recorded on paper, which often leads to misplaced records and long queues. The new system should allow students and staff to search for books, borrow them using their school ID, and return them without manual paperwork. As a KS3 computer scientist, your job is to analyse the problem, propose a solution using appropriate hardware and software, design the data structures, write algorithms, and plan testing.
我们学校的图书管理员要求我们开发一个数字系统,用于管理图书馆的图书目录并处理借还书。目前所有记录都写在纸上,经常导致记录错位和排长队。新系统应允许学生和教职工使用学校 ID 搜索图书、借书和还书,无需人工文书工作。作为一名 KS3 计算机科学学习者,你的任务是分析问题、使用合适的硬件和软件提出解决方案、设计数据结构、编写算法以及规划测试。
We will treat this as a WJEC-style case study, meaning we must consider the needs of different people (stakeholders), make sensible choices about technology, and show clear computational thinking throughout.
我们将把它视为 WJEC 风格的案例研究,这意味着我们必须考虑不同人群(利益相关者)的需求,对技术做出合理的选择,并在整个过程中展示清晰的计算思维。
2. Identifying Stakeholders and Requirements | 识别利益相关者与需求
The first step in any system design is to understand who will use it and what they need. In our library system, there are three main stakeholders: the librarian, students, and teachers. The librarian wants to easily add new books, view who has borrowed which item, and generate reports on popular titles. Students and teachers want a fast way to find if a book is available and to borrow it without waiting in line. They also want to check their loan history and any overdue fines.
任何系统设计的第一步是了解谁将使用它以及他们需要什么。在我们的图书馆系统中,有三个主要利益相关者:图书管理员、学生和教师。图书管理员希望轻松添加新书、查看谁借了哪本书,并生成热门书籍报告。学生和教师希望快速找到一本书是否可借,并能不排队地借阅。他们还希望查看自己的借阅历史和任何逾期罚款。
From these conversations, we can list functional requirements: search book by title, author, or ISBN; borrow a book; return a book; register a new user; and display loans. Non‑functional requirements include that the system should be easy to use, respond within 2 seconds, and protect personal data with passwords.
从这些交流中,我们可以列出功能需求:按书名、作者或 ISBN 搜索图书;借书;还书;注册新用户;显示借阅记录。非功能性需求包括系统应易于使用、在 2 秒内响应,并使用密码保护个人数据。
3. Hardware Selection | 硬件选择
Because the library is a fixed space, we will use a desktop computer as the main station for the librarian. It will have a fast processor, at least 8 GB of RAM, and a large hard drive to store the database. We also need a barcode scanner to read book ISBNs and user ID cards quickly. This reduces typing errors and speeds up transactions. A receipt printer will produce a small slip showing the due date when a book is borrowed. For students who want to search the catalogue, a touch‑screen kiosk can be placed near the entrance.
由于图书馆是一个固定空间,我们将使用台式计算机作为图书管理员的主站。它将配备快速处理器、至少 8 GB 内存和一个大容量硬盘用于存储数据库。我们还需要一个条形码扫描器来快速读取图书 ISBN 和用户 ID 卡。这减少了打字错误并加快了交易速度。借书时,一台收据打印机将打印一张显示到期日的小票。对于想要搜索目录的学生,可以在入口附近放置一个触摸屏自助终端。
All these devices will be connected to a local server that runs the library software and stores the database. We avoid storing data on individual machines because a central server makes backup and security easier. A battery backup (UPS) is also included so that power cuts do not corrupt the database.
所有这些设备都将连接到一台运行图书馆软件并存储数据库的本地服务器。我们避免在单台机器上存储数据,因为中央服务器使备份和安全更容易。还包含了一个电池备份(UPS),以便停电时不会损坏数据库。
4. Software Considerations | 软件考量
The most suitable software type for this project is a custom‑built database application. We will design a program using a high‑level language such as Python because it is taught at KS3 and has excellent libraries for database handling. The user interface will be developed with a library like tkinter to create windows, buttons, and text fields. For the data layer, we can use SQLite, which is a lightweight database that does not need a separate server process — ideal for a school environment.
该项目最合适的软件类型是定制数据库应用程序。我们将使用高级语言(如 Python)设计程序,因为它在 KS3 阶段教学,并且有出色的数据库处理库。用户界面将使用 tkinter 之类的库来创建窗口、按钮和文本字段。对于数据层,我们可以使用 SQLite,这是一种轻量级数据库,不需要独立的服务器进程——非常适合学校环境。
We must also consider the operating system. The computers will run a stable version of Linux or Windows, and all devices will have security software to prevent malware. Regular updates will be scheduled outside library hours.
我们还必须考虑操作系统。计算机将运行稳定版本的 Linux 或 Windows,并且所有设备都将安装安全软件以防止恶意软件。将安排在图书馆关闭时间进行定期更新。
5. Data Structure Design | 数据结构设计
Data is the heart of the library system. We need to think carefully about how to organise it. Two main tables will be created in the database: Books and Users. A third table, Loans, will link them together.
数据是图书馆系统的核心。我们需要仔细考虑如何组织数据。数据库中将创建两个主表:Books(图书)和 Users(用户)。第三个表 Loans(借阅)将把它们连接起来。
The Books table will have fields: BookID (primary key, integer), Title (text), Author (text), ISBN (text, unique), and Available (Boolean). The Users table will contain: UserID (primary key), Name (text), Role (student/teacher), and PasswordHash (text). The Loans table records: LoanID (primary key), BookID (foreign key), UserID (foreign key), DateOut (date), and DateDue (date). By using Boolean for availability, we can quickly check if a book can be borrowed without counting records.
Books 表将包含字段:BookID(主键,整数)、Title(文本)、Author(文本)、ISBN(文本,唯一)和 Available(布尔值)。Users 表将包含:UserID(主键)、Name(文本)、Role(学生/教师)和 PasswordHash(文本)。Loans 表记录:LoanID(主键)、BookID(外键)、UserID(外键)、DateOut(日期)和 DateDue(日期)。通过使用布尔值表示可借状态,我们可以快速检查图书能否借出,而无需计算记录数。
We also need to choose suitable data types and constraints. For example, the ISBN must always be 13 digits, so we can use a check constraint. Passwords will be stored as a hash using a library function for security, never as plain text.
我们还需要选择合适的数据类型和约束。例如,ISBN 必须始终为 13 位数字,因此我们可以使用检查约束。密码将使用库函数以哈希形式存储以确保安全,绝不存储为纯文本。
6. Algorithm Design: Search and Borrow Books | 算法设计:图书检索与借阅
The most common task in the library is searching for a book. Because our database uses SQL, we can write a query, but from a computational thinking perspective we should also understand the algorithm behind it. Let’s design a linear search on a list of book titles. Although in reality the database handles this, knowing how a search works is an important KS3 skill.
图书馆中最常见的任务是搜索图书。因为我们的数据库使用 SQL,所以可以编写查询,但从计算思维的角度看,我们也应理解其背后的算法。让我们在书名字符串列表上设计一个线性搜索。虽然实际上由数据库处理,但了解搜索如何工作是重要的 KS3 技能。
PROCEDURE search_book(title_to_find)
FOR each book IN book_list DO
IF book.title = title_to_find THEN
RETURN book
ENDIF
ENDFOR
RETURN “Not found”
ENDPROCEDURE
程序 search_book(待找书名)
对于 book_list 中的每本书 DO
如果 book.title = 待找书名 THEN
返回 book
结束如果
结束循环
返回 “未找到”
结束程序
The borrowing process involves checking availability, verifying the user has no outstanding fines, and then updating the database. Here is a simple pseudocode for lending:
借阅流程包括检查可借性、验证用户没有未缴罚款,然后更新数据库。以下是借书的简单伪代码:
PROCEDURE borrow_book(user_id, book_id)
IF book.available = True THEN
IF user_has_fine(user_id) = False THEN
INSERT INTO Loans (BookID, UserID, DateOut, DateDue)
VALUES (book_id, user_id, TODAY, TODAY+14)
UPDATE Books SET available = False WHERE BookID = book_id
PRINT “Book borrowed. Due date: “, TODAY+14
ELSE
PRINT “Please clear fines before borrowing.”
ENDIF
ELSE
PRINT “Book is currently on loan.”
ENDIF
ENDPROCEDURE
程序 borrow_book(用户ID, 图书ID)
如果 book.available = True THEN
如果 user_has_fine(用户ID) = False THEN
插入到 Loans (BookID, UserID, DateOut, DateDue)
值 (图书ID, 用户ID, 今天, 今天+14)
更新 Books 设置 available = False 当 BookID = 图书ID
打印 “借书成功。到期日:”, 今天+14
否则
打印 “请在借书前缴清罚款。”
结束如果
否则
打印 “此书当前已被借出。”
结束如果
结束程序
7. User Interface Design | 用户界面设计
For the librarian, the interface will be a series of straightforward forms. A menu screen offers options: Search Books, Borrow, Return, Manage Users, and Reports. When borrowing, the librarian scans the book ISBN and the user’s barcode; the system automatically fills in details and displays a confirmation. Error messages appear in red, and success messages in green, following common HCI (Human‑Computer Interaction) principles. The student kiosk has a simpler search‑only interface with large buttons that can be used without a keyboard.
对于图书管理员,界面将是一系列简单的表单。菜单屏幕提供选项:搜索图书、借书、还书、用户管理和报告。借书时,管理员扫描图书 ISBN 和用户条形码;系统自动填入详情并显示确认信息。错误消息显示为红色,成功消息显示为绿色,遵循常见的人机交互原则。学生自助终端有一个仅用于搜索的简单界面,带有大按钮,无需键盘即可使用。
We must also think about accessibility. The font will be adjustable, and colour contrast will meet WCAG guidelines so that visually impaired users can operate the system. All input fields will have clear labels.
我们还必须考虑无障碍访问。字体可调节,颜色对比度将符合 WCAG 指南,以便视力障碍用户能够操作该系统。所有输入字段都将有明确的标签。
8. Network and Security Considerations | 网络与安全考虑
The library system will operate within the school’s local area network (LAN). The central server hosts the database, and client machines connect via Ethernet for reliability. Wi‑Fi could be used for the kiosk, but it is less secure, so we will use a protected SSID with WPA3 encryption. Each user must log in with a unique username and password. The password is hashed and compared to the stored hash — at no point is the plain password visible. Additionally, user roles determine access: students can only borrow and search, while librarians can add books and view all records.
图书馆系统将在学校的局域网内运行。中央服务器托管数据库,客户机通过以太网连接以确保可靠性。自助终端可以使用 Wi‑Fi,但安全性较低,因此我们将使用受保护的 SSID 并采用 WPA3 加密。每个用户必须使用唯一的用户名和密码登录。密码经过哈希处理并与存储的哈希值比较——任何环节都不会看到纯文本密码。此外,用户角色决定访问权限:学生只能借阅和搜索,而图书管理员可以添加图书和查看所有记录。
To protect data from loss, the server will perform an automatic backup every evening to an external hard drive and a cloud folder. This follows the 3‑2‑1 backup rule: three copies, on two different media, with one off‑site.
为防止数据丢失,服务器将每晚自动备份到外部硬盘和云文件夹。这遵循 3-2-1 备份规则:三份副本,存放在两种不同介质上,其中一份异地存放。
9. Testing the System | 系统测试
Testing is essential to make sure the system works correctly and handles errors gracefully. We will design a test plan that includes normal, abnormal, and boundary cases. The table below shows some test cases for the borrow function.
测试对于确保系统正常运行并能优雅地处理错误至关重要。我们将设计一个测试计划,包括正常、异常和边界情况。下表展示了借阅功能的一些测试用例。
| Test Case | Input | Expected Result |
|---|---|---|
| Borrow an available book | Valid user, available book ID | Loan recorded, availability set to False |
| Borrow an already loaned book | Book with available=False | Error message “Book is currently on loan” |
| User with unpaid fine tries to borrow | User flagged with fine | Error message “Please clear fines” |
| Invalid book ID entered | Non‑existent ID | Error message “Book not found” |
We will also test search with partial titles, multiple authors, and special characters. Usability testing will involve a few students and the librarian to see how quickly they can complete tasks. Any bugs found will be logged and fixed before the system goes live.
我们还将测试使用部分书名、多个作者和特殊字符进行搜索。可用性测试将邀请几名学生和图书管理员参与,观察他们完成任务的速度。发现的任何错误都将被记录并在系统上线前修复。
10. Evaluation and Future Improvements | 评估与未来改进
After building and testing, we must evaluate how well the system meets its original requirements. Overall, the system successfully allows fast searching, borrowing, and returning. The barcode scanner reduced transaction time by 70% compared to manual typing. The librarian can now generate reports on borrowing trends in seconds, which was impossible with paper records. However, some students found the kiosk search a bit slow when typing on the on‑screen keyboard, so a physical keyboard might be added later.
在构建和测试之后,我们必须评估系统满足原始需求的程度。总体而言,该系统成功实现了快速搜索、借阅和归还。与手动输入相比,条形码扫描器将交易时间缩短了 70%。图书管理员现在可以在几秒钟内生成借阅趋势报告,这是纸质记录无法实现的。然而,一些学生发现在屏幕键盘上输入时自助终端搜索有点慢,因此将来可以加装物理键盘。
Future improvements could include an online reservation system so users can reserve books from home, a recommendation engine based on loan history, and integration with the school’s management information system to automatically update student lists. Adding RFID tags instead of barcodes would allow multiple books to be checked out simultaneously. These enhancements would require more advanced data structures and security measures but are natural next steps.
未来的改进可以包括一个在线预约系统,使用户能够在家预约图书;一个基于借阅历史的推荐引擎;以及与学校管理信息系统的集成,以自动更新学生名单。使用 RFID 标签代替条形码可以同时借出多本书。这些增强功能将需要更高级的数据结构和安全措施,但却是理所当然的后续步骤。
By working through this case study, you have practiced all the WJEC key skills: understanding a problem, designing a solution, selecting appropriate technology, representing data, writing algorithms, planning testing, and evaluating outcomes. This is exactly the kind of thinking that leads to high marks in KS3 Computer Science.
通过这个案例研究,你已经练习了所有 WJEC 关键技能:理解问题、设计解决方案、选择合适技术、表示数据、编写算法、规划测试以及评估结果。这正是能在 KS3 计算机科学中获得高分的思维方式。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导