Why Not to Use Static

What is wrong with static methods? Why is it said that they "damage Object Orientation"? What do they have to do with coupling? In this video, we will answer these questions based on 3 main points regarding the harmful aspects of static class methods and attributes:

  • They break the Object-Oriented paradigm
  • They promote coupling
    • Harming changeability (violating the Open/Closed Principle of SOLID)
    • Making testability more difficult
  • They hide dependencies between classes

I recommend checking out the videos on How to Listen to Your Tests (as we also talked about how coupling made test development difficult), and the one on SOLID's Dependency Inversion Principle (as it is one of the aspects discussed in today's video). In the upcoming videos, we will talk about topics such as:

  • How to test classes that call static methods
  • Under what circumstances it is not harmful to use static methods

Pay according to your needs

lite (only monthly)

19 €
per month
  • Access to a subset of courses to lay the foundation for maintainable, scalable, and testable code
  • Company invoice
PopularLaunch Week

standard

20,75 €
Save 171
Annual payment of 249
per month
  • Full course catalog
  • Receive job offers verified by Codely
  • Company invoice
Launch Week

premium

37,42 €
Save 139
Annual payment of 449
per month
  • All previous benefits
  • Early access to new courses
  • Discount on workshops

We won't increase the price while your subscription is active