Live data from Hacker News

Switch to another language in the middle of a project?

news.ycombinator.com

1–10 of 25 posts

Switch to another language in the middle of a project?

#1
Hi,

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?

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?

Re: Switch to another language in the middle of a project?

#3
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.

That's how it goes for my slowly-evolving will-release-it-someday-when-it's-ready CL web framework anyway.

Re: Switch to another language in the middle of a project?

#4
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.

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.

Whichever way you go, learning python (or ruby, I suppose) will serve you well in the future.

Re: Switch to another language in the middle of a project?

#5
post #4

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. 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. Whichever way yo…

Yes. It's quiet a lot of code now. And, my friends are not familiar with python/ruby.

Thank you for your advice.

Re: Switch to another language in the middle of a project?

#6
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.

I also recommend you check out NOLOH (shameless self plug), there will be a limited developer release at the end of this month.

Re: Switch to another language in the middle of a project?

#7
I believe that in the book The Mythical Man-Month: Essays on Software Engineering ( http://en.wikipedia.org/wiki/The_Mythical_Man-Month ), Fred Brooks suggests that you "build one to throw away". I don't recall him suggesting that you change programming language.

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.

Re: Switch to another language in the middle of a project?

#9
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.

Re: Switch to another language in the middle of a project?

#10
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.

I'd love to hear from anyone who's tried this approach.

Post reply on HN