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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Switch to another language in the middle of a project?

7 点作者 sangguine将近 17 年前
Hi,<p>My friends and I have been developing a website in PHP on weekends for almost a year now. From what I have read, PHP is not as good as Python or Ruby. I am wondering if we should switch to one of the two. If so, what's the best way to switch?<p>If not, I am also thinking about implementing a PHP framework. We have been developing without a framework. Do you think we should? Doesn't the implementation mean rewriting the code?

18 条评论

breily将近 17 年前
I find python a lot more enjoyable/productive than PHP, but unless you're having major problems with your current code, it seems like porting it would just be a lot of extra work.<p>I would guess it mostly depends on how much code you have written now (if most of your time has been design/planning, then it might be worth it), and whether or not the people you work with have experience with python/ruby.<p>Whichever way you go, learning python (or ruby, I suppose) will serve you well in the future.
评论 #195614 未加载
vaksel将近 17 年前
finish your project in PHP, throw it up, start making money. Then in your spare time if you feel like it, switch to another language. Or if you are starting to have some performance issues.<p>If you are going to change your language every time some new language gets hyped you'll never finish.
评论 #195824 未加载
xirium将近 17 年前
I believe that in the book The Mythical Man-Month: Essays on Software Engineering ( <a href="http://en.wikipedia.org/wiki/The_Mythical_Man-Month" rel="nofollow">http://en.wikipedia.org/wiki/The_Mythical_Man-Month</a> ), Fred Brooks suggests that you "build one to throw away". I don't recall him suggesting that you change programming language.<p>If you are having performance problems or you code has become spaghetti and your team is most comfortable with the current language then you could start again in the same language. This has the advantage that you could use good sections of the current implementation with the least effort.
Hexstream将近 17 年前
If you want to implement a web framework, keep in mind that it will be a slow and iterative process. And don't expect to create it in a vacuum (1. make super great framework 2. use it). It will be more like, you notice some patterns of repetition in the code of your existing project(s), and then you devise a way to factor that into a library. Try to implement your web framework as libraries instead of a monolithic pile of spaghetti. There are tons of design decisions you'll have to take and it's better if you can use different parts of the web framework (and perhaps write new ones) for different projects. At first your web framework will be pretty specific to your project, and you'll hit walls whenever you want to go in a direction you hadn't thought of yet. You'll see what is truly general and what's really project/section/page-specific once you have a good corpus of samples.<p>That's how it goes for my slowly-evolving will-release-it-someday-when-it's-ready CL web framework anyway.
mooneater将近 17 年前
I've heard the suggestion to use Cake PHP as intermediate step from frameworkless (or "custom framework") PHP, to Rails/Django. Basically it will result in organizing your code by model/view/controller, so the structure will be more similar to what you would have in a Ruby or Python framework.<p>I'd love to hear from anyone who's tried this approach.
swombat将近 17 年前
I was in almost the same situation as you, and I decided, for the very reasonable reasons explained in the other responses, to stay with PHP.<p>In summary:<p>- I know PHP, don't know Rails<p>- I could be a victim of the "grass is greener" effect<p>- I'm already too far into the project to make such a drastic change<p>- I made the decision to use PHP in the first place - I'd look like an idiot for making such a big mistake (even to just myself and my business partner) And so on.<p>All very good reasons, and I still think my decision was highly defensible, and I stand by it.<p>However, it was a mistake - the deadly kind. There's no telling what could have happened if I'd switched to Rails at the time (I had a <i>strong</i> hunch that Rails was way better). But here's what happened:<p>- Turns out we weren't so far into the project after all (a typical mistake) - it was another 8 months before we released<p>- I've since learned Rails, and reckon I could probably have redone the whole site in less time than that with Rails (probably 3-5 months with better functionality as a result)<p>- PHP and the framework I used (custom) were not adequate for our long-term aims. The viscosity ( <a href="http://www.inter-sections.net/2007/12/01/comparing-pieces-of-string-part-1/" rel="nofollow">http://www.inter-sections.net/2007/12/01/comparing-pieces-of...</a> ) of the whole thing increased to the point where after we finally went live, making further changes was too expensive/difficult/error-prone to be worth our while<p>Basically, this decision killed this product that I spent about a year working on.<p>I still stand by it, but I've learned from my mistake. I even wrote an article about it (though I didn't mention this specific product, the argument applies): <a href="http://www.inter-sections.net/2008/01/22/fundamental-mistakes/" rel="nofollow">http://www.inter-sections.net/2008/01/22/fundamental-mistake...</a><p>What would I have done differently? How about take a 2 week break and give Rails a really good try to see how well I liked it and if it was just an impression. I would then probably have made the decision to switch, and I believe it would have been the right one. I suggest you do the same with your product. Building a product that's painful to evolve is a deadlier mistake than wasting a bit of work. Also, it's not all wasted - you've still learnt about the business domain.<p>Anyway, good luck!<p>Daniel
underscore将近 17 年前
I think the answer kind of depends on the nature of the project.<p>Re-writing something you have now in another language/framework can be (in addition to fun) a great way to learn the new language/framework. If this is just a fun project, well, cool - best of luck to you. If this is a business, something that you'd like to start making money (or at least getting press) from, then maybe the delay will hurt you more than the fun will help you.<p>In my case, the website was the online component of a small university department. I inherited a PHP codebase that worked, but that I really didn't like, and opted to re-write it in Python/Django. I'm really happy with the decision: I think it was a great way to learn the framework, and the result is a lot better than the PHP site that it replaced, but I don't think I would have done it if I hadn't had a working PHP site to placate students while I was working on it.<p>Good luck with whatever route you choose to go.
Kaizyn将近 17 年前
The answer depends on the purpose of the project. If you're building something to make money, you should not spend the time now to switch languages unless your NEW language has some library or feature which your current project simply cannot work without. However, if this is a learning exercise only or just a fun project, there would be no harm in spending the time to explore both the Python and Ruby options.<p>The key to your decision here should be how much time and effort it would require to duplicate a feature you want to use in your existing system as compared to what comes out of the box with either a new language or an existing PHP framework. If it's a pain to do and the functionality is critical to your project's success, then you should port. Otherwise, I'd recommend you keep doing what you're doing.
maxklein将近 17 年前
Very big mistake if you are serious about bussiness. Django and Ruby are very tough to find cheap programmers for, but there is no shortage of cheap PHP programmers. Expect a language change to throw you back 3 months or more.<p>And there are many PHP frameworks, don't implement a new one.
评论 #195833 未加载
donal将近 17 年前
Oh how apt your timing is, Jeff Atwood just wrote a nice article on his Coding Horror block titled:<p>"PHP Sucks, But It Doesn't Matter" (<a href="http://www.codinghorror.com/blog/archives/001119.html" rel="nofollow">http://www.codinghorror.com/blog/archives/001119.html</a>)<p>Why introduce regressions and headache by switching to another language that I'm guessing you don't know as well as PHP.<p>Jeff says it best in that article: "building a compelling application is far more important than choice of language."<p>Personally, I'd just keep plugging away in PHP. It isn't my favorite language, but it has yet to fail me. It is like the farmers rusty pickup truck. Not very flashy, but it gets the job done.
thorax将近 17 年前
I've said this a lot, but I can't recommend Code Igniter enough when working with PHP. Quite fast, almost feels like an entirely different "real" language with so much library support from the framework.<p>Even when I work with Django (being a huge Python man myself), I miss having some of the better aspects of Code Igniter (and definitely CI's user guide is stellar).<p>Don't switch languages mid-way unless you have a great reason. PHP blog-flak isn't a good enough reason (IMHO) unless your team is fluent in another language they can code more securely.
评论 #195675 未加载
asnyder将近 17 年前
I wouldn't say PHP is not as good as Python or Ruby, it's simply different. For instance you could use a development platform/framework that lives on top of PHP that might make your life easier. You'll have the same issues with Python and Ruby and will eventually implement a framework or platform that lives on top of them.<p>I also recommend you check out NOLOH (shameless self plug), there will be a limited developer release at the end of this month.
sah将近 17 年前
I'd say stick with PHP for this project, and try doing the next one in Python or Ruby.<p>If you feel like you need a framework, slowly build it up one piece at a time as you need it. Don't re-write your whole app before you're making money. You can spend a lot of time doing that, and there are so many other things that can potentially go wrong, you don't need to add "it took us too long to get it working" to the list.
iamnirav将近 17 年前
I was recently halfway through a project that was going strong in PHP, but I started reading about Django and Python and decided to port everything over: turned out to be a very good decision. Django keeps my code clean and Python keeps me inspired. While PHP is a good language, I would argue that it takes more self-control to program well in it.
评论 #195736 未加载
smanek将近 17 年前
Well, I think you should start learning Python or Ruby.<p>Learning enough to make an informed decision (heresay doesn't count) should only take a few weekends.<p>After that you can decide for yourselves if it would be worthwhile.
lakeeffect将近 17 年前
We switched from PHP to phython after six months of working on the project, it has made all the difference. I would do it again 9 month or even a year into a project. Django is the best.
jdavid将近 17 年前
i think you should go where your passion is.if you are board with php, you might be willing to put more hours in to another language.<p>you will find that the more languages you know the easier it is to switch.<p>i also think you should keep in mind on how you plan to progress in your company, the further you are from writing the code, the more you will want to be able to recognize a broad set of patterns.
craigbellot将近 17 年前
I am also contemplating a switch from php to RoR. After developing another site in RoR and loving it, php just doesn't inspire me anymore.