Everyone:

OK, not to instigate Yet Another Which Is Better (YAWIB) session, I'm really
interested in a couple issues by way of deciding whether I want to use Ruby
or Python. Until I bumped into Ruby, Python was a slam dunk. I'm kinda at a
point where I gotta pick and run.

Now, I'm trying to consider Ruby, but unfortunately the documentation
available, not to mention samples and libraries, pale in comparison to
what's available for Python. Even the Programming Ruby book, now distributed
as a chm in the windows installation, leaves me hanging in a few spots
(though overall its the best thing out there about Ruby, period).

I definitely want a real object oriented script language, one that's easy to
extend, and on this basis alone I rule out Perl. Can't stand the agonies I
have to go through to create objects and register them as extensions -- and
in terms of interfacing to C or C++ it's a real headache, comparatively
speaking. I love Perl's regular expression power, but both Python and Ruby
have re modules that are comparable and in most cases more than enough.

Here's what I like about Python that I'm not sure is easy to do in Ruby:

1. I like the interactive console, a la IDLE and PythonWin. Mainly because
I'm prototyping as I go, I like to test things before I commit them to a
code in script. I know there's IRB, but it doesn't seem as robust on Win32
as Python's interactive environment (I'm mostly a Win32 guy) -- I'm using
the Win32 install 1.6.5 from Rubycentral.com. For some reason, it works on
my desktop but not on my laptop. Ruby also doesn't always seem to give
helpful error messages, comparatively speaking. I also have in mind using
this interactive environment in the software I'm developing, which is sort
of an admin console gluing together a whole bunch of apps via whatever
interface they provide (whether by COM, by command line, or API extension).

2. I like that I can use Visual C++ to write Python extensions. I'm not sure
I have enough room on my laptop to get the whole cygwin environment
installed that Ruby seems (again, based on the documentation) to mandate for
writing extensions, which are *.so files even on Windows. Also, the Visual
C++ extension API is fairly well thought out, I'm not yet comfortable with
the Ruby API, mainly because I'm only functional (not proficient) with GCC.

3. Python's Windows extensions are all VERY WELL written and implented in
the ActiveState distro, it's very robust, and a breeze to both use and
create COM objects in Python. I used Ruby's win32ole package to play with
automating word and excel, and it takes much longer for the win32ole package
in Ruby to load the first time you use it than it does Python's win32com
module. I also like the fact that Python's Win32 ole extensions let you
generate a module based on a type library for "early binding" COM objects.
But anyway.

4. I find Python's module/package architecture to be easy and intuitive. All
I need is a silly little __init__.py (with or without package initialization
code) in subdirectories of the Python21 root (which represent the hierarchy
of the API I'm writing), and viola, I've got a package of modules that I can
instantly test using the interactive console. I like the ability to import
specific modules from a package, and not the whole thing, if I want to.

5. I also like the fact that any Python script can be written so as to be
included as a module in another script, via the

if __name__ == '__main__':
	# get command line args and off we go
else:
	# loading the module and all the classes and stuff in the callee namespace

trick. Is there a comparable way to do this in Ruby?

All of that having been said, here's what I like about Ruby, and why I'd
pick it over Python, but for those few things mentioned above:

1. Ruby's OOP is really OOP. As a C++ guy, I appreciate the access control
of 'private', 'public' and 'protected' methods and data. This is lacking in
Python. Makes it much easier to model Ruby classes such that they can be
converted at will into C++ classes without adding or removing any concepts.
I'm sure there are a lot of differences, but at least everything isn't
public whether I like it or not. (the object.__data convention doesn't do it
for me in Python).

2. I like the mixin alternative to multiple inheritance a lot. I (Almost)
never use MI in C++ anyway.

3. I like Ruby's terse but elegant minimalist syntax. Oddly, it's no harder
to read it for as easy as it is to type it. Mind you, I do like Python's
indentation scheme -- if the target audience consists of relative scripting
newbies, which does apply to portions of what I'm building, Python's
approach seems to me easier to convey and thus to train people in. On the
other hand, any halfway decent software engineer should have no difficulty
with Ruby.

4. I like the fact that Ruby can be extended in C, but I'm leary of the GCC
thing vs. being able to use my familar VCPP environment (No, I don't have
pictures of Bill Gates in place of crucifixes in my home, I actually can't
stand Bill Gates, but my work demands Win32 predominantly, and aside from
one under-equipped Linux box at home, all my machines are Windows of some
32-bit variety, and I do have Visual Studio 6.0, and am proficient at using
it.) Python lets me use Visual C++ very easily.

Any thoughts, words of caution, advice, suggestions, reflections, even
essays or flames, are welcome.

Thanks!

#*******************************************
#* Bob Calco
#* Senior Software Engineer
#* CorTechs, Inc.
#*******************************************
#* rcalco / cortechs.com
#* 703.989.3160 -- cell
#* 703.968.7021 -- office (ext. 120)
#* 703.968.8180 -- fax
#*******************************************