Comprehensive Analysis of Programming Language Idioms and Their Application to Software Quality

Date

2024

Authors

Zhang, Zejun

Journal Title

Journal ISSN

Volume Title

Publisher

Abstract

Achieving high-quality code is fundamental to the success and sustainability of software development projects. Software quality encompasses multiple facets, including maintainability, readability, and performance, each posing its unique challenges. Achieving these goals requires a deep understanding of best practices and effective coding conventions. Programming idioms, known for their conciseness and improved performance, offer substantial benefits but also introduce complexity that can hinder their adoption. Compared to idioms in other programming languages, Pythonic idioms are particularly well-regarded and receive significant attention from the Python community and developers. This thesis explores the enhancement of software quality through the strategic use of Pythonic idioms and systematic bi-directional transformation between idiomatic and non-idiomatic Python code, focusing on three critical aspects: code maintainability, readability, and performance optimization. Firstly, we introduce an automated refactoring tool, RIdiom that transforms non-idiomatic Python code into idiomatic forms, significantly enhancing maintainability and reducing manual effort. By leveraging Large Language Models (LLMs) in a hybrid knowledge-driven approach, we synergize rule-based methods with the adaptability of LLMs to improve code detection and refactoring accuracy. This integration addresses common challenges in code transformation, boosting both precision and consistency. Additionally, our approach promotes the consistent use of best practices across codebases, ultimately contributing to more maintainable and robust software. To aid developers' understanding and proper utilization of Pythonic idioms, we explain these idioms into equivalent non-idiomatic code, bridging comprehension gaps and ensuring semantic accuracy. This intuition is particularly beneficial for developers less familiar with Pythonic constructs, helping them to avoid common pitfalls and write more idiomatic Python code. Furthermore, we conduct an empirical study to evaluate the performance impacts of Pythonic idioms, providing developers with clear, evidence-based guidelines for optimal code performance. Our study reveals that while Pythonic idioms generally enhance performance, their impact can vary based on specific usage contexts and data characteristics. Our findings reveal nuanced insights into the benefits and limitations of Pythonic idioms, supporting developers in writing more maintainable, readable and efficient code.

Description

Keywords

Citation

Source

Type

Thesis (PhD)

Book Title

Entity type

Access Statement

License Rights

Restricted until

2024-11-26

Downloads

File
Description