A Bipolar Sky

Half-grey half revelation of twisted mixture soft-spoken identities screaming into the ears of the quiet ones The dust from the fields carrying lavender lights over the water tower scanning far above…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Cohesion and Coupling

When writing out code systems, it’s important to keep certain concepts in mind to maintain a clean, low error frequency code base. Such concepts I will be going over in today’s blog is cohesion and coupling. These topics are kind of like a good software design philosophy.

Cohesion

Cohesion is the amount of how focused a certain module or function is to a certain task. The higher the cohesion the more focused the function. It is like a measure of how everything fits together. In general a good system design has high cohesion.

Low Cohesion can be like a metaphorical hand class. It has the ability to fold origami, give massages, write code, draw pictures and etc. A High Cohesion example would be like a Med kit class. It has bandages, bandaids and all things related to healing you. The hand class is unfocused with unrelated tasks while the Med Kit class is very focused.

Coupling

Coupling is the amount of how dependent a certain module or function is to another module or task. A higher coupling means there is strong dependence. Higher coupling also means it may be difficult to change and maintain your code due to the fact that changing one function may cause unintended bugs or side effects to other functions. This can cause an entire system reevaluation that can cost time and money.

Overall a good system design has low coupling and high cohesion.

In addition it is also good to keep a system modularized. This is the process of dividing a system into independent modules that can be reused, easily understood and maintained very easily.

Add a comment

Related posts:

Why a second Instagram account is underrated?

Before I started to paint I used my now primary Instagram account mainly for photography. My feed already had its structure and the infamous theme all “influencer” talk about. So messing it up with…

Culpa

Quebrando o vinho. Bebendo as taças. Não sei. Forcei a barra. Perdoa. Desgraça. Vou ligar. Juro. Não importa. Eu não sirvo para isso não. Nem poderia. Mas por você. Sei que perdi o controle. Não…

When to Say Yes

There have been so many times in my life I said yes because I feared I would miss out on an opportunity. I applied for roles at work I didn’t really want. I joined exciting projects that didn’t…