Description of the Kata: https://kata-log.rocks/banking-kata
- Basic account operations:
deposit
,withdrawal
, andaccount statement generation
. - TDD (Test-Driven Development).
- Basic Error Handling.
In this exercise, I also wanted to explore
SOLID
principles and theStrategy Design Pattern
.- SOLID Principles.
- Design Patterns added:
- Factory Pattern.
- Strategy Pattern: Applied for handling different types of fees.
The correct level of abstraction needs to be thought through well. Here are other points not covered in this Kata:
- Mocking or Fakes (for Unit Tests)
- Tasks / Asynchronous operations
- Implementing persistence
- Creating RESTful API endpoints and Services
- Authentication & Authorization
- Event-Driven Architecture (integration with other services)
- Dockerization & Microservices (depends on the context)
- CI/CD Pipeline
- Performance Optimization
- Monitoring & Logging
- Documentation
var account = new BankAccount(1000, transactionFactory);
var fixedFeeStrategy = new FixedFeeStrategy(10); // $10 fixed fee
var percentageFeeStrategy = new PercentageFeeStrategy(0.02m); // 2% fee
// Use fixed fee strategy
account.Withdraw(100, fixedFeeStrategy);
// Use percentage fee strategy
account.Withdraw(200, percentageFeeStrategy);