Before refactoring, my dart idle game used the mixin Merch for purchasing enterprises…
Jump to turn (8)
- 1Before refactoring, my dart idle game used the mixin Merch for purchasing enterp
- 2Explain the purpose of this refactoring
- 3Explain the concept of composition root, be very specific
- 4The thing is, creating Merch instances is the responsibility of a Merch parent,
- 5What could be the reasoning of mixins not having generative constructors?
- 6Why constructor chaining is not supported
- 7Don't you think storing any kind of game state in flutter widgets is bad practic
- 8What are Provider, Riverpod, Redux and BLoC
- User
Before refactoring, my dart idle game used the mixin Merch for purchasing enterprises and upgrades. Merch was holding a Bank field. After refactoring, Merch became concrete class to be composed, it holds a IMerchComposite field to call onSuccessfulPurchase of a parent, and a IBankBasicSpend field for calling spend() of some bank injected in it
- Assistant
Before refactoring, the Dart Idle Game used the mixin
Merchfor handling the purchasing of enterprises and upgrades. TheMerchmixin also held aBankfield.However, after refactoring, the
Merchmixin was transformed into a concrete class that could be composed with other classes. Instead of directly holding aBankfield, it now holds anIMerchCompositefield, which allows it to call theonSuccessfulPurchasemethod of its parent. Additionally, it holds anIBankBasicSpendfield for calling thespend()method of some bank that has been injected into it.