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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Please tell us how you started a project in PHP and are sorry for this.

40 点作者 zebra超过 11 年前
And if you have to start the same project again what would be different and why?<p>I&#x27;ve invested over 10000 hours in PHP and I want to know whether to invest another 10000 in some other language and what are the alternatives.<p>There are lot of opinions in the wild but I think that opinion supported by example is much better than just &quot;I like X and dislike Y&quot;<p>edit - some grammar EDIT 2 - To be more precise - I am not looking for a brain teaser, but for a tool which will allow me to be 1.5x (or 2x or 3x) more productive. I am looking for a tool to feed my family and myself in the next few years. To be honest I am a little scared of all &quot;PHP sucks&quot; articles. I don&#x27;t want to be jobless in 3 years when&#x2F;if PHP becomes the new COBOL.

25 条评论

interstitial超过 11 年前
Never fear, some the nastiest, unmaintainable code I&#x27;ve ever seen is written in Rails. There is a conspiracy of silence among the Rails gurus that is utterly dishonest. Your self-doubt plays into their hands. Just watch, 10 years or less from now, all the mature programmers will confess what utter folly their &quot;Rails Period&quot; was now that they moved on to Programming Language Awesome 4.6
评论 #7165594 未加载
gexla超过 11 年前
10,000 house seems like an awful big investment for a plan B. Granted, much of that time will be paid for, but you would still need to spend a lot of time learning the plan B. That then leaves one skill on the side while you are using the other skill. Again, not the best investment.<p>As a solid PHP developer, if you aren&#x27;t as solid on the front-end, then that&#x27;s a great direction to go. An ace HTML &#x2F; JS &#x2F; CSS developer will have no problem finding work, especially as the front-end gets more complex and gets asked to do more. This would be a great enhancement to your tool-set rather than a replacement.<p>Otherwise, I would be looking at things which could bring in an alternative income. For example, you could build an add-on for Wordpress which you could sell while also boosting your profile in the Wordpress community. You may not want to do Wordpress work, but that could be another source if your other sources dried up.<p>There&#x27;s lots of other things you could do also. The possibilities are endless. You should try to break out of your comfort zone of doing dev work to bring in other sources of income.<p>I can sense the fear, uncertainty and doubt in your post. You should embrace the chaos, kick your creativity into gear and try some different things. Chaos and change is good, it shakes things up and creates new opportunities.
Jemaclus超过 11 年前
As a PHP dev (8 years), I can honestly say PHP is an ugly language. But it gets the job done. And I&#x27;d say with 10K hours under your belt, you can do what you damn well please. Feel like spending another 10K hours in PHP? Go for it. Wanna learn C or Rust or Scala or Python or Ruby? Knock yourself out.<p>I personally am a fan of diversity (master one skill set, then another, then another). Unless you&#x27;re doing cutting-edge work, you&#x27;re probably at that point where your diminishing returns are close to zero, so you might as well learn something new.
评论 #7165375 未加载
mik3y超过 11 年前
I&#x27;ve done some dreadful things in PHP. And Java. And Python. And C. And more..<p>The problem has never been the language, but rather the software&#x27;s organization and architecture (or the lack thereof). You can make mistakes in any language, some just make it a little easier for you. Such as PHP&#x27;s notorious ability to mix code and HTML in the same file... the horror!<p>Before contemplating a language change, you might want to think about ways you could improve your architecture, development practices, and code hygiene.
评论 #7165683 未加载
rowanseymour超过 11 年前
I deeply regret choosing PHP for a dictionary website that I wrote 5 years ago. The trouble is that I&#x27;ve moved on as a developer. Mostly everything else I write now is Java or Groovy. I used to be ok with PHP&#x27;s quirks but now I find my old PHP code so painful to look at that I generally don&#x27;t and have pretty much given up development on that project with the vague hope of one day having a free month to rewrite it from scratch in something else.<p>Don&#x27;t see your hours with PHP as a waste though. It&#x27;s important as a developer to try different platforms and languages so you understand the pros and cons of different approaches.
samcasas超过 11 年前
I&#x27;d like to say something, stick to PHP. PHP is a very neat programming language; I recommend you to read about Composer and PSR standards, but if you want to learn something different, try with Python or Ruby, both languages are kind of similar, hope it helps.
ryan-allen超过 11 年前
You wont be jobless in a few years even if you continue writing PHP. So don&#x27;t worry. The scare tactics are nothing but marketing usually. When Rails was initially marketed DHH used Java as a scapegoat. Ironically the Java stack traces he posted as proof in the early days of Rails have nothing on the monstrosities that exist in modern Rails apps.<p>I would recommend playing around with some other technology though, not so you can move to greener pastures but to just get a taste of what else is out there. Front-end stuff like Angular and Ember (which require some knowledge of HTML&#x2F;CSS and JS, which as a PHP guy I bet you would have). Tools like these may slowly make backend technology less differentiated on the small to medium scale as time goes on, so you can&#x27;t go wrong with investing time in frameworks like these.<p>Coming from PHP, and probably knowing some JS, have a bit of a look at Node (and Express, to get started), the concurrency model is different enough from PHP. Or even have a look at (gasp) ASP.NET MVC. I don&#x27;t think that tech gets enough love these days. Try using Heroku with Rails and then go and try and use .NET with Azure. You&#x27;ll be surprised at how much more responsive Azure is by comparison and you&#x27;ll be enamored with the tight tool integration.<p>Either way, there&#x27;s nothing to worry about. There&#x27;ll still be heaps of PHP apps to maintain in your lifetime. It might make it harder for you to jump into some fancy new start up, but if you don&#x27;t wear a cap backwards and have skinny jeans you wont get a job with the cool kids anyway.<p>Set aside a couple of hours a week to explore some alternatives and see how you feel within 3 months.
评论 #7165750 未加载
frevd超过 11 年前
I&#x27;m a C# veteran and have programmed for more than a decade. I started PHP last year for a project, and I must say 5.4 is quite rich in features (it&#x27;s also very weird, agreed, but nothing beyond any control, the docs are great). It&#x27;s astounding how much more productive you can be with PHP and its library, compared to ASP.Net for example. The libary is greatly grown (besides being impossible to remember it is the fastest way to use global functions for standard stuff and classes if you need custom implementation). You won&#x27;t probably find any language more productive than that. If you&#x27;re aiming for becomeing more well-paid as a specialist, web programming won&#x27;t get you too far though, unless you have great back-end qualifications for special-purpose architecture. You could look into unity3d for a change (C# or Javascript). The only language that you must know in 3 years is Javascript. You should be proficient in it, since more and more moves into the client and cloud callbacks vs. serverside processing.
jeffmould超过 11 年前
IMO - if you are starting a project as a business, go with what you or your developers are most comfortable with. If for some reason you need to change down the road then so be it. There are plenty of sites that are highly successful that have been built on PHP.<p>On the other hand, if you are building a project to learn from, or for personal reasons, then take the time to start learning a new language.<p>This is not to say you can&#x27;t invest time in another language to build a project in a different language. There may be reasons where PHP will just not cut it.<p>So to answer your original question. There are no projects I am sorry for building in PHP. However, there are projects where I look back and say I wish I had taken the time to learn a different language. Those projects tend to fall into the second category and I was just too lazy to take the time to learn something new&#x2F;different at the time.
zebra超过 11 年前
Thank you people!<p>My lesson: I will stick with PHP and learn more about organization, architecture and best practices. And Composer and PSR.
评论 #7165601 未加载
bsaul超过 11 年前
I would recommend having a &quot;back up&quot; technology just in case. Try to go for a quite different language&#x2F;technology that is more &quot;hype&quot; (objective-c, nodejs , f# , scala, haskell , golang, python, whatever). <i>Nobody knows for sure what the next trend will be</i> , so just cover yourself. You don&#x27;t need to switch to that new tech full time, but just enough to be able to answer a few quizz question with it in interviews.
nhmit超过 11 年前
Sorry I have to answer this way, but if you spent that amount of time in PHP, how come you don&#x27;t know the answer already?<p>To answer your question: Whether it be PHP or Python or Ruby, you will need to work hard. Advice if you stick with PHP: Get the Zend&#x27;s PHP and ZF certificates. Apply for job after that. You won&#x27;t be jobless in next 5 years, and you can expect quite a good salary.
bobdvb超过 11 年前
10 years ago I was working at a European telco, they needed a way to monitor traffic flow on customer connections but the tools that existed didn&#x27;t work for half the population. So, given that I had paid my way through college programming the bosses gave the task of scoping the project to me (a communications engineer).<p>I looked at the available tools, got a price for a very expensive commercial tool, and got a price from an independent programmer to use rrdtool and build a custom tool. I wrote a paper which set out the options in a paper for management, explicitly saying it should be a fixed price contract with only supervision from our team, no effort.<p>The Engineering Director came to me and said he had a contact at another company, they already had a solution that would be suitable and they would be paid (by the hour) to adapt it to our needs. A month later they arrived with a Cisco PIX firewall, two HP Xeon servers and a pile of PHP and Perl code.<p>There was supposed to be two days of training and some integration. It didn&#x27;t work. They had done nearly nothing and we had two weeks before the system had to be ready. So I knuckled down, rewrote the entire thing virtually from scratch and while learning PHP and Perl (I had exposure before but you could see my evolution of understanding in different parts of the code).<p>Two weeks later we had an undocumented mess that actually worked. I left shortly afterwards because I realised I might actually have to support this spawn of bile. I think it was two years later that I got a call asking me why it had slowed to a crawl. Given that my mind had blanked everything to save my sanity I couldn&#x27;t help. But I suggested they look to see if the filesystem was full and to check the database. Apparently after a database and file system clean-up everything worked fine. I don&#x27;t know how long it remained in service, but I fear it might still be functioning.<p>I know you wanted to opinions on different methodologies, but this is really just me sharing my scars and explaining why I shouldn&#x27;t be let near code. ;-)
tiquorsj超过 11 年前
I build products and I ship. Regardless of the language I&#x27;ve built beautiful things. Under the hood, in each of the ten languages I&#x27;ve used, there is always something I would improve. Knowing that is one way I get better at building products and shipping. Don&#x27;t forget the goal.
gcb0超过 11 年前
I published several projects in php. And i hated that i used the language in vogue at the time to try to not use php.<p>What I&#x27;d done different if i were starting the last one now? I&#x27;d not start on ruby, and would have went directly to php.<p>Btw, I&#x27;m starting one now in elixir. Cross fingers.
amerkhalid超过 11 年前
I am myself heavily invested in PHP. And yes all &quot;PHP Sucks&quot; articles scare me, and I have seen some of the worst code written in PHP. But I think PHP should be with us for a long time. With modern frameworks like Laravel, we can write great and easily maintainable code.<p>However, I still have Java as my backup language. I use Java for my side projects. I think there will always be demand for Java because of heavy use in big enterprises.
haney超过 11 年前
I spent a few years freelancing as a PHP developer and then transitioned into python for the last 3. It&#x27;s fairly easy to transition between PHP&#x2F;Python&#x2F;Ruby and I&#x27;d suggest getting a little bit familiar with similar languages. I know that knowing a bit of all three has led me to be able to develop more quickly and cleanly. Also, more diversity in your understanding would help with your job security concerns.
troels超过 11 年前
Good COBOL programmers are in high demand.
EGreg超过 11 年前
I started <a href="http://github.com/EGreg/Q" rel="nofollow">http:&#x2F;&#x2F;github.com&#x2F;EGreg&#x2F;Q</a> three years ago in PHO, and it grew out of <a href="http://phponpie.com" rel="nofollow">http:&#x2F;&#x2F;phponpie.com</a><p>If I had to do it again I&#x27;d use node, but only for ONE REASON: concurrent I&#x2F;O
gesman超过 11 年前
PHP is great if you want to quickly craft and sell your own product (such as wordpress plugin and theme) or service and sell it.<p>PHP is not great if you want to get hired by someone else.<p>Pay rates for PHP skills are the worst.
mesozoic超过 11 年前
First of all you&#x27;ll be fine as everyone leaves PHP because it &quot;sucks&quot; and all of that legacy code needs to be maintained.
rickboyce超过 11 年前
I started with PHP as a teenager, and ended up coding PHP professionally for about 6 years. I&#x27;m certainly not sorry for it (:<p>I haven&#x27;t touched PHP in a few years (C# and Python for work now) and since really groking a other few languages I&#x27;ve come to the conclusion that, IMO, PHP manages to combine some of the worst aspects of dynamic and static typing to produce an ugly, confused language with gotchas that still haunt me.<p>But none of that matters - management, directors, clients, whoever care about results and productivity. They don&#x27;t exist inside of the tech-hype bubble. People want a certain feature set, at a certain cost and within a certain time frame. They certainly won&#x27;t rewrite their massive code base from PHP to start again in new-shingy-x, when they could be adding more value to an existing solution.<p>As much as I dislike PHP, I was amazingly productive in it. The systems I developed where way ahead of their competition just because I could iterate so rapidly. (It turns out I am even more productive in Python than I ever was in PHP, hindsight &#x27;eh!)<p>You mentioned COBOL - there are a world of COBOL jobs out there (this is the first page that came up in Google <a href="http://www.jobsite.co.uk/cgi-bin/advsearch?search_type=quick&amp;location_within=20&amp;fp_skill_include=COBOL&amp;location_include=" rel="nofollow">http:&#x2F;&#x2F;www.jobsite.co.uk&#x2F;cgi-bin&#x2F;advsearch?search_type=quick...</a> ) The fact that COBOL hasn&#x27;t been cool for a few decades doesn&#x27;t change the fact that there are masses of applications still running it across the world.<p>In your post you didn&#x27;t say anything about disliking PHP, you said your scared of yours skills becoming redundant. Don&#x27;t be - there will be vast amounts of PHP development going on in the world for decades to come, it isn&#x27;t going anywhere just because the next big thing arrived. It just won&#x27;t be cool and discussed at length on the internet anymore.<p>If you focus on being a skilled programmer instead of a coder who only works in PHP then you won&#x27;t have trouble adapting your skillset. Make a point to really understand how what your developing works and why. When I picked up Java and C# after PHP I was productive in those languages within a few days - they are not that different at all. After a few months you will have learnt the idioms of those ecosystems and be well on your way to being fluent. A great programmer can produce great code in any language, a poor programmer will produce poor code in any language.<p>I do think it is really valuable to pick up a new language now and again, I always learn something that I take back to whatever I do day-to-day. It sounds like you work in web development at the moment, so maybe stick with something along those lines. Expert Javascript developers are so hard to find, I always find them the hardest to recruit for! It is a challenging language - everyone seems to &#x27;know&#x27; it at some superficial level, but make an effort to really understand its idiosyncrasies.<p>Much more important than anything I&#x27;ve said above - developers have very personal, often very strong, opinions about programming languages. Take them all with a pinch of salt - programming languages don&#x27;t matter nearly as much as we think they do. Play with a bunch of languages and then focus on a few the few that you really take to - quickly you will find something that you are passionate about enough to want to put your next 10,000 hours into.
评论 #7165711 未加载
wushupork超过 11 年前
I&#x27;d love to hear Mark Zuckerberg reply to this.
评论 #7165377 未加载
elwell超过 11 年前
Have you considered implementing HHVM?
dschiptsov超过 11 年前
Ask Facebook.)<p>hint: hhvm