Plaza 365
Plaza 365

No results found for your search

RegisterLog in

-1

Visit article

#ax2012

#codemaintenance

#methodextraction

#readability

#refactoring

Dynamics 365 Finance

Category

Oct 29, 2022

Published date

Text

Article Type


AI Summary

  • The article discusses a refactoring project in which the author had to adjust a piece of logic implemented as a method with over two thousand lines.
  • The code was found to be unmaintainable and difficult to understand.
  • Upon further exploration, the author discovered that the method consisted of many almost identical blocks of code, with select statements varying slightly in conditions.
  • The developer did not know how to write queries dynamically and did not think about extracting the remaining code to a separate method.
  • As a result, the method was duplicated multiple times with slight variations in behavior.
  • The author extracted the logic to a method that took a query as a parameter and created a collection of Query objects to execute them one by one.
  • The queries were created by methods with names describing the business scenario.
  • The refactored code was easier to understand and even non-programmers could review it to ensure it met business requirements.

Registered users can view the full text for FREE!

Sign In Now!

Cookies Consent

We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.