/SaveThePrincess

Simple example for Single Level of Abstraction design principle

Primary LanguageC#MIT LicenseMIT

How to save a princess

I regularly talk about Single Level of Abstraction SLA with colleges. This example gives a few examples where SLA can or should be used.

Why Single Level of Abstraction

  • Code readability is much better
    • Fewer LoC per function
    • Less Comments needed (function names replace them)
  • Less mental jumping between Levels (but now functions)
  • Write Code top down
  • Encapsulation
  • Reusability of functions (e.g. -> Defeat() function)

How to use the code

  • The YoungHero class will show code which has some SLA issues and contains some comments what to refactor.
  • The SeasonedHero shows a refactored version.