Stay away BaseClasses for your Health

Furkan Paşaoğlu
DigiGeek
Published in
2 min readSep 17, 2021

--

Hello everyone, today I am gonna write why we should avoid from BaseActivity, BaseClasses, and BaseFragment. Why they are anti-pattern, what we can use instead of BaseClasses. I know “Base” is appealing but causes bugs, defects, conflicts, complexity (unhealthy) in the future.

Pleeeaasee. Stay away and hide it where children can’t see it !!!

Let’s assume Sakir is supporting BaseClasses, Abbas is not. See what are the dialogs between them

Ref [https://kulturveyasam.com/]

Yeaah you witnessed a Turkish Quarrel. Actually, we don’t talk about software like this but this is imaginary so there is no problem 😉

As you understand, Abbas won the quarrel. BaseClasses is anti-pattern.

  • Naming is meaningless
  • Block to extend others classes
  • BaseClasses update takes a lot of effort and impacts almost all classes
  • Hard to write a test because dependencies are tightly coupled
  • Maybe you want to use one method of BaseClass and when you extend it, you get all methods. One method's changes may cause RunTimeException and crashes.

⚠️ If that isn’t enough to prevent you from BaseClasses. You can try it and see how bugs, conflicts and complexity feels like ⚠️

Don’t forget to clap, stay well 👋

--

--