📚 Year 13 WJEC Computer Science: Case Study Practical Drills | Year 13 WJEC 计算机:案例分析实战演练
In WJEC A Level Computer Science, the case study is a vital component that tests your ability to apply theoretical knowledge to a real-world scenario. Through systematic analysis, design, implementation, and evaluation, you demonstrate not only your computational thinking but also your understanding of professional practices. This article walks you through a comprehensive case study of a Library Management System (LMS), providing a practical drill that mirrors what you might encounter in your examination.
在 WJEC A Level 计算机科学中,案例分析是检验你将理论知识应用于实际场景能力的重要组成部分。通过系统分析、设计、实现和评估,你不仅要展示计算思维,还要展现对专业实践的理解。本文将以一个图书馆管理系统(LMS)的完整案例为线索,带领你进行实战演练,帮助你熟悉考试中可能出现的题型。
1. Understanding the Scenario | 理解案例场景
A small town library currently operates a manual, paper-based system to manage 15,000 books, 2,000 registered members, and an average of 300 daily lending transactions. Staff record borrowings in logbooks, search the catalogue using index cards, and send overdue notices by post. The library committee has commissioned you to develop a computerised Library Management System (LMS) that must support members, librarians, and an online public access catalogue (OPAC). The new system should streamline check-out, check-in, reservation, fine calculation, and reporting while ensuring data integrity and security.
一个小镇图书馆目前使用手工纸质系统管理15,000册藏书、2,000名注册会员以及日均300笔借阅事务。工作人员用日志本记录借阅,通过索引卡片检索目录,并通过邮寄方式发送逾期通知。图书馆委员会委托你开发一个计算机化图书馆管理系统(LMS),该系统必须支持会员、图书馆员以及在线公共检索目录(OPAC)。新系统需简化借书、还书、预约、罚金计算和报表生成,同时保证数据的完整性与安全性。
2. Feasibility Study | 可行性研究
Before committing resources, we conduct a feasibility study covering technological, economic, legal, and operational aspects. Technologically, the library already owns a local area network, four desktop PCs, and a barcode scanner, making a client-server solution feasible with a centralised database. Economically, the initial estimate shows a development cost of £8,000 and annual maintenance of £1,200; a cost-benefit analysis reveals that automating processes will save roughly 60 staff hours per week, recovering the investment within 18 months. Legally, the system must comply with the UK Data Protection Act 2018 and GDPR, especially regarding members' personal data. Operationally, staff are willing to be trained, and the transition can be phased to avoid disrupting service.
在投入资源之前,我们进行涵盖技术、经济、法律和运营方面的可行性研究。技术上,图书馆已拥有一个局域网、四台台式电脑和一台条码扫描器,因此采用集中式数据库的客户端-服务器方案是可行的。经济上,初步估算开发成本为8,000英镑,年度维护1,200英镑;成本效益分析表明流程自动化每周可节省约60个工时,投资将在18个月内收回。法律上,系统必须符合英国《2018年数据保护法》和GDPR,特别是会员个人数据部分。运营上,员工愿意接受培训,过渡可以分阶段进行以避免服务中断。
3. Requirements Elicitation | 需求获取与分析
Functional requirements are captured through interviews, observations, and user stories. Key functions include: checking out a book by scanning its barcode and a member card; checking in returned books and automatically updating availability; searching the catalogue by title, author, or ISBN; placing a reservation for an item currently on loan; calculating overdue fines at a rate of £0.20 per day; and generating weekly reports on overdue items and popular titles. Non-functional requirements specify that the system must respond to a catalogue search within two seconds, support 10 concurrent users, maintain 99.9% uptime, and enforce role-based access control so that only librarians can modify member records.
通过访谈、观察和用户故事来捕获功能需求。主要功能包括:通过扫描条码和会员卡借书;归还图书并自动更新可借状态;按书名、作者或ISBN检索目录;对当前已借出图书进行预约;按每日£0.20计算逾期罚金;生成逾期物品和热门图书的周报表。非功能需求规定系统必须在两秒内响应目录搜索,支持10个并发用户,保持99.9%的正常运行时间,并实施基于角色的访问控制,只有图书馆员可以修改会员记录。
Example of a user story: 'As a librarian, I want to check out a book by scanning its barcode and the member's card so that the transaction completes in under five seconds.' This technique ensures the development team remains focused on user value.
用户故事示例:'作为图书馆员,我希望通过扫描条码和会员卡来借出图书,以便交易在五秒内完成。'这一技术确保开发团队始终聚焦于用户价值。
4. System Design Overview | 系统设计总览
rises a desktop application for librarians and a web-based OPAC for members. The business logic layer handles rules such as fine calculation and reservation expiry. The data access layer interfaces with a relational database. A context diagram shows external entities (Member, Librarian) interacting with the LMS through data flows like 'borrow request' and 'availability query'. Internally, data flow diagrams (DFDs) break down the process 'Check Out Book' into steps: verify member status → verify item availability → create loan record → update item status.
LMS 采用模块化层次架构设计,包含表示层、业务逻辑层和数据访问层。表示层由面向图书馆员的桌面应用和面向会员的基于 Web 的 OPAC 组成。业务逻辑层处理诸如罚金计算和预约到期等规则。数据访问层与关系数据库交互。一个背景图展示外部实体(会员、图书馆员)通过'借阅请求'、'可借查询'等数据流与 LMS 交互。在内部,数据流图(DFD)将'借书'过程分解为多个步骤:验证会员状态 → 验证图书可借状态 → 创建借阅记录 → 更新图书状态。
5. Data Modelling and Database Design | 数据建模与数据库设计
An entity-relationship diagram identifies the main entities: Member, Book, Loan, Reservation, and Fine. A Member can have many Loans; a Book can be involved in many Loans over time. The Loan entity acts as an associative entity with attributes LoanID, DateOut, DueDate, and DateReturned. The Reservation entity links a Member to a Book with a ReservationDate and status. These are mapped to relational schemas:
实体关系图识别出主要实体:会员(Member)、图书(Book)、借阅(Loan)、预约(Reservation)和罚金(Fine)。一个会员可以有多条借阅记录;一本图书可以在不同时间参与多次借阅。借阅实体作为关联实体,具有 LoanID、借出日期、到期日和归还日期等属性。预约实体通过预约日期和状态将会员与图书联系起来。这些被映射为以下关系模式:
| Member | MemberID (PK), Name, Address, Email, Phone, JoinDate |
|---|---|
| Book | ISBN (PK), Title, Author, Publisher, Year, CopiesTotal, CopiesAvailable |
| Loan | LoanID (PK), MemberID (FK), ISBN (FK), DateOut, DueDate, DateReturned |
| Reservation | ResID (PK), MemberID (FK), ISBN (FK), ResDate, Status |
Title} but not in the Loan table. The schema already satisfies 3NF because no non-key attribute is transitively dependent on the primary key. A composite index on (ISBN, MemberID) in the Loan table will speed up frequent queries like 'which books does a member currently have?'
检查函数依赖以进行规范化。对于 Loan 表:LoanID → {MemberID, ISBN, DateOut, DueDate, DateReturned};ISBN → {Title} 但此依赖不在 Loan 表中。该模式已满足第三范式,因为没有非主属性传递依赖于主键。在 Loan 表上对 (ISBN, MemberID) 建立复合索引将加快诸如'某会员当前借阅了哪些书?'等频繁查询的速度。
6. User Interface Design | 用户界面设计
Wireframes are sketched for the librarian dashboard, which includes a 'Quick Check-out' panel with input fields for barcode and member ID, a 'Currently Borrowed' list, and notifications for overdue items. The OPAC web page features a prominent search bar, filter options by genre and availability, and a 'My Account' section where members can view their loans and reservations. Nielsen's usability heuristics guide the design: consistency in button placement (e.g., all action buttons in the top right), error prevention (e.g., disabling the 'borrow' button if a member has outstanding fines), and informative feedback (e.g., 'Book checked out successfully' or 'This title is currently reserved').
针对图书馆员仪表板绘制了线框图,包括一个含条码和会员ID输入栏的'快速借出'面板、一个'当前借阅'列表以及逾期通知。OPAC 网页设有一个突出的搜索栏、按流派和可借状态筛选的选项,以及一个供会员查看借阅与预约的'我的账户'区域。Nielsen 的可用性启发式原则指导设计:按钮位置的一致性(例如所有操作按钮位于右上角)、错误预防(例如当会员有未缴罚金时禁用'借阅'按钮)以及信息丰富的反馈(例如'图书借出成功'或'此书名当前已被预约')。
7. Prototyping and Iterative Refinement | 原型制作与迭代完善
A low-fidelity paper prototype is first presented to librarians and three representative members. Feedback reveals that a search-by-author feature must support partial names, and that the due date should be prominently displayed when checking out. These are quickly incorporated. A high-fidelity clickable prototype is then developed using a tool like Figma, simulating the database response. In a second round of testing, users request a 'one-click renewal' option, which is added to the loan management screen. This iterative approach minimises the risk of building unwanted features and ensures the final system is intuitive.
首先向图书馆员和三位有代表性的会员展示低保真纸质原型。反馈显示按作者搜索功能必须支持部分姓名匹配,且在借出时应突出显示到期日。这些意见被迅速融入设计。随后使用类似 Figma 的工具开发可点击的高保真原型,模拟数据库响应。在第二轮测试中,用户请求增加'一键续借'选项,该功能随即被添加到借阅管理界面。这种迭代方法将构建无用功能的风险降至最低,并确保最终系统直观易用。
8. Implementation Considerations | 实现考量
The back-end is implemented in Python using the Flask framework, with SQLite as the database engine for its portability and low administration overhead. The librarian client is built with Tkinter to provide a responsive desktop interface, while the OPAC is a set of HTML/CSS pages rendered through Flask templates. Key algorithm – check-out process:
后端使用 Python 的 Flask 框架实现,数据库引擎选用 SQLite,因其便携且管理开销低。图书馆员客户端采用 Tkinter 构建,以提供灵敏的桌面界面;OPAC 则是一组通过 Flask 模板渲染的 HTML/CSS 页面。关键算法——借出流程:
1. Read barcode → look up ISBN in Book table
2. If CopiesAvailable ≥ 1 and Member has no outstanding fines > £5.00
3. Create a new Loan record: DateOut = today, DueDate = today + 14 days
4. Decrement CopiesAvailable by 1
5. Display success message
6. Else display appropriate error message
All database operations are wrapped in transactions to maintain consistency. Password hashing using bcrypt protects member credentials. The OPAC interface uses AJAX to provide dynamic search suggestions without full page reloads, improving perceived performance.
所有数据库操作都被封装在事务中以保持一致性。密码通过 bcrypt 哈希存储来保护会员凭据。OPAC 界面使用 AJAX 提供动态搜索建议,无需整页重载,从而提升了感知性能。
9. Testing Strategies | 测试策略
A comprehensive test plan spans unit, integration, system, and acceptance testing. Unit tests check the fine calculation function: for example, if a book is 3 days overdue, the fine should be £0.60. Boundary tests ensure the rule that fines cap at the book's replacement cost works correctly. Integration tests simulate the full check-out flow, from barcode scanning to database update, verifying that transactional rollback occurs if the member's fine status changes concurrently. System testing evaluates performance under load – 10 concurrent users performing searches should all receive responses within 2 seconds.
全面的测试计划涵盖单元测试、集成测试、系统测试和验收测试。单元测试检查罚金计算函数:例如,若图书逾期3天,罚金应为£0.60。边界测试确保罚金上限为图书重置成本的规则正确执行。集成测试模拟从条码扫描到数据库更新的完整借出流程,验证当会员罚金状态并发改变时事务是否回滚。系统测试评估负载下的性能——10个并发用户执行搜索,所有响应均应在2秒内完成。
Test data includes normal cases (a member with one book), boundary cases (member attempting to borrow the last copy of a title), and erroneous cases (scanning a non-existent barcode). A traceability matrix links each test to a specific requirement, ensuring full coverage.
测试数据包括正常情况(借有一本书的会员)、边界情况(会员尝试借阅某书目的最后一本)以及错误情况(扫描不存在的条码)。可追溯性矩阵将每个测试与具体需求关联起来,确保全面覆盖。
10. Maintenance and Evaluation | 维护与评估
Post-deployment maintenance falls into three categories: corrective (fixing bugs such as a miscalculation of leap-year due dates), adaptive (adjusting the fine rate from £0.20 to £0.25 following a committee decision), and perfective (adding a recommendation engine based on borrowing history). The system is evaluated against the original objectives using quantitative metrics: average check-out time decreased from 45 seconds to 4 seconds; overdue returns dropped by 30% due to automated email reminders; and member satisfaction surveys show 92% approval of the OPAC search functionality. Qualitative feedback highlights that the reservation system could be enhanced with an SMS notification, which is added to the backlog for a future release.
部署后的维护分为三类:纠正性维护(修复如闰年到期日计算错误的缺陷)、适应性维护(根据委员会决定将罚金率从£0.20上调至£0.25)和完善性维护(增加基于借阅历史的推荐引擎)。通过量化指标对照最初目标评估系统:平均借出时间从45秒降至4秒;由于自动邮件提醒,逾期归还率下降了30%;会员满意度调查显示92%的用户认可OPAC搜索功能。定性反馈指出预约系统可通过短信通知进一步增强,该需求被添加至后续版本的待办事项中。
11. Legal, Ethical, and Security Considerations | 法律、道德与安全考虑
The LMS stores personally identifiable information (PII), making compliance with the Data Protection Act 2018 and UK GDPR essential. Members must give explicit consent before their data is used for marketing emails; data retention policies ensure loan histories are anonymised after three years. Ethical design means the OPAC adheres to WCAG 2.1 accessibility standards – sufficient colour contrast, keyboard navigability, and screen reader compatibility. From a security perspective, the system defends against SQL injection by using parameterised queries, prevents cross-site scripting (XSS) on the OPAC, and enforces HTTPS for all web traffic. A data backup routine is automated daily to an off-site location.
LMS 存储个人可识别信息(PII),因此符合《2018年数据保护法》和英国 GDPR 至关重要。会员必须明确同意其数据才可用于营销邮件;数据保留政策规定借阅历史在三年后匿名化。道德设计意味着 OPAC 遵循 WCAG 2.1 无障碍标准——足够的色彩对比度、键盘可导航性以及屏幕阅读器兼容性。在安全方面,系统通过参数化查询防范 SQL 注入,防止 OPAC 上的跨站脚本(XSS),并对所有网络流量强制使用 HTTPS。数据备份程序每日自动执行并异地存储。
12. Conclusion: Mastering the Case Study Approach | 结语:掌握案例分析的方法
Working through a detailed case study like this Library Management System equips you with the analytical and evaluative skills required for the WJEC examination. You have learned how to deconstruct a scenario, extract requirements, model data, design interfaces, and plan testing – all while considering feasibility, legality, and usability. When facing your own exam case study, remember to follow a structured approach: understand the context, justify your design decisions, and always link back to the user's needs. Practice with various scenarios, and you will develop the confidence to tackle any problem.
通过像图书馆管理系统这样一个详细案例的学习,你获得了WJEC考试所需的分析与评估技能。你已经学会如何解构场景、提取需求、建模数据、设计界面以及规划测试——同时始终考量可行性、合法性和可用性。在面对你自己的考试案例时,请记住遵循结构化方法:理解背景,为设计决策提供理由,并始终回应用户需求。多加练习不同场景,你将建立起攻克任何问题的信心。
Published by TutorHao | Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图