Fw: [翻譯] 為什麼我選Ruby

看板Soft_Job作者 (dryman)時間12年前 (2013/03/23 12:29), 編輯推噓3(3034)
留言37則, 7人參與, 最新討論串1/2 (看更多)
※ [本文轉錄自 Translate-CS 看板 #1HJIvFUc ] 作者: dryman (dryman) 看板: Translate-CS 標題: [翻譯] 為什麼我選Ruby 時間: Sat Mar 23 12:23:41 2013 http://www.codinghorror.com/blog/2013/03/why-ruby.html 為什麼我選擇Ruby (而且不選C#) ================ 我已經使用微軟產品來開發程式數十年了。我從小開始就在家使用微軟Basic程式語言, 而且我第一個工作就是在微軟開發 Microsft FoxPro, Microsoft Access, 以及 Micro- soft Visual Basic。各位看官,我現在可以看得到微軟產品的未來,它將會是一堆在 Wintel小生態圈中發展得很糟糕的 CRUD 應用程式。 對我們熟悉的人知道,我們過去用 Microsoft .NET 來開發 Stack Overflow 。使用 .NET也是它現在可以運行得這麼快的原因。所以當我們發表 [Discourse][discourse] 的時候,很多人都問我們 > 為什麼你們不用 .NET 來建 Discourse? 讓我說清楚:我 *愛* .NET 。離題一下,我這輩子最棒的事是把 Coding Horror 的貼紙 遞給 [Anders Hejlsberg][anders] 。容我表達一下我的興奮之情,一想到他我還是會 興奮得發抖。這世界上或許有五十位頂尖的程式語言開發者,而 Anders 是在他們之中 唯一開發出 Turbo Pascal 和 Delphi 語言的一人。由於 Anders 的頂尖建議, .NET 從開發初期就是一個富含頂尖設計的程式語言 -- 除了擁有 Java 的一切優點外,還 持續在這十年間有各種出色的進化,並且對其他各種動態型別程式語言有巨大的影響。 但就如同我一開始講的,我故意不選擇 .NET 作為下個專案的開發語言。你可能會期待 看到一個憤怒而義憤填膺的人在這裡長篇大論說離開微軟生態圈有多爽:*我自由了! 我自由了!感謝主我終於自由啦!* 不好意思,這我五年以前已經 [寫過了][old post] 。 我跟其他實務導向的工程師一樣,我只是選擇最有效的工具而已。雖然我喜歡 .NET , 但這對一個 100% 開放原始碼的 Discourse 專案來說真的是一個很糟糕的選擇。為什 麼?有三個理由如下: 1. **授權** 我的天,授權。雖然這沒有花很多錢,但這邪惡且惱人的協定將會確保 你所有的程式碼還有開發出來的軟體都被授權籠罩著,而且視不同的開發程度及 版本、授權給誰,授權來做什麼用、哪些伺服器被授權等作用都不同。等等?什麼? 對不起我剛剛不小心陷入了 [瘋狂的授權地獄][rabid]2. **開發的摩擦力** 如果你想要開發出一個真正的開放原始碼軟體,你必須要有人 參與你的專案才行,如此它才是一個有生機的、會呼吸、會成長的好專案。而且如 果你不能將一個開放原始碼專案下載下來修改,你將不會跟社群有任何連結,這... 對開發來說的阻力真的是太大了。 我在 Stack Overflow 學到最重要的一件事情是,程式開發的世界是扁平的,世界 上任何角落都可能冒出開發鬼才。我想說的是,即使那個鬼才來自 [這個笨美國工程師][ugly programmer] 從來沒聽過的地方,說著我們聽不懂的 語言,但聽好了,他們還是用跟我們一樣的程式語言在工作著!很瘋狂吧! 使用微軟的工具練來開發很難吸引到其他地區的鬼才,例如阿根廷、尼泊爾、或 保加利亞的人。開放原始碼的作業系統、開源的程式語言還有工具練對這些國家 的人更公平,這是讓下一世代全世界的工程師一起來改變世界的基石。 3. **軟體生態圈** 當我在 Stack Extrange 時我們盡可能的開放我們的軟體平台。 我們致力回饋給這個社會,因為我們認為公司的價值在於我們能回饋多少給社會, 我們試著把許多有用的的作品開放出來。許多我們的作品並非源自 Stack Extrange 而是從 Creative Commons 授權中和許多開發者一起貢獻開發出來的,這不是所 有人的貢獻嗎? 你可以用 .NET 開發開源碼軟體,而且也有很多人這麼做,但這永遠就是不太自然 ,永遠都有點怪怪的。無論你多麼努力,核心團隊永遠不會會接受你的補釘(patch) 在 .NET 社群中想要貢獻開源好似逆勢而行,大大小小的公司都不願意貢獻他們的 原始碼。或許是因為他們知道展示出來的程式碼很爛,隨便啦。開源文化就是不在 微軟的 .NET 生態圈中,而且那些寫一手爛程式的公司特別畏懼開源。如果你害怕 你開源的程式會丟臉,那份恐懼會深深地阻止你回饋給社群。開源碼社群最..迷人 的一點就是他們不會害怕展示他們自己的程式,也不畏懼談論自己的想法。 結果就是,對於任何你想用 .NET 來完成的任務,如果你幸運的話,你可能可以找 到一兩個可用的函式庫。而在任何熱門的開源社群中,你很容易就可以找到上百個 好用的函式庫來完成任務。是的,或許其中六個爛掉了、沒人維護、沒什麼用、或 寫得糟透了,但是由於開源碼社群活躍的特性,你還是可以找到超好的三個函式庫! 你絕對是贏家! 如同我 [五年前寫過文章][old post]> 我是個實務主義者。現在我選擇微軟的世界,但這不代表我不知道另外半個世界在 > 在幹什麼的。完成任務的方法永遠都有不只有一個。我選擇其中一種方法不代表這 > 這就是唯一對的方法或比較好的方法。把自己孤立起來絕對會變得無知,因此需要 > 了解另外半個世界是怎麼運作的,了解那些跟你活在不同世界的工程師是怎麼過活 > 的。他們使用什麼樣的工具,為什麼如此選擇。如果你兩邊都嘗試過了,你可以跟 > 據自己的觀察決定哪一邊比較好,如果另一邊比較好就可以加入另一邊的世界。 > 我打賭你說再見會說得很輕鬆。 我已經離開了微軟的世界。對的、錯的、好得、壞的都不重要了。我們只是根據我們 的需求決定了要開發專案使用的程式語言。 待續 後面一半我可能沒時間翻完,先把原文貼上,大意是因為朋友用ruby,所以就一起用 ruby,就這麼簡單.. However, I'd also be lying if I didn't mention that I truly believe the sort of project we are building in Discourse does represent most future software. If you squint your eyes a little, I think you can see a future not too far in the distance where .NET is a specialized niche outside the mainstream. But why Ruby? Well, the short and not very glamorous answer is that I had narrowed it down to either Python or Ruby, and my original co-founder Robin Ward has been building major Rails apps since 2006. So that clinched it. I've always been a little intrigued by Ruby, mostly because of the absolutely gushing praise Steve Yegge had for the language way back in 2006. I've never forgotten this. For the most part, Ruby took Perl's string processing and Unix integration as-is, meaning the syntax is identical, and so right there, before anything else happens, you already have the Best of Perl. And that's a great start, especially if you don't take the Rest of Perl. But then Matz took the best of list processing from Lisp, and the best of OO from Smalltalk and other languages, and the best of iterators from CLU, and pretty much the best of everything from everyone. And he somehow made it all work together so well that you don't even notice that it has all that stuff. I learned Ruby faster than any other language, out of maybe 30 or 40 total; it took me about 3 days before I was more comfortable using Ruby than I was in Perl, after eight years of Perl hacking. It's so consistent that you start being able to guess how things will work, and you're right most of the time. It's beautiful. And fun. And practical. Steve is one of those polyglot programmers I respect so much that I basically just take whatever his opinion is, provided it's not about something wacky like gun control or feminism or T'Pau, and accept it as fact. I apologize, Steve. I'm sorry it took me 7 years to get around to Ruby. But maybe I was better off waiting a while anyway: Ruby is a decent performer, but you really need to throw fast hardware at it for good performance. Yeah, I know, interpreted languages are what they are, and caching, database, network, blah blah blah. Still, we obtained the absolute fastest CPUs you could buy for the Discourse servers, 4.0 Ghz Ivy Bridge Xeons, and performance is just … good on today's fastest hardware. Not great. Good. Yes, I'll admit that I am utterly spoiled by the JIT compiled performance of .NET. That's what I am used to. I do sometimes pine away for the bad old days of .NET when we could build pages that serve in well under 50 milliseconds without thinking about it too hard. Interpreted languages aren't going to be able to reach those performance levels. But I can only imagine how rough Ruby performance had to be back in the dark ages of 2006 when CPUs and servers were five times slower than they are today! I'm so very glad that I am hitting Ruby now, with the strong wind of many solid years of Moore's law at our backs. Ruby is maturing up nicely in the 2.0 language release, which happened not more than a month after Discourse was announced. So, yes, the downside is that Ruby is slow. But the upside is there is a lot of low hanging performance fruit in Ruby-land. Like.. a lot a lot. On Discourse we got an across the board 20% performance improvement just upgrading to Ruby 2.0, and we nearly doubled our performance by increasing the default Ruby garbage collection limit. From a future performance perspective, Ruby is nothing but upside. Ruby isn't cool any more. Yeah, you heard me. It's not cool to write Ruby code any more. All the cool people moved on to slinging Scala and Node.js years ago. Our project isn't cool, it's just a bunch of boring old Ruby code. Personally, I'm thrilled that Ruby is now mature enough that the community no longer needs to bother with the pretense of being the coolest kid on the block. That means the rest of us who just like to Get Shit Done can roll up our sleeves and focus on the mission of building stuff with our peers rather than frantically running around trying to suss out the next shiny thing. And of course the Ruby community is, and always has been, amazing. We never want for great open source gems and great open source contributors. Now is a fantastic time to get into Ruby, in my opinion, whatever your background is. (However, It's also worth mentioning that Discourse is, if anything, even more of a JavaScript project than a Ruby on Rails project. Don't believe me? Just go to try.discourse.org and view source. A Discourse forum is not so much a website as it is a full-blown JavaScript application that happens to run in your browser.) Even if done in good will and for the best interests of the project, it's still a little scary to totally change your programming stripes overnight after two decades. I've always believed that great programmers learn to love more than one language and programming environment – and I hope the Discourse project is an opportunity for everyone to learn and grow, not just me. So go fork us on GitHub already! [advertisement] Hiring developers? Post your open positions with Stack Overflow Careers and reach over 20MM awesome devs already on Stack Overflow. Create your satisfaction-guaranteed job listing today! Posted by Jeff Atwood [discourse]: http://www.discourse.org [anders]: http://en.wikipedia.org/wiki/Anders_Hejlsberg [old post]: http://www.codinghorror.com/blog/2007/05/giving-up-on-microsoft.html [rabid]: http://www.codinghorror.com/blog/2009/07/oh-you-wanted-awesome-edition.html [ugly programmer]: http://www.codinghorror.com/blog/2009/03/the-ugly-american-programmer.html -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 207.151.231.159 ※ 編輯: dryman 來自: 207.151.231.159 (03/23 12:28) ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 轉錄者: dryman (207.151.231.159), 時間: 03/23/2013 12:29:06 ※ 編輯: dryman 來自: 207.151.231.159 (03/23 12:35)

03/23 12:45, , 1F
這篇感覺只講到為什麼跳離 .Net XD
03/23 12:45, 1F

03/23 12:46, , 2F
因為我沒翻完啊,後面還有一半...
03/23 12:46, 2F

03/23 12:47, , 3F
其實選ruby的理由很簡單,他朋友也用ruby,就這樣...
03/23 12:47, 3F

03/23 12:53, , 4F
.NET的主力語言c#其實在近年來的程式語言發展中有很強大
03/23 12:53, 4F

03/23 12:53, , 5F
的影響力
03/23 12:53, 5F

03/23 12:55, , 6F
我覺得這幾年影響力最大的是llvm的生態圈XD
03/23 12:55, 6F

03/23 12:56, , 7F
linq誕生時各大論壇馬上就出現java或其它語言什麼時候也
03/23 12:56, 7F

03/23 12:56, , 8F
會有相似的東西
03/23 12:56, 8F

03/23 12:57, , 9F
文章翻一半不太好吧
03/23 12:57, 9F

03/23 12:58, , 10F
很難翻啊樓上...文章超長orz
03/23 12:58, 10F

03/23 12:59, , 11F
當共變數與共異變數誕生時又出現一股檢視java&c++現有泛
03/23 12:59, 11F

03/23 12:59, , 12F
型機制的討論潮
03/23 12:59, 12F

03/23 13:00, , 13F
perl很早就有SQL的OO adapter,Lisp家族把SQL變成自家的DSL
03/23 13:00, 13F

03/23 13:01, , 14F
也用得很多...Linq不是第一個
03/23 13:01, 14F
※ 編輯: dryman 來自: 207.151.231.159 (03/23 13:03)

03/23 13:03, , 15F
c#形式的lambda expression先是被scalar採用 最後java也
03/23 13:03, 15F

03/23 13:03, , 16F
跟進
03/23 13:03, 16F

03/23 13:06, , 17F
C#的lambda expression好像是從Haskell和ML引進的吧XD
03/23 13:06, 17F

03/23 13:08, , 18F
我想說的是相較於java .net平台雖然冷門很多 但做為它的
03/23 13:08, 18F

03/23 13:08, , 19F
競爭對手絕對夠資格
03/23 13:08, 19F

03/23 13:10, , 20F
其實.NET也不冷門啦,在台灣算是蠻熱門的 :P
03/23 13:10, 20F

03/23 13:10, , 21F
嗯...忘了提plinq
03/23 13:10, 21F

03/23 13:11, , 22F
而且.NET的JIT是真的很強
03/23 13:11, 22F
※ 編輯: dryman 來自: 207.151.231.159 (03/23 13:14)

03/23 13:14, , 23F
任何程式語言都顯少有完全原創的東西 各家都是歷年來演
03/23 13:14, 23F

03/23 13:14, , 24F
化後的結果
03/23 13:14, 24F

03/23 13:14, , 25F
同意
03/23 13:14, 25F

03/23 13:16, , 26F
微軟生態圈還有一個好處是文件強大,這點跨到開源文化圈時
03/23 13:16, 26F

03/23 13:16, , 27F
會非常不適應...大部分的開源文件都相對起來冷硬很多...
03/23 13:16, 27F

03/23 13:18, , 28F
重點不在於誰是真正的原創 而是誰演化得比較快而不得不
03/23 13:18, 28F

03/23 13:18, , 29F
使競爭對手跟進
03/23 13:18, 29F

03/23 13:19, , 30F
用手機打字真是有夠慢...
03/23 13:19, 30F

03/23 13:21, , 31F
其實講到速度的話...Ruby還有JS的社群才叫可怕呢XD
03/23 13:21, 31F

03/23 13:24, , 32F
看這樣開發js有多酷炫XD
03/23 13:24, 32F

03/23 13:51, , 33F
swank-js 真的是超級好物...
03/23 13:51, 33F

03/23 15:06, , 34F
swank-js真是超級難安裝|||orz 弄了三個小時才搞定
03/23 15:06, 34F

03/23 15:33, , 35F
我在AJAX版寫了swank-js的安裝指南,這真是超難安裝的
03/23 15:33, 35F

03/23 20:22, , 36F
對照著原文看,這篇真的翻得超棒的!
03/23 20:22, 36F

03/24 19:35, , 37F
看了前一兩頁 先push
03/24 19:35, 37F
文章代碼(AID): #1HJI-JDD (Soft_Job)
文章代碼(AID): #1HJI-JDD (Soft_Job)