Case Study Practice for Year 8 Edexcel Computer Science | 案例分析实战演练

📚 Case Study Practice for Year 8 Edexcel Computer Science | 案例分析实战演练

In this article, we will work through a complete case study to apply the key concepts of Year 8 Edexcel Computer Science. You will act as a junior analyst tasked with designing a simple digital library system for a primary school. From identifying requirements to testing your solution, this practical exercise will strengthen your understanding of algorithms, data representation, hardware, networks, and online safety.

本文将带你完成一个完整的案例分析,运用 Year 8 Edexcel 计算机科学的核心概念。你将扮演一名初级分析师,为小学设计一个简单的数字图书馆系统。从需求分析到解决方案测试,这次实战练习将巩固你对算法、数据表示、硬件、网络和网络安全的掌握。


1. Problem Definition and Requirements | 问题定义与需求分析

The headteacher of Greenfield Primary School wants a digital system to replace their paper-based library log. The system must allow pupils and staff to search for books, borrow books, return books, and view their current borrowed items. It needs to be simple enough for 8-year-olds to use, must not require expensive hardware, and must keep data safe within the school network.

格林菲尔德小学的校长希望用一个数字化系统取代纸质借阅登记。系统必须让学生和教师搜索图书、借书、还书并查看当前借阅记录。它需要足够简单,8 岁孩子也能使用;不能依赖昂贵硬件;数据必须在校园网内安全保存。

Functional requirements: search by title or author, borrow a book (reducing stock by 1), return a book (increasing stock by 1), and view personal borrowing history. Non-functional requirements: response time under 2 seconds, a simple menu interface, password-protected access for staff, and data stored in a plain text file that can be backed up easily. Constraints: existing school laptops with Python installed, no budget for cloud services.

功能性需求:按书名或作者搜索、借书(库存减 1)、还书(库存加 1)、查看个人借阅历史。非功能性需求:响应时间低于 2 秒、简洁的菜单界面、教师需要密码保护访问、数据存储在易于备份的纯文本文件中。约束条件:使用学校现有安装 Python 的笔记本电脑,无云服务预算。


2. System Design and Flowcharts | 系统设计与流程图

We can model the borrow-book process with a flowchart. The sequence begins when the user selects ‘Borrow’ from the main menu. A decision diamond checks whether the requested book exists in stock. If the stock is greater than 0, the system reduces stock by 1, records the borrower ID and date, and displays a success message. Otherwise, it shows ‘Book not available’. The flow ends when the user returns to the menu.

我们可以用流程图模拟借书过程。用户从主菜单选择“借书”开始。一个判断菱形检查所借图书是否有库存。如果库存大于 0,系统将库存减少 1,记录借阅者 ID 和日期,并显示成功提示;否则显示“图书不可借”。流程在用户返回菜单时结束。

Similarly, returning a book follows: select ‘Return’, input book ID, check if the user actually borrowed it (validation decision). If valid, stock increases by 1 and the borrow record is removed; if not, an error message appears. Drawing these flowcharts helps you spot missing steps, such as confirming the user’s identity before allowing a return.

类似地,还书流程为:选择“还书”,输入图书 ID,检查该用户是否确实借了这本书(校验判断)。如果有效,库存增加 1 并删除借阅记录;否则显示错误信息。画这些流程图有助于发现遗漏步骤,例如在允许还书之前需确认用户身份。


3. Data Structures and Variables | 数据结构与变量

To store information in the system, we need well-defined variables and data structures. A book record can be represented as a list or dictionary containing: title (string), author (string), ISBN (string), and stock (integer). A borrowing record needs: student_name (string), student_id (string), book_id (string), borrow_date (string). Constants can be defined for the maximum number of books a pupil can borrow at once (e.g., MAX_BORROWED = 3) and the loan period in days (LOAN_DAYS = 14).

为了在系统中存储信息,我们需要定义清晰的变量和数据结构。一本图书的记录可以用包含以下字段的列表或字典表示:书名(字符串)、作者(字符串)、ISBN(字符串)和库存(整数)。借阅记录需要:学生姓名(字符串)、学生 ID(字符串)、图书 ID(字符串)、借阅日期(字符串)。常量可以定义每位学生最多可同时借阅的数量(MAX_BORROWED = 3)和借阅天数(LOAN_DAYS = 14)。

Variable Data Type Example Value
book_title String ‘The Gruffalo’
author String ‘Julia Donaldson’
isbn String ‘978-1-4472-8199-3’
stock Integer 5
borrowed_by String ” or student_id

中文表格翻译:变量 book_title 字符串;author 字符串;isbn 字符串;stock 整数;borrowed_by 字符串。通过这些结构,检索和更新数据都能用清晰的代码实现。


4. Programming Concepts: Sequence, Selection, Iteration | 编程概念:顺序、选择与迭代

The core borrow function can be written in pseudocode using three fundamental constructs. Sequence is simply executing steps in order: display message, receive input, update stock. Selection (if-else) decides what to do based on stock availability. Iteration might be used to search through the list of books until the desired ISBN is found.

借书核心功能可以使用三种基本结构写成伪代码。顺序就是按序执行:显示提示、接收输入、更新库存。选择(if-else)根据库存可用性决定下一步。迭代可以用来遍历图书列表直到找到目标 ISBN。

Example pseudocode for borrowing:
1. Input student_id
2. Input book_isbn
3. Set found = False
4. For each book in book_list (iteration):
If book.isbn == book_isbn (selection):
If book.stock > 0:
book.stock = book.stock – 1
record borrowing
found = True
Break
5. If found == False:
Display ‘Book not available’

借书伪代码示例:
1. 输入 student_id
2. 输入 book_isbn
3. 设置 found = False
4. 对 book_list 中的每本书(迭代):
如果 book.isbn == book_isbn(选择):
如果 book.stock > 0:
book.stock = book.stock – 1
记录借阅信息
found = True
跳出循环
5. 如果 found == False:
显示 “图书不可借”


5. Algorithm Design – Searching and Sorting | 算法设计 – 搜索与排序

When a user searches by title, the system must scan through the book list linearly until it finds a match (or reaches the end). This is a linear search, suitable for small data sets like a primary school library with a few hundred books. Its time complexity is O(n), but with a small n, performance is acceptable.

当用户按书名搜索时,系统必须线性扫描图书列表直到找到匹配项(或到达列表末尾)。这就是线性搜索,适合像小学图书馆这样只有几百本书的小型数据集。其时间复杂度为 O(n),但由于 n 很小,性能可以接受。

To make browsing easier, books can be sorted alphabetically by title using a bubble sort or the built-in sort function in Python. Bubble sort repeatedly compares adjacent elements and swaps them if they are in the wrong order. While not the fastest, it reinforces your understanding of nested loops and comparison logic.

为了方便浏览,可以使用冒泡排序或 Python 内置排序函数将图书按书名字母顺序排列。冒泡排序不断比较相邻元素并在顺序错误时交换它们。虽然它不是最快的算法,但能很好地巩固你对嵌套循环和比较逻辑的理解。


6. Data Representation and Storage | 数据表示与存储

All data is stored as binary in the computer. The book’s stock (an integer) is represented in two’s complement binary form. For example, a stock of 5 is stored as

5₁₀ = 0000 0101₂

The ISBN and book titles are strings; each character is encoded using ASCII, taking up one byte. ‘The Gruffalo’ contains 12 characters, so it uses 12 bytes of storage.

所有数据在计算机中以二进制形式存储。库存数量(整数)以二进制补码表示。例如库存 5 存储为

5₁₀ = 0000 0101₂

ISBN 和书名是字符串,每个字符用 ASCII 编码,占用一个字节。“The Gruffalo”共 12 个字符,所以占用 12 字节的存储空间。

For simplicity, the library data can be kept in a CSV file. Each line represents a book: title, author, ISBN, stock. When the program runs, it loads the file into a list in RAM, allowing fast read/write operations. After any change, the program saves the updated list back to the CSV file.

为简单起见,图书馆数据可保存在 CSV 文件中。每行代表一本书:书名、作者、ISBN、库存。程序运行时将文件加载到内存中的列表,以便快速读写。任何改动之后,程序将更新后的列表存回 CSV 文件。


7. Hardware and Software Requirements | 硬件与软件要求

The system will run on the school’s existing laptops, which have Intel i3 processors, 4 GB RAM, and Windows operating systems. No additional hardware is required beyond a network router to allow sharing of the CSV file (stored on a shared drive) among multiple computers. A backup hard drive can store daily copies of the data file.

系统将运行在学校现有的笔记本电脑上,配置为 Intel i3 处理器、4 GB 内存、Windows 操作系统。除网络路由器(以便多台计算机共享共享驱动器上的 CSV 文件)外,不需要额外硬件。一个备份硬盘可存储数据文件的每日副本。

On the software side, Python 3 is installed on all machines. We shall use the built-in `csv` module for file handling and simple `input()`/`print()` for the text-based interface. A code editor like IDLE or Thonny is sufficient. No database server is necessary, keeping the setup lightweight.

在软件方面,所有计算机都安装了 Python 3。我们将使用内置的 `csv` 模块处理文件,并使用简单的 `input()`/`print()` 实现文本界面。IDLE 或 Thonny 等代码编辑器就足够了。不需要数据库服务器,保持配置简便。


8. User Interface Design | 用户界面设计

Given the young users, the interface should be minimal and clear. The main menu displays five options:
1. Search Book
2. Borrow Book
3. Return Book
4. View My Borrowed
5. Exit
After each action, the program returns to the menu. Prompts use short, friendly language: ‘Enter book title:’. Error messages are simple: ‘Sorry, that book is not in our library.’

考虑到使用者年龄较小,界面必须极简且清晰。主菜单显示五个选项:
1. 搜索图书
2. 借书
3. 还书
4. 查看我的借阅
5. 退出
每次操作后,程序返回菜单。提示语使用简短友善的语言:“请输入书名:”。错误信息也很简单:“抱歉,图书馆没有那本书。”

If we added a graphical user interface (GUI), buttons and a search bar would replace text input. But for Year 8, a text interface demonstrates core principles without the complexity of event-driven programming. We can still use ASCII art to make it playful: draw a book icon with characters.

如果增加图形用户界面(GUI),按钮和搜索栏会取代文本输入。但对于 Year 8 的水平,文本界面能够在避免事件驱动编程复杂性的同时展示核心原理。我们仍然可以用 ASCII 艺术使其更有趣:用字符画出一本书的图标。


9. Cybersecurity and Ethics | 网络安全与伦理

Staff access requires a password. The system stores hashed passwords (not plain text) so that even if the file is viewed, the real password remains hidden. Pupils use their unique student ID without a password, but they can only view their own borrowing history. Input validation is crucial: the program checks that the entered book ID exists and that the student ID matches a valid record before allowing a transaction.

教师访问需要密码。系统存储经过哈希处理的密码(而非明文),这样即使文件被查看,真实密码也不会泄露。学生使用唯一的学生 ID 无需密码,但只能查看自己的借阅历史。输入验证至关重要:程序需先检查输入的图书 ID 是否存在、学生 ID 是否有效,然后才允许交易。

Ethically, we must protect personal data. The borrowing records contain student names, which should not be displayed on public screens. The data file is stored on a password-protected shared drive accessible only to library staff. Under data protection principles, data must be kept accurate and not kept longer than necessary—we can automatically delete borrowing records older than one year.

在伦理方面,我们必须保护个人数据。借阅记录含有学生姓名,不应显示在公共屏幕上。数据文件存储在受密码保护的共享驱动器中,仅图书馆工作人员可访问。根据数据保护原则,数据必须保持准确,且保留时间不超过所需——我们可以自动删除超过一年的借阅记录。


10. Testing and Debugging | 测试与调试

We will create a test plan covering normal, boundary, and erroneous inputs. Normal test: borrow a book with stock > 0, expecting success. Boundary test: borrow when stock = 1, then try to borrow the same book again (stock becomes 0) and expect an error message. Erroneous test: enter a non-existent ISBN or a negative number for stock—the system must handle these gracefully without crashing.

我们将制定一个测试计划,覆盖正常、边界和异常输入。正常测试:在库存>0 时借书,期待成功。边界测试:在库存=1 时借书,然后再次借同一本书(库存变为 0),期待错误信息。异常测试:输入不存在的 ISBN 或负数的库存——系统必须优雅处理而不崩溃。

When a bug occurs, we use print statements to display variable values at key points. For example, after loading the CSV, print the book list to confirm it is parsed correctly. Step-through debugging in IDLE allows us to watch the flow of execution line by line. These techniques help identify logic errors, such as forgetting to save the file after updating stock.

出现 bug 时,我们使用打印语句在关键点显示变量值。例如,加载 CSV 后,打印图书列表以确认解析正确。在 IDLE 中逐步调试可让我们逐行观察执行流程。这些技术有助于识别逻辑错误,例如更新库存后忘记保存文件。


11. Evaluation and Improvements | 评估与改进

The prototype meets all the functional requirements: searching, borrowing, returning, and viewing records. It is fast because data stays in memory, and the CSV format makes backups straightforward. However, it cannot handle simultaneous access by multiple users if two people try to borrow the last copy at the same time. Also, there is no automatic overdue reminder, and the text interface may feel dated.

原型满足了所有功能需求:搜索、借书、还书和查看记录。由于数据驻留在内存中,速度很快;CSV 格式使备份变得简单。然而,如果两个人同时借最后一本书,它无法处理并发访问。此外,没有自动逾期提醒,文本界面也可能显得过时。

Future improvements could include converting to a SQLite database for concurrent access and more robust data handling. Adding a simple tkinter GUI would make the system more appealing for young children. We could also add a recommendation feature that suggests books based on past borrows, using a basic collaborative filtering algorithm. An email notification service for overdue books would further help the school librarian.

未来改进可包括转换为 SQLite 数据库以支持并发访问和更可靠的数据处理。添加一个简单的 tkinter 图形界面会让系统对幼儿更具吸引力。我们还可以增加推荐功能,根据过往借阅记录推荐图书,使用基本的协同过滤算法。逾期图书的邮件提醒服务也会进一步帮助学校图书馆员。


12. Reflection and Summary | 反思与总结

Through this case study, you have applied every major topic from Year 8 Edexcel Computer Science: you defined problems precisely, designed algorithms and flowcharts, chose appropriate data structures, implemented sequence-selection-iteration, understood data representation and storage, considered hardware and software needs, thought about cybersecurity and ethics, and tested your solution. This end-to-end process mirrors how real software is developed and shows how computational thinking solves everyday problems.

通过这次案例分析,你应用了 Year 8 Edexcel 计算机科学的每个主要主题:精确地定义问题,设计算法和流程图,选择合适的数据结构,实现顺序、选择与迭代,理解了数据表示和存储,考虑了硬件和软件需求,思考了网络安全与伦理,并测试了你的解决方案。这一端到端的过程反映了真实软件的开发方式,展示了计算思维如何解决日常问题。

You can now apply the same approach to other scenarios, such as designing a canteen ordering system or a lost-property tracker. The skills of decomposition, pattern recognition, abstraction, and algorithm design will serve you well beyond the computing classroom.

你现在可以将同样的方法应用于其他场景,例如设计食堂订餐系统或失物追踪器。分解、模式识别、抽象和算法设计的技能将使你终生受益,远超计算机课堂。

Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading