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
Popular

standard

24,92 €
Save 121
Annual payment of 299
per month
  • Full course catalog
  • Design and architecture challenges
  • Highlighted solutions videos for challenges
  • Receive job offers verified by Codely
  • Company invoice

premium

41,58 €
Save 89
Annual payment of 499
per month
  • Everything above
  • More benefits coming soon

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