• شماره ركورد
    30650
  • پديد آورنده

    مهنوش شهيدي

  • عنوان
    ‫ارائه ‬‫يك‬ ‫روش‬ ‫بازسازي‬ ‫خودكار‬ ‫استخراج‬ ‫تابع‬ ‫جهت‬ ‫تصحيح‬ ‫ضد‬‫الگو‬‫ي‬‫ تابع‬ ‫بلند‬ ‫در‬ ‫كد‬
  • مقطع تحصيلي
    كارشناسي ارشد
  • رشته تحصيلي
    مهندسي كامپيوتر - نرم افزار
  • سال تحصيل
    1397
  • تاريخ دفاع
    1399/12/19
  • استاد راهنما
    دكتر مهرداد آشتياني
  • دانشكده
    مهندسي كامپيوتر
  • چكيده
    عرضه كردن يك نرم‌افزار خوب به بازار، از اهميت بالايي در دنياي كامپيوتر و تجارت برخوردار است. يك نرم‌افزار خوب بايد حاوي ويژگي‌هاي مشخصي، ازجمله انعطاف‌پذيري، قابليت نگهداري و ساختار صحيح باشد. روش و ابزارهاي فراواني براي نوشتن و بررسي يك نرم‌افزار خوب با چنين ويژگي‌هايي وجود دارد. رعايت درست اصول شي‌گرايي در زبان‌هاي شي‌گرا از جمله روش‌هايي است كه ما را به نوشتن نرم‌افزار انعطاف‌پذيرتر و بهتري وادار مي‌كند. برنامه‌نويس‌ها سعي بر استفاده از اين اصول دارند اما گاهي به خاطر كمبود وقت، هزينه، سهل‌انگاري و موارد ديگر در رعايت كامل اين اصول بي‌توجهي مي‌شود و باعث ايجاد ساختارهاي اشتباه، پيچيده و گاه مشكل‌زا در كد مي‌شوند كه ايجاد تغيير در برنامه و گسترش آن را با مشكل مواجه مي‌كنند. اغلب اين ساختارها، مشخصات خاص و شناخته‌شده‌اي دارند كه مي‌توان پس از شناسايي، با كمك روش‌هاي بازسازي كد، تصحيح شوند. اين كار هم مي‌تواند به‌صورت دستي توسط خود برنامه‌نويس و هم به‌صورت خودكار به كمك ابزارهايي آماده انجام شود. ابزار و روش‌هايي در اين زمينه مطرح شده‌اند ولي اين حوزه هنوز با مشكلات زيادي همچون محدوديت در نوع تصحيح، نياز به نيروي انساني براي نظارت بر فرايند تصحيح و همچنين عدم دقت كافي در تشخيص ساختارهاي اشتباه موجود در برنامه، مواجه است. علاوه بر اين، روش‌هاي موجود كه براي تصحيح كد استفاده مي‌شوند در برخي موارد كارايي مناسبي ندارند و قادر به حذف ضدالگوها در برنامه و اصلاح آنها نيستند. در اين پايان‌نامه روشي خودكار براي تشخيص و تصحيح ضدالگوي تابع بلند ارائه شده است. اين روش شامل 4 مرحله اصلي است. در مرحله اول به كمك بازنمايي گرافي پروژه و با تحليل روابط بين توابع و همچنين تعداد خطوط توابع، توابعي كه داراي ضدالگو هستند، تشخيص داده مي‌شوند. در مرحله بعد براي بازسازي اين توابع، قطعه كدهايي كه انسجام بالايي دارند، به كمك تحليل‌هاي گرافي تشخيص داده شده و براي رده‌بندي مي‌شوند. پس از رده‌بندي بهترين قطعه كد براي استخراج انتخاب شده و به تابع جديدي منتقل مي‌شود. در قدم بعد براي اين تابع نام مناسب توليد شده و در نهايت كلاسي كه اين تابع مي‌تواند در آن قرار بگيرد، انتخاب مي‌شود. كلاس مقصد نيز به كمك نگاشت قواعد و اصول شئ‌گرايي بر ويژگي‌هاي گراف و تحليل‌هاي گرافي به گونه‌اي انتخاب مي‌شود كه اصل چسبندگي زياد و وابستگي كم به خوبي رعايت شود. در آخر تابع جديد به همراه كلاسي كه تابع مي‌تواند در آن قرار بگيرد به عنوان پيشنهاد بازسازي به برنامه‌تويس ارائه مي‌شود. در نهايت روش پيشنهادي پياده‌سازي شده و هر بخش به طور جداگانه ارزيابي شده است. براي ارزيابي كيفيت كد پس از بازسازي از نظر متخصصان كمك گرفته شده و در مقايسه با كارهاي مشابه انجام شده، در زمينه رعايت اصل تك مسئوليتي، از نظر متخصصان تفاوت 21 درصدي ايجاد شده است.
  • تاريخ ورود اطلاعات
    1402/12/26
  • عنوان به انگليسي
    An Automated Extract-Method Refactoring Approach to Correct the Long Method Code-smell
  • تاريخ بهره برداري
    3/10/2022 12:00:00 AM
  • دانشجوي وارد كننده اطلاعات

    مهنوش شهيدي

  • چكيده به لاتين
    The creation of high-quality software is of great importance in the current state of the enterprise systems and web-based applications. High-quality software should contain certain features including flexibility, maintainability and a well-designed structure. There are several approaches to write high-quality software with such features. Correctly adhering to the object- oriented principles is one such approach to make the code more flexible. Developers usually try to leverage these principles, but many times neglecting them due to the lack of time and the extra costs involved. Therefore, sometimes they create confusing, complex, and problematic structures in code, known as code smells. Code smells have specific and well- known patterns that can be corrected after their identification with the help of the refactoring techniques. This process can be performed either manually by the developers or automatically. This work provides an automated method for detecting and refactoring long-method code smell. We use network properties to analyze code quality and refactor long methods. The whole process has 5 main steps. At the first step long-method code smells will be detected based on code dependencies and number of code lines. At the next step all possible refactorings will be extracted from detected methods. These possible refactorings will be ranked based on modularity metric. The best option from all possible refactorings is the code with the highest cohesion. Code lines with high cohesion are performing same responsibility. Netxt step is to generate proper name for the new method. This name will be generated based on the function responsibility. The last step is to define destination class for new method. This class will be specified based on class coupling and cohesion. We intend to maximize internal cohesion of classes and minimize their external coupling. Finally, the best refactoring option with its proper method name and destination class will be suggested to the programmer. We use experts’ opinion to eva‎luate the proposed method. The experts were asked to score the code quality after applying refactoring and compare the quality with another related work. Base on their opinion the quality of code has improved 21% in terms of single responsibility principle.
  • كليدواژه هاي فارسي
    شي‌گرايي , بازسازي كد , تصحيح خودكار , گراف , تابع بلند
  • كليدواژه هاي لاتين
    Code smells , Refactoring , Object oriented design , Long-method
  • Author
    Mahnoosh
  • SuperVisor
    Shahidi