Skip to content

Simple example for Single Level of Abstraction design principle

License

Notifications You must be signed in to change notification settings

MathiasReichardt/SaveThePrincess

Repository files navigation

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.

About

Simple example for Single Level of Abstraction design principle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages