Pros/Cons of Turbogears/Rails?

Bruno Desthuilliers onurb at xiludom.gro
Tue Aug 29 14:36:40 EDT 2006


Adam Jones wrote:
> Bruno Desthuilliers wrote:
>> Paul Boddie wrote:
>>> Ray wrote:
>> (snip)
>>>> We're a Java shop so
>>>> our developers are trained in Java, Struts, Tomcat, etc. Any switch to
>>>> a dynamic language will be a huge change. However it baffles me that
>>>> they are open to at least a PoC in Rails. but when I suggested Python,
>>>> they went: "nah we're not interested in Python. Rails it is."
>>>>
>>>> *shrugs* whatever it is, those guys are doing something right.
>>> Making the Java people feel like they're doing something wrong, I
>>> guess. And perhaps the Rails people realised that by giving those
>>> people who lack direction, motivation, conviction or a sense of purpose
>>> or control something to gravitate towards, some of them might feel
>>> empowered enough to evangelise their discovery to the rest of the
>>> group.
>>>
>> FWIW, and while it's certainly not enough by itself to explain the
>> phenomenon, I think that Ruby's object model being much more
>> conventional than Python's may have some influence too on RoR's adoption
>> by the Java world.
> 
> I don't know enough about Ruby to comment, but how is its object model
> "more conventional" than Python's?

short answer (no time to elaborate...) and IMHO (of course):

Well, Ruby's object model is mostly based on Smalltalk, with private
attributes representing state, public methods representing behaviour,
and a "message passing" mechanism which will select the appropriate
method an call it.

In Python, an object is mostly a set of attributes, some of them
implementing the descriptor protocol, some of them being callables, and
one of them being the class object (which itself etc...). On top of
this, you have a lookup mechanism and a 'call' operator. And "message
passing" in fact boils down to retrieving an attribute (thru the lookup
mechanism, which can itself cause function/method calls, decorate the
attribute etc), and eventually apply the call operator to this attribute.

>From the surface, the main visible differences are that Python has no
proper access restrictions and that one can retrieve a reference to a
method object via simple lookup, but the philosophy is really different
IMHO.

> The only thing I can see is access
> control for methods, which seems like a silly thing to base a language
> decision on.

Java's philosophy is bondage and discipline. This has been sold over and
over to both suits and programmers. Making the move to a dynamically
typed language is already a big step for some of these peoples, so even
if all the difference they see is the absence of access control, I think
it can impact the choice. Now go tell them you can even change the class
of a given instance at runtime, and look at them running away screaming !-)

Not to say Ruby is less flexible or dynamic than Python (AFAICT, they
both have roughly equivalent potential in this domain), but Ruby can
surely look safer and way less confusing than Python to Java'ers.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list