📚 Case Study Practical Exercises for Year 9 Edexcel Computer Science | Year 9 Edexcel 计算机:案例分析实战演练
The Year 9 Edexcel Computer Science course challenges students to apply computational thinking to real-world problems. In this case study, we will design a simple library book-lending system for a school. By following each stage from problem analysis to evaluation, you will build essential skills in abstraction, algorithm design, programming logic, data representation, and cybersecurity. Each section presents a concrete task with explanations in English and Chinese, helping bilingual learners master the material effectively.
Year 9 Edexcel 计算机课程要求学生将计算思维应用于现实问题。本文以设计一个简单的学校图书馆借阅系统为案例,通过从问题分析到评估的各个阶段,你将逐步掌握抽象、算法设计、编程逻辑、数据表示和网络安全等核心技能。每个小节均提供英文与中文的双语讲解和实操任务,帮助双语学习者扎实理解相关内容。
1. Understanding the Scenario and Problem Definition | 理解案例背景与问题定义
A school librarian currently manages book borrowing using paper cards. Pupils often forget to return books on time, leading to lost items and long queues. The head teacher wants a simple computerised system that can record which pupil borrows which book, calculate due dates, and show overdue items. The first step in computational thinking is to clearly define the problem by identifying inputs, processes, and outputs.
学校图书馆目前使用纸质借书卡管理借阅。学生经常忘记按时还书,造成图书丢失和排队等候时间过长。校长希望开发一个简单的计算机系统,能够记录哪位学生借了哪本书、计算应还日期并显示逾期项目。计算思维的第一步是通过确定输入、处理和输出来清晰定义问题。
Inputs are pupil ID, book ID, and the current date. The process must validate pupil and book records, calculate a return date by adding 14 days to the borrow date, and flag any overdue loans when the current date exceeds the return date. Outputs include a confirmation message for successful borrowing, a list of books currently borrowed by a pupil, and an overdue report for the librarian.
输入为学生ID、图书ID和当前日期。处理过程需要验证学生和图书记录的有效性,将借阅日期加上14天计算出应还日期,并在当前日期超过应还日期时标记逾期。输出包括借阅成功的确认信息、某位学生当前借阅的图书列表以及供图书管理员查看的逾期报告。
2. Decomposition and Abstraction | 分解与抽象
Large problems are easier to solve when broken into smaller, manageable parts. Decomposition separates the book-lending system into modules: pupil registration, book catalogue, borrowing process, return process, and overdue checker. Abstraction focuses on only the essential details, such as storing pupil names and the books they have borrowed, while ignoring irrelevant data like their favourite colour.
大问题分解为小部分后更易解决。分解将借阅系统拆分成模块:学生注册、图书目录、借书流程、还书流程和逾期检查。抽象则只关注关键细节,例如存储学生姓名和所借图书,忽略其最喜欢的颜色等无关数据。
For example, a pupil can be represented abstractly by a unique ID, name, and form class. A book can be represented by a unique ISBN, title, and author. A borrowing transaction links a pupil ID and book ID with a borrow date. This abstraction allows us to design data structures and algorithms without being overwhelmed by real-world complexity.
例如,学生可以被抽象为一个唯一的ID、姓名和班级。图书可以抽象为唯一的ISBN、书名和作者。借阅交易将学生ID和图书ID与借阅日期关联。这种抽象使我们能够设计数据结构和算法,而不会被现实世界的复杂性淹没。
3. Data Requirements and Representation | 数据需求与表示
The system needs to store data in tables, similar to how databases work. We can model this with three simple arrays or lists in pseudocode: one for pupils, one for books, and one for transactions. Pupil records might include [pupilID, name, class]. Book records include [bookID, title, author]. Transaction records include [pupilID, bookID, borrowDate, returnDate].
系统需要以类似数据库表的形式存储数据。我们可以用三个简单的数组或列表在伪代码中建模:一个用于学生,一个用于图书,一个用于借阅交易。学生记录可能包含 [学号, 姓名, 班级]。图书记录包含 [书号, 书名, 作者]。交易记录包含 [学号, 书号, 借阅日期, 应还日期]。
Dates can be stored as strings like ‘2027-03-15’ or as integer day numbers from a fixed reference. For Year 9, using a simple format and comparing strings alphabetically will often work because dates in yyyy-mm-dd format sort correctly. Binary representation is not required for dates here, but we will later see how Boolean values represent true/false overdue status.
日期可存储为字符串,如 ‘2027-03-15’,或使用从固定参考点起算的整数天数。对于九年级学生来说,采用简单格式并按字母顺序比较字符串(因为 yyyy-mm-dd 格式能正确排序)通常可行。这里日期无需二进制表示,但稍后我们会看到布尔值如何表示逾期状态的真假。
4. Algorithm Design with Flowcharts and Pseudocode | 用流程图和伪代码设计算法
An algorithm is a step-by-step procedure to solve a problem. Let’s design the borrowing algorithm. The logic: check if the pupil exists, check if the book exists and is not already borrowed, then create a new transaction with today’s date and a due date 14 days later.
算法是解决问题的逐步操作步骤。我们来设计借阅算法。逻辑如下:检查学生是否存在,检查图书是否存在且未被借出,然后创建一条新交易记录,包含当天日期和14天后的应还日期。
Pseudocode for borrowing (English-like):
BEGIN
INPUT pupilID, bookID
IF pupilID NOT IN pupils THEN PRINT ‘Pupil not found’
ELSE IF bookID NOT IN books THEN PRINT ‘Book not found’
ELSE IF bookID already in active transactions THEN PRINT ‘Book already on loan’
ELSE
borrowDate ← CURRENT_DATE
returnDate ← borrowDate + 14 days
ADD [pupilID, bookID, borrowDate, returnDate] TO transactions
PRINT ‘Book borrowed successfully. Return by ‘ + returnDate
END IF
END
流程图可用菱形表示决策,矩形表示处理步骤。这种直观表示有助于在编写代码前理清逻辑。
5. Programming Concepts: Variables, Conditions, and Loops | 编程概念:变量、条件和循环
To implement the algorithm in Python, we use variables to store data, if-elif-else statements for conditions, and lists to hold our records. Loops allow us to search through lists. For example, to check if a pupil exists, we can iterate through the pupils list with a for loop.
要在 Python 中实现算法,我们使用变量存储数据,if-elif-else 语句处理条件,列表保存记录。循环允许我们遍历列表进行搜索。例如,检查学生是否存在,可以用 for 循环遍历 pupils 列表。
Pseudo-Python snippet:
pupils = [[‘P001′,’Alice’,’9A’], [‘P002′,’Bob’,’9B’]]
for pupil in pupils:
if pupil[0] == pupilID:
found = True
break
Variables like borrowDate and returnDate store strings. Using a 14-day constant avoids hard-coding. Conditions handle validation, and formatted strings create user-friendly messages. These fundamental constructs appear in all high-level languages and are key to the Edexcel syllabus.
变量如 borrowDate 和 returnDate 存储字符串。使用14天常量可避免硬编码。条件判断负责验证,格式化字符串用于生成友好的用户消息。这些基本构造出现在所有高级语言中,是 Edexcel 大纲的关键内容。
6. Binary Logic and Boolean Expressions | 二进制逻辑与布尔表达式
Boolean expressions evaluate to True or False and drive every decision. In our system, a book is overdue if the current date is greater than the return date. This comparison yields a Boolean. Combining conditions with AND, OR, NOT is essential. For instance, a book can be borrowed only if pupilExists AND bookAvailable AND bookNotAlreadyLoaned.
布尔表达式的计算结果为真或假,驱动所有决策。在我们的系统中,如果当前日期大于应还日期,图书即逾期。该比较操作会产生一个布尔值。使用 AND、OR、NOT 组合条件至关重要。例如,只有当学生存在 且 图书可用 且 图书未被借出时,才允许借阅。
Binary representation also underpins data storage. While Year 9 does not require bitwise operations, understanding that everything inside a computer is represented with 1s and 0s helps contextualise Boolean logic. Logical operators can be modelled with truth tables, which are part of the Edexcel curriculum. A simple AND truth table: True AND True → True; all other combinations → False. This mirrors the logic that all borrowing conditions must be met.
二进制表示也是数据存储的基础。虽然九年级不要求位运算,但理解计算机内部的一切都以1和0表示有助于理解布尔逻辑的背景。逻辑运算符可以用真值表建模,这是 Edexcel 课程的一部分。简单的 AND 真值表:True AND True → True;其他组合 → False。这正好反映了借阅时所有条件必须满足的逻辑。
7. User Interface and Interaction Design | 用户界面与交互设计
A system must be usable. We can design a simple text-based menu that asks the user (the librarian) to choose an option: 1. Borrow a book, 2. Return a book, 3. View overdue books, 4. Exit. Each selection calls the relevant procedure. Good design includes clear prompts, error messages, and confirmation of successful actions.
系统必须易于使用。我们可以设计一个简单的文本菜单,让用户(图书管理员)选择一个选项:1. 借书,2. 还书,3. 查看逾期图书,4. 退出。每个选项调用相应的过程。优秀的设计包括清晰的提示、错误消息以及成功操作的确认信息。
Even at this level, we can apply the principle of ‘input – process – output’ to the interface itself. For example, the overdue function might output a report like: ‘Overdue as of 2027-03-25: P001 Alice – “The Hobbit” overdue by 3 days.’ Such output requires careful formatting of date calculations and string concatenation.
即便在这个阶段,我们也可以将“输入—处理—输出”原则应用于界面本身。例如,逾期功能可输出类似这样的报告:‘截至2027年3月25日逾期:学号 P001 Alice —《霍比特人》逾期3天。’ 这样的输出需要对日期计算和字符串拼接进行精心格式化。
8. Testing and Debugging | 测试与调试
Every program must be tested. We can create a test plan with normal, boundary, and erroneous data. Normal test: borrow a book when all details are valid. Boundary test: borrow a book on the last day of the month to check date calculation. Erroneous test: enter a pupil ID that does not exist – the system should display ‘Pupil not found’ and not crash.
每个程序都必须经过测试。我们可以创建一个包含正常数据、边界数据和错误数据的测试计划。正常测试:在所有信息有效时借阅图书。边界测试:在月末最后一天借书,检查日期计算。错误测试:输入不存在的学号 — 系统应显示“未找到该学生”且不崩溃。
Debugging involves systematically finding and fixing errors. If the overdue report shows a negative number of days, we may have accidentally swapped the current date and return date in the comparison. Reading error messages, adding temporary print statements, and tracing through the logic step by step are essential skills that mirror professional software development.
调试是指系统地查找并修复错误。如果逾期报告显示负数的天数,我们可能无意中在比较时交换了当前日期和应还日期。阅读错误消息、添加临时的 print 语句以及逐步追踪逻辑,是与专业软件开发一致的必备技能。
9. Cybersecurity and Data Protection Considerations | 网络安全与数据保护考量
Even a small school system must consider security. Pupil data must be protected under the Data Protection Act (2018) and GDPR principles. This means passwords for librarian access, encrypted storage for personal data, and ensuring that a pupil can only view their own borrowing record, not others’.
即使是一个小型学校系统也必须考虑安全性。学生数据必须根据《数据保护法》(2018) 和 GDPR 原则受到保护。这意味着图书管理员访问需要密码,个人数据加密存储,并确保学生只能查看自己的借阅记录,而不能查看他人的。
In our simplified model, we can simulate authentication by asking for a librarian password before showing the menu. We also need to consider output sanitisation to avoid displaying full lists of all pupils. Thinking about cybersecurity from the earliest design stages builds responsible habits and prepares students for more advanced topics in Key Stage 4.
在我们的简化模型中,我们可以通过在显示菜单前要求输入图书管理员密码来模拟身份验证。我们还需要考虑输出净化,避免显示所有学生的完整列表。从最早的设计阶段就开始思考网络安全,可以培养负责任的习惯,并为学生在 KS4 阶段学习更高级主题做好准备。
10. Evaluation and Future Improvements | 评估与未来改进
After building and testing the prototype, we evaluate how well it meets the original objectives. Does it reduce queues? Does it correctly identify overdue books? Are the error messages helpful? This reflective process often reveals limitations. For example, our simple date string comparison might fail in a leap year or across year boundaries if not handled properly.
在构建并测试原型后,我们评估其满足原始目标的程度。它是否减少了排队等候?是否正确识别了逾期图书?错误消息是否有帮助?这种反思过程往往会揭示局限性。例如,如果处理不当,我们简单的日期字符串比较在闰年或跨年时可能会出错。
Potential improvements include adding a fine calculator (e.g., £0.10 per day overdue), a reservation system, or a graphical user interface. These suggestions demonstrate how computational thinking is iterative: we can always refine and extend our solution. Capturing evaluation in a structured way shows deeper understanding and earns higher marks in Edexcel assessments.
潜在的改进包括添加罚款计算器(例如,每逾期一天罚0.10英镑)、预约系统或图形用户界面。这些建议表明计算思维是迭代的:我们总是可以完善和扩展我们的解决方案。以结构化方式进行评估能展示更深入的理解,并在 Edexcel 评估中取得更高分数。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导