Cohesion aur coupling software engineering mein mahatvapurna tathya hai jo software system ke bhitar ke components ke beech ke sambandh aur interaction ko vyakhya karte hain.
Cohesion: Cohesion, ek module ya component ke zimmedariyon ke beech ke sambandh aur focus ka star darshata hai. Yeh measure karta hai ki module ke andar ke tatva kitni majbooti se jude hote hain aur ve ek hi task ya functionality ko poora karne mein saath milkar kaam karte hain.
High cohesion yeh darshata hai ki module ke andar ke tatva gehre roop se jude hote hain aur ek saath ek hi lakshya ki taraf pravin karte hain. Isse code ki maintainability, reusability, aur samajhne ki shamta mein sudhar hota hai. Cohesion ko kai staron mein vibhajit kiya jaa sakta hai:
- Functional Cohesion: Module ke andar ke tatva ek hi functionality ya task ke aadhar par samaanvit hote hain.
- Sequential Cohesion: Module ke andar ke tatva ko kramik roop se ek nirdharit kram mein execute kiya jata hai.
- Communicational Cohesion: Module ke andar ke tatva ek hi input data par kaam karte hain ya bhaagidar tatvon ke beech mein intermediate results ko share karte hain.
- Procedural Cohesion: Module ke andar ke tatva ek nirdharit prakriya ya operation se jude hote hain.
Coupling: Coupling, software system ke components ke beech ke sambandh ko vyakhya karta hai. Yeh measure karta hai ki ek component dusre components se kis matra mein aur kitne gehre roop se jude hote hain.
Low coupling yani kam coupling achha hai, kyunki isse components ke beech ki dependency aur interdependence kam hoti hai. Yeh code ke maintainability, reusability, aur flexibility ko badhata hai. Coupling kai prakar ke ho sakte hain:
- Loose Coupling: Components kam depend karti hain aur ek dusre ke badle hone par kam prabhav dalte hain.
- Tight Coupling: Components gehre roop se ek dusre ke saath jude hote hain aur ek component ki badlav ke karan dusre components par bhi prabhav hota hai.
Cohesion aur coupling ka sahi balance rakhna software system ki quality, scalability, aur maintainability ke liye zaroori hai. High cohesion aur low coupling ka upyog karke, software system ko robust aur flexible banaya ja sakta hai.