Why is tightly coupled bad but strongly typed good?

后端 未结 9 624
日久生厌
日久生厌 2021-02-04 13:30

I am struggling to see the real-world benefits of loosely coupled code. Why spend so much effort making something flexible to work with a variety of other objects? If you know w

9条回答
  •  萌比男神i
    2021-02-04 13:48

    Yet I feel like strongly typed is encouraged, but loosely coupling is bad.

    I don't think it is fair to say that strong typing is good or encouraged. Certainly lots of people prefer strongly typed languages because it comes with compile-time checking. But plenty of people would say that weak typing is good. It sounds like since you've heard "strong" is good, how can "loose" be good too. The merits of a language's typing system isn't even in the realm of a similar concept as class design.

    Side note: don't confuse strong and static typing

提交回复
热议问题