📚 Case Study Practical Drill for Year 8 WJEC Computing | 八年级 WJEC 计算机案例分析实战演练
In this revision lesson, you will work through a complete case study for a school library borrowing system. This practical drill follows the WJEC approach for Year 8 Computing, covering analysis, design, pseudocode, testing, and evaluation. By the end, you will understand how each step connects and be ready to tackle similar scenario questions in your assessments.
在这节复习课中,你将完整地演练一个学校图书借阅系统的案例。这个实战练习遵循 WJEC 对八年级计算机课程的要求,涵盖分析、设计、伪代码、测试和评估。到最后,你会明白每个步骤如何衔接,并能够在评估中应对类似的场景题。
1. Introduction to Case Studies | 案例分析简介
A case study in computing is a detailed investigation of a real‑life scenario that requires a digital solution. You will be presented with a problem, such as a school needing a program to track book loans. Your job is to break down the problem, plan a solution, write structured instructions, and then check if it works correctly. This mirrors the software development lifecycle used by real programmers.
计算机中的案例分析是对需要数字解决方案的真实场景进行详细研究。你将看到一个具体问题,比如一所学校需要一个程序来跟踪图书借阅。你的任务是分解问题、规划解决方案、编写结构化的指令,然后检查它是否正常工作。这模仿了真实程序员使用的软件开发生命周期。
2. Understanding the Problem | 理解问题
Our scenario: the librarian at Oakwood School wants a simple system to record when a student borrows or returns a book. The system should store the student’s name, the book title, and the date of the transaction. It must also prevent the same student from borrowing more than three books at a time. Read the problem description twice: first to get the overall idea, then to underline key requirements like “three books limit” and “record date”.
我们的场景:奥克伍德学校的图书管理员想要一个简单的系统,用来记录学生借阅或归还图书的情况。系统需要存储学生的姓名、书名以及操作日期。同时,必须防止同一名学生同时借阅超过三本书。阅读问题描述时请读两遍:第一遍获取整体思路,第二遍划出关键要求,比如“三本书的限制”和“记录日期”。
3. Requirements Analysis | 需求分析
We can list functional requirements (what the system must do) and non‑functional requirements (how it should behave).
我们可以列出功能性需求(系统必须做什么)和非功能性需求(系统应如何表现)。
| Functional Requirements | Non‑functional Requirements |
|---|---|
| Allow librarian to input student name and book title | The interface should be easy to use (text‑based menu) |
| Check if student already has 3 books on loan | The system must respond within 2 seconds |
| Record the current date automatically | Data should be saved even if the program closes |
中文对照:
| 功能性需求 | 非功能性需求 |
|---|---|
| 允许图书管理员输入学生姓名和书名 | 界面应易于使用(基于文本的菜单) |
| 检查学生是否已借有3本书 | 系统必须在2秒内响应 |
| 自动记录当前日期 | 即使程序关闭数据也应保存 |
4. Designing the Solution: Flowcharts | 设计方案:流程图
Before coding, we draw a flowchart to visualise the borrowing process. The main actions are: start, display menu (borrow/book return/exit), decide which option is chosen, and follow the relevant path. For the borrow path, we check the number of books currently on loan for that student. If count < 3, we add a new loan record; otherwise, we show an error message.
在编写代码之前,我们画一个流程图来直观地展示借阅过程。主要动作是:开始、显示菜单(借书/还书/退出)、判断选择了哪个选项,并沿着相应的路径处理。对于借书路径,我们需要检查该学生当前借阅的图书数量。如果数量 < 3,则添加一条新的借阅记录;否则,显示错误信息。
Flowchart summary (symbols used):
- Oval: Start/End
- Parallelogram: Input/Output (e.g., ‘Enter student name’)
- Diamond: Decision (e.g., ‘Book count < 3?')
- Rectangle: Process (e.g., ‘Add to loan list’)
流程图总结(所用符号):
- 椭圆:开始/结束
- 平行四边形:输入/输出(例如,“输入学生姓名”)
- 菱形:判断(例如,“图书数量 < 3?”)
- 矩形:处理(例如,“添加到借阅列表”)
5. Pseudocode Basics | 伪代码基础
Pseudocode is a simplified, language‑independent way of writing algorithms. WJEC expects you to use clear indentation, meaningful variable names, and keywords like INPUT, OUTPUT, IF...THEN...ELSE, and WHILE...ENDWHILE. It helps you plan the logic without worrying about syntax errors. Practice writing short routines, such as checking if a number is positive.
伪代码是一种简化的、与编程语言无关的算法书写方式。WJEC 期望你使用清晰的缩进、有意义的变量名以及诸如 INPUT, OUTPUT, IF...THEN...ELSE 和 WHILE...ENDWHILE 等关键词。这有助于你规划逻辑,而不必担心语法错误。练习编写简短的例程,比如检查一个数字是否为正数。
6. Writing Pseudocode for the Library System | 为图书馆系统编写伪代码
Below is a partial pseudocode for the borrow function. Notice how we use a list called loans to track records. Each record contains student name, book title, and due date.
下面是借书功能的部分伪代码。请注意我们如何使用名为 loans 的列表来跟踪记录。每条记录包含学生姓名、书名和应还日期。
SET loans = empty list
OUTPUT "1 – Borrow, 2 – Return, 3 – Exit"
INPUT choice
IF choice = 1 THEN
INPUT studentName
SET count = 0
FOR each record IN loans
IF record.student = studentName THEN
count = count + 1
ENDIF
ENDFOR
IF count < 3 THEN
INPUT bookTitle
ADD {student: studentName, book: bookTitle, date: CURRENT_DATE} TO loans
OUTPUT "Book issued."
ELSE
OUTPUT "Sorry, limit reached."
ENDIF
ENDIF
This logic counts how many current loans a student has before allowing a new one.
这段逻辑在允许新借阅之前,先统计该学生当前借了几本书。
7. Testing the Logic | 测试逻辑
We must test with normal, boundary, and erroneous data. Normal test: a student with 1 existing book borrows another – should succeed. Boundary test: a student with exactly 2 books tries to borrow a third – should succeed; then try to borrow a fourth – should fail. Erroneous test: enter a number instead of a name, or press enter without typing anything. Record expected vs. actual results.
我们必须使用正常数据、边界数据和错误数据进行测试。正常测试:一个已借1本书的学生再借一本——应该成功。边界测试:一个刚好借了2本书的学生尝试借第3本——应该成功;然后再尝试借第4本——应该失败。错误测试:输入数字而不是姓名,或者什么也不输入直接回车。记录预期结果与实际结果。
| Test Case | Data | Expected | Pass/Fail |
|---|---|---|---|
| Normal | Amy, 1 loan → borrow "Moon" | Success | |
| Boundary | Ben, 3 loans → borrow "Sun" | Reject | |
| Erroneous | Student name: 123 | Prompt again or reject |
中文对照:
| 测试用例 | 数据 | 预期 | 通过/失败 |
|---|---|---|---|
| 正常 | Amy,已有1本 → 借 "Moon" | 成功 | |
| 边界 | Ben,已有3本 → 借 "Sun" | 拒绝 | |
| 错误 | 学生姓名:123 | 重新提示或拒绝 |
8. Identifying Potential Errors | 识别潜在错误
Errors can be syntax errors (like a missing ENDIF) or logical errors. A logical mistake in our pseudocode might be forgetting to reset the count variable before counting again, or not considering returned books. If we never remove records when a book is returned, a student would stay blocked even after returning a fourth book. Always dry‑run your algorithm with a trace table to catch these.
错误可能是语法错误(例如缺少 ENDIF)或逻辑错误。我们伪代码中的一个逻辑错误可能是忘记在重新计数之前将计数变量重置,或者没有考虑已归还的图书。如果归还图书时从未移除记录,那么学生即使在归还了第四本书之后仍然会被阻止借阅。始终使用跟踪表来手动执行算法,以捕捉这类错误。
9. Evaluating the Solution | 评估方案
After design and testing, you must evaluate whether the solution meets the original requirements. Does it prevent a student borrowing more than three books? Yes. Does it record the date? Yes. However, it does not yet handle book returns (our pseudocode only showed the borrow part). A full solution would need an additional branch for choice = 2 that removes the correct record. Also, storing data only in a list means it is lost when the program exits – this is a limitation.
在设计和测试之后,你必须评估解决方案是否满足最初的需求。它是否阻止学生一次借阅超过三本书?是的。它是否记录了日期?是的。但是,它还不能处理还书(我们的伪代码只展示了借书部分)。一个完整的解决方案需要为 choice = 2 增加一个分支来移除正确的记录。此外,仅将数据存储在列表中意味着程序退出时数据会丢失——这是一个局限性。
10. Ethical and Social Considerations | 道德与社会考量
Digital systems that store personal data must respect privacy. The library system stores student names and borrowing history. Schools must ensure this data is not shared with unauthorised people. Under the principles of data protection, data should be kept secure, used only for its intended purpose, and deleted when no longer needed. As a designer, you could add a password protection or simple encryption.
存储个人数据的数字系统必须尊重隐私。该图书馆系统存储学生姓名和借阅历史。学校必须确保这些数据不会与未经授权的人员共享。根据数据保护的原则,数据应安全保存、仅用于预定目的,并在不再需要时删除。作为设计者,你可以添加密码保护或简单的加密措施。
11. Improving the System | 系统改进
After evaluation, suggest three practical improvements: (1) Add a return‑book function that removes the loan record. (2) Replace the list with a simple file or database so data persists. (3) Include input validation to ensure names contain only letters and that the date is in the correct format. These enhancements would make the system more robust and closer to a real‑world application.
在评估之后,提出三项实际改进建议:(1) 增加还书功能,以移除借阅记录。(2) 用简单的文件或数据库替代列表,使数据持久保存。(3) 加入输入验证,确保姓名只包含字母,日期格式正确。这些增强将使系统更加健壮,更接近真实应用。
12. Summary and Key Takeaways | 总结与要点
A successful case study demands a clear structure: understand the problem → list requirements → design (flowcharts & pseudocode) → test thoroughly → evaluate and improve. Always consider edge cases and ethical implications. For WJEC Year 8, practice writing concise pseudocode and drawing simple flowcharts. Use descriptive variable names and comment your logic. You will encounter similar tasks in exams, so treat this drill as a template for your own revision.
一个成功的案例分析需要清晰的结构:理解问题 → 列出需求 → 设计(流程图和伪代码) → 全面测试 → 评估并改进。始终考虑边缘情况和道德影响。对于 WJEC 八年级,请练习编写简洁的伪代码并绘制简单的流程图。使用描述性的变量名并为逻辑添加注释。考试中你会遇到类似的任务,所以把这个练习当作你复习的模板吧。
Published by TutorHao | Computing Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导