These days I'm stuck to fixing some defects about a parser. The parser parses an internal scripting language, and the language itself is evolving. The original code works, rarely correct, however. The parser module needs refactoring with no doubts. The problem is: how to refactor so that the impacts to the release of whole product will be minimized.
Before making a decision, I analyzed the problems and the risks.
The problems are:
- the language itself is not well defined,
- hard-coded parsing rules,
- high coupling of modules,
- duplicated functionalities in separate modules, and
- parser engine is the worst part because it even doesn't generates a syntax tree!
To avoid the problems, the parser needs to be refactored, or even worse, redesigned. This will bring many risks. So at this moment, refactoring of whole module is not acceptable(parse engine was already refactored by me when fixing defects but only brings a functional parser).
The risks are:
- in recent sprints a functional parser with fewer defects must be delivered,
- work load of the team is fairly high,
- the parser itself is written in java while half of team are java newbies,
- the new parser must be embedded into the existing eclipse plug-in but this will cause impacts to other modules.
Frankly speaking, all modules in this product are examples of poor software engineering. Java is used to write procedural code in this project. I have to say that the team is unlucky to take over such a mass of garbage. We have to face this.
Considering the problems and risks described above, at least 2 phases of refactoring are needed:
- 1st is to deliver a functional parser and this has been done by refactoring the parse engine,
- 2nd is to redesign the whole module.
The 2nd phase should be put to "Feature Improvement" or "New Feature" backlog. So the refactoring needs at least 3 iterations. The evolving of the language should be considered and the best moment is when the defects of the language itself have been fixed, and the vagueness of syntax has been eliminated.
阅读(1635) | 评论(0) | 转发(0) |