[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,94 +2,202 @@
|
||||
id: wiki-2026-0508-arrangement-and-composition
|
||||
title: Arrangement and Composition
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-ARCO-002]
|
||||
aliases: [composition-over-inheritance, function-composition, ui-composition]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced, arrangement, composition, design, Systems-Thinking, structure]
|
||||
verification_status: applied
|
||||
tags: [composition, design, architecture, functional]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: typescript
|
||||
framework: react
|
||||
---
|
||||
|
||||
# [[Arrangement-and-Composition|Arrangement-and-Composition]]
|
||||
# Arrangement and Composition
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "배열이 창조하는 의미: 개별 요소들은 그대로일지라도 그것들을 어떤 순서로, 어떤 간격으로 배치하느냐에 따라 전체 시스템의 기능과 미적 가치가 완전히 달라지는 '관계의 인지 과학'."
|
||||
## 매 한 줄
|
||||
> **"매 small piece 의 arrange 의 emergent capability 의 만든다"**. 매 *Design Patterns* (GoF, 1994) 의 "favor composition over inheritance" 의 most-cited principle. 매 2026 의 React Server Components, Unix pipes, fp-ts pipe, kubernetes operator composition 의 same idea 의 different incarnation.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
배치와 구성(Arrangement-and-Composition)은 각 부분 요소를 조직화하여 하나의 통일된 전체(Wholeness)를 만드는 예술적, 공학적 행위입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **배치의 원칙**:
|
||||
* **Proximity (근접성)**: 가까이 있는 것끼리 의미적으로 연관되어 있다고 느낌 (게슈탈트 원칙).
|
||||
* **Hierarchy (위계)**: 크기나 위치를 통해 정보의 우선순위를 시각화함.
|
||||
* **Rhythm (리듬)**: 반복과 변주를 통해 시각적/지적 흐름을 유도함.
|
||||
2. **구성과 기능**:
|
||||
* **Modular Composition**: 독립된 모듈을 조립하여 복잡한 시스템을 구축 ([[Agent Architecture|Agent Architecture]]와 연결).
|
||||
* **Balance vs Tension**: 균형 잡힌 배열은 안정감을 주고, 의도적으로 깨진 배열은 주의력을 환기시킴.
|
||||
3. **지식 관리에서의 적용**:
|
||||
* 노트 간의 연결(Graph)과 폴더 구조의 배치가 지식의 인출 효율을 결정함.
|
||||
### 매 composition modes
|
||||
- **Function composition**: `f ∘ g` — output 의 input 의 chain.
|
||||
- **Object composition**: 매 has-a > is-a — delegation, mixin, trait.
|
||||
- **Component composition**: 매 React/Vue children, slot. 매 layout 의 declarative.
|
||||
- **Process composition**: 매 Unix pipes, k8s sidecar, DAG (Airflow).
|
||||
- **Type composition**: 매 union, intersection, generics.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 고정된 그리드 시스템 내의 '정적 배치'가 미덕이었으나, 현대의 반응형 디자인 정책은 사용자의 기기에 따라 배치를 유연하게 바꾸는 '액티브 레이아웃 정책'으로 변화함(RL Update).
|
||||
- **정책 변화(RL Update)**: 음악 및 영상 창작 정책에서, AI가 개별 음표가 아닌 '악기 간의 배치(Arrangement)'와 '전체 흐름(Composition)'을 학습하여 인간 프로듀서 수준의 곡을 완성하는 'AI 오케스트레이션 정책'이 실용화됨.
|
||||
### 매 arrangement axes
|
||||
- **Horizontal**: 매 sibling 의 parallel — fan-out / fan-in.
|
||||
- **Vertical**: 매 layer / pipeline — sequential.
|
||||
- **Tree**: 매 hierarchy — 매 component tree / DOM.
|
||||
- **Graph**: 매 arbitrary edges — 매 dataflow / DAG.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Structural Principles|Structural Principles]], [[Aesthetic-Value|Aesthetic-Value]], Design Theory, [[Agent Architecture|Agent Architecture]], Workflow-InteGrity
|
||||
- **Modern Tech/Tools**: [[Figma|Figma]] (Auto-layout), [[CSS Grid|CSS Grid]], AI-powered music arrangers (Suno, Udio).
|
||||
---
|
||||
### 매 응용
|
||||
1. UI — 매 component slot, render prop, children-as-function.
|
||||
2. Data pipeline — 매 dbt model graph, Airflow DAG.
|
||||
3. Function-level — 매 pipe / compose / Result.flatMap.
|
||||
4. Service mesh — 매 sidecar composition (Envoy + app).
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### Function composition (TypeScript / fp-ts)
|
||||
```ts
|
||||
import { pipe, flow } from 'fp-ts/function';
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
const trim = (s: string) => s.trim();
|
||||
const lower = (s: string) => s.toLowerCase();
|
||||
const slug = (s: string) => s.replace(/\s+/g, '-');
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
const slugify = flow(trim, lower, slug); // point-free
|
||||
const out = pipe(' Hello World ', trim, lower, slug); // value-first
|
||||
console.log(slugify(' Hello World ')); // "hello-world"
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Composition over inheritance (Go — embedding)
|
||||
```go
|
||||
type Logger struct{ prefix string }
|
||||
func (l Logger) Log(msg string) { fmt.Println(l.prefix, msg) }
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
type Counter struct{ n int }
|
||||
func (c *Counter) Inc() { c.n++ }
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
// HTTP server composes both — no inheritance
|
||||
type Server struct {
|
||||
Logger // embedded → Server.Log() works
|
||||
*Counter // embedded pointer
|
||||
addr string
|
||||
}
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
s := &Server{Logger: Logger{"[srv]"}, Counter: &Counter{}, addr: ":8080"}
|
||||
s.Log("starting"); s.Inc()
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### React component composition
|
||||
```tsx
|
||||
// "Slot" composition — children as primary API
|
||||
function Card({ header, footer, children }: {
|
||||
header?: ReactNode; footer?: ReactNode; children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="card">
|
||||
{header && <header>{header}</header>}
|
||||
<main>{children}</main>
|
||||
{footer && <footer>{footer}</footer>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
<Card
|
||||
header={<h2>Order #1234</h2>}
|
||||
footer={<button>Cancel</button>}
|
||||
>
|
||||
<OrderDetails id="1234" />
|
||||
</Card>
|
||||
```
|
||||
|
||||
### Higher-order component / wrapper composition
|
||||
```tsx
|
||||
const withAuth = <P,>(C: ComponentType<P>) =>
|
||||
(props: P) => useUser() ? <C {...props} /> : <Login />;
|
||||
|
||||
const withLogging = <P,>(C: ComponentType<P>, name: string) =>
|
||||
(props: P) => { console.log(name, props); return <C {...props} />; };
|
||||
|
||||
// Compose
|
||||
const Page = withAuth(withLogging(Dashboard, 'Dashboard'));
|
||||
```
|
||||
|
||||
### Unix pipes (process composition)
|
||||
```bash
|
||||
cat access.log \
|
||||
| grep '\.html"' \
|
||||
| awk '{print $7}' \
|
||||
| sort \
|
||||
| uniq -c \
|
||||
| sort -rn \
|
||||
| head -20
|
||||
```
|
||||
|
||||
### DAG composition (Airflow / Dagster)
|
||||
```python
|
||||
from dagster import asset
|
||||
|
||||
@asset
|
||||
def raw_orders(): return load_csv("orders.csv")
|
||||
|
||||
@asset
|
||||
def cleaned_orders(raw_orders): return raw_orders.dropna()
|
||||
|
||||
@asset
|
||||
def daily_revenue(cleaned_orders):
|
||||
return cleaned_orders.groupby("day")["total"].sum()
|
||||
# Dagster builds DAG from inputs → outputs automatically
|
||||
```
|
||||
|
||||
### Type composition (TypeScript)
|
||||
```ts
|
||||
type Timestamped = { createdAt: Date; updatedAt: Date };
|
||||
type Identified = { id: string };
|
||||
type Soft Deletable = { deletedAt: Date | null };
|
||||
|
||||
// Intersection composition
|
||||
type Entity<T> = T & Identified & Timestamped & SoftDeletable;
|
||||
type User = Entity<{ email: string; name: string }>;
|
||||
```
|
||||
|
||||
### Algebraic composition — Result.flatMap (Rust)
|
||||
```rust
|
||||
fn parse(s: &str) -> Result<i32, String> { s.parse().map_err(|e| e.to_string()) }
|
||||
fn double(n: i32) -> Result<i32, String> { Ok(n * 2) }
|
||||
fn check_positive(n: i32) -> Result<i32, String> {
|
||||
if n > 0 { Ok(n) } else { Err("non-positive".into()) }
|
||||
}
|
||||
|
||||
let out: Result<i32, _> = parse("21")
|
||||
.and_then(double)
|
||||
.and_then(check_positive); // composition via and_then
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Mode |
|
||||
|---|---|
|
||||
| Shared state across siblings | Composition (props / context) > inheritance |
|
||||
| Behavior reuse, no state | Mixin / trait / function |
|
||||
| Conditional capability | HOC / decorator |
|
||||
| Linear pipeline | pipe / compose |
|
||||
| Branching workflow | DAG (Dagster, Airflow) |
|
||||
| Multi-axis variation | Strategy / Plugin |
|
||||
|
||||
**기본값**: 매 favor composition — 매 inheritance 의 only 매 strict is-a + immutable hierarchy.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Design Patterns]] · [[Functional Programming]]
|
||||
- 변형: [[Composition over Inheritance]] · [[Pipe-and-Filter]]
|
||||
- 응용: [[React]] · [[Airflow]] · [[Unix-Philosophy]]
|
||||
- Adjacent: [[Base_Layouts]] · [[Architectural-Constraint-Enforcement]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 inheritance hierarchy → composition 의 refactor suggestion, 매 pipeline의 DAG 의 visualize.
|
||||
**언제 X**: 매 deep domain modeling — 매 human 의 boundary judgment 의 필수.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Inheritance for code reuse**: 매 fragile base class — 매 composition 의 사용.
|
||||
- **Composition explosion**: 매 100-deep wrapper — 매 readability 의 X. 매 refactor.
|
||||
- **God component**: 매 50-prop slot — 매 split.
|
||||
- **Implicit composition order**: 매 HOC stacking 의 order-dependent — 매 explicit naming.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Gamma et al., *Design Patterns*; React docs — composition vs inheritance; Wadler — *Theorems for Free*).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — function/object/component/process composition patterns |
|
||||
|
||||
Reference in New Issue
Block a user