📚 Case Study Practice for Year 10 WJEC Computer Science | 案例分析与实战演练:十年级 WJEC 计算机科学
In the WJEC GCSE Computer Science exam, case study questions require you to apply your theoretical knowledge to a realistic scenario. This article provides a hands-on walkthrough of a typical case study, showing you how to deconstruct a problem, design data structures, write pseudocode, and plan tests.
在 WJEC GCSE 计算机科学考试中,案例分析题要求你将理论知识应用于一个真实情境。本文会带领你逐步剖析一个典型案例,展示如何拆解问题、设计数据结构、编写伪代码并规划测试方案。
1. Understanding the WJEC Case Study Format | 理解WJEC案例研究格式
Case study questions on the WJEC paper usually present a short narrative followed by several sub-questions worth 8–12 marks in total. You might be asked to analyse requirements, propose a design, write an algorithm, consider ethical issues, or suggest suitable testing strategies. Success depends on methodical reading and structured answers.
WJEC 试卷中的案例分析题通常先给出一段简短叙述,然后跟随若干子问题,总分 8 到 12 分。你可能会被要求分析需求、提出设计方案、编写算法、考虑伦理问题或建议合适的测试策略。成功的关键在于有条理地阅读和结构化的作答。
2. Reading and Deconstructing the Scenario | 阅读与拆解情境
Let us work through a sample scenario: ‘A school wants a program to manage its library lending system. The library holds books, each with an ISBN, title, author, and quantity in stock. Students have a unique ID, name, and year group. When a student borrows a book, the system records the borrow date, the due date (14 days later), and later the actual return date. The system must allow searching for a book by title, lending a book, returning a book, and calculating overdue fines (£0.10 per day).’
我们通过一个示例情境进行演练:“某学校想要一个程序来管理图书馆借阅系统。图书馆拥有图书,每本书有 ISBN、书名、作者和库存数量。学生有唯一 ID、姓名和年级。学生借书时,系统记录借阅日期、应还日期(14 天后)以及之后的实际归还日期。系统必须允许按书名搜索、借书、还书以及计算超期罚款(每天 £0.10)。”
Start by underlining the key nouns (entities) and verbs (processes). Nouns: book, student, borrow date, due date, return date, fine. Verbs: search, lend, return, calculate fine. This immediately separates the data you need to store from the operations the program must perform.
第一步是划出关键名词(实体)和动词(过程)。名词:图书、学生、借阅日期、应还日期、归还日期、罚款。动词:搜索、借书、还书、计算罚款。这样就能快速区分要存储的数据和程序必须执行的操作。
3. Identifying Key Requirements and Constraints | 识别关键需求与约束
Functional requirements describe what the system must do: (1) Search for a book by title and display its availability. (2) Lend a book to a student if copies are available. (3) Record a return and calculate any overdue fine. (4) Store all transaction history. Non-functional requirements might include: the interface should be text-based and simple to use, and the system must respond within a couple of seconds on a standard school computer. Constraints: the program will be written in Python and stored locally; no network or database server is available.
功能需求描述系统必须做什么:(1) 按书名搜索并显示是否可借。(2) 如果有库存,将书借给学生。(3) 记录还书并计算超期罚款。(4) 保存所有交易历史。非功能需求可能包括:界面应为文本方式且易于使用,系统在标准学校计算机上必须在几秒内响应。约束条件:程序用 Python 编写并本地存储,没有网络或数据库服务器。
Clearly separating functional and non-functional requirements helps you stay focused when designing algorithms and data structures.
清晰地区分功能需求与非功能需求有助于在设计算法和数据结构时保持专注。
4. Abstraction and Modelling | 抽象与建模
Abstraction means focusing on the essential details and ignoring irrelevant ones. For our library, we model a ‘Book’ by its ISBN, title, author, and quantity. A ‘Student’ is modelled by ID, name, and year group. A ‘Loan’ links a student and a book, with borrow date, due date, and actual return date. We do not need to model the colour of the book cover or the student’s favourite subject.
抽象意味着关注必要的细节并忽略无关信息。对我们的图书馆来说,我们通过 ISBN、书名、作者和库存数量来建模“图书”。通过 ID、姓名和年级建模“学生”。一条“借阅记录”关联学生和图书,并包含借阅日期、应还日期和实际归还日期。我们不需要将书的封面颜色或学生最喜欢的科目纳入模型。
The model can be represented using an entity-relationship sketch: BOOK —< LENDS >— STUDENT, where LENDS holds the date attributes. This mental model guides your data structure choices.
该模型可以用实体关系草图表示:图书 ——< 借阅 >—— 学生,其中借阅实体持有日期属性。这个思维模型会指导数据结构的选择。
5. Designing Data Structures | 设计数据结构
In Python, we might store books as a list of dictionaries, where each dictionary contains keys such as ‘ISBN’, ‘title’, ‘author’, and ‘quantity’. Students could be stored in a similar list. Loans can be stored as a list of dictionaries, each recording ‘studentID’, ‘ISBN’, ‘borrowDate’, ‘dueDate’, and ‘returnDate’ (which is None until the book is returned). This makes it easy to add, search, and modify records.
在 Python 中,我们可以将图书存储为字典列表,每个字典包含 ‘ISBN’、’title’、’author’ 和 ‘quantity’ 等键。学生可以用类似的列表存储。借阅记录也可存储为字典列表,每条记录包含 ‘studentID’、’ISBN’、’borrowDate’、’dueDate’ 和 ‘returnDate’(在还书前值为 None)。这便于添加、搜索和修改记录。
| Variable | Data Type | Description |
|---|---|---|
| books | List of dict | Collection of all book records |
| students | List of dict | Collection of all student records |
| loans | List of dict | All borrowing transactions |
Table showing the main data structures for the library system.
上表展示了图书馆系统的主要数据结构。
6. Algorithm Design with Pseudocode | 用伪代码设计算法
Let us design the ‘search book’ algorithm. The program receives a target title, loops through the books list, and returns the matching record along with how many copies are in stock. Below is a possible pseudocode solution written in a structured English style that mirrors Python.
我们来设计“搜索图书”算法。程序接收目标书名,遍历图书列表,返回匹配记录及当前库存数量。下面是模仿 Python 风格的结构化英语伪代码。
FUNCTION search_book(target_title)
FOR each book IN books
IF book.title == target_title THEN
RETURN book.ISBN, book.title, book.quantity
ENDIF
ENDFOR
RETURN “Book not found”
ENDFUNCTION
Think about what happens when multiple books share the same title. The algorithm above returns the first match. In a WJEC answer, you could explain that a more robust design might collect all matches and display them, or prompt the user to select by ISBN.
想一想如果多本书书名相同会发生什么。上述算法返回第一个匹配项。在 WJEC 答题中,你可以说明更健壮的设计可能会收集所有匹配项并显示,或者提示用户按 ISBN 选择。
The lend algorithm must check availability, create a new loan record with borrow date and calculated due date, and decrement the book’s quantity. Here is the core logic:
借阅算法必须检查库存、创建带有借阅日期和计算出的应还日期的新借阅记录,并减少图书库存数量。核心逻辑如下:
FUNCTION lend_book(isbn, student_id)
Find book WHERE book.ISBN == isbn
IF book.quantity > 0 THEN
book.quantity ← book.quantity – 1
new_loan ← {studentID: student_id, ISBN: isbn, borrowDate: TODAY, dueDate: TODAY + 14 days, returnDate: None}
ADD new_loan TO loans
RETURN “Loan successful”
ELSE
RETURN “No copies available”
ENDIF
ENDFUNCTION
Notice the use of the assignment arrow ← and the clear conditional logic. Examiners expect pseudocode to be unambiguous even if not perfectly syntactical.
请注意赋值箭头 ← 的使用和清晰的条件逻辑。考官希望伪代码明确无误,即使语法不完美。
7. Developing a Flowchart Representation | 绘制流程图表示
A flowchart can visualise the lending process. The sequence of shapes might be: Start → Input ISBN → Search book → Decision (Found?) → If No, output ‘Book not found’ and end. If Yes → Check quantity > 0 → If No, output ‘Out of stock’. If Yes → Enter student ID → Record loan → Update quantity → Output ‘Success’ → End.
流程图可以直观展示借书过程。形状顺序为:开始 → 输入 ISBN → 搜索图书 → 判断(找到?)→ 如果否,输出“未找到图书”并结束。如果是 → 检查 quantity > 0 → 如果否,输出“无库存”。如果是 → 输入学生 ID → 记录借阅 → 更新库存 → 输出“成功” → 结束。
In the exam, you may be asked to draw a flowchart on paper. Using standard symbols (ovals for start/end, parallelograms for input/output, rectangles for processes, diamonds for decisions) earns marks. Even a text-based description can demonstrate your understanding of control flow.
考试中可能要求你在纸上画出流程图。使用标准符号(椭圆表示开始/结束,平行四边形表示输入/输出,矩形表示处理,菱形表示判断)可以得分。即使是基于文本的描述也能展示你对控制流程的理解。
8. Testing Strategy and Trace Tables | 测试策略与跟踪表
A robust test plan includes normal, boundary, and erroneous test cases. For the search function, a normal test would search for an existing title; a boundary test might search for an empty string or a title with very long characters; an erroneous test could input a non-string data type. For the lend function, test with quantity = 1 to ensure it decrements correctly and the last copy triggers ‘no copies’ next time.
一个健壮的测试计划包括正常、边界和错误测试用例。对于搜索功能,正常测试是用存在的书名搜索;边界测试可能是搜索空字符串或超长书名;错误测试可以输入非字符串数据类型。对于借书功能,测试数量为 1 的情况,确保它正确递减,并且最后一本被借出后下次触发“无库存”。
| Test ID | Input | Expected Output | Actual Output | Pass/Fail |
|---|---|---|---|---|
| T1 | search(“Oliver Twist”) | ISBN 978-0-14-143974-5, qty 3 | … | … |
| T2 | lend(isbn, studentID) when qty=1 | Success, qty becomes 0 | … | … |
| T3 | lend again same book | “No copies available” | … | … |
Sample test table for the library system. A trace table helps you follow variables step by step during algorithm dry runs.
图书馆系统的示例测试表格。跟踪表有助于你在算法手工执行时逐步追踪变量。
For the overdue fine calculation, the formula is fine = (returnDate – dueDate) × 0.10 if returnDate > dueDate, else 0. Use a boundary test where returnDate equals dueDate (expected fine 0) and where returnDate is one day late (expected fine £0.10).
对于超期罚款计算,公式为:如果归还日期 > 应还日期,则罚款 = (归还日期 − 应还日期) × 0.10,否则为 0。使用边界测试:归还日期等于应还日期(预期罚款 0)和归还日期晚一天(预期罚款 £0.10)。
9. Considering Ethical and Legal Issues | 考虑伦理与法律问题
Any system handling personal data must comply with the Data Protection Act 2018 and UK GDPR principles. Student names, IDs, and borrowing history are personal data. The school must ensure data is stored securely, accessed only by authorised staff, and not shared without consent. The program should not display a student’s full details to other students using the search terminal.
任何处理个人数据的系统都必须遵守《2018 年数据保护法》和英国通用数据保护条例原则。学生姓名、ID 和借阅历史都是个人数据。学校必须确保数据安全存储,只有授权人员才能访问,未经同意不得共享。程序不应在搜索终端向其他学生显示某学生的完整信息。
Furthermore, the software should include input validation to prevent accidental or malicious misuse, like entering a negative fine or borrowing more copies than exist. These considerations can be mentioned in an evaluation or design justification in the WJEC paper.
此外,软件应包含输入验证,防止意外或恶意滥用,例如输入负数罚款或借出超出库存的数量。这些考虑可以在 WJEC 试卷的评估或设计理由中提及。
10. Evaluation and Reflection | 评估与反思
Once the design is complete, evaluate it. The list-of-dictionaries approach is simple and works well for small datasets typical of a school library, but would not scale efficiently for huge libraries. Searching by title uses a linear search, which is O(n). To improve, we could index books by title using a dictionary for O(1) average lookup. However, this would require extra memory – a classic trade-off.
设计完成后,进行评估。字典列表的方法简单,对于学校图书馆这种典型小数据集很有效,但如果图书馆规模巨大就不易扩展。按书名搜索使用线性搜索,时间复杂度为 O(n)。我们可以用字典按书名索引来改进,实现平均 O(1) 的查找。但这需要额外内存——这是典型的权衡。
Reflect on user experience: a real system would need clear prompts and error messages. Also, discuss how you would gather feedback and conduct iterative refinement. In a WJEC case study, showing awareness of the software development lifecycle impresses examiners.
反思用户体验:真实系统需要清晰的提示和错误消息。还要讨论如何收集反馈并进行迭代改进。在 WJEC 案例分析中,表现出对软件开发生命周期的认识会给考官留下深刻印象。
Remember to link your evaluation back to the original requirements. Did the solution meet all functional and non-functional goals? Could data validation be strengthened? These reflections demonstrate higher-order thinking.
请记住,将评估与原始需求联系起来。解决方案是否满足了所有功能和非功能目标?数据验证能否加强?这些反思体现了高阶思维。
Published by TutorHao | WJEC Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导