将PHP(Kohana)项目转移到Java Play的经验!框架?
我已经用 PHP + Kohana 开发一个网站一年多了。大约有 100K - 150K 行代码(CSS + JS + PHP),大约有 150 个 PHP 文件(应用程序类和帮助模块,不包括 Kohana 的系统和模块文件)。
由于某些原因,我需要将整个项目转移到Java(使用Play!框架)。显然要完成传输需要的时间并不短,所以我打算一步一步地进行,比如将模块、控制器和模型一一替换,然后更新视图文件。在传输过程中,服务器需要能够同时处理PHP和JAVA。但我不知道该怎么做。
有人有将 PHP 项目转移到 Java 的经验吗?高度赞赏步骤、参考、意见和建议的列表。
I have been working on a website with PHP + Kohana for more than a year. There are ~100K - 150K lines of codes (CSS + JS + PHP), and there are ~150 PHP files (application classes and helper modules, not including the Kohana's system & module files).
Because of some reasons, I need to transfer the whole projects to Java (with Play! framework). It obviously will take not a short period of time to finish the transfer, so I plan to do it step by step, say replacing the modules, controllers and models one by one, then update the view files. During the transfer, the server needs to be able to handle PHP and JAVA simultaneously. But I have no idea how to do it.
Does anyone have experience to transfer PHP projects to Java? A list of steps, references, advices and suggestion is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一次性完成所有事情,并且在完成之前无法进行测试,这将是一场噩梦。随着您的前进,您将学习更好的技术并改变方向,这将很难应用于整个代码库。
任何如此大的 Web 应用程序都会分解为核心功能(例如 20%)和附加功能(例如 80%)。在开始任何编码之前,请通过丢弃任何多余的内容来弄清楚系统的核心功能是什么。继续前进,无情地削减内容,直到将其缩减为一小部分功能。
编写一个具有这些核心功能的应用程序,使其完美运行,并对其进行破坏性测试。在此过程中,您可能已经了解了很多关于应该如何编写它的知识,因此请花时间重构核心代码,使其完全按照您想要的方式工作。如果您需要尝试不同的做事方式,现在正是时候。确保它通过了你能想到的每一个测试,并确保它在接下来的测试中继续通过这些测试。
一旦您的核心不仅可以工作而且以正确的方式工作,那么您就可以开始扩展它以包含一些额外的功能。系统越大,改变事情就越困难,所以如果在任何时候你发现需要改变系统的架构方式,那么就集中精力添加新的部分。
Doing the whole thing at once, and having no way to test until you finish, is going to be a nightmare. As you're going, you'll learn better techniques and have changes of direction, that are going to be really hard to apply to the whole code base.
Any web application that large is going to break down into core features (say 20%), and additional bits (say 80%). Before you start any coding at all, work out what the core features of the system are by discarding anything that's superfluous. Keep going, ruthlessly cutting things, until you have it down to a small subset of the features that hangs together.
Code an application that does those core features, get that working perfectly, and test it to destruction. In the process you've probably learned a lot about how you should have written it, so take the time to refactor the core code to work in exactly the way you want. If you need to experiment with different ways of doing things, now is the time. Make sure it passes every test you can think of, and make sure it keeps passing those tests through the next bit.
Once you have that core not just working but working in the right way, then you can start expanding it to include some of the extra features. The bigger the system gets the more awkward it will be to change things, so if at any point you find you need to change how the system is architected then focus on that in favour of adding new bits.
没有办法同时做到这一点。你不能一半的逻辑用 PHP 完成,另一部分用 Java 完成。准备您的迁移。彻底完成,一次完成。
我唯一的建议是测试。游戏包括测试机制,使用它们。一直运行测试,没有回归,硒等等。这样您就可以放心,您的新应用程序运行得与旧应用程序一样好。
There is no way to do this simultanously. You cannot have half of the logic done in PHP and the other part in Java. Prepare your migration. Do it completely, a one-shot.
My only advise will be testing. Play includes test mecanisms, use them. Run test all the time, no regression, selenium and all. That way yuo might be assured your new application runs as good as the old one.