开发者

Rewriting A Custom PHP App on a framework. Torn between Python (Django) and PHP (CodeIgniter)

I was thinking of rewriting my custom PHP app on a framework... mainly for the solidity and more ease of growth going forward. Right now its a pseudo MVC setup w开发者_如何转开发ith lots of hacks in between.

I already have the db built out and the app uses a lot of AJAX too.

I am not concerned with the amount of work involved as the solidity of the platform I move things to. Server configurations are no worries. I am also looking to increase performance all around.

My friend (and Python enthusiast) told me things of python rendering tabular type data at almost 40% increase over PHP and speed is definitely a decision maker in this.

Taking out the fact that there would be significantly less work moving to a PHP based framework since the app is PHP already which would be the best fit?

I know there are a lot of PHP vs Python stories out there. Python seems to be the clear winner, but how easy is it to use with standard web stuff like AJAX?

I just want to know who would use which and why vs the other.


According to the language benchmark game, Python isn't all that ahead.

Of course, they are benchmarking very specific algorithms and data structures. Do they relate to your application? Probably not. On the same note, even though Python has a library for tabular data, is that really going to benefit your application substantially? Probably not.

Optimizing a program doesn't mean switching to a supposedly faster language. What it does mean is first carefully profiling your application and identifying where bottlenecks occur. You may find that querying the database is actually taking most of the time -- and this isn't uncommon for many web applications. Secondly, to fix the bottleneck you might consider caching, rewriting queries, or tweaking database settings. Without identifying a specific problem, though, we cannot start coming up with fixes.

Saying an application is slow is simply not specific enough and merely migrating to another language is bound to carry over the same problems. My advice, if you wish to refactor your application -- by reimplementing it using a framework or whatever -- is to first consider the solidity and ease of growth, as you stated. Optimization is far down the road, after the application is rewriting and working, and after specific problems are identified by profiling.

As far as to which language offers the best goods, neither can be declared an absolute winner. Both languages are memory managed (a feature well found to decrease development time), are dynamically and weakly typed, support OOP, have a wealth of libraries, and have plenty of documentation, among many other similarities. Don't feel tempted to use a language based on the argument that it is simply better, or people say it is what real developers use -- PHP is often given a hard time, but lets say it is out of love. Pick the language that has been always been faithful to you, or if you are allowed to be risky, pick the language that excites you.


Which language do you prefer? That's all that really matters. Both have solid frameworks and similar performance. If you want to increase performance, writing more efficient code is going to make a way bigger difference.

Personally, I like python. Django is great, but you might also consider Flask or Pyramid/Pylons. Ajax is just as easy with python as it is with PHP--it's only a request. The server configuration is definitely harder--it doesn't get any easier than PHP--but it's not that hard, and you said you didn't mind it. If you like both languages equally, give python a shot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜