The Artima Developer Community
Sponsored Link

Weblogs Forum
Are Dynamic Languages Going to Replace Static Languages?

83 replies on 6 pages. Most recent reply: Aug 6, 2010 11:26 AM by Stephen Monette

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 83 replies on 6 pages [ « | 1 2 3 4 5 6 | » ]
Cees de Groot

Posts: 16
Nickname: cdegroot
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 10, 2003 8:13 AM
Reply to this message Reply
Advertisement
Arnold, I just right click on the method name and select 'find all senders' from the menu that pops up. In a dynamic strongly typed system called Smalltalk (and the functionality has been available for a quarter of a centry now).

A lot depends on IDE. See my post over at Kern Arnolds blog re. human factors.

Cees de Groot

Posts: 16
Nickname: cdegroot
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 10, 2003 8:19 AM
Reply to this message Reply
Well, Bill, I'd go to the source and develop something in Smalltalk - if only to get the taste of an integrated development environment for a dynamically typed language. My issues with Python and other new dynamic languages is that the language is fine (sometimes better than Smalltalk, sometimes not), but that the lack of an excellent IDE tends to emphasize the risks of dynamic languages.

If you're into web stuff, Seaside might be neat to take a peek at. It is written in Squeak (a personal multimedia environment written in Smalltalk), and among others shows one of the unique strengths of 'objects all the way' by employing reified continuations and other fun stuff to keep the context of the webserver exactly in sync with the web browser. If you don't do anything else, like at the source code of the minesweeper demo that comes with it.

Squeak: http://www.squeak.org
Seaside: http://www.beta4.com/seaside2

(now, that's the third article pushing smalltalk I post here in five minutes, I'm signing off before I get too obnixious)

Kenny Tilton

Posts: 4
Nickname: kenzo
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 10, 2003 12:23 PM
Reply to this message Reply
> > "I wish I was programming in Ruby or Python, or even
> > Smalltalk. "
> >
> > How about Common Lisp? Mature, compiled, and ANSI
> > Standard.
>
> I get the general impression that mature is often a
> synonym for 'old (and therefore boring)'. Developers love
> new languages and new features.

Very true! of course, if they like novelty, wait till they get a load of Lisp: macros, multi-methods, closures... :)

Anyway, you are talking about the masses, I was just pointing out an alternative to Python and Smalltalk for the C++ heavyweights here, so we do not disagree.

kenzo

Kenny Tilton

Posts: 4
Nickname: kenzo
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 10, 2003 12:35 PM
Reply to this message Reply
> Even worse, don't you end up with a system where each
> "interface" has to have unique method names associated
> with it? So, let's say that I have one "interface" with a
> method "react". I decide that a better name might be
> "makeItSo", so I do my refactoring and change all "react"
> calls to "makeItSo". Oops! Someone else on the team
> already had an "interface" with a "makeItSo" method. Now
> I want to refactor my original method call name to
> something different. Wouldn't it become extremely
> difficult to decide which "makeItSo" calls were for my
> interface, and which were for the other guy on the team?
> How do you address issues like this without strong
> typing?

In Common Lisp you could not even load both functions, or if they were methods in a generic function their parameter lists coincidentally would have to match precisely (in length and &key and &rest usage) or the compiler will squawk.

If that happens... GREP? :) and add an assertion to the other guy's method to catch any callers you miss when switching back. me, I shy away from heavily overloaded words such as "react" to avoid such collisions up front.

btw, Mac Common Lisp does have a "who calls" dialog. Allegro CL does not, but there are introspective mechanisms (dynamic languages are like that) which allowed me to create a "who calls" utility. Turns out I never use it, I just use the editor's global search mechanism in cases like this.

Arnt Witteveen

Posts: 1
Nickname: arntw
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 10, 2003 12:40 PM
Reply to this message Reply
Reading all this got me thinking: is there really so much difference between dynamic and statically typed languages?

First off, what is the difference anyway? Both have some sort of type notion, since you really can't add 5 and "blabla". So the difference then lies in where the typechecking occurs. In dynamic languages, the runtime system does the checking, and there is no checking by any form of compiler. In statically typed languages, the compiler does the checking, and there is no checking at runtime.

The difference form the programmers point of view is that, with statically typed languages, there is more code to be typed, and with dynamic languages, there is are more runtime errors (wether they occur in tests or in the field).

I don't get the 'waiting for compile' point I read several times, as far as static languages go: in dynamic checking, you'll just be waiting for the tests, which (if they are good) you have written to cover all code, which will take long. I should know, since in my current environment running all tests simply isn't doable (30 min on newest pc's).

As for the evolution of languages as mentioned in http://www.paulgraham.com/hundred.html , I wonder if we won't see both sides coming together in an 'optional typing' system. You could argue that this already is the case: in C++ for example, you have a form of dynamic typing (from the programmers point of view anyway) through templates. In any lisp variant, you could implement statical typing by making the most basic element of any list a pair with 2 things, first the value you want to represent, second it's type.

Finally, I do not completely agree with the idea about as few axioms as possible. I would rather say any successfull language needs as few axioms as possible while remaining usable and good libraries to do most of whatever is needed at that point in time easily. There are a few toy languages with one instruction which are supposed to be turing complete still. Can't find one right now, but Brainf*ck with it's 8 instructions is also good example over oversimplification. And C for example has good libraries for console io and memory management, which was (I guess) what was needed at the time.

Todd Blanchard

Posts: 316
Nickname: tblanchard
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 11, 2003 6:23 PM
Reply to this message Reply
> OK but if your change affects the interface or calling
> protocol you still have to find all the callers in either
> case. This is quite feasible in the statically typed
> case, whether you use grep or a fully fledged analysis
> tool.
>
> But how would you find the call sites in a dynamicaly
> typed language? For what string would you grep?

Well.... In Squeak (open source smalltalk), if you mistype a message send or variable name, the compiler will sort of "spell check" these symbols and offer you "pretty close" choices during compilation. So typos aren't really a problem and the system helps you fix them (as opposed to, say javac which will just tell you where in the file something isn't quite right.

Second, when removing a method, the system will confirm the removal and tell you how many call sites there are. With a click, the call sites are displayed and you can fix them (or ignore them - sometimes they are sending a message of the same name in unrelated code).

You can always perform a query for "all references of class", "all senders of message", "all implementations of message", and so forth. Because the system is dynamic and alive, you can do any number of queries on the actual code.

Finally, the ability to fix code in the debugger, back up, change code, step forwards, etc... means that my code is better tested under more conditions than any static language code I've ever written. The most robust programs are written in the environment that makes it easiest to find and fix the bugs. Period.

I'll finish by mentioning that I'm about equally fluent in C, C++, Java, Objective C, and Smalltalk. There are plenty of large scale Smalltalk systems around and my experience is that they are much easier to scale than systems of equivalent complexity written in C++.

They just don't seem as large because they were so much easier to write!

> Putting it another way: a static type system, for all the
> effort it requires of the programmer, creates a static
> dependency graph for the program. And this is useful in
> analysis and refactoring.

Refactoring originated in the Smalltalk world I believe - at least we've had the refactoring browser a lot longer than the Java folks.

> But the "find all callers"
> problem represents a very real practical difference that I
> have not seen addressed in the static vs. dynamic
> discussion.

This problem is far easier to solve in Smalltalk than in a static language. With static languages, you're usually stuck with grep.

Cees de Groot

Posts: 16
Nickname: cdegroot
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 3:43 AM
Reply to this message Reply
> This problem is far easier to solve in Smalltalk than in a
> static language. With static languages, you're usually
> stuck with grep.

That's only true in a practical sense (and not even always, I think - VisualAge/J and maybe Eclipse?). In fact, static languages would have an advantage, because they couldn't just hunt for all places where a method named 'foo' is called, but they could hunt for all places where the method has a String arguments and returns a Boolean.

That this doesn't happen, seems to be indicative to me of how hard it is to write good IDE's in static languages. Basically every Smalltalk implementation quickly bolts on a class browser soon after they've reached the level where the VM works and can talk to a GUI, because it's so darn simple and useful. It's equally useful in C++/Java, and that it doesn't happen is probably because it's hard work.

On the other hand (straying off your message here), might it be that two other salient features of Smalltalk, the 'live object system' and the ability to extend base classes, aren't that what makes the environment so productive? It might be that having this is what makes it so simple to write class browsers and object inspectors in Smalltalk, even more than the fact that the language uses dynamic typing. It seems that VisualAge/J came close here (no wonder, running on top of Smalltalk and written by a bunch of Smalltalk hacks ;-)), and it looks like Java and Eclipse are slowly moving at least in the way of a 'live object system'; of course, the ability to extend base classes is just as important but probably will never be a part of Java.

Edoardo Comar

Posts: 7
Nickname: edoardo
Registered: Apr, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 6:02 AM
Reply to this message Reply
May we add Joshua Bloch to the type bigots set ?

this article of his suggest that type safety makes your code safe ...
http://java.sun.com/features/2003/05/bloch_qa.html

[quote]You'll have to say:

List<String> words = new ArrayList<String>();

The upside is that if you try to insert something that's not a string, you find out at compile time and fix the problem. Without generics, you discover such a bug when your most important customer calls your VP to tell him that the program on which his business depends just crashed with a ClassCastException.
[/quote]

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 6:56 AM
Reply to this message Reply
> May we add Joshua Bloch to the type bigots set ?

Perhaps... if we renamed it to the 'type advocates set'.

(Apologies for being a bit off-topic here.)
I really do hate to see words such as 'bigot' (and similar other words) used when we are simply discussing and comparing different computer programming methodologies and philosophies. It adds an unnecessary level of confrontation to the discussion and devalues those occasions where such words are genuinely applicable.

Vince.

Edoardo Comar

Posts: 7
Nickname: edoardo
Registered: Apr, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 7:09 AM
Reply to this message Reply
The word "bigot" was used by Bill in his opening post.
I should have enclosed it in quotes.

Edo

Edoardo Comar

Posts: 7
Nickname: edoardo
Registered: Apr, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 7:21 AM
Reply to this message Reply
oops ... by uncle Bob not Bill !
> I've been a statically typed bigot for quite a few years

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 7:41 AM
Reply to this message Reply
> oops ... by uncle Bob not Bill !
> > I've been a statically typed bigot for quite a few years

OK then. I'll let you off (this time)... :)

V.

MichaelKirby

Posts: 3
Nickname: mpkirby
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 8:46 AM
Reply to this message Reply
I can't see TDD as a replacement for static type checking for one simple reason. Static type checking is done by the compiler, and TDD is done by the developer.

I am sure I could be successful with this replacement if my development team was made up of Bob Martin's, but alas, it isn't. It is made up of a mix of people and skills, some of whom have technical ability far below that of Bob.

I have seen cases where tests written by these folks pass on empty implementations, and they don't ever get around to fixing it.

In a "typical" development group, such a substitution would most certainly fail. In a "advanced" group, I think it would be successful. But then so would almost anything you throw at an advanced group.

Mike

Kenny Tilton

Posts: 4
Nickname: kenzo
Registered: May, 2003

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 12, 2003 7:08 PM
Reply to this message Reply
> Reading all this got me thinking: is there really so much
> difference between dynamic and statically typed
> languages?

This might be a good time to point out that this thread is not just about dynamic vs static /type checking/, it is about dynamic vs static languages altogether, and there are many more differences than the type checking.

> The difference form the programmers point of view is that,
> with statically typed languages, there is more code to be
> typed, and with dynamic languages, there is are more
> runtime errors (wether they occur in tests or in the
> field).

Amount of code to be typed is not the problem. It is the way fussing with that (and even getting the compiler to play along with ones ideas) slows down the creative stage of development. The compile-time checking certainly catches a lot of mistakes, but as the opening article suggests, there are other ways to do that.

>
> I don't get the 'waiting for compile' point I read several
> times, as far as static languages go: in dynamic checking,
> you'll just be waiting for the tests,

Again, I think the key is that dynamic languages are perhaps an order of magnitude faster for development, leaving plenty of time to run tests. I can run thru a couple or three approaches before settling on one and quickly churning out tons of code. Then I test.

>
> I wonder if we
> won't see both sides coming together in an 'optional
> typing' system. You could argue that this already is the
> case: in C++ for example...

I was going to say Dylan. No types necessary. Add them where you like (for performance or safety or whatever).

Programming in Lisp (or Smalltalk or Prolog) is a lot different than programming in C/C++/Java. It is hard to compare them feature by feature, because the whole of dynamic languages is greater than the sum of the features.

I am a little confused because I have been reading a few C++ -> dynamic language stories, but one of them arose only when the person sat down with Python for a while. Probably nothing less can convey the nature of dynamic languages.

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Are Dynamic Languages Going to Replace Static Languages? Posted: May 13, 2003 2:05 AM
Reply to this message Reply
> I can run thru a
> couple or three approaches before settling on one and
> quickly churning out tons of code. Then I test.
>

This is precisely the situation that worries that worries the advocates of the older methodologies. Under the pressures of a deadline, many developers simply hack out something that works and then go with it. The temptation to drop the testing (or at least minimize it) is enormous. Static type checking at least makes makes some tests mandatory by incorporating them into the compile stage.
> >
> > I wonder if we
> > won't see both sides coming together in an 'optional
> > typing' system.

This is something that Visual Basic has had this for years. Explicit variable declaration can be turned on or off on a class by class basis and, even then, variables need not be declared as a specific type.

In practise, all the VB coding standards I ever came across made explicit variable declaration mandatory and (with notable exceptions) advised against the use of untyped variables. Mixing the two philosophies was generally found to create more problems than it was worth.

Vince.

Flat View: This topic has 83 replies on 6 pages [ « | 1  2  3  4  5  6 | » ]
Topic: Have Generics Killed Java? Previous Topic   Next Topic Topic: Adding Optional Static Typing to Python


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us