응집도, 결합도, 관심사 분리
코드를 유지 관리하기 쉽게 만드는 세 가지 소프트웨어 설계의 기본 특성인 높은 응집도, 낮은 결합도, 명확한 관심사 분리를 익혀 보세요.
응집도, 결합도, 관심사 분리은(는) CoddyKit의 무료 Clean Architecture & Design Patterns in Practice 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Clean Architecture & Design Patterns in Practice 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Clean Architecture & Design Patterns in Practice 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Why These Properties Matter
Under clean code and SOLID lie three deeper design properties: cohesion, coupling, and separation of concerns. They explain why the rules work.
What is Cohesion
Cohesion measures how well a module’s responsibilities belong together. High cohesion = one well-defined job; low cohesion = a grab-bag of unrelated methods.
Low vs High Cohesion
Compare the two: the Util class mixes unrelated concerns, while UserRepository is tightly focused. That focus is high cohesion.
// Low cohesion
class Util {
saveUser() {}
sendEmail() {}
formatDate() {}
}
// High cohesion
class UserRepository {
save() {}
findById() {}
}What is Coupling
Coupling measures how much one module depends on another’s internals. Tight coupling spreads changes everywhere; loose coupling keeps interactions minimal.
Tight Coupling Example
Here OrderService creates its own SmtpMailer, locking it to that exact class. Swapping the mailer means editing the service — tight coupling.
class OrderService {
constructor() {
this.mailer = new SmtpMailer();
}
}Loosening the Coupling
Inject the mailer instead. Now OrderService depends on an abstraction and accepts any implementation. That’s loose coupling.
class OrderService {
constructor(mailer) {
this.mailer = mailer;
}
}The Sweet Spot
The sweet spot is high cohesion and low coupling together: focused modules that stay independent, so systems are easy to change, test, and reason about.
Separation of Concerns
Separation of concerns means splitting a program so each part owns one distinct concern — keep UI, business logic, and data access in separate layers.
Mixed Concerns
This function tangles data access, logic, and presentation together. Touch any one concern and you risk breaking the others — mixed concerns.
function showTotal(id) {
const rows = db.query('SELECT * FROM orders WHERE id=' + id);
const total = rows.reduce((s, r) => s + r.price, 0);
document.body.innerHTML = 'Total: ' + total;
}Separated Concerns
Split it into a repository, a calculator, and a view. Each concern now changes and tests independently. Much cleaner.
const order = repository.findById(id);
const total = calculator.total(order);
view.render(total);How They Connect to SOLID
These properties underpin SOLID: single responsibility drives cohesion, dependency inversion drives low coupling, and layering expresses separation of concerns.
Quick Check
High cohesion, low coupling — can you tell them apart?
Recap
You’ve got the foundations: cohesion keeps related work together, low coupling minimizes dependencies, and separation of concerns divides by purpose.
자주 묻는 질문
“응집도, 결합도, 관심사 분리” 강의는 무료인가요?
네 — “응집도, 결합도, 관심사 분리” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Clean Architecture & Design Patterns in Practice 강의 전체를 잠금 해제할 수 있습니다. Clean Architecture & Design Patterns in Practice 강의에는 총 4개의 강의가 포함되어 있습니다.
“응집도, 결합도, 관심사 분리”에서 뭘 배우나요?
코드를 유지 관리하기 쉽게 만드는 세 가지 소프트웨어 설계의 기본 특성인 높은 응집도, 낮은 결합도, 명확한 관심사 분리를 익혀 보세요. 브라우저에서 직접 실행하는 실습 코드로 Clean Architecture & Design Patterns in Practice을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Clean Architecture & Design Patterns in Practice을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Clean Architecture & Design Patterns in Practice은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“응집도, 결합도, 관심사 분리” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Clean Architecture & Design Patterns in Practice 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Clean Architecture & Design Patterns in Practice 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 클린 코드 소개
- SOLID 원칙 개요
- 좋은 설계의 가치
- 응집도, 결합도, 관심사 분리