Just a reminder on refactoring: it means finding parts of the code where it can be improved in quality.
Also, as style of code must be consistent across whole code base, I should also apply the refactoring in all similar places that need to be refactored the same way.
Refactor the system back.. backfactor.
I see 2 reasons “why not to”:
one has no time
I will try to argue both.
1. Sure you can. Maybe you have no way to know if code after modification works the same way as before. Well, you probably have no tests, or your code was already way too complicated. Either way – you need to find a solution, and find it quick
2. No time. This is tricky. As I believe leaving such code creates legacy code. Creates inconsistency among code base. And in the end more time is wasted than spent on backfactoring.
Any new (or you) developer reading system code in future, will find the same problems solved in different ways, or expressed in different ways. They will need to spend more time than you would backfactoring earlier..
Hope it makes you thinking when you refactor next time :-)
Am I a GOOD programmer when I write A LOT of CODE?No! I’m certainly not.
Tonight I found myself again very happy because I removed a lot of lines from my code. There was really a lot of redundancy in the code. And when the moment comes that I just CTRL+Y (IDEA‘s “delete line”) then I’m happy.
I’m really, really happy.
The first such moment in life was then when Andrew and I sat down in front of the hopeless app and thrown away a lot of generic code which just existed there. That was a custom database layer, and we changed it to another one, based on Prevayler. And during one afternoon we deleted a lot of someone’s else work – I remember that was more than 120 classes. Trash.
Tonight I did once more big refactoring. I didn’t deleted so many files this time, but removed a lot of redundancy in the code. And that’s really good.
Agile way and live modification of “presentation layer”
on meeting with client..
My problem is, I develop software for librarian client. It is a library system (books, readers, lendings, etc..).
I try to adopt many XP characteristics; that is:
frequent client meetings
First of all, the core system is already made. Requirements are based on few user stories, live talks with librarians and former library system (that needs to be exchanged into some modern software).
Let’s talk in detail about how I make user interface and how do I adopt it to librarian needs.
First, the technology used is Struts. The presentation layer consists of web pages written in Struts jsp’s format.
Second; when the core business system is done, then the only thing to do is to write presentation layer.
So what I actually did today is:
went to the client’s office
modifed presentation layer (WWW pages) immediately after feedback (at the meeting)
The last point is most important. In two hours working together with client (at client’s office) I did more than I could do alone at home.