• Post Reply Bookmark Topic Watch Topic
  • New Topic

When getting back to an old project, how should i approach it?  RSS feed

 
Ranch Hand
Posts: 128
4
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I was working on a  java project a long time ago and I had to stop working on it because of life. Now I have some free time to work on it again and after spending 3 hours on it, it looks strange to me. I have no idea how long it will take me to refigure out what I did in there but I know if I am going to start the project again all over it may take me a week to get to the same point I am right now.

My question is, which approach should I take?
 
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would start by refactoring the parts that look "strange" so that they don't look all that strange. Code should be clear enough so that when you look at it again after not seeing it for a while, it actually *reminds* you of what was going through your mind when you were writing it.  Ask yourself why the code looks strange to you now. Here are some of the main reasons:

1. Poor choice of names - they are either misleading or unclear and do not help to explain what their purpose is and how they fit into the surrounding logic. Use Rename refactoring.

2. Poor organization - too much code doing too many things in one place. Use Extract refactoring.  Also, code like this tends to be very tightly coupled. Try to make your code/design more loosely coupled. Separate different responsibilities.

3. Mixing levels of abstraction - most hard-to-understand code is that way because it violates the Single Level of Abstraction Principle (SLAP). Use Rename and Extract refactoring as appropriate.

Good luck. 
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!