TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Relaunch my website in Ruby/Python or continue with PHP?

6 pointsby syed123almost 8 years ago
Hey All, My site http://LetsLunch.com is written in PHP - YII framework - we are looking to relaunch it with a new angle/pivot. Any ideas on should we continue to build on existing PHP or switch to more modern languages like ruby/rails, angular etc.. is switching over and rewriting worth it?

7 comments

Can_Notalmost 8 years ago
First off, most of those languages/frameworks aren't even modern, let alone "more modern" than PHP. Next most of them are not significantly faster than PHP, if they're not definitely slower than PHP. If you're not using modern PHP, you can upgrade to PHP7.x faster than a full rewrite. I would avoid rewriting anything non-trivial, because you have no guarantee that your new codebase will be completed in a predictable amount of time, let alone be faster. If a specific sub-module needs to be in a faster language, rewrite that small part in something like golang or elixir. You need to be really careful with full rewrites, you're more likely to end up with a whole year of lost productivity than a success story. I'd recommend learning how to profile and optimize performance _after_ migrating to PHP7+.
评论 #14503202 未加载
jstewartmobilealmost 8 years ago
Stay the course and tune out the fashionistas. We maintain large codebases in all three, and I can only remember one case where any of the languages got in the way (PHP&#x27;s poor threading support). And even that case wasn&#x27;t a show stopper--we just used fork() instead.<p>Great business idea BTW. If I lived in a larger city I would definitely try it out!
评论 #14501587 未加载
odonnellryanalmost 8 years ago
I&#x27;d say, if the site can be rewritten quickly, use the language you&#x27;re most productive in.<p>If the site is small and can be ported in &lt; 1 week might be a good rule.<p>But if your most productive language is PHP, why not leave it?<p>No reason to use Rails, Node, or Python for this.
评论 #14501785 未加载
mabynogyalmost 8 years ago
Rewrite it in Go with Caddy for the backend and plain JS for the front.<p><a href="https:&#x2F;&#x2F;caddyserver.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;caddyserver.com&#x2F;</a>
salukialmost 8 years ago
Check out Laravel if you&#x27;re sticking with PHP but interested in a new framework.
评论 #14506685 未加载
sparklingalmost 8 years ago
Do you have some ugly corners in your code base? Lots of legacy stuff that you want to rework anyway, regardless the language? Then it might make sense.
评论 #14502035 未加载
git-pullalmost 8 years ago
I did PHP before Python. Done CakePHP, Drupal back in the day. Then did some idiorm + paris w&#x2F; slim.<p>That said, I&#x27;d like to try to sell you on Python. First off, let&#x27;s begin by saying PHP is a solid web language with mature tools. I haven&#x27;t looked at the ecosystem in maybe 5 years. Due to this, I can&#x27;t speak for PHP 7 and the latest and greatest best practices and libraries.<p>But as of 2017, I think python has surpassed PHP in web development. This is due to some fundamental things being baked into the language, and external factors like luck, timing, and momentum.<p>0. PHP&#x27;s &quot;lost years&quot;: PHP didn&#x27;t capitalize on standardization, packaging and libraries for a long time. I don&#x27;t know what the reason was, but it was PHP 5 for a long time and the language didn&#x27;t &quot;move&quot;.<p>This allowed other languages like ruby to gain ground back in 2005-2012. PHP 6 never happened. The community had to pull together and start PHP-FIG and stuff. During those years, a lot happened, other language ecosystems gained significant traction.<p>Sure, there were great strides in <i>individual</i> projects like Drupal and Wordpress. But these CMS and frameworks lacked a package manager during that time. And despite being OOP, developers weren&#x27;t sharing each other&#x27;s code the same way Ruby and Python did.<p>1. Code standardization: Python nails this. PEP8 (code style), PEP257 (code documentation).<p>1.1 Code aesthetic: While the lack of subcolons and block-style struck me as a gimmick for a while (remember I did PHP before python), I came to find it makes code a hell of a lot easier to read.<p>2. Package management - People started publishing packages early on. Even if there was distutils&#x2F;setuptools warts for a couple years, the practice of having a real market for code was great. PHP didn&#x27;t have that for a long time.. anyone remember PEAR?<p>3. OOP: Python&#x27;s OOP makes it very clear to move up the class tree. This sort of winds in with the the code style too, you can easily navigate and traverse large codebases and wrap your brain around chunks of code really fast in python.<p>4. Imports: Better implemented in python. Much more straight forward and clear. You can pull in a full module from your environment&#x27;s current packages or relative location (import flask or import . mymodule). You can also import objects like constants, functions and classes scoped in a module, like &quot;from mymodule import myfunction&quot;, also import as an alias, &quot;from mymodule import myfunction as a&quot;.<p>5. Community: At this point, Python&#x27;s community is more active. Though PHP seems to be strong as well. People are building websites in PHP and are still successful at it. That says a lot.<p>6. Use Domains: Python is being used in big data (pyspark), general data science with pandas, numpy, juypter. The web with django, flask. System utilities like supervisor. People can write mobile games with kivy. There are C speedups like Cython. ORM&#x27;s like Peewee and SQLAlchemy are mature and superbly documented.<p>6.1 Web: Python&#x27;s most popular web framework, Django, is very mature. The ORM is very nice. Migrations. Documentation. Flask, a popular framework for Python, also have excellent documentation and many users. And aside from that, there are many other web libraries like Pyramid, and ones I can&#x27;t even think off the top of my head. Pyramid is actually one I hear great stuff about haven&#x27;t even tried yet.<p>7. Runtime implementations: CPython (default), pypy (python-hosted), Jython for Java and IronPython for .NET<p>8. Performance: pypy, numpy&#x2F;pandas has tabular &#x2F; typed speedups. I&#x27;m probably forgetting a few.<p>9. C&#x2F;C++ integration: Boost.Python, pybind11 (new and highly cool), CFFI, Cython, Swig, and the CPython&#x27;s own implementation of C API&#x27;s, which CPython itself builds upon is at your disposal, and ctypes.<p>10. Documentation: Python itself, as well as the top libraries in the open source community all use Sphinx to generate documentation. Builds nice static, themed HTML sites with a nifty feature called &quot;intersphinx&quot; to link across project documentation. And it&#x27;s used at scale in the community. Big thanks to ReadTheDocs.org for providing a place for the community to host.<p>In most cases, the above &quot;nice things&quot; about python have been around in production and used at scale long before I did Python full time. This gives python a significant advantage.<p>Some additional free resources on Python:<p>- <a href="https:&#x2F;&#x2F;python-guide.readthedocs.io" rel="nofollow">https:&#x2F;&#x2F;python-guide.readthedocs.io</a><p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;vinta&#x2F;awesome-python" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;vinta&#x2F;awesome-python</a>
评论 #14502861 未加载