Codebase Volumetrics & Complexity Analysis
Date: 2026-01-09 Scope: WepNG_MVC Solution
Executive Summary
Based on a static analysis of the codebase, the WepNG_MVC system is estimated to be approximately 16,000 Function Points (FP) in size.
This places the application in the "Very Large / Enterprise ERP" size category. Rewriting such a system from scratch would typically require ~110+ man-years of effort (based on industry standard of ~150 FP/developer/year for maintenance/evolution or ~200-300 for new dev).
Recommendation: DO NOT REWRITE. The "Strangler Fig" pattern is the only viable migration strategy.
1. Volumetrics Data
The following raw metrics were collected from the current branch:
| Metric | Count | Description |
|---|---|---|
| Lines of Code (LOC) | 851,377 | C# Code only (excluding JS/HTML/CSS). Verified. |
| Files | 5,490 | Total C# files. |
| Controllers | 765 | Functional Modules / Areas. |
| Entry Points | 3,052 | Public Action Methods (Potential User Interactions). |
| Screens / Views | 2,797 | Razor .cshtml files (User Interfaces). |
| Domain Models | ~3,395 | Classes in WepNG_Business/Model (Entities + DTOs). |
2. Function Point Estimation (Methodology)
Two independent methods were used to estimate the functional size, yielding consistent results.
Method A: Backfiring (industry Standard from LOC)
- Formula:
Total LOC/Language Gear Factor - Factor for C#: ~53 LOC per Function Point (QSM / SPR data).
- Calculation: 851,377 / 53 = 16,063 FP
Method B: Component Counting (Approximate IFPUG)
- Transactional Functions (EI/EQ):
- Based on 3,052 Controller Actions.
- Assumed Complexity: Average (~4 FP/Action).
- Contribution: ~12,208 FP.
- Data Functions (ILF):
- Based on ~3,400 Model files (Assuming ~10% are core "Entities" worth 7 FP, rest are small DTOs/Enums).
- Contribution: ~340 * 7 = ~2,380 FP.
- Total: 12,208 + 2,380 = 14,588 FP
Note: The Backfiring method (A) often captures complexity hidden in "God Classes" better than component counting (B), suggesting the real size is closer to 16k FP.
3. Analysis & Implications
3.1. Complexity "Hotspots"
As noted in the hotspot_analysis_results.md, the complexity is not evenly distributed.
- WEPV2ModelBuilder.cs (17k LOC) and OrderTravelProductOMGT.cs (7k LOC) indicate "God Classes" that concentrate a disproportionate amount of logic.
- This suggests that while the system is large (14.5k FP), the Maintenance Complexity is likely higher than the raw size suggests due to coupling.
3.2. Refactoring vs. Strangling
- Big Bang Rewrite Risk: Extremely High. Replicating 14,500 FP of logic (much of it hidden in 17k lines of
ModelBuildermapping) is virtually impossible without massive regression. - Strangler Strategy: Essential.
- Isolate the 765 Controllers one by one.
- Move them to a new platform (Target) incrementally.
- Use the 3,050 Entry Points as a checklist for migration.
4. Next Steps
- Freeze God Classes: As per Hotspot recommendations.
- Define Bounded Contexts: Group the 3,395 Models into domains (e.g., "Order", "Product", "CRM") to map the Monolith's internal structure.
- Prioritize Modules: Use Churn data to decide which of the 765 Controllers to strangle first (High Churn = High Value).