生成式人工智慧 (Generative Artificial Intelligence, GAI) 正快速改變軟體開發與程式設計教育的方法,能協助使用者自動生成程式碼、加速開發,然而也帶來了程式碼模組性不足及學生過度依賴相關工具的風險。學生在學習抽象化與問題分解等模組化分析概念時可能遭遇瓶頸,在此狀況下使用生成式 AI 將導致產生的程式碼模組性不佳、難以維護。針對此問題,本研究提出一個基於責任驅動設計 (Responsibility-Driven Design)、測試驅動學習 (Test-Driven Learning) 與行為驅動開發 (Behavior-Driven Development) 的學習方法。此方法透過具體的情境引導學生進行模組責任分析來學習模組化思考,並結合測試驅動學習預先規劃驗收標準。本研究進行為期七週的教學實驗,結果顯示本研究的學習方法比起直接撰寫模組與測試案例提示的方法,能讓學生與生成式 AI 協作開發出更具模組性的程式碼。根據對實驗組受試者的問卷調查,學生普遍認為我們的學習方法能有效引導他們進行抽象思考與問題分解,也願意使用本研究提出的流程來與生成式 AI 協作。;While generative artificial intelligence (GAI) is rapidly transforming software development and programming education with its capability to generate code automatically, it also introduces risks such as low code modularity and a tendency for some students to be overly reliant on such tools. Students may face challenges in learning key modular design concepts, such as abstraction and decomposition. Collaborating with generative AI in this context will lead to maintainability issues due to low modularity. To address this problem, this research proposes a learning methodology based on responsibility-driven design (RDD), test-driven learning (TDL), and behavior-driven development (BDD). We utilize concrete scenarios to guide students to analyze the responsibilities of modules and integrate it with test-driven learning to help students cultivate the skill of planning acceptance criteria. This research conducted a seven-week teaching experiment, and the results show that our learning methodology enabled students to produce code with better modularity in a human-AI collaboration setting, compared with a methodology focused on directly writing module and test case prompts. According to the questionnaire survey conducted with participants in the experimental group, students generally consider our learning approach beneficial for learning abstraction and decomposition. They also expressed their willingness to adopt the proposed process for collaborating with generative AI.