9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
4.8 KiB
4.8 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-계층화-아키텍처-layered-architecture | 계층화 아키텍처 (Layered Architecture) | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
계층화 아키텍처 (Layered Architecture)
매 한 줄
"매 application 을 horizontal layer (presentation / business / persistence / data) 의 stack 으로 조직". 매 가장 흔한 default architecture — 매 simple, 매 onboarding 쉬움. 매 large-scale 에서 coupling/performance 한계 발생 → microservice/hexagonal 로 진화.
매 핵심
매 표준 layer
- Presentation: UI / REST controller / GraphQL resolver. 매 input 의 validation + serialization.
- Business / Service: domain logic, transaction boundary, orchestration.
- Persistence / Repository: ORM, query, cache.
- Data: DB, file, message broker.
매 strict vs relaxed
- Strict layering: 매 layer N 은 layer N-1 만 호출 가능. 매 testability 좋음.
- Relaxed: layer skip 가능 (e.g. controller → repository 직접). 매 anti-pattern 으로 간주.
매 응용
- Spring Boot 의 @Controller / @Service / @Repository.
- Django 의 view / business / model.
- Clean Architecture 의 adapter ring 변형.
- .NET 의 N-tier WebAPI / BLL / DAL.
💻 패턴
Spring Boot 의 표준 3-layer
@RestController
@RequestMapping("/orders")
public class OrderController {
private final OrderService service;
public OrderController(OrderService s) { this.service = s; }
@PostMapping
public OrderDto create(@RequestBody @Valid CreateOrderReq req) {
return service.create(req);
}
}
@Service
public class OrderService {
private final OrderRepo repo;
@Transactional
public OrderDto create(CreateOrderReq req) {
Order o = Order.from(req);
return OrderDto.from(repo.save(o));
}
}
@Repository
public interface OrderRepo extends JpaRepository<Order, Long> {}
DTO ↔ Domain 매 boundary
// 매 controller 는 DTO 만, service 는 domain entity 만 다룬다.
public record CreateOrderReq(String sku, int qty) {}
public record OrderDto(Long id, String sku, int qty, String status) {
public static OrderDto from(Order o) {
return new OrderDto(o.getId(), o.getSku(), o.getQty(), o.getStatus().name());
}
}
Repository abstraction (testability)
public interface OrderRepo {
Order save(Order o);
Optional<Order> findById(Long id);
}
// 매 unit test 의 Stub repository 의 inject:
class StubOrderRepo implements OrderRepo { /* in-memory */ }
매 cross-cutting (logging / tx / auth) 의 AOP
@Aspect
@Component
class AuditAspect {
@Around("@annotation(Audited)")
public Object audit(ProceedingJoinPoint pjp) throws Throwable {
long t0 = System.nanoTime();
Object result = pjp.proceed();
log.info("{} took {}ns", pjp.getSignature(), System.nanoTime() - t0);
return result;
}
}
Layer 의 dependency rule (안티: upward call)
// ❌ Service 가 Controller 호출 X
// ❌ Repository 가 Service 호출 X
// ✅ 매 한 방향: presentation → service → persistence
매 결정 기준
| 상황 | Approach |
|---|---|
| CRUD-heavy MVP | 매 layered (default 선택) |
| 매 complex domain logic | hexagonal / clean architecture |
| 매 high decoupling 필요 | event-driven / CQRS |
| 매 large team / bounded context | microservice |
| 매 simple script | 매 layer X — single file |
기본값: 매 small/medium app 은 3-layer (controller / service / repository) + DI + DTO boundary.
🔗 Graph
- 부모: Software Architecture
- 변형: Hexagonal Architecture · Clean Architecture · Onion Architecture
- 응용: Spring Boot · ASP.NET Core
- Adjacent: Separation of Concerns · Dependency Injection
🤖 LLM 활용
언제: scaffolding generation, layer 위반 review, refactor towards layered. 언제 X: 매 trivial CRUD — boilerplate overhead.
❌ 안티패턴
- Anemic Service: 매 service 가 단순 repo passthrough — domain logic 누락.
- Smart Controller: business logic 의 controller 누수.
- Layer skip: controller 가 repo 직접 호출.
- God Service: 매 service class 가 5000+ lines — bounded context 분할 필요.
🧪 검증 / 중복
- Verified (Richards Software Architecture Patterns 2nd ed. 2022).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — layered patterns + Spring example + anti-patterns |