The Artima Developer Community
Sponsored Link

Weblogs Forum
Ruby, PHP and a Conference

43 replies on 3 pages. Most recent reply: Feb 23, 2006 9:25 PM by Tom Robinson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 43 replies on 3 pages [ « | 1 2 3 ]
Greg Jorgensen

Posts: 65
Nickname: gregjor
Registered: Feb, 2004

Re: Ruby, PHP and a Conference Posted: Jan 27, 2006 10:29 PM
Reply to this message Reply
Advertisement
If your ISP doesn't offer PHP5 because it will break PHP4 code, they are just lazy. PHP4 and PHP5 can run simultaneously on the same web server. The ISP sets the web server to use PHP4 for files that end with .php4 or .php, and to use PHP5 for files that end with .php5. If a customer wants to use PHP5 by default, they can set that in a .htaccess file.

I use 1and1.com and they offer PHP4 and PHP5 (and, I think, PHP3, which was handled the same way). Other ISPs I've used for client projects offer PHP4 and PHP5. I'm not surprised GoDaddy sticks with PHP4 because they target the lowest of the low-end, but it's not a PHP shortcoming.

Rommel Lagera

Posts: 2
Nickname: rommel
Registered: Jan, 2006

Re: Ruby, PHP and a Conference Posted: Jan 28, 2006 2:43 AM
Reply to this message Reply
Nice article Bruce!!! But like you have said, due to limited space only few things have been discussed. I wish you will consider writing a full-featured book on Ruby. I know this will be along shot, but Ruby has special features that warrants in depth discussion. This includes code blocks, regular expression (Ruby style), singleton classes, mixin, reflection, distributed apps and much more. Your experience in writing books and expertise on different languages will definitely make a difference. It will be informative and enlightening to the reader even if he or she will not use Ruby as his or her main development tool.

Wishful thinkingÂ…

Joe Cheng

Posts: 65
Nickname: jcheng
Registered: Oct, 2002

Re: Ruby, PHP and a Conference Posted: Jan 28, 2006 7:03 AM
Reply to this message Reply
> I wish you will consider writing a full-featured book on Ruby.

No need, Ruby already has a great book:
http://pragmaticprogrammer.com/titles/ruby/index.html

An older version (covering Ruby 1.6) is available for free, here:
http://www.rubycentral.com/book/

Rommel Lagera

Posts: 2
Nickname: rommel
Registered: Jan, 2006

Re: Ruby, PHP and a Conference Posted: Jan 28, 2006 5:43 PM
Reply to this message Reply
The Pickaxe is really a great book, I learned Ruby from it. But having something written by someone with C++, Java and Python expertise could give us a different perspective on Ruby features and capabilities. I think another (free) book won't hurt. :)

Charles Haws

Posts: 24
Nickname: hawscs
Registered: Nov, 2003

Re: Ruby, PHP and a Conference Posted: Jan 30, 2006 9:02 PM
Reply to this message Reply
Thank you, Bruce! I've been wondering what the fuss is myself, and I thought you got some pretty unfair criticism for the last Ruby article.

I have to say, I spent a little while looking at Ruby earlier. At least the resources I was looking at were explaining the whole language. I was frankly not likely to invest enough time to learn everything just to find out why it was interesting. Sure, I would, if my goal was to use it. But my goal was more like yours: to find out what's got people so excited. I did not get it either.

Anyway, I really appreciate the distillation. Looks like there really are some interesting features there, more than just the blocks.

Devin Mullins

Posts: 7
Nickname: twifkak
Registered: Jan, 2006

Re: Ruby, PHP and a Conference Posted: Jan 31, 2006 8:34 AM
Reply to this message Reply
The result: there are definitely some very cool things here. I don't know why Ruby fans don't talk about them, but they're here.
We've got better things to do than proselytize. I'll leave that to the hyper-enthusiasts.

Devin Mullins

Posts: 7
Nickname: twifkak
Registered: Jan, 2006

Re: Ruby, PHP and a Conference Posted: Jan 31, 2006 10:29 AM
Reply to this message Reply
Oh, and so I'm not all fussypants, here's a minor correction:
"unlike Python, there's no pass equivalent in Ruby, so you're basically forced to provide code for all method bodies"
def foo
end

Or for brevity:
def foo; end
or:
def foo() end
Note that empty code blocks return nil. I actually use a minor variation on this fact -- non-existent else clauses return nil. Stupid, contrived example (not a good use case):
# Returns nil if the object isn't found. Assuming some stupid $map object exists.
def get(name)
$map[name] if $map.has?(name)
end

Alex Bunardzic

Posts: 546
Nickname: alexbunard
Registered: Oct, 2005

Re: Ruby, PHP and a Conference Posted: Jan 31, 2006 12:51 PM
Reply to this message Reply
This may be a bit beside the topic, but man this is the slowest forum I've ever seen. It takes forever to load the next page! And since you're discussing how you like PHP etc., isn't it time you guys revamp this site and rewrite it in one of the languages that are specialized for web development? J2EE is just soooo sluggish.

Jim Jewett

Posts: 11
Nickname: jimj
Registered: Apr, 2005

Re: Ruby, PHP and a Conference Posted: Jan 31, 2006 4:31 PM
Reply to this message Reply
Thank you; this was the first quick-intro I've seen to Ruby that didn't boil down to either "You can do things in a clumsy manner" or "You can write line noise". I could actually see myself using the language based on this, if python weren't available.

Speaking of which...

python also has open classes; the catch is that a class can choose to close itself, and the standard builtins do. (I will agree that adding functions to a specific instance rather than to the whole class can be confusing; it stays a function instead of becoming an instancemethod with the special access to self. But adding to a class isn't that hard.)


>>> int.f=f

Traceback (most recent call last):
File "<pyshell#33>", line 1, in -toplevel-
int.f=f
TypeError: can't set attributes of built-in/extension type 'int'
>>> class C(int): pass

>>> c=C()
>>> c.f()

Traceback (most recent call last):
File "<pyshell#38>", line 1, in -toplevel-
c.f()
AttributeError: 'C' object has no attribute 'f'
>>> def f(self, arg): print arg

>>> C.f=f
>>> c.f("and the method appears")
and the method appears
>>> c.g=f
>>> c.g("but self magic doesn't happen", "so not an instancemethod")
so not an instancemethod


Even before @classmethod, you could always write self.__class__, which doesn't seem much worse than Ruby's x.class prefix for calling classmethods.

One way to emulate Ruby's module is just to use a regular class, but throw an exception in __init__ or __new__ (preferably only if the instance is not also an instance of a subclass).

dl h

Posts: 1
Nickname: acrylic1
Registered: Feb, 2006

Re: Ruby, PHP and a Conference Posted: Feb 1, 2006 5:53 AM
Reply to this message Reply
> > puts is not a statement (unlike in Python, which makes
> > Pythons print somewhat inconsistent) it is a plain
> Kernel
> > module method.
>
> puts "at beginning"
>
> Isn't a statement? Then what do you call what would be
> called a statement in any other language in Ruby?

'print' in Python is a keyword. 'print' and 'puts' in Ruby are methods. Ruby allows you drop parentheses from statements that are not ambiguous.

Bil Kleb

Posts: 1
Nickname: bilkleb
Registered: Feb, 2006

Re: Ruby, PHP and a Conference Posted: Feb 1, 2006 9:21 AM
Reply to this message Reply
FWIW in terms of syntactic sugar, instead of if not CommonStuff, I'd recommend unless CommonStuff. Also, you could do a count += 1 instead count = count + 1. --Bil

Dat Nguyen

Posts: 1
Nickname: thucdat
Registered: Feb, 2006

Re: Ruby, PHP and a Conference Posted: Feb 1, 2006 4:57 PM
Reply to this message Reply
Bruce is more business-oriented than object-oriented.
The popularity of Perl, Python, and Ruby is undeniable. It's not pratical to use Smalltalk to do a variety of system administration tasks. Smalltalk is great for certain GUI apps, but not flexible for the rest of things to do on a computer. Smalltalk is avaible only on a few platforms.

Tom Robinson

Posts: 2
Nickname: trobinson
Registered: Feb, 2006

Re: Ruby, PHP and a Conference Posted: Feb 23, 2006 8:37 PM
Reply to this message Reply
I don't think this is the same thing as Objective-C categories (or Smalltalk class extensions, for that matter).

As near as I can tell, it really means that you can add or override the methods for a single object, like in Self. I'm getting this from pp. 382-383 in Programming Ruby, Second Edition....

Tom Robinson

Posts: 2
Nickname: trobinson
Registered: Feb, 2006

Re: Ruby, PHP and a Conference Posted: Feb 23, 2006 9:25 PM
Reply to this message Reply
...
> It's not pratical to use Smalltalk to do a variety of
> system administration tasks.

If you are saying that you would like to write a simple script to run from the command line, then I would agree. If the task is non-trivial and worth waiting to start up a Smalltalk image, then simply not so.

> Smalltalk is great for
> certain GUI apps, but not flexible for the rest of things
> to do on a computer.

This sounds like (dubious) second hand knowledge. Smalltalk does have shortcomings and idiosyncrasies, but lack of flexibility is not one of them.

> Smalltalk is avaible only on a few
> platforms.

A couple of Smalltalk dialects are available only for Intel/Windows. Others run on just about anything you want. Squeak will run on anything that has a C compiler, as long a s someone writes the primitives - you could, if nobody else has.

Check out the following:

Seaside - A Continuations based application server
http://www.seaside.st

Croquet - It looks like a distributed graphics framework, but it's really something new and completely different than anything you've seen before.
http://www.opencroquet.org


Squeak Projects - http://www.squeak.org/Projects

Flat View: This topic has 43 replies on 3 pages [ « | 1  2  3 ]
Topic: Software as Services Previous Topic   Next Topic Topic: OpenOffice 2.0 passes the first trial-by-fire

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use