TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

PHP to Django: Changing the engine while the car is running

2 点作者 adolfoabegg超过 14 年前

2 条评论

Udo超过 14 年前
<i>In our case, the prototype was written in PHP with the kind of architecture you'd expect from a prototype. There were 45 .php files in a folder with one file called class.main.php. No templates. No classes. No consistent database access. No MVC. No ORM. No tests. [...] it was still obvious that moving to Django was in the best interest of our company (and my sanity).</i><p>Isn't the entire point of prototype code to throw it away eventually? It's okay if the code is messy, because it's just meant as a quick proof of concept, right?<p>People think programming in PHP _has_ to be messy and insane. But what I find even more amazing is actual PHP developers perpetuating this somehow. Case in point, I just spent the night doing maintenance on a website where a simple contact form was one monstrous 3000 lines copy-and-paste spaghetti code disaster written in PHP by a very well-known, respected and well-educated programmer. In the end I threw it away and replaced it with 50 lines of sane and maintainable code, also written in PHP. The point of this anecdote isn't to show how cool I am but to illustrate that there is something about PHP that makes people switch off their brains. Which is kind of sad, because it is possible to write very elegant things with it.
mattdw超过 14 年前
Writing a session backend for Django to allow it to share sessions with PHP is a pretty clever idea. To be honest, that's the only really interesting thing they did.