PHP to Java (using PtoJ)

前端 未结 5 2381
感动是毒
感动是毒 2021-02-15 15:32

I would like to transition our codebase from poorly written PHP code to poorly written Java, since I believe Java code is easier to tidy up. What are the pros and cons, and for

5条回答
  •  清歌不尽
    2021-02-15 16:35

    In contrast to other answers here, I would agree with your strategy to convert "PHP code to poorly written Java, since I believe Java code is easier to tidy up", but you need to make sure the tool that you are using doesn't introduce more bugs than you can handle.

    An optimum stategy would be: 1) Do automated conversion 2) Get an MVP running with some basic tests 3) Start using the amazing Eclipse/IntelliJ refractoring tool to make the code more readable.

    A modern Java IDE can refactor code with zero bugs when done properly. It can also tell you which functions are never called and a lot of other inspections.

    I don't know how "PtoJ" was, since their website has vanished, but you ideally want something that doesn't just translate the syntax, but the logic. I used php2java.com recently and it worked very well. I've also used various "syntax" converters (not just for PHP to Java, but also ObjC -> Swift, Java -> Swift), and even they work just fine if you put in the time to make things work after.

    Also, found this interesting blog entry about what might have happened to numiton PtoJ (http://www.runtimeconverter.com/single-post/2017/11/14/What-happened-to-numition).

提交回复
热议问题