Software Design/Prohibit overriding implementation of a function

From Wikiversity
Jump to navigation Jump to search

Why[edit | edit source]

Why not[edit | edit source]

  • Forces to write boilerplate code (and leads to increased code size) when inheriting behavior from abstract classes (e. g. Java's default methods).
  • May lead to some logic duplication between implementations of a function in different classes extending an abstract class: see practice Don't repeat logic in several places.

Related[edit | edit source]

Sources[edit | edit source]

  • A De Goes, John (October 26, 2019). "12 Steps to Better Scala". Hamburg, Germany: Scala Hamburg. "Make Methods Final or Abstract"