← 返回资讯屏轩教育 · 行业资讯

Case Study Practical Walkthrough | 案例分析实战演练

2026-07-20 12:27 · 本文部分内容由AI辅助创作

📚 Case Study Practical Walkthrough | 案例分析实战演练

In CCEA GCSE Computer Science, the ability to apply theoretical knowledge to real-world scenarios is crucial. This case study walkthrough will guide you through the complete analysis, design, and implementation of a library book lending system. We will follow the stages of the system development life cycle (SDLC), from problem definition to maintenance, highlighting key concepts such as feasibility, requirements, algorithm design, testing, and changeover. By working through this practical example, you will strengthen your understanding of how computer systems are developed and how to approach exam-style scenario questions.

在CCEA GCSE计算机科学中,将理论知识应用于实际场景至关重要。本案例分析实战演练将引导你完成一个图书馆图书借阅系统的完整分析、设计与实施。我们将遵循系统开发生命周期(SDLC)的各个阶段,从问题定义到维护,重点介绍可行性、需求、算法设计、测试和转换等关键概念。通过这个实践示例,你将加深对计算机系统开发方式的理解,并掌握如何应对考试中的场景题。


1. Problem Definition and Scope | 问题定义与范围

The local community library currently uses a paper-based system to track its collection of 5,000 books and 800 active members. Librarians record loans manually in ledgers, which often leads to errors such as lost entries or mis-filed records. Members sometimes keep books beyond the due date without any automated reminder, and calculating overdue fines is time-consuming. The library committee has requested a computerised system that can handle book cataloguing, member management, borrowing, returns, and fine calculation.

当地社区图书馆目前使用纸质系统来管理其5000本藏书和800名活跃会员。图书管理员在账本中手动记录借阅情况,这经常导致错误,例如条目丢失或记录错放。会员有时会逾期未还书却没有自动提醒,计算逾期罚款也费时费力。图书馆委员会要求建立一个计算机化系统,能够处理图书编目、会员管理、借阅、归还和罚款计算。

The scope of the project is to develop a standalone application for library staff. It will not include an online public access catalogue for library users; members must still visit the library or call to renew books. The system must run on the existing office PC with Windows 10 and store data persistently. The project will be developed using Python with a SQLite database, as the library has no budget for commercial software.

该项目的范围是开发一个供图书馆工作人员使用的单机应用程序。它不包括面向图书馆用户的在线公共检索目录;会员仍需亲临图书馆或致电续借。系统必须在现有的Windows 10办公电脑上运行,并持久存储数据。项目将使用Python结合SQLite数据库进行开发,因为图书馆没有购买商业软件的预算。


2. Feasibility Study | 可行性研究

A feasibility study examines whether the proposed solution is achievable within constraints of time, budget, and technology. For the library system, we consider three main aspects: technical feasibility, economic feasibility, and operational feasibility.

可行性研究旨在检验拟议的解决方案在时间、预算和技术限制下是否可以实现。对于这个图书馆系统,我们考虑三个主要方面:技术可行性、经济可行性和操作可行性。

Technical feasibility: The existing library PC has sufficient processing power and storage for Python and SQLite. The developer is familiar with these tools, and no specialised hardware is needed. A simple database design will meet all data storage needs without requiring a complex client-server setup.

技术可行性:图书馆现有的电脑具备足够的处理能力和存储空间来运行Python和SQLite。开发人员熟悉这些工具,且无需专用硬件。简单的数据库设计即可满足所有数据存储需求,无需复杂的客户端-服务器架构。

Economic feasibility: The software tools (Python, SQLite) are free and open-source. The only costs are the developer's time and minimal training for library staff. The benefits – reduced clerical errors, automatic fine calculation, and time savings – outweigh the low investment. No ongoing licence fees are expected.

经济可行性:软件工具(Python、SQLite)是免费开源的。唯一的成本是开发人员的时间和对图书馆员工的最基本培训。其收益——减少文书错误、自动计算罚款和节省时间——超过了较低的投入。预计不会产生持续的许可费用。

Operational feasibility: Library staff accept computerisation and are willing to attend short training sessions. The new system will mirror existing manual processes (issue book, return book, check member status), so the transition should be smooth. A user manual will be provided to minimise disruption.

操作可行性:图书馆员工接受计算机化,并愿意参加短期培训。新系统将模拟现有的人工流程(借书、还书、检查会员状态),因此转换过程应当平稳。将提供用户手册以最大限度地减少中断。


3. Requirements Analysis | 需求分析

Requirements are gathered by interviewing library staff and observing current procedures. They are categorised into functional and non-functional requirements.

通过与图书馆员工访谈及观察现有流程来收集需求。需求分为功能性需求和非功能性需求。

Functional requirements describe what the system must do.

功能性需求描述系统必须做什么。

The system must allow librarians to add new book records, including title, author, ISBN, and shelf location. Each book must have a unique system-generated book ID.

系统必须允许图书管理员添加新的图书记录,包括书名、作者、ISBN和书架位置。每本书籍必须有一个由系统生成的唯一图书ID。

It should support member registration with fields for name, contact number, email, and a unique member ID. Members' borrowing history must be linked to their profile.

它应支持会员注册,包括姓名、联系电话、电子邮件和唯一的会员ID。会员的借阅历史必须与其个人资料关联。

The core feature is borrowing: a librarian enters the member ID and book ID; the system checks the member's eligibility (no outstanding fines) and the book's availability, then creates a loan record with the current date and a calculated due date (e.g., 14 days later).

核心功能是借阅:图书管理员输入会员ID和图书ID;系统检查会员资格(无未缴罚款)和图书可借性,然后创建借阅记录,包含当前日期和计算出的应还日期(例如14天后)。

For returns, the librarian scans or enters the book ID; the system locates the active loan, calculates if the book is overdue, updates the loan record, and if applicable, adds a fine to the member's account (e.g., £0.25 per day).

归还时,图书管理员扫描或输入图书ID;系统查找活跃的借阅记录,计算图书是否逾期,更新借阅记录,如果适用,向会员账户添加罚款(例如每天£0.25)。

The system must generate reports, such as a list of overdue books and a summary of fines collected per month.

系统必须生成报告,例如逾期图书列表和每月罚款汇总。

Non-functional requirements cover quality attributes.

非功能性需求涵盖质量属性。

The user interface must be intuitive, with clear menus and form fields, as some staff have limited computer experience. Response times for common operations (borrow, return) should be under two seconds. The system must enforce data backup at the end of each day to prevent data loss.

用户界面必须直观,具有清晰的菜单和表单字段,因为有些员工计算机经验有限。常见操作(借阅、归还)的响应时间应低于两秒。系统必须在每天结束时强制执行数据备份,以防止数据丢失。


4. System Design | 系统设计

In the design phase, we specify the data structures, user interface, and processing logic. The database will consist of three core tables: Book, Member, and Loan. The following shows the record structures designed for program-level handling.

在设计阶段,我们规定数据结构、用户界面和处理逻辑。数据库将包含三个核心表:Book(图书)、Member(会员)和Loan(借阅)。以下显示了为程序级处理而设计的记录结构。

id (integer, primary key), title (string), author (string), isbn (string), status (string: 'available' or 'on loan').

图书记录:book_id(整数,主键),title(字符串),author(字符串),isbn(字符串),status(字符串:'available' 或 'on loan')。

primary key), name (string), contact (string), email (string), fines (real, amount outstanding).

会员记录:member_id(整数,主键),name(字符串),contact(字符串),email(字符串),fines(实数,未缴罚款金额)。

, member_id (foreign key), date_out (date), date_due (date), date_returned (date or null).

借阅记录:loan_id(整数,主键),book_id(外键),member_id(外键),date_out(日期),date_due(日期),date_returned(日期或空)。

The user interface will be menu-driven, using a command-line interface or a simple graphical form. The main menu offers options: 1. Add Book, 2. Register Member, 3. Borrow Book, 4. Return Book, 5. View Overdue Loans, 6. Pay Fines, 7. Exit. Each option leads to a submenu or input dialogue.

用户界面将采用菜单驱动的方式,使用命令行界面或简单的图形窗体。主菜单提供以下选项:1. 添加图书,2. 注册会员,3. 借阅图书,4. 归还图书,5. 查看逾期借阅,6. 缴纳罚款,7. 退出。每个选项将导向子菜单或输入对话框。

Loan record, and updates Book.status. The output is a confirmation message. On return, inputs are book_id, the system updates Loan.date_returned and possibly Member.fines, and sets Book.status back to 'available'.

数据流:在借阅图书时,系统接收输入(member_id、book_id),进行验证,从Member表和Book表读取数据,写入新的Loan记录,并更新Book.status。输出是一条确认消息。归还时,输入是book_id,系统更新Loan.date_returned及可能的Member.fines,并将Book.status设置回'available'。


广告 / Sponsored

5. Algorithm Design – Lending a Book | 算法设计——借书

The lending process must ensure that only eligible members can borrow available books. The pseudocode below captures the decision logic and database updates.

借阅过程必须确保只有符合条件的会员才能借阅可用的图书。下面的伪代码体现了决策逻辑和数据库更新。

Pseudocode for Lending a Book:

   INPUT member_id, book_id
   member = FIND member WHERE member_id = member_id
   IF member is NOT FOUND THEN
       OUTPUT "Member not registered."
   ELSE
       IF member.fines > 0 THEN
           OUTPUT "Please clear outstanding fines before borrowing."
       ELSE
           book = FIND book WHERE book_id = book_id
           IF book is NOT FOUND THEN
               OUTPUT "Book not in catalogue."
           ELSE
               IF book.status = 'on loan' THEN
                   OUTPUT "Book currently unavailable."
               ELSE
                   SET book.status = 'on loan'
                   CREATE new_loan WITH (member_id, book_id, date_out = TODAY, date_due = TODAY + 14 days)
                   SAVE new_loan
                   UPDATE book
                   OUTPUT "Book borrowed successfully. Due date: ", date_due
               ENDIF
           ENDIF
       ENDIF
   ENDIF

借书算法伪代码:

   输入 member_id, book_id
   member = 根据 member_id 查找会员
   如果 member 不存在 则
       输出 "会员未注册。"
   否则
       如果 member.fines > 0 则
           输出 "请在借阅前还清逾期罚款。"
       否则
           book = 根据 book_id 查找图书
           如果 book 不存在 则
               输出 "图书不存在。"
           否则
               如果 book.status = '已借出' 则
                   输出 "图书不可借。"
               否则
                   设置 book.status = '已借出'
                   创建 new_loan 包含 (member_id, book_id, date_out = 今天, date_due = 今天 + 14天)
                   保存 new_loan
                   更新 book
                   输出 "借阅成功。应还日期:", date_due
               结束条件
           结束条件
       结束条件
   结束条件

This algorithm validates the member's existence and fine status before checking the book's availability. It prevents double lending and enforces the rule that members with outstanding fines cannot borrow. The due date is calculated by adding the standard loan period (14 days) to the current date.

该算法在检查图书可借性之前验证会员的存在性和罚款状态。它防止了重复借阅,并强制执行有未缴罚款的会员不能借书的规则。应还日期通过将标准借阅期(14天)加到当前日期来计算。


6. Algorithm Design – Returning a Book | 算法设计——还书

When a book is returned, the system must locate the active loan, determine if it is overdue, apply any fine, and update records accordingly. The pseudocode is shown below.

归还图书时,系统必须找到对应的活跃借阅记录,判断是否逾期,相应计算罚款并更新记录。伪代码如下所示。

Pseudocode for Returning a Book:

   INPUT book_id
   book = FIND book WHERE book_id = book_id
   IF book is NOT FOUND THEN
       OUTPUT "Book ID not recognised."
   ELSE
       active_loan = FIND loan WHERE book_id = book_id AND date_returned IS NULL
       IF active_loan IS NULL THEN
           OUTPUT "This book is not currently on loan."
       ELSE
           member = FIND member WHERE member_id = active_loan.member_id
           SET active_loan.date_returned = TODAY
           SET book.status = 'available'
           IF TODAY > active_loan.date_due THEN
               days_overdue = (TODAY - active_loan.date_due) in days
               fine = days_overdue × 0.25
               member.fines = member.fines + fine
               OUTPUT "Book is overdue. Fine added: £", fine
           ELSE
               OUTPUT "Book returned on time. No fine."
           ENDIF
           UPDATE active_loan
           UPDATE book
           UPDATE member
       ENDIF
   ENDIF

还书算法伪代码:

   输入 book_id
   book = 根据 book_id 查找图书
   如果 book 不存在 则
       输出 "图书ID无法识别。"
   否则
       active_loan = 根据 book_id 和 date_returned 为空 查找借阅记录
       如果 active_loan 为空 则
           输出 "此书目前未借出。"
       否则
           member = 根据 active_loan.member_id 查找会员
           设置 active_loan.date_returned = 今天
           设置 book.status = '可借'
           如果 今天 > active_loan.date_due 则
               days_overdue = (今天 - active_loan.date_due) 的天数
               fine = days_overdue × 0.25
               member.fines = member.fines + fine
               输出 "图书逾期。已添加罚款:£", fine
           否则
               输出 "图书按时归还。无罚款。"
           结束条件
           更新 active_loan
           更新 book
           更新 member
       结束条件
   结束条件

This algorithm first checks the book's existence and that it is actually on loan. By comparing today's date with date_due, it calculates overdue days. The fine is set at £0.25 per day, which is added to the member's outstanding fines. All affected records are then saved.

该算法首先检查图书是否存在以及是否实际处于借出状态。通过比较当前日期和应还日期,计算逾期天数。罚款按每天£0.25计算,并加到会员的未缴罚款中。然后保存所有受影响的记录。


7. Data Validation and Error Handling | 数据验证与错误处理

Robust systems must prevent invalid data from being entered and handle errors gracefully. For the library system, several validation checks are implemented at the input stage.

稳健的系统必须防止无效数据输入,并能妥善处理错误。对于图书馆系统,在输入阶段实施了多种验证检查。

Presence check: Required fields such as book title, member name, and ISBN must not be left blank. If a librarian tries to save a record with missing data, an on-screen message prompts them to fill in all fields.

存在性检查:必填字段如书名、会员姓名和ISBN不能留空。如果图书管理员尝试保存数据缺失的记录,屏幕会提示填写所有字段。

Data type check: Member fines and book IDs must be numeric. When entering a fine payment, the system ensures the input is a valid real number. If a user enters letters where numbers are expected, an error message is shown.

数据类型检查:会员罚款和图书ID必须是数字。在输入罚款缴纳时,系统确保输入是有效的实数。如果用户在期望数字的地方输入字母,将显示错误信息。

Range check: The loan period is fixed at 14 days, but the system could also validate that a member's age is above a minimum (if registered). However, the main range applies to fine payment amounts: they must be positive and not exceed the outstanding fine. The system rejects negative or zero payment attempts.

范围检查:借阅期限固定为14天,但系统也可以验证会员年龄是否高于最小值(如已注册)。不过,主要的范围检查适用于罚款缴纳金额:金额必须为正数且不超过未缴罚款。系统拒绝负数或零的缴纳尝试。

Existence/lookup check: When borrowing or returning, the typed book ID or member ID must correspond to an existing record. The algorithms shown earlier already include 'NOT FOUND' branches to prevent operations on non-existent entities.

存在性/查找检查:借阅或归还时,输入的图书ID或会员ID必须与现有记录对应。前面展示的算法已经包含了“未找到”的分支,以防止对不存在的实体进行操作。

Error handling also covers database connection failures. If the database file is missing or corrupted, the program displays a friendly message and exits safely rather than crashing.

错误处理还涵盖数据库连接失败的情况。如果数据库文件丢失或损坏,程序会显示友好的消息并安全退出,而不是崩溃。


8. Testing | 测试

A comprehensive test plan ensures the system meets its requirements and handles edge cases. The test data includes normal, boundary, and erroneous inputs. The table below shows selected test cases for the lending and returning functions.

全面的测试计划确保系统满足需求并能处理边缘情况。测试数据包括正常值、边界值和错误值。下表显示了针对借阅和归还功能的部分测试用例。

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

广告 / Sponsored
环球网校中级经济师2026年教材人力资源管理师金融财政税收工商管理实务建筑与房地产经济基础知识历年真题试卷官方中国人事…
经济 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥54.8

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

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao
Test ID Description Input Data Expected Result Type
T001