📚 CIE IGCSE Computer Science: Case Study Practice | CIE IGCSE 计算机科学:案例分析实战演练
Case study questions are a major component of CIE IGCSE Computer Science. They require you to analyse a real-world scenario, apply your problem-solving skills, and demonstrate a structured approach to software development. This article walks you through a complete case study, using a school library book-lending system as an example, and shows you how to excel in both coursework and exam contexts.
案例分析题是 CIE IGCSE 计算机科学的重要组成部分。它们要求你分析真实场景,运用问题解决能力,并展示结构化的软件开发方法。本文将以学校图书馆借书系统为例,带你完整演练一个案例,教你如何在课程作业和考试中脱颖而出。
1. Understanding the Problem | 理解问题
In any case study, the first critical step is to read the scenario thoroughly and identify exactly what the software is supposed to do. The scenario might describe a school library that currently uses paper records. The librarian wants a digital system to manage books, track loans, and instantly see which books are available.
在任何案例分析中,关键的第一步是仔细阅读场景,准确识别出软件需要做什么。场景可能描述一个目前使用纸质记录的学校图书馆。管理员想要一个数字化系统来管理图书、跟踪借阅情况,并能即时查看哪些书可借。
You must extract the functional requirements. For our library example, the system needs to: allow the librarian to add a new book (title, author, ISBN), lend a book to a student by recording the book ID and borrower name, return a book by its ID, and display the full catalogue with availability status. Writing these requirements as a concise list prevents later misinterpretation.
你必须提取功能需求。以我们的图书馆为例,系统需要:允许管理员添加新书(书名、作者、ISBN),通过记录图书 ID 和借阅者姓名把书借给学生,通过图书 ID 归还图书,以及显示完整目录及可借状态。将这些需求写成简明的清单可以避免后续误解。
2. Decomposition and Abstraction | 分解与抽象
Decomposition means breaking down the complex problem into smaller, manageable sub-problems. For the library system, we can decompose it into: adding books, borrowing books, returning books, and generating reports. Each sub-problem can be solved independently before integrating them.
分解是指将复杂问题拆分成更小、更易管理的子问题。对于图书馆系统,我们可以将其分解为:添加图书、借出图书、归还图书和生成报告。每个子问题可以先独立解决,再集成在一起。
Abstraction involves filtering out unnecessary details and focusing only on the essential information. A book has many attributes, but for the lending process we abstract away physical properties like weight or colour. Instead we model a book as a record containing an ID, title, author, ISBN, and a status field indicating whether it is available or borrowed. The borrower is abstracted simply to a name string and possibly a class identifier.
抽象涉及过滤掉不必要的细节,只关注关键信息。一本书有很多属性,但在借阅过程中我们抽象掉重量、颜色等物理特性。我们仅将书建模为一个记录,包含 ID、书名、作者、ISBN 和一个表示可借或已借的状态字段。借阅者被简化为一个名字字符串,或许再加一个班级标识。
3. Identifying Inputs, Outputs, and Processes | 识别输入、输出和处理
Every software solution processes inputs to produce outputs. Clearly identifying these elements early on makes algorithm design much easier. For the library system, the main inputs are: book details (title, author, ISBN) for adding books; book ID and borrower name for borrowing; and book ID for returning. Outputs include confirmation messages like "Book added successfully", a list of all books with their statuses, and error messages when a book is not found.
每个软件解决方案都是处理输入并产生输出。尽早明确这些元素可以让算法设计容易得多。对图书馆系统而言,主要输入有:添加图书时的图书详情(书名、作者、ISBN);借书时的图书 ID 和借阅者姓名;还书时的图书 ID。输出包括确认消息如 "图书添加成功"、所有图书及其状态的列表,以及未找到图书时的错误消息。
The core processes are: validating input, searching for a book by ID, updating a book's status from 'available' to 'borrowed' and associating the borrower's name, resetting the status back to 'available' upon return, and iterating through a collection to display the catalogue. Thinking in terms of IPO (Input-Process-Output) tables is a useful exam technique.
核心处理包括:验证输入、按 ID 搜索图书、将图书状态从 "available" 更新为 "borrowed" 并关联借阅者姓名、归还时将状态重置回 "available",以及遍历集合以显示目录。用 IPO(输入-处理-输出)表的思路是一种有用的考试技巧。
4. Algorithm Design: Flowcharts | 算法设计:流程图
Flowcharts are a graphical way to represent an algorithm. For the borrowing process, start with an oval 'Start' symbol. Then use a parallelogram to show input: "Enter book ID and borrower name". A diamond decision symbol checks "Does the book ID exist?". If no, output "Invalid ID" and end. If yes, another diamond checks "Is the book available?".
流程图是以图形方式表示算法的方法。对于借书过程,先从椭圆形 "开始" 符号开始。然后使用平行四边形显示输入:"输入图书 ID 和借阅者姓名"。一个菱形判断符号检查 "图书 ID 是否存在?"。如果不存在,输出 "无效 ID" 并结束。如果存在,另一个菱形判断 "该书是否可借?"。
If the book is available, process the loan by updating the status to 'borrowed' and storing the borrower name, then output "Book borrowed successfully". If it is already on loan, output "Book not available". All paths converge to an oval 'End' symbol. When drawing flowcharts in an exam, use the standard symbols accurately: oval for start/end, parallelogram for input/output, rectangle for process, and diamond for decision.
如果书可借,则处理借阅:将状态更新为 "borrowed" 并存储借阅者姓名,然后输出 "图书借阅成功"。如果书已借出,输出 "图书不可借"。所有路径汇聚到椭圆形的 "结束" 符号。在考试中画流程图时,要准确使用标准符号:椭圆表示开始/结束,平行四边形表示输入/输出,矩形表示处理,菱形表示判断。
5. Algorithm Design: Pseudocode | 算法设计:伪代码
Pseudocode is a text-based way to outline an algorithm using structured English-like syntax. It is perfect for showing logical flow without worrying about exact programming language rules. Below is the borrowing algorithm for our library system, presented alongside Chinese explanations in a table.
伪代码是用结构化的类英语语法勾勒算法的文本方式。它非常适合展示逻辑流程,无需担心具体编程语言的规则。下表展示了我们图书馆系统的借书算法,并配有中文解释。
| Pseudocode | Chinese Explanation 中文说明 |
|---|---|
| PROCEDURE BorrowBook(BookID, Borrower) | 定义借书过程,接受图书ID和借阅者姓名 |
| IF BookExists(BookID) THEN | 如果图书存在,则继续 |
| IF GetStatus(BookID) = 'available' THEN | 如果该书状态为可借,则 |
| SetStatus(BookID, 'borrowed') | 将状态设置为已借出 |
| SetBorrower(BookID, Borrower) | 记录借阅者姓名 |
| OUTPUT "Book borrowed successfully" | 输出成功消息 |
| ELSE | 否则(书不可借) |
| OUTPUT "Book not available" | 输出不可借消息 |
| ENDIF | 结束内层判断 |
| ELSE | 否则(图书不存在) |
| OUTPUT "Invalid book ID" | 输出无效ID消息 |
| ENDIF | 结束外层判断 |
| ENDPROCEDURE | 过程结束 |
Notice how indentation clarifies the structure of selection (IF-THEN-ELSE) and the use of descriptive procedure names. In the CIE exam, you are expected to write pseudocode that is clear, logical, and uses appropriate constructs such as loops (WHILE, FOR), selection, and assignment.
请注意缩进如何澄清选择结构(IF-THEN-ELSE)以及使用描述性的过程名称。在 CIE 考试中,你需要写出清晰、合乎逻辑的伪代码,并使用适当的结构,如循环(WHILE、FOR)、选择和赋值。
6. Data Structures and Variables | 数据结构与变量
Choosing appropriate data structures is essential for efficient problem solving. For our library case study, we can use an array of records (or list of dictionaries in Python) to store book information. Each element of the array holds a composite structure with fields: bookID, title, author, isbn, status, borrower. Arrays allow quick access by index, but we must search sequentially to find a specific bookID, which is acceptable for a small library.
选择合适的数据结构对高效解决问题至关重要。对于我们的图书馆案例,可以使用一个记录数组(或 Python 中的字典列表)来存储图书信息。数组的每个元素都包含一个复合结构,字段有:bookID、title、author、isbn、status、borrower。数组允许通过索引快速访问,但我们必须顺序搜索以找到特定的 bookID,这对于小型图书馆是可以接受的。
arian. Loop counters like index are used when iterating through the book array. Constants such as MAX_BOOKS may define the maximum capacity. Properly naming variables and using correct data types (string, integer, Boolean) improves code readability and reduces errors.
我们需要变量在处理过程中保存临时数据。例如,inputBookID 和 inputBorrower 将存储管理员输入的值。遍历图书数组时会用到 index 这类循环计数器。像 MAX_BOOKS 这样的常量可定义最大容量。正确命名变量并使用正确的数据类型(字符串、整数、布尔型)能提高代码可读性并减少错误。
7. Testing Strategy | 测试策略
A thorough testing strategy demonstrates that your solution works correctly and handles errors gracefully. We must design test cases covering normal, boundary, and erroneous data. The test plan below outlines key scenarios for the borrowing module.
一个全面的测试策略可以证明你的方案能正确工作并能妥善处理错误。我们必须设计覆盖正常、边界和异常数据的测试用例。下面的测试计划概括了借书模块的关键场景。
| Test ID | Scenario 场景 | Input 输入 | Expected Outcome 预期结果 |
|---|---|---|---|
| T1 | Borrow an available book 借阅可借的书 | bookID='B001', borrower='Alice' | Status changes to 'borrowed', success message 状态变为 'borrowed',成功消息 |
| T2 | Borrow an already borrowed book 借阅已借出的书 | bookID='B001' (currently on loan) | Error message "Book not available" 错误消息 "Book not available" |
| T3 | Borrow with invalid book ID 无效图书 ID | bookID='X999', borrower='Bob' | Error message "Invalid book ID" 错误消息 "Invalid book ID" |
| T4 | Empty borrower name 借阅者姓名为空 | bookID='B002', borrower='' | Error message prompting valid name 提示输入有效姓名的错误消息 |
In your case study, include a similar table and explain why each test case is important. Testing should also include returning books and displaying the catalogue. Mention that all tests should be executed and results recorded, as this is a requirement in the CIE coursework.
在你的案例分析中,要包含类似的表格并解释每个测试用例为何重要。测试还应包括归还图书和显示目录。要提到所有测试均应执行并记录结果,因为这是 CIE 课程作业的一项要求。
8. Programming the Solution | 编写解决方案
and define functions for each main task: add_book(), borrow_book(), return_book(), and display_books(). Following the pseudocode closely, use if-
Published by TutorHao | Year 11 Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

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