• Post Reply Bookmark Topic Watch Topic
  • New Topic

code refactoring  RSS feed

 
ramya narayanan
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I want to know
1)what is refactoring ? Is it about changing the code completely?
2) How to refactor the code in a backwards compatible manner?
please explain?
Regards.
 
dee anderson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend you obtain a copy of Refactoring: Improving the Design of Existing Code by Martin Fowler. You can order it from amazon. Refactoring is a huge subject which cannot be adequately explained in a forum such as this.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ramya,

in short "refactoring" means cleaning up your code to make it more readable, maintainable, extensible etc. usually WITHOUT changing its behavior. This goes hand in hand with testing (especially unit tests) to verify that the changes to the code hasn't changed its behavior.

Refactoring in a backwards compatible manner means that other code which depends on the code you want to refactor should work without changes after the refactoring. You can achieve this with a clear modular design where each piece of code only depends on a clearly defined and stable interface which is like a contract how to use the code hidden behind the interface. So you can change everything in the code behind the interface as long as it still fulfills the contract.

Of course this is only a simple explanation. In reality good application design, refactoring, code testing and so on are topics which require a lot of experience

Marco
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!