Refactoring improves maintainability without altering externally observable behavior,yet it remains costly and error-prone when applied manually at scale.While large language models(LLMs)can generate plausible refacto...Refactoring improves maintainability without altering externally observable behavior,yet it remains costly and error-prone when applied manually at scale.While large language models(LLMs)can generate plausible refactorings,practical adoption is limited by uncontrolled edit scope,inconsistent outputs under stochastic decoding,and weak traceability of why a change was produced.This paper proposes a smell-targeted,scope-bound refactoring framework for JavaScript that couples deterministic AST-based smell detection with constrained LLM transformation.The key design principle is to bind generation to explicitly detected smell instances,enforce a structured output contract(refactored code plus per-smell rationale),and log full refactoring artifacts for repeatable evaluation.We implement the framework as a microservice-based prototype(detector,prompt construction and routing,orchestrator,analytics,and UI)and evaluate it on LeetCode-style solutions and multiple GitHub repositories.Across the evaluated projects,the approach achieves an average smell reduction of 83.96%and an average maintainability index improvement of+5.366,while maintaining a mean developer acceptance rate of 91.66%.A targeted temperature study identifies an operating point around 0.4 that maximizes acceptance(approximately 95%in controlled trials),balancing determinism with sufficient flexibility for structure-improving edits.These results suggest that explicit scope control and structured traceability are central to making LLM-based refactoring reliable and reviewable,and motivate future integration with automated validation(tests,linting)and repository-conditioned policies.展开更多
自Jesse James Garrett提出了AJAX概念以来,由于AJAX在提升用户交互体验的同时,又不需要在客户端安装插件。因此,一经提出就引起了互联网领域的广泛关注。但目前的网络爬虫技术在AJAX框架的URL解析过程中存在着不能够识别事件触发顺序...自Jesse James Garrett提出了AJAX概念以来,由于AJAX在提升用户交互体验的同时,又不需要在客户端安装插件。因此,一经提出就引起了互联网领域的广泛关注。但目前的网络爬虫技术在AJAX框架的URL解析过程中存在着不能够识别事件触发顺序等问题,导致大量数据不能被搜索引擎有效检索。本文针对此问题,通过研究基于对象的程序切片算法,以及脚本执行引擎与切片模块的互操作,最终解决AJAX框架中URL提取以及异步JavaScript网络爬虫系统的关键技术问题。展开更多
摘要Refactoring improves maintainability without altering externally observable behavior,yet it remains costly and error-prone when applied manually at scale.While large language models(LLMs)can generate plausible refactorings,practical adoption is limited by uncontrolled edit scope,inconsistent outputs under stochastic decoding,and weak traceability of why a change was produced.This paper proposes a smell-targeted,scope-bound refactoring framework for JavaScript that couples deterministic AST-based smell detection with constrained LLM transformation.The key design principle is to bind generation to explicitly detected smell instances,enforce a structured output contract(refactored code plus per-smell rationale),and log full refactoring artifacts for repeatable evaluation.We implement the framework as a microservice-based prototype(detector,prompt construction and routing,orchestrator,analytics,and UI)and evaluate it on LeetCode-style solutions and multiple GitHub repositories.Across the evaluated projects,the approach achieves an average smell reduction of 83.96%and an average maintainability index improvement of+5.366,while maintaining a mean developer acceptance rate of 91.66%.A targeted temperature study identifies an operating point around 0.4 that maximizes acceptance(approximately 95%in controlled trials),balancing determinism with sufficient flexibility for structure-improving edits.These results suggest that explicit scope control and structured traceability are central to making LLM-based refactoring reliable and reviewable,and motivate future integration with automated validation(tests,linting)and repository-conditioned policies.
摘要自Jesse James Garrett提出了AJAX概念以来,由于AJAX在提升用户交互体验的同时,又不需要在客户端安装插件。因此,一经提出就引起了互联网领域的广泛关注。但目前的网络爬虫技术在AJAX框架的URL解析过程中存在着不能够识别事件触发顺序等问题,导致大量数据不能被搜索引擎有效检索。本文针对此问题,通过研究基于对象的程序切片算法,以及脚本执行引擎与切片模块的互操作,最终解决AJAX框架中URL提取以及异步JavaScript网络爬虫系统的关键技术问题。