Anyway, OOP is your friend.

Jump to navigation Jump to search

Anyway, OOP is your friend.

Good abstractions: Robot, Wave, BattleField

Bad abstractions: Radar, Gun, Wheel

Why? Because once you segment your code into gun & wheel, information sharing gets hard. A large part of wheel & gun can be shared and then you need EnemyHistoryManager etc. A Gun isn't a gun at all, all a gun does is a turret, a bullet plus some powder, and all a wheel does is turning. You don't need a driver or a brain, everything in your code is driver, everything in your code is brain. You just model everything in plain code, no need for extra layer of abstraction.

I was putting everything inside "Enemy" class, now they are segregated again into Radar, Gun and Movement. It turns out that no abstractions are good or bad, only fitting the need or not. The wave processing logic of Gun and Movement is similar, but you never want a change in gun to affect movement, then re-implementing the same logic twice is acceptable.

Xor (talk)17:14, 29 January 2022