Denis Jakus

making tech less cryptic

CTO x Unique People

Denis Jakus

making tech less cryptic

CTO x Unique People

CTO Note

Class Coupling1 min read

05 November 2017 .NET
Class Coupling1 min read

What is class coupling?

Class coupling is a measure of class complexity and it’s subclasses. It is showing us how deep are classes interconnected.

We have two types of coupling:

  1. Tight coupling
  2. Loosely coupling

1.Tight coupling

Tight coupling is when one class is dependent on the other class and each class change triggers rebuilding of other (dependent) class.

2. Loosely coupling

This type of coupling is ideal and makes perfect software. Why? Because when we change one class we dont want to change half of the application or we don’t want to rebuild whole application beacuse of one class change.
How do we build loosely coupled apps? We build them by:

  • Encapsulation
  • Interfaces
  • Class relationships ( inheritance or composition )

When creating relationships between classes we use inheritance and/or composition.
Preffered way of building relationships is by using composition.

Taggs:
Related Posts
How to organize Visual Studio projects

Facebook Twitter Evernote Hacker News Gmail Print Friendly Yahoo Mail reddit LinkedIn Blogger Tumblr Like In my latest Youtube video,…

Caching in DotNet Core WebAPI using Strategy Pattern

Facebook Twitter Evernote Hacker News Gmail Print Friendly Yahoo Mail reddit LinkedIn Blogger Tumblr Like Let me write today about…

Write a comment