Ruby is an object-oriented programming language. When beginners take over an Rails application with Legacy Code, they will learn and practice object-oriented programming.
Do you have the following questions: Why is the same code everywhere in the application? Why is the code still there even though it is not used anymore? What is the method means? Why does the comment of code differ from the actual code?
The longer project goes online, the more problems we get. Every time a new feature is added, the project will get bigger and bigger, and the messy code will also increase. The legacy code will lead higher development costs in the future. The best way is to refactor code while developing and collate highly relevant code together. Do not let the code be scattered everywhere and be difficult to maintain. The project can progress while developing.
I will give a few simple examples and explain how to write Service Objects that are commonly used to organize code, and show how to refactor highly coupled Objects into low-coupled ones.
About Cindy Liu
2 years of experience with Ruby on Rails