The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 18, 2019, 10:40:35 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Ruby  (Read 3570 times)
kurdt
Lifer
*****
Offline Offline

Posts: 1153


paha arkkitehti


View Profile
« on: April 06, 2010, 11:57:56 AM »

I'm reading The Ruby Programming Language book. I'm only 100 pages in and I have no previous experience with Ruby so I'm no expert yet. And to be clear, I'm talking about Ruby, not Ruby on Rails.

But it seems that's there's some truth to Ruby's "Programmer's best friend" slogan. It seems Matz (the guy who's behind Ruby) has truly created something awesome. Ruby is faster than PHP and it does a lot more. After 100 pages it seems that if desktop computer is C, laptop is .NET and iphone is PHP, Ruby is ipad. It's similar mix of niceties of scripting language and powerfulness of more low level languages like C.

I'm still learning but it seems pretty awesome language... will report when I have actual coding experience Smiley
Logged

I met god and he had nothing to say to me.
isthisthingon
Global Moderator
Lifer
*****
Offline Offline

Posts: 2879



View Profile
« Reply #1 on: April 06, 2010, 12:19:15 PM »

Ruby is beautiful, and far less dangerous in the hands of the experienced.  However, like other scripting languages, Ruby has areas where performance problems preclude previously preferred programming practices, otherwise known as the 7Ps.  Anyone who knows anything about programming knows about the seven Ps, FFS.

One area of concern is threading.  Threads in Ruby are dreadfully expensive and should be called ropes.  They're still great to have, but they're not ideal in terms of larger scaling architectures.  But as I've mentioned in the past, employing a non-blocking, evented approach to highly scalable architectures (nested callback or Reactor pattern approach) offsets this thread performance loss.

PS: I was kidding about the 7Ps, however I laughed when I googled it: http://en.wikipedia.org/wiki/7_Ps_%28military_adage%29
Logged

I would love to change the world, but they won't give me the source code.
kurdt
Lifer
*****
Offline Offline

Posts: 1153


paha arkkitehti


View Profile
« Reply #2 on: April 06, 2010, 01:19:43 PM »

Ruby is beautiful, and far less dangerous in the hands of the experienced.  However, like other scripting languages, Ruby has areas where performance problems preclude previously preferred programming practices, otherwise known as the 7Ps.  Anyone who knows anything about programming knows about the seven Ps, FFS.

One area of concern is threading.  Threads in Ruby are dreadfully expensive and should be called ropes.  They're still great to have, but they're not ideal in terms of larger scaling architectures.  But as I've mentioned in the past, employing a non-blocking, evented approach to highly scalable architectures (nested callback or Reactor pattern approach) offsets this thread performance loss.
Actually the reason why I chose to learn Ruby is that I know I don't have enough passion to learn C or similar low level language so good that I can say I'm solid with it. But with Ruby I can get more milage out of scripting language similar to PHP and get support for REST architecture out of the box. Coding takes a bit different type of mind than what I have. My mind seems to be able to connect unseemingly similar patterns to each other in order to create new things but I can't hold a lot of parallel information in my mind at once which seems to be the key for brilliant programmer.

Luckily I have designed a new type of architecture that makes it possible to start coding the system with any language and replace any piece of it later with faster code written with another language without even rebooting the system.

P.S. We are actually talking about using Node as server for few things. There's also EventMachine for Ruby in case you haven't ran into it before but right now I'm liking Node.js better. What we are planning to pull off isn't anything you have probably seen before, at least in the web, so it's a bit hard to explain without going into details Smiley It's bits and pieces from everywhere put together in a way that's going to be beyond awesome ... whole iPad thing is going to look lame in comparison what I'm planning to do to the web Wink
Logged

I met god and he had nothing to say to me.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #3 on: April 06, 2010, 02:14:05 PM »

This make programs in C/C++ is total BS.
Take a look at autocad, probably one of the most successful programs. In that case they took the embedding route. Main program is made in C/C++ embedded in side it is lisp interpreter. Blizzard and most other successful gamings companies embed lua. Firefox same story with javascript.
Or you can go the extending route this is the strategy used with python and ruby proggies. Make basic program with script, embed C/C++.

Ruby is very beautiful. It has many features which only lisp has.
Really nice thing is blocks and closures. Also besides scheme it has callcc. Callcc is super cool.

That all said, why do i use python Smiley. Mainly because i am used to python, massive ammount of 3rd party libs for python. Ease at which python can interface with C/C+ libs.
Also ruby lacks a VM (they are working on one), if they ever get a proper VM i will switch over Smiley

One area of concern is threading.  Threads in Ruby are dreadfully expensive and should be called ropes.  They're still great to have, but they're not ideal in terms of larger scaling architectures.  But as I've mentioned in the past, employing a non-blocking, evented approach to highly scalable architectures (nested callback or Reactor pattern approach) offsets this thread performance loss.
Biggest issue is threads. Ruby threads are not "real threads" but what are called "green threads". Not having real threads only becomes an issue when doing stuff like GUI.
As a rule of thumb, no need to use threads. Reactor pattern is much better. In python the library of choice is twisted.
Logged
isthisthingon
Global Moderator
Lifer
*****
Offline Offline

Posts: 2879



View Profile
« Reply #4 on: April 06, 2010, 03:08:36 PM »

>EventMachine

Yep.

>This make programs in C/C++ is total BS.

I've been hearing this basically my whole life.  Then something like MongoDB comes out - written entirely in C++ - and again the crowd says 

Though C/C++ would be terribly slow to build everything in, they never seem to become extinct.  Following any conceivable path leading to where only the highest level languages are needed/worth the ROI, all you need to do is reduce the size of your hardware.  Firmware will favor C-like languages for generations to come, imho.  As soon as the device becomes capable of interpreting a HLL, someone comes out with something smaller or someone wants more from the same device to happen faster 
Logged

I would love to change the world, but they won't give me the source code.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #5 on: April 06, 2010, 03:20:42 PM »

As soon as the device becomes capable of interpreting a HLL, someone comes out with something smaller or someone wants more from the same device to happen faster 
They already had that Smiley http://en.wikipedia.org/wiki/Lisp_machine  ROFLMAO
Logged
isthisthingon
Global Moderator
Lifer
*****
Offline Offline

Posts: 2879



View Profile
« Reply #6 on: April 06, 2010, 03:29:23 PM »

Wicked tight form factor ROFLMAO



Hook a strap to it and you've got a fashionable wristwatch Wink
Logged

I would love to change the world, but they won't give me the source code.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #7 on: April 07, 2010, 01:30:47 PM »

I love Ruby to death.

But I rarely write in it as I'm much more familiar with PHP and Perl. I strongly prefer Ruby to Python as I think Python's whitespace obsession is silly.

Agreed on the threads ITTO. I came here to post the same thing. They're not truly threads in that they live in the same resource space as the application does, and they are very expensive because they don't "detach", they "clone".
Logged

hai
isthisthingon
Global Moderator
Lifer
*****
Offline Offline

Posts: 2879



View Profile
« Reply #8 on: April 07, 2010, 03:37:37 PM »

The whitespace obsession is a concession.  But Google, Canonical/Ubuntu and even NASA went with Python!!  Sarcasm

Logged

I would love to change the world, but they won't give me the source code.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!