由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 二爷说的node beats Ruby其实很清楚啊
相关主题
rails vs django 感受ruby,python有没有自己的ide?
为什么这年代还有大量用PHP的网站??弱问下,UBER后台用的是啥?
为什么无论Java还是Ruby,转成Node代码量都是几十倍的减少呢?node.js又赢了
看一个php+python程序员的悔恨之路发现写JS, D3, nodeJS的很受鄙视啊
Python vs Ruby,Django vs Rail大家怎么看ruby on rails?
说go写东西超快的都是跟什么语言比的呀ruby on rails 和 php
Refactoring long class step by step (2)请教各位高手们PHP和Python是否和Ruby一样有Scalability的问题 (转载)
恳请编程的达人指点一下,非常感谢!Why is ruby on rails so popular?
相关话题的讨论汇总
话题: ruby话题: code话题: js话题: object话题: side
进入Programming版参与讨论
1 (共1页)
d******e
发帖数: 2265
1
Absolutely. Our Node code base has grown a little from the original version,
but it's still on the order of 1,000 to 2,000 lines of code. The Ruby code
base we were using previously, in contrast, was in the neighborhood of 60,
000 lines of code. The biggest reason for that reduction is that our current
code base is essentially framework-free, which means there's just not a
whole lot of cruft in there.
The second big reason has to do with the more functional approach we're
taking now, as opposed to an object-oriented one, which proved to be an
important shift for us. In Ruby, the natural tendency is to create an object
that essentially wraps every communication and type. Even though Ruby is
actually a functional language, it has a much stronger notion of class and
object than does JavaScript. So in our earlier code base we had lots of
layers of abstraction and objects that had been created under the guise of
greater componentization, refactorability, and reusability. In retrospect,
however, we really didn't need most of that.
Another significant reason for the code reduction is the momentum behind the
MVC (model- view-controller) model, at least for mobile vs. Web-based
systems. Before, we had mostly server-side rendering. Now with the move of
templates and views over to the client side—along with rendering, of course
—a lot of that code has just gone away. Along with that has come a new
trust and belief that the back ends, where the models live, are where the
validation and all the other more advanced things are going to happen. That
means not having to double-check things, which eliminates another huge chunk
of code.
1. 砍掉ruby framework
3. render也没有了
这些不算什么真的优势。
2.其实最有取,不知道这个cut了多少。
我估计cut4倍是能有的。毕竟oop不够灵活。只会做加法不会减法,很容易膨胀的。
m******t
发帖数: 635
2
OK. I'll try to make sense of it.
Rails follows MVC paradigms. The code in View are separated into two parts:
Helpers and Templates. The HTML templates (generally in ERB files) are not
counted in LOC by Rails tradion. Maybe this guy counted them as well.
So, out of 60K LOC,
40K are ERB files (i.e., HTML files with Ruby calling methods)
10K are Ruby (M, C and Helpers) and JS code (say, 6~8 K Ruby and 2~4K JS)
10K are testing code (integration and unit tests)
So basically, they reduced 6~8K Ruby code to 1~2K JS. Does that make more
sense now. They basically moved the rendering from Server-Side to Client-
Side, though they never counted those client code.
Follows Rails's tradition, I would say it's a 6~8K LOC Rails project instead
of 60K.

version,
code
current
object

【在 d******e 的大作中提到】
: Absolutely. Our Node code base has grown a little from the original version,
: but it's still on the order of 1,000 to 2,000 lines of code. The Ruby code
: base we were using previously, in contrast, was in the neighborhood of 60,
: 000 lines of code. The biggest reason for that reduction is that our current
: code base is essentially framework-free, which means there's just not a
: whole lot of cruft in there.
: The second big reason has to do with the more functional approach we're
: taking now, as opposed to an object-oriented one, which proved to be an
: important shift for us. In Ruby, the natural tendency is to create an object
: that essentially wraps every communication and type. Even though Ruby is

d********g
发帖数: 10550
3
我之前说的,1w vs 2k或者5k vs 2k更靠谱。6w vs 2k吹得太过简直就是无脑Ruby黑,
还暴露了
“In Ruby, the natural tendency is to create an object that essentially
wraps every communication and type. Even though Ruby is actually a
functional language, it has a much stronger notion of class and object than
does JavaScript. So in our earlier code base we had lots of layers of
abstraction and objects that had been created under the guise of greater
componentization, refactorability, and reusability. In retrospect, however,
we really didn't need most of that.”
这节奏,就是放着Rails convention不用,硬是Ruby重造轮子。server side MVC移到
client side后又耍赖不算templates了,显然client side MVC板上钉钉的framework不
然JS裸写写死

【在 m******t 的大作中提到】
: OK. I'll try to make sense of it.
: Rails follows MVC paradigms. The code in View are separated into two parts:
: Helpers and Templates. The HTML templates (generally in ERB files) are not
: counted in LOC by Rails tradion. Maybe this guy counted them as well.
: So, out of 60K LOC,
: 40K are ERB files (i.e., HTML files with Ruby calling methods)
: 10K are Ruby (M, C and Helpers) and JS code (say, 6~8 K Ruby and 2~4K JS)
: 10K are testing code (integration and unit tests)
: So basically, they reduced 6~8K Ruby code to 1~2K JS. Does that make more
: sense now. They basically moved the rendering from Server-Side to Client-

c******o
发帖数: 1277
4
还有test怎么算的问题,我们的后端代码test的line都接近,有时甚至超过代码本身了。
这也是为啥我不喜欢“js大牛”做后端的原因。
m******t
发帖数: 635
5
大牛说的很对。话说阿三真的敢说啊。

than
,

【在 d********g 的大作中提到】
: 我之前说的,1w vs 2k或者5k vs 2k更靠谱。6w vs 2k吹得太过简直就是无脑Ruby黑,
: 还暴露了
: “In Ruby, the natural tendency is to create an object that essentially
: wraps every communication and type. Even though Ruby is actually a
: functional language, it has a much stronger notion of class and object than
: does JavaScript. So in our earlier code base we had lots of layers of
: abstraction and objects that had been created under the guise of greater
: componentization, refactorability, and reusability. In retrospect, however,
: we really didn't need most of that.”
: 这节奏,就是放着Rails convention不用,硬是Ruby重造轮子。server side MVC移到

n****1
发帖数: 1136
6
二爷下次转贴时能否标明作者是否三哥呢?
q*c
发帖数: 9453
7
这种选择性描述事实的,绝对不能听。

【在 m******t 的大作中提到】
: OK. I'll try to make sense of it.
: Rails follows MVC paradigms. The code in View are separated into two parts:
: Helpers and Templates. The HTML templates (generally in ERB files) are not
: counted in LOC by Rails tradion. Maybe this guy counted them as well.
: So, out of 60K LOC,
: 40K are ERB files (i.e., HTML files with Ruby calling methods)
: 10K are Ruby (M, C and Helpers) and JS code (say, 6~8 K Ruby and 2~4K JS)
: 10K are testing code (integration and unit tests)
: So basically, they reduced 6~8K Ruby code to 1~2K JS. Does that make more
: sense now. They basically moved the rendering from Server-Side to Client-

t****a
发帖数: 1212
8
我个人近来的感觉, ruby是相当elegant的语言,表达能力丝毫不弱于js
z****e
发帖数: 54598
9
i think u should try vert.rb
if the code lines are 10 times more than node.js
then come to tim the creator of vert.x
and post following statement: vert.x sucks
z****e
发帖数: 54598
10
agree

了。

【在 c******o 的大作中提到】
: 还有test怎么算的问题,我们的后端代码test的line都接近,有时甚至超过代码本身了。
: 这也是为啥我不喜欢“js大牛”做后端的原因。

相关主题
说go写东西超快的都是跟什么语言比的呀ruby,python有没有自己的ide?
Refactoring long class step by step (2)弱问下,UBER后台用的是啥?
恳请编程的达人指点一下,非常感谢!node.js又赢了
进入Programming版参与讨论
z****e
发帖数: 54598
11
30 to 1 is apparently a bluff
公孙 is absolutely right
based on my recent experiences on vert.rb&vert.js
i pretty sure the code lines are the same for these 2 languages
i could even write a tool to transform js code to rb code
and change it back
just change the keywords
and js has even more lines since it is using {}
which probably take two lines for some coding styles

than
,

【在 d********g 的大作中提到】
: 我之前说的,1w vs 2k或者5k vs 2k更靠谱。6w vs 2k吹得太过简直就是无脑Ruby黑,
: 还暴露了
: “In Ruby, the natural tendency is to create an object that essentially
: wraps every communication and type. Even though Ruby is actually a
: functional language, it has a much stronger notion of class and object than
: does JavaScript. So in our earlier code base we had lots of layers of
: abstraction and objects that had been created under the guise of greater
: componentization, refactorability, and reusability. In retrospect, however,
: we really didn't need most of that.”
: 这节奏,就是放着Rails convention不用,硬是Ruby重造轮子。server side MVC移到

p*****2
发帖数: 21240
12

试试coffee?

【在 z****e 的大作中提到】
: 30 to 1 is apparently a bluff
: 公孙 is absolutely right
: based on my recent experiences on vert.rb&vert.js
: i pretty sure the code lines are the same for these 2 languages
: i could even write a tool to transform js code to rb code
: and change it back
: just change the keywords
: and js has even more lines since it is using {}
: which probably take two lines for some coding styles
:

l**********n
发帖数: 8443
13
赵老师对ruby和js这么熟悉,能比较这两种语言吗?

【在 z****e 的大作中提到】
: 30 to 1 is apparently a bluff
: 公孙 is absolutely right
: based on my recent experiences on vert.rb&vert.js
: i pretty sure the code lines are the same for these 2 languages
: i could even write a tool to transform js code to rb code
: and change it back
: just change the keywords
: and js has even more lines since it is using {}
: which probably take two lines for some coding styles
:

z****e
发帖数: 54598
14
no
i am not the expert on js and ruby neither
and believe for script language
公孙 to be bashed is the guru of this type of languages
for us, they r all scripts
and we use them a lot especially
frontend programmers who have right
to choose any script languages they want
as long as people could get things done on time

【在 l**********n 的大作中提到】
: 赵老师对ruby和js这么熟悉,能比较这两种语言吗?
l**********n
发帖数: 8443
15
java也可以作为frontend开发的语言啊。那么script lan和非script lan有啥区别,是
否script lan只能开发frontend。

【在 z****e 的大作中提到】
: no
: i am not the expert on js and ruby neither
: and believe for script language
: 公孙 to be bashed is the guru of this type of languages
: for us, they r all scripts
: and we use them a lot especially
: frontend programmers who have right
: to choose any script languages they want
: as long as people could get things done on time

z****e
发帖数: 54598
16
語法和結構通常比較簡單
學習和使用通常比較簡單
通常以容易修改程式的「直譯」作為執行方式,而不需要「編譯」
程式的開發產能優於執行效能

【在 l**********n 的大作中提到】
: java也可以作为frontend开发的语言啊。那么script lan和非script lan有啥区别,是
: 否script lan只能开发frontend。

1 (共1页)
进入Programming版参与讨论
相关主题
Why is ruby on rails so popular?Python vs Ruby,Django vs Rail
这儿有Ruby on Rails的高手吗?请教一下 (转载)说go写东西超快的都是跟什么语言比的呀
RUBY On Rails 如何快速入门Refactoring long class step by step (2)
请问ruby on rail好学吗?job前途如何?多谢。恳请编程的达人指点一下,非常感谢!
rails vs django 感受ruby,python有没有自己的ide?
为什么这年代还有大量用PHP的网站??弱问下,UBER后台用的是啥?
为什么无论Java还是Ruby,转成Node代码量都是几十倍的减少呢?node.js又赢了
看一个php+python程序员的悔恨之路发现写JS, D3, nodeJS的很受鄙视啊
相关话题的讨论汇总
话题: ruby话题: code话题: js话题: object话题: side