4 ms·
Every half-baked, low-quality, ill-designed language has defenders somewhere on the web. Why is this news? In my professional career I've used C, C++, Perl, a
by tjic 17y ago
Every half-baked, low-quality, ill-designed language has defenders somewhere on the web.
Why is this news?
In my professional career I've used C, C++, Perl, and Ruby.
I come with no preexisting biases.
...but after having written several programs in Perl until they became unmaintainable (despite my good coding style), and then rewritten them in Ruby in something like 1/10th to 1/20th the lines... I've got no particular interest in spending time reading about how Perl is wonderful.
I've been there.
I gathered my own data.
See Paul's thoughts on blub programmers and blub languages.
http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html
- patrickas 17y agoWOW I had no idea Ruby was so succinct compared to Perl! Could you please share a sample of code that takes 20 times more lines in Perl than Ruby.
- tjic 17y agoI've got an admin interface to an ecommerce website. The admin screen gives access to all sorts of entities: series of videos, individual videos, copies of DVDs, customers, wiki pages, etc. Let's say that there are 40 different types of entities. I could write custom views for each of these. Or, using Ruby's reflection, I had them all share common views which then use reflection to figure out the basic data and the relationships between data types. E.g.: <% reflections = item.class.reflections.select {|key, val| [ :has_one, :has_many, :belongs_to, :has_and_belongs_to_many ].include?(val.macro) }.to_array reflections.each do |key,val| if ! reject.include?(key) %> <h1> <%= key.to_s %></h1> <% bullet_pts = item.send(key).to_array if bullet_pts.empty? %> <span style="padding-left:25px;"><i>none</i></span> <% else %> <ul> <% bullet_pts.sort_by {|x| x.methods.include?(:name) ? x.name : 0}.each do |subitem| %> <li><%= linktext = subitem.respond_to?(:name) ? subitem.name : (subitem.respond_to?(:text) ? subitem.text : subitem.id ) # TJICFIX P3: this is an ugly way to specify a link. do it better! link_to(linktext, :controller => subitem.class.to_s.pluralize.underscore, :action=>:show, :id =>subitem.id) + "<br>" %> <% end %> </ul> <% end # if "none" else "lots!" end # if ... reject end # reflections.each %> With the above as a partial, and one other that's similar, a full view for a very very complicated object becomes this: <%= render (:partial => 'admin/shared/show_basicdata', :locals => { :item => @item }) %> <%= render (:partial => 'admin/shared/show_relations', :locals => { :item => @item, :reject => [:category_courses] }) %> I'm reworking this approach for a new project right now. The new code goes beyond "index" and "show" views to "edit" and "create" views. Also, because most of the controllers are pretty similar, except for business logic, I'm also about to start compressing those down with metaprogramming (except for callbacks, which will vary). In this particular codebase, I think that the expansion to rewrite it in Perl would be much more than 20x. Maybe more like 100x ... or 200x.
- berntb 17y agoEven Java has reflection... :-) What is the Ruby-unique feature not existing in e.g. Moose? (I'm not a real web programmer these days, but is it still common to template with code PHP-style, like that?) Edit: Emphasis on my point, since I only got an answer to my humorous note that these days, most languages have reflection functionality.
- tjic 17y ago> Even Java has reflection We were debating PERL vs. Ruby. Java's irrelevant.
- kscaldef 17y agoGiven a framework like Moose (entirely fair, since you've dragged Rails into the discussion), I'm not seeing anything yet that can't be done with Perl. I sort of get the feeling you haven't used Perl in a while and aren't familiar with any of the modern object frameworks.
- systems 17y agoFirst I am not completely buying the "rewritten them in Ruby in something like 1/10th to 1/20th the lines". But I will give you the benefit of doubt since I don't know ruby. I do know Perl thought, and I also know few other languages, including say Groovy. And while there certain tasks which can be expressed in Groovy better, there are also others who are better expressed in Perl! And I think it would be the same for Ruby! Ultimately, Perl, Groovy and Ruby all fall under the same category and are more or less the same type of things! Perl is still a very good choice for code creation and software developed because: 1) It has very competitive feature set 2) Huge library set 3) The best community 4) It is still evolving I am sure we can almost do a s/Perl/Ruby on this post and it would still make sense. People who are defending Perl do so, because they want it to grow, and as Perl grow they grow with it. If you have ever been passionate about anything, you should understand where the people who defend Perl come from!
- kscaldef 17y ago> ...but after having written several programs in Perl until they became unmaintainable (despite my good coding style), and then rewritten them in Ruby in something like 1/10th to 1/20th the lines... I've got no particular interest in spending time reading about how Perl is wonderful. I agree with another poster. I'd love to see the data that you gathered. I've worked fairly extensively with both Perl and Ruby, and I have a hard time imagining anything which is 10-20x shorter in Ruby than in Perl. I also have to question the maintainability assertion. Ruby and Perl are similar enough that I'm pretty sure I can take a "maintainable" program in either one and port it to the other with minimal changes and no noticable change in maintainability.
- tjic 17y ago> Ruby and Perl are similar enough that I'm pretty sure I can take a "maintainable" program in either one and port it to the other with minimal changes Without intending to flame, I can't imagine that you'd say this if you've used some of the more powerful techniques in Ruby. If you've used techniques X,Y, and Z in Perl, you can find them in Ruby. ... but unless you think in a Lisp-like way, you won't even realize that techniques G' and E''' exist in Ruby, but not in Perl.
- berntb 17y agoI have written some lisp-code in my days, what are those features missing in Perl?
- kscaldef 17y agoSome content would be nice, rather than the implication that I'm just an ignorant blub-er. So, once again, how about some of that data you say you collected to back up what you're saying? Which "more powerful techniques" are you talking about?