4 ms·
I forget where I learned this. But this follows my refactoring legacy code principal. Your new code (typescript in this case) should never reference the old co
by pyrolistical 3y ago
I forget where I learned this. But this follows my refactoring legacy code principal.
Your new code (typescript in this case) should never reference the old code. Old code is the only thing that knows about new code.
The reason being is if your new code ever knows about your old code, your new code will carry on old code forever. You can never escape.
But if only old code knows about new code. Your new code is perfectly clean.
For this typescript conversion problem the nice thing is you can configure typescript to allowJs and your existing code can import compiled typescript
- quickthrower2 3y agoOoh that may have been the approach for my sister comment about circular deps. Thanks for the insight. The solution for me would be make new libraries (without circle) and migrate old code to reference them. Instead of pulling old code into the new libraries with the circular deps coming with them
- nicoburns 3y agoYou could also just remove the circular deps first?
- quickthrower2 3y agoYou could. Probably a lot of work! You are also fighting against new code going in adding more. Splitting into modules prevents this.
- redbar0n 3y agoBut then you effectively won’t be able to build on what you already have? Or, you’d have to continue expanding the old code using only the old language/methods (here: JS instead of TS).
- Smaug123 3y ago(The "strangler pattern" can encompass this if you make an exception to the policy for the facade that hides the legacy code.)
- pyrolistical 3y agoClose. But the few descriptions I’ve read don’t seem to talk about avoiding new system calling to old system