[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: "stereotyping"

Michael Campbell

11/20/2003 3:02:00 AM

Sean O'Dell wrote:

> That's my experience. I love Ruby, but I just don't see a large
team working
> together without at least SOME form of type checking.

Does smalltalk have it? (Genuinely asking, I was under the
assumption
it did not, but I don't know smalltalk.) I do believe there have
been
some historically large smalltalk projects in the past, no?

>>However I have noticed that I need to "read the source" far more
often
>>than with Java libraries, and correctly interpreting the source
requires
>>experience.
>
> Thank you, that was my point. It's far easier to read the method
definition
> and see the types than to dig around in code. Good for smallish
projects,
> not efficient nor safe for large team projects.

I might note here that the fact he has to read the source wasn't
attributed to the fact there were no types listed. (It might have
been, but you're presuming it was, and I see no evidence of that
based
on the quote.)

>>I would love to do a comparative experiment myself; one team with
Java
>>and one with Ruby. Just not sure the boss would fund it :-)
>
>
> This was my point, too. At least with some type checking you could
show that
> Ruby would be at least as safe as Java, but with all the freedom of
Ruby.
> It's a win-win. Hard to argue against.

You're making the presumption here that type checking can be
correlated with "safety", which I'm not sure has been shown yet.




__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion....

7 Answers

Sean O'Dell

11/20/2003 3:06:00 AM

0

On Wednesday 19 November 2003 07:01 pm, Michael Campbell wrote:
> Sean O'Dell wrote:
> >
> > This was my point, too. At least with some type checking you could
>
> show that
>
> > Ruby would be at least as safe as Java, but with all the freedom of
>
> Ruby.
>
> > It's a win-win. Hard to argue against.
>
> You're making the presumption here that type checking can be
> correlated with "safety", which I'm not sure has been shown yet.

It's associated with "understanding" which is usually the predicate of
"safety." Understanding what a method expects helps you to call it properly.

Sean O'Dell



Michael Campbell

11/20/2003 3:15:00 AM

0

Sean O'Dell wrote:

>>You're making the presumption here that type checking can be
>>correlated with "safety", which I'm not sure has been shown yet.
>
> It's associated with "understanding" which is usually the predicate of
> "safety." Understanding what a method expects helps you to call it properly.

How do the smalltalkers manage?



Clifford Heath

11/20/2003 4:49:00 AM

0

Michael campbell wrote:
> How do the smalltalkers manage?

Couldn't say for sure, but I've never known a smalltalker who
worked as part of a team on a project of extended duration...
I'm sure that says something.

Julian Fitzell

11/20/2003 7:48:00 AM

0

Clifford Heath wrote:
> Michael campbell wrote:
>
>> How do the smalltalkers manage?
>
>
> Couldn't say for sure, but I've never known a smalltalker who
> worked as part of a team on a project of extended duration...
> I'm sure that says something.

Wow! That's quite the troll! - I think I'll bite.

As a smalltalker who has been working on the same project in a team at
work for 9 months and who has been contributing to open source projects
as part of rather large distributed teams for several years, I can
assure you that the fact that you've never met any smalltalkers who have
done so reflects more on who you've met than on who is out there.

I quick scan of http://www.whysmalltalk.com/production... gives
you some idea of some of the many large scale applications deployed
using Smalltalk. These applications are used by companies like Chrysler
and FedEx as well as many large banks, insurance companies, etc. I
think we can safely assume that these applications are developed by more
than a single individual and over an extended duration.

To touch on the broader issue, I don't need a static type to know what a
method expects. My method parameter might be called aWidget, for
example which tells me it is expecting something that behaves like a
widget. Then if I need more clarification, I can look at the code
(which is probably no more than 5-10 lines - smalltalk methods are
usually that short) and see what methods are called on it. Then I know
it's expecting an object that responds to those methods. If for some
reason, it still wasn't clear, I could easily put in a comment
explaining what was expected but I can't think of a time recently where
that has been necessary.

I can't say I've ever run into cases in Smalltalk where I can't
understand what a method expects because I don't have static typing.
And I'd laugh at anyone who claims Java code (for example) is easier to
read than Smalltalk - I don't need a Javadoc equivalent in Smalltalk to
understand the code.

Julian




Clifford Heath

11/20/2003 11:40:00 PM

0

Julian Fitzell wrote:
> Wow! That's quite the troll! - I think I'll bite.

Sorry, it probably was a bit OTT. Interesting though that most of the
apps listed are either inhouse dev't or products sold to generate
support (customisation) revenue - like large trading apps for example.

My experience is with designing and extending large software products
(>1MLOC) over dozens of upgrade cycles and six+ years, where you gather
a large base of legacy code and entrenched design faults, with a need
for backward compatibility and migration at every release, with teams
of 10-30 engineers (not super-large, but enough that central review and
control is quite hard), most of whom have been working on the product
for less than half its life. I've done this three times now.

9 months on a project doesn't really count. Problems arise over 9 years
when you can't provide hands-on support for customer upgrades. I can't see
how I'd do that with any fully dynamic language without even optional
typing. Not Ruby, definitely not Smalltalk, though both are superlative in
some fields. That doesn't mean I'm happy with the languages I *have* used
however, I think the computer language field has a *long* way to go yet.
Wish I had time to write Rite :-) Ruby's so good, and Rite is such a good
opportunity for significant further improvement.

> If for some
> reason, it still wasn't clear, I could easily put in a comment
> explaining what was expected but I can't think of a time recently where
> that has been necessary.

That is indeed the mark of a good language - it communicates by itself
without the need for comments. However, the lack of method typing in
both R&S limit the amount of information that can be included without
adding comments, and that's a pity when so much else is right. Note that
it's only partly about what the compiler can check, it's mainly about
what the human can apprehend.

Clifford.

Julian Fitzell

11/21/2003 12:56:00 AM

0

Clifford Heath wrote:
> Julian Fitzell wrote:
>
>> Wow! That's quite the troll! - I think I'll bite.
>
>
> Sorry, it probably was a bit OTT. Interesting though that most of the
> apps listed are either inhouse dev't or products sold to generate
> support (customisation) revenue - like large trading apps for example.

Well, I've never had a discussion about this that has changed the minds
of either party, so I'm weary of carrying on much longer and I certainly
stop short of trying to convince you - but I figure I might as well put
the counterarguments out in the open for those who may be reading.

> My experience is with designing and extending large software products
> (>1MLOC) over dozens of upgrade cycles and six+ years, where you gather
> a large base of legacy code and entrenched design faults, with a need
> for backward compatibility and migration at every release, with teams
> of 10-30 engineers (not super-large, but enough that central review and
> control is quite hard), most of whom have been working on the product
> for less than half its life. I've done this three times now.

People often say that Smalltalk is never successfully used for "large"
projects, but they usually mean "large" in the sense of code size as
opposed to large in the sense of amount of functionality. In my
opinion, no language is ever used successfully for "large" projects when
using the former definition. In my experience, writing in Smalltalk
produces code that has the same functionality as Java with a tenth of
the volume of code. Our project is an enterprise level application for
a university community of 30,000 people; many of the large smalltalk
applications out there are being used in similar environments and have
been around for more than 6 years.

This doesn't in any way prove that static typing is evil or even worse,
but the statement that "large" projects can't be done in a
non-statically-typed language is pretty flawed, in my opinion.

> 9 months on a project doesn't really count. Problems arise over 9 years
> when you can't provide hands-on support for customer upgrades. I can't see
> how I'd do that with any fully dynamic language without even optional
> typing. Not Ruby, definitely not Smalltalk, though both are superlative in
> some fields. That doesn't mean I'm happy with the languages I *have* used
> however, I think the computer language field has a *long* way to go yet.
> Wish I had time to write Rite :-) Ruby's so good, and Rite is such a good
> opportunity for significant further improvement.

I really don't understand your statement that "I can't see how I'd do
that with any fully dynamic language". That statement seems to depend
on the assumption that there is some problem with dynamic typing which
is exactly the point being debated in this thread (though not, really,
the point of my response, which was just to point out that Smalltalkers
do in fact work in teams over extended periods of time).

>> If for some reason, it still wasn't clear, I could easily put in a
>> comment explaining what was expected but I can't think of a time
>> recently where that has been necessary.
>
>
> That is indeed the mark of a good language - it communicates by itself
> without the need for comments. However, the lack of method typing in
> both R&S limit the amount of information that can be included without
> adding comments, and that's a pity when so much else is right. Note that
> it's only partly about what the compiler can check, it's mainly about
> what the human can apprehend.

Again, I don't really see how it limits the amount of information that
can be included. Is "someMethod: fooString" really any less clear a
declaration that "someMethod(String foo)" ? The difference to the human
reader seems pretty minimal. In fact, to a human reader, why would it
even matter if it had to be expressed in a comment instead of as a type?

The point of the compiler enforcement really is the crux of the matter
in my opinion. Some people like the basic security of static checking,
but it gets in your way every time you want to change a type (you have
to go change all the methods that take that as a parameter) even though
the behaviour or interface is the same. You need to spend a lot of time
up front making sure your types and interfaces are correct so you don't
have to go through making changes like that later. You have to always
worry about casting when you take objects out of an array (assuming
we're talking about Java anyway) and you can have a runtime type error
anyway if the object doesn't cast correctly.

To many of us, the increased plasticity allows us to more easily
refactor and to make the code reflect what we mean as we develop rather
than bending to the will of a compiler. This, in my opinion, leads a
cleaner system that is easier to understand, less likely to contain
bugs, and easier to find bugs in when they do occur. Others may
disagree, but this is my experience.

And I will also say (though has little more merrit than you saying you
don't know any Smalltalkers who work in teams on large projects) that
the vast majority of people I have talked to who have used dynamic and
static typing swear by dynamic typing.

Not the most compelling argument, but like I said, I'm not trying to
tell anyone else they can't use static typing. All I'm saying is:

a) I don't want to use it; and
b) I don't experience any of the problems, when using dynamic typing,
that people who like static typing say I should be experiencing.

Julian



Clifford Heath

11/21/2003 1:31:00 AM

0

Julian Fitzell wrote:
> Well, I've never had a discussion about this that has changed the minds

I'm not the religious type, and I appreciate you taking the time to
write, and in fact I agree with a lot of what you say, including about
Java. Although I've only done smaller projects using it I agree that a
lot of things about it are windy and annoying, and lack of proper
generics makes it less type-safe than promoted. C# has most of the same
problems, but it'll be interesting to see how generics change that.

> In my opinion, no language is ever used successfully for "large" projects
> when using the former definition.

Well, that's probably a fair generalisation over the industry, but my
experience is different - all three products on which I've worked (C,
C++, C#, with Perl, Ruby, Java and horrors! VBScript in parts) are/were
large in most relevant senses, including extent and depth of maintenance
over time by a changing team. It's really the human factors that allow
or deny success in this kind of project.

> Our project is an enterprise level application for a university community
of > 30,000 people; many of the large smalltalk applications out there are
being > used in similar environments and have been around for more than 6 years.

One customer, right? Try doing that with fifty customers, all on different
old versions, all abusing the system in different ways that the designers
didn't intend, and all wanting their issues attended to without having to
take the hit for an upgrade to the most recent version.

Your comments on refactoring are well-taken, but I feel would be solved
better by better tool support in a more strongly-typed language. To safely
refactor in any language, you must be confident of limiting side effects.
A dynamic language just makes side effects will occur at runtime instead
of compile time - and if your test suite doesn't give very high code
coverage how will you know that the system can be released. Remember, you
can't just patch it after it's in production because it's not just one
local customer, it's dozens.

How often during your time on this project have you needed to quickly patch
a critical error recently introduced into production? That sort of thing is
simply impossible in our product environment, and would guarantee business
failure almost immediately.

> I really don't understand your statement...

Perhaps what I've said clarifies it a bit.

Clifford.