Code refactoring
I hope that after reading this book, you want to implement concepts such as the Class-Method-Property model, Natural Language Programming, and Encapsulation.
When the existing code does not follow these structures, the code can be refactored by following a few easy steps.
Please note that we must be the original creator of the code in order to refactor. We should never refactor code that we do not own. If we want to refactor the code modifications that we have done in the objects we don't own, we should use the Hooks Pattern.
Finding the process owner
The first step for refactoring is to find the owner of the code. This is typically the record with which you start the transaction. If this is true, the code can be moved to a function of the table. If the code does not have a specific record, we can move it into an interface.
Moving to Codeunit
Depending on the owner, we now have either an interface or a method. Both should be in a Codeunit of their own....