Program Design and Development

AP Computer Science Principles · Unit 1 — Creative Development

Development processes: iterative and incremental

A development process is the sequence of phases a team goes through to build a program. The usual phases are investigating and reflecting, designing, prototyping and testing. What makes a process good is not a fixed order but feedback: the results of one phase change the plan for the next.

The framework names two process styles, and the exam often asks you to identify which one a scenario describes.

The two are not opposites. A real project is often incremental at the large scale (one feature at a time) and iterative inside each feature (several feedback loops per feature). A process can also be exploratory (the team discovers requirements while building) or ordered and intentional.

Lặp (iterative): đi vòng nhiều lần Khảo sát, phản tưThiết kế Làm mẫu (prototype)Kiểm thử phản hồi của người dùng đưa vòng sau quay lại sửa bản trước Tăng dần (incremental): thêm từng khối 1. Đăng nhập — đã kiểm, chạy đúng2. Tìm kiếm — đã kiểm, chạy đúng 3. Giỏ hàng — đang kiểm4. Thanh toán — chưa làm khối mới chỉ ghép vào khi khối cũ đã chạy đúng
Lặp và tăng dần. Bên trái: một vòng có mũi tên quay về — dấu hiệu nhận ra quy trình lặp là sửa lại thứ đã làm theo phản hồi. Bên phải: các khối chồng lên nhau — dấu hiệu của tăng dần là khối mới chỉ thêm khi khối cũ đã đúng.

Investigation, specifications and documentation

Investigation answers the question what should this program do, and for whom? Teams collect information through surveys, user testing, interviews and direct observation of people doing the task. The outcome is a list of program requirements — descriptions of how the program must behave — and a program specification, which defines those requirements precisely enough that someone could test against them. A good requirement can be checked: "the reminder appears within one second of 8 p.m." can be tested, "the app is fast" cannot.

Design turns requirements into a plan: brainstorming, storyboarding the screens, deciding how to split the program into procedures and modules, laying out the user interface, and planning how the program will be tested.

Program documentation is a written description of the function of a code segment, event, procedure or program and how it was developed. Comments are one form of documentation written inside the code; they are ignored by the computer when the program runs, so they never change behaviour. Documentation helps in developing and maintaining a program, especially in a team, and it should be written throughout development, not only at the end. Comments that are not updated after a change become harmful: the program still runs the new way, but the comment now tells the next reader the old story.

Finally, code segments, media or ideas taken from others — a library, a tutorial, a classmate — must be acknowledged, normally by naming the author or source in the documentation.

Worked example: Nhận diện kiểu quy trình qua nhật ký dự án

A team's log for a library-booking app:

Week 1: interviewed 6 librarians; wrote the requirement “a student can reserve a study room for 1 or 2 hours.” Week 2: built and tested only the room-list screen. Week 3: added the reservation feature after the room list passed every test. Week 4: student testers could not find the cancel button, so the team moved it and re-tested. Week 5: testers asked for 30-minute slots; the team changed the requirement and the reservation code.

Which weeks show an incremental approach, which show an iterative approach, and what evidence in week 1 shows investigation?

Solution

Tăng dần: tuần 2–3. Nhóm làm và kiểm riêng màn hình danh sách phòng, chỉ thêm chức năng đặt phòng sau khi danh sách qua mọi ca kiểm. Đó đúng là “bảo đảm từng mảnh chạy đúng trước khi ghép”.

Lặp: tuần 4–5. Phản hồi của người thử kéo nhóm quay lại sửa thứ đã làm: tuần 4 sửa giao diện (vị trí nút huỷ) rồi kiểm lại; tuần 5 còn quay về tận giai đoạn yêu cầu, đổi “1 hoặc 2 giờ” thành khung 30 phút rồi sửa mã đặt phòng.

Khảo sát: tuần 1 có phỏng vấn 6 thủ thư và kết quả được ghi thành một yêu cầu kiểm được. Lưu ý: việc nhóm đổi yêu cầu ở tuần 5 không có nghĩa tuần 1 làm sai — quy trình lặp chính là chỗ cho phép điều đó.

Common mistake

Bẫy nhận diện sai “lặp”. Lặp không có nghĩa là “làm đi làm lại cùng một việc” hay “dùng vòng lặp trong mã”. Dấu hiệu bắt buộc là sửa đổi dựa trên phản hồi/kiểm thử. Còn “làm xong mảnh A, kiểm A, rồi mới thêm B” là tăng dần dù có lặp lại nhiều lần. Bẫy thứ hai: chọn phương án nói chú thích làm chương trình chạy chậm hơn hoặc làm đổi kết quả — chú thích bị bỏ qua khi chạy, cái hại của chú thích cũ là đánh lừa người đọc.

Key takeaway

Chốt: lặp = quay lại sửa theo phản hồi; tăng dần = thêm từng mảnh đã chạy đúng. Khảo sát (phiếu, thử với người dùng, phỏng vấn, quan sát) sinh ra yêu cầu và đặc tả kiểm được. Tài liệu và chú thích viết trong suốt quá trình, không ảnh hưởng hành vi, và phải ghi nguồn phần mượn.

← Collaboration, Program Purpose and Program Function · All AP Computer Science Principles lessons · Practice AP Computer Science Principles questions (free, instant scoring) · Identifying and Correcting Errors →