课程: Advanced Python: Build Hands-On Projects with Design Patterns (2023)
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Behavioral patterns - Python教程
课程: Advanced Python: Build Hands-On Projects with Design Patterns (2023)
Behavioral patterns
- [Instructor] Behavioral patterns are the best practices of how you make your objects interact with each other. The focus here is defining the protocols between these objects when trying to work together to accomplish a common goal. You may want to write code processing an online banking transaction. The program should be able to handle tasks like depositing or withdrawing money. It'll be ideal if you have ways to compose individual reusable actions into a transaction, or cancel it altogether. Let's consider withdrawing money. The first action is to identify a user. Depending on the mode of identification, appropriate actions to verify the user's identity ensues. Once the user indicates the amount to withdraw from which account, the next action is to check if there is enough balance to continue on with the next steps. At this time, the system may cancel the entire transaction due to the insufficient fund in the account.…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。