Changing a PHP Culture to Go?

blov · · 593 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>How can a die-hard, seemingly intractable, PHP team be convinced to switch to Go? I can understand PHP for web applications, and that may still be appropriate, but systems programming should never be done in a web scripting language, PHP or otherwise.</p> <hr/>**评论:**<br/><br/>SeerUD: <pre><p>There are many factors, and some of it is whether you have the right time full stop. If people aren&#39;t willing to learn, no matter what, then you&#39;re not going to get anywhere.</p> <ul> <li>Present reasons to switch, with things to back up those reasons - facts.</li> <li>Try get people interested in it, talk about interesting things you&#39;ve seen or written in Go.</li> <li>Invite people to work on projects of your own with you.</li> <li>Find a genuine problem you&#39;re having with PHP, and do it better with Go.</li> </ul> <p>That last one is important. If PHP is actually solving problems adequately for the team, then why would they switch? Even if it&#39;s &#34;wrong&#34;, or if Go would arguably be better, then why should they care? That&#39;s what you have to convince them of.</p></pre>Redundancy_: <pre><p>Start with small isolated things that make people&#39;s lives better, and are good examples of things that Go does well (like highly concurrent tasks, tools that have to be distributed to people, etc).</p></pre>tylermumford: <pre><p>If you figure it out, let me know. I&#39;ll do the same. :)</p></pre>benwalton: <pre><p>Hard to answer this from the outside. I&#39;d figure out what the metrics for success are then demonstrate how Go helps you meet those faster, better and/or cheaper. Get a few &#34;wins&#34; under your belt and converting others will become easier.</p> <p>For most people, change is the scary part. Once it becomes less scary - through your winning uses - change is easier.</p></pre>no1youknowz: <pre><p>Simple, once you start to split the monolithic application from page rendering and backend processing. Then split those backend processing tasks to microservices. Then pair it up with something like a message queue and gocraft. You then have two main benefits.</p> <p>First, PHP shouldn&#39;t be used for long running scripts, especially connected to a database. Go has no such issue. </p> <p>Also PHP doesn&#39;t have threading, oh there is pthreads but gimme a break. Go will wipe the floor when it comes to concurrency. </p> <p>Go will also use the full cores on the server. I don&#39;t think PHP even gets a chance.</p> <p>Have you ever tried to write an traffic intensive app? Like getting hit with 10k impressions every second? With PHP you&#39;ll have to scale horizontally with about 30 servers. Go, you can have just 1 or 2 lol.</p> <p>Second, because of the microservice architecture. Now singular developers or groups can maintain a piece of the app. They can add more functionality / fix bugs without holding up or interference from the team.</p> <hr/> <p>Before I learned Go. I was die hard PHP. Now for me, PHP has been relegated to delivering HTML and doing FE processing. Anything BE related, gets put in an MQ and Go then handles it, very quickly and simply.</p> <p>Some things I do with Go:-</p> <p>1) Image generation (screenshot)</p> <p>2) HTML to PDF generation</p> <p>3) Image conversion PNG -&gt; HTML (for emails)</p> <p>4) UI Notification (alert after job finishes processing)</p> <p>5) Sending emails to 10s of millions of users.</p> <p>6) Posting status on social networks</p> <p>There&#39;s more, but you get the idea. With a PHP BE, the job could be running, the server crash and then it gets lost. But with my implementation. The job is clustered and if the server crashes, then gets respawn on another server and tries again. For me, this is the killer app.</p></pre>jlbrt: <pre><blockquote> <p>Have you ever tried to write an traffic intensive app? Like getting hit with 10k impressions every second? With PHP you&#39;ll have to scale horizontally with about 30 servers. Go, you can have just 1 or 2 lol.</p> </blockquote> <p>Is this a hyperbole or actual numbers? I&#39;ve written in PHP for the past few years, but if this is true, that&#39;s amazing.</p></pre>kostix: <pre><p>Slapping them with a printed copy of <a href="https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/" rel="nofollow">this essay</a> should be enough.</p></pre>kaeshiwaza: <pre><p>Often people don&#39;t want to try an other language because there is a long learning curve and the deployment is very specific and need also a long learning curve.</p> <p>Go is very easy to learn and deploy. So just try, it will be quicker than to explain ! Try to build a web app that can serve pages, websocket and images live resized for example. Then make it read by someone who don&#39;t know Go. Sure he will want to do it also !</p></pre>arp242: <pre><p>Ask them to open a file and try again with a different filename if the path already exists in a secure and race-proof way.</p> <p>Oops, you can&#39;t.</p> <p>This stupid limitation actually &#34;inspired&#34; a rant of me a while ago: <a href="https://arp242.net/weblog/php-fopen-is-broken.html" rel="nofollow">https://arp242.net/weblog/php-fopen-is-broken.html</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

593 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传