Is rewriting a PHP application in Python a productive step?

I have some old applications written in PHP that I am going to translate into Python - both are websites that run as simple static html, then switch to PHP and now include blogs with admin areas, rss, etc. I am thinking of rewriting them in Python to improve maintainability, as well as to take advantage of my increased experience to write things more reliably.

Is it worth the effort?

+6
python php
source share
11 answers

Here you need to consider some parts,

  • What do you get from dubbing
  • This is a cost-effective solution.
  • Will the code be easier for new programmers to work with?
  • Effectively, would this be a good option?

These four points are important, will the work be more efficient after re-writing the code? Probably. But will it be worth rethinking?

One important step for the next, if you decide to rewrite, make 3 documents, first analyze the project, what needs to be done? How should everything work? Then lay out the document with the requirements, what exactly do we need and how to do it? And last but not least, a project document in which you put all of your finite class diagrams, system operations, and ways to design and stream the page.

This will help the new developer and the old ones to really think about "do we really need to rewrite?".

+14
source share

Remember to resist the effect of the second system , and you should be safe.

Rewriting an existing project gives you an achievable goal. You know where you are going. But do not try to do too much at once.

+4
source share

Well, it depends ...;) If you are going to use the old code together with the new Python code, this may be useful not so much for speed as for simplification of integration. But usually: "If it has not broken, do not correct." Allso rewriting can lead to better code, but only do it if you need to.

As a hobby project, of course, it is worth it, because this process is the goal.

+2
source share

Mistakes are very expensive: you spend a lot of time on something that does not directly help you. Joel Spolsky clarifies:

Things You Should Not Do, Part I

You must do this if the benefits outweigh the costs; just be careful not to underestimate the cost.

+2
source share

As others have said, see why you do it.

For example, at work, I rewrite our existing inventory / sales system to the Python / django backend. What for? Since the existing base of PHP code is outdated and will not scale well as our business grows (plus it was built when our business model was different and then fixed to fit our current needs, which led to some spaghetti code)

So, basically, if you think you are going to benefit from this in ways that are not just "sweet, it is now in python!" then go for it.

+2
source share

Is your goal solely to improve applications, or do you want to learn / work with Python?

If this is the first, I would say that you should stick with PHP, as you already know this.

+1
source share

If you are going to add additional functions to code that already works for you, then it would be nice to port it to python. In the end, it will give you increased productivity. You just need to balance it, whether rewriting the task will outweigh the potential gain ...

And also, when you do this, try to do unittest as much as possible.

+1
source share

As others said, re-recording will take much longer than you think, and fixing all the errors and using everything that works as in the old version will take even longer. Most likely, you better just improve and reorganize the php code that you have. There are only a few good reasons to transfer a project from one language to another:

  • Performance. Some languages ​​are simply faster than others, and the moment comes when there is nothing that could be optimized, and throwing hardware into a problem ceases to be effective.
  • maintainability. Sometimes it is difficult to find good people who know some obscure language in which your old code is written. In such cases, it might be a good idea to rewrite it in a more popular language in order to facilitate road service.
  • Porting to another platform. If you suddenly need to make your old VB program on OS X and Linux, as well as Windows, then you are probably looking at rewriting in another language.

In your case, it does not look like any of the above points are true. Of course, if this is an unimportant application, and you want to do it for training, then it will certainly go for it, but from a business or economic point of view, I would look for a long time that such a rewriting will be worth and what exactly you hope to receive.

+1
source share

I did a conversion between a PHP site and a Turbogears (Python) site for my company. The initial reason for this was twice, firstly, so the redesign would be simpler, and secondly, features could be easily added. It took some time to fully convert, but in the end we got a very flexible rear end and an even more flexible and intuitive interface. We have added several functions that would be very complex in PHP, and currently we are doing a complete redistribution of the interface, which turned out to be very simple.

In short, I would recommend, and my boss would probably say the same thing. However, some people make good points. Python is not as fast as what PHP can give you, but what it lacks in performance, it more than compensates for its versatility.

+1
source share

Other issues include how important business applications are to applications, and how difficult it is to find companions. If your pages are a hobby, then I don’t see a reason why you should not rewrite them, because if you enter errors or the rewriting does not go according to the schedule, the business will not lose money. If the application is central to business, I would not rewrite it, if you do not encounter limitations with the current design that cannot be overcome, with a complete rewrite, at this point the choice of language is secondary to the fact that you need to throw it out for several years works because it is not supported and no longer meets your needs.

0
source share

One element that did not appear is the size of the current code base. Depending on how much code should affect your decision.

Joel Spolsky's argument , never to be rewritten, is valid in the context of a Netscape-sized code base. While lower code code benefits greatly from rewriting.

0
source share

All Articles