DOI: 10.5281/zenodo.18053679
title: PatternForge: A Benchmark Dataset for Pattern-Based Refactoring of Code Smells

description: PatternForge Dataset and Artifacts


This repository provides the complete dataset and experimental artifacts used in the study:



PatternForge: A Multi-Agent LLM Framework for Refactoring Code Smells into Design Patterns


The repository is intended to support transparency, reproducibility, and reuse of the benchmark introduced in the paper. All artifacts required to inspect, reproduce, and extend the experimental results are publicly available.



Repository Contents


The dataset is organized according to a standardized and documented directory structure.Each instance corresponds to a single dominant code smell, a fixed complexity level, and a specific programming language.

dataset/ └── SmellType/ └── ComplexityLevel/ └── InstanceID/ ├── original/ # Original smelly implementation ├── refactored/ # Refactored version generated by PatternForge ├── tests/ # Executable test suite for behavioral validation └── metadata.json # Smell type, target pattern, language, complexity

This separation explicitly distinguishes input artifacts from generated outputs, preventing ambiguity between manually authored code and automatically refactored results.



Dataset Description


The dataset consists of 72 curated instances, evenly distributed across:



Six canonical code smellsLong Method, God Class, Feature Envy, Switch Statement, Data Class, Duplicated Code

Three complexity tiersEasy, Medium, Hard

Two statically typed object-oriented languagesJava and C#


Each instance is designed to exhibit one dominant architectural deficiency, following canonical definitions from the refactoring literature (e.g., Fowler, Kerievsky, Olbrich et al.).Overlapping or confounding smells are intentionally avoided to enable controlled, fine-grained architectural analysis.



Refactored Implementations


All code under the refactored/ directories is generated exclusively by the PatternForge framework using:



prompt-guided, multi-agent reasoning,

explicit pattern-role planning,

bounded validation with compilation and test execution.


No manual post-editing or corrective intervention has been applied to the refactored outputs.



Behavioral Validation


Each dataset instance includes an executable test suite under the tests/ directory.These tests are used to verify behavioral equivalence between the original and refactored implementations.

The test suites are intentionally lightweight and instance-specific, serving as a conservative oracle to detect functional deviations introduced during architecture-level refactoring.



Metadata


Each dataset instance is accompanied by a metadata.json file that records static structural metrics for both the original (smelly) implementation and the refactored version generated by PatternForge.

The metadata file is organized into two main sections:





original: structural metrics extracted from the initial implementation containing the code smell




refactored: structural metrics extracted from the pattern-based refactored implementation



For each section, the following metrics are reported:





Lines of Code (LOC): number of logical source code lines




Class Count: number of declared classes




Interface Count: number of declared interfaces




Type Count: total number of types (classes + interfaces)




Cyclomatic Complexity: control-flow complexity computed using the standard McCabe definition




Coupling Between Objects (CBO): number of distinct type-level dependencies



This metadata structure enables direct, quantitative comparison of structural properties before and after refactoring, supporting the analysis of complexity variation, architectural expansion, and coupling effects introduced by pattern-based transformations.

Moreover, the standardized metadata schema facilitates automated metric aggregation, cross-instance statistical analysis, and reproducibility of experimental configurations, making it suitable for systematic benchmarking of architecture-level refactoring approaches.



Intended Use


This dataset is designed for:



evaluating architecture-level refactoring frameworks,

studying pattern-aware automated refactoring,

benchmarking LLM-based multi-agent code transformation systems.


It is intended as a capability and feasibility benchmark, not as a large-scale industrial corpus.

 



Reviewer-Oriented Note


This repository is structured to ensure:



clear separation between original and generated artifacts,

full inspectability of refactoring outputs,

reproducibility of behavioral validation,