Files
2nd/10_Wiki/Topics/Architecture/vFunction.md
T
Antigravity Agent f8b21af4be Wiki cleanup: error-doc removal, dedup merge, link normalization
10_Wiki/Topics 대규모 정리:
- 오류 캡처/미완성 stub 문서 227개 제거
- 교차폴더 중복 43클러스터 병합 (63파일 → redirect)
- 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건
- 카테고리 MOC 6개 신규 생성
- Graph 섹션 미해결 related-keyword 링크 10,058건 제거

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:52:15 +09:00

4.5 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-vfunction vFunction 10_Wiki/Topics verified self
virtual function
가상 함수
vFunction.com
none A 0.9 applied
oop
polymorphism
architecture
modernization
2026-05-10 pending
language framework
cpp none

vFunction

매 한 줄

"매 dispatch 의 runtime 의 resolve". 매 term 의 two meanings — (1) C++ virtual function (vtable-based dynamic dispatch), (2) vFunction.com (AI-driven Java monolith → microservices modernization platform). 매 context 의 disambiguate.

매 핵심

매 (1) Virtual function (C++)

  • vtable: 매 class per — function pointer table.
  • vptr: 매 instance per — vtable 의 pointer.
  • Dispatch: obj->fn()obj->vptr[fn_index]() (one extra indirection).
  • Cost: ~1-2 ns per call, 매 inlining 의 block.
  • Override: derived class 의 same signature 의 redefine.

매 (2) vFunction.com platform

  • Static + dynamic analysis: 매 Java/.NET monolith 의 scan.
  • Domain extraction: AI 의 bounded context 의 cluster.
  • Refactor recommendation: 매 service boundary + dead code + TCO.
  • 2025 update: Claude/GPT-5 backed reasoning, 매 Spring Boot extraction template.

매 응용 (vfunc C++)

  1. Strategy pattern.
  2. Plugin/driver interface.
  3. Mock injection 의 testing.

매 응용 (vFunction.com)

  1. Legacy Java EE → microservice migration.
  2. Technical debt quantification.
  3. Architectural drift detection.

💻 패턴

Virtual function (modern C++20)

struct Shape {
    virtual ~Shape() = default;
    virtual double area() const = 0;       // pure virtual
};

struct Circle : Shape {
    double r;
    explicit Circle(double r) : r(r) {}
    double area() const override { return 3.14159 * r * r; }
};

double total(std::span<const std::unique_ptr<Shape>> shapes) {
    double s = 0;
    for (auto& sh : shapes) s += sh->area();   // dynamic dispatch
    return s;
}

Devirtualization hint (final)

struct FastCircle final : Shape {              // final → compiler 의 devirtualize
    double area() const override final { return 3.14; }
};

CRTP (static polymorphism, vfunc 의 X)

template<class Derived>
struct Shape {
    double area() const { return static_cast<const Derived*>(this)->area_impl(); }
};

struct Square : Shape<Square> {
    double s;
    double area_impl() const { return s * s; }   // zero overhead
};

Rust (trait object, vfunc analog)

trait Shape { fn area(&self) -> f64; }
struct Circle { r: f64 }
impl Shape for Circle { fn area(&self) -> f64 { 3.14 * self.r * self.r } }

fn total(shapes: &[Box<dyn Shape>]) -> f64 {
    shapes.iter().map(|s| s.area()).sum()  // dyn dispatch via vtable
}

vFunction.com workflow (concept)

# .vfunction/config.yaml
target: java/spring-boot
analyze:
  paths: [src/main/java]
  exclude: [test, generated]
extract:
  strategy: domain-driven
  min-cohesion: 0.7
recommendations:
  - service-boundaries
  - dead-code
  - dependency-cycles

매 결정 기준

상황 Approach
Runtime polymorphism, OOP virtual function
Hot loop, type known CRTP / template
Plugin boundary virtual + dyn lib
Legacy Java refactor vFunction.com
Greenfield modular DDD + bounded context

기본값: virtual function 의 default OOP, CRTP 의 perf-critical.

🔗 Graph

🤖 LLM 활용

언제: legacy code 의 virtual function chain 의 analyze, 매 modernization scope 의 estimate. 언제 X: 매 micro-optimization decision (devirtualize 의 X) — 매 profiler 의 use.

안티패턴

  • Virtual everything: 매 every method 의 virtual, 의 cost + 의 hard 의 reason. Final 의 default.
  • Diamond inheritance: 매 multiple virtual base, 의 composition 의 prefer.
  • Virtual destructor 의 forget: base class polymorphic, 의 leak.
  • vFunction 의 silver bullet: tool 의 recommendation 의 blindly 의 apply, 의 domain understanding 의 first.

🧪 검증 / 중복

  • Verified (ISO C++ standard, Stroustrup "Tour of C++" 3rd, vfunction.com docs 2025).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — full vFunction (virtual + platform) entry