lesscode.org


Control-Space  

By Bill de hÓra under Talk, Then you win. on 29. August 2005

Tim Bray warms up to Ruby, and had this to say about the value of static typing:

“Call me hidebound and conservative, but I think that ‘optimizing code’ and ‘helping IDEs’ (and it’s a whole lot more than just ‘tooltip help’) are awfully damn important. In particular, as James Strachan has often argued, the combination of a good modern IDE and a statically typed language mean that you hardly ever have to type out a full method or variable name, and even though you might have to write more lines of Java than you would in Ruby, you might get the code written just as fast.”

Yes you might get the code written just as fast. And in truth you can really bomb through Java code in a tool like IDEA. But after you ship, you will have more code to deal with, you will have more tools in the chain, you will have more technology to deal with. All that extra stuff and surface area is not neccessarily a good thing. And there’s no guarantee the system logic will be as flexible as the one written in some other language. “But my refactoring IDE will help me deal with all that” - yes, and this is what we might call a self-fulfiling prophecy ;)

On the other hand the most common non-idiosyncratic compliant I hear about Python is not being able to know what a function takes or returns without jumping out to the function source. This sounds trite, but it appears to really drive people to distraction - I suspect it has something to do with breaking flow.

But if this is the sole argument left against dynamic typing (and it appears to be, along with the human resources), then the dynamic camp have come a long way . Komodo and Eclipse PyDev shows what you can do in terms of autocomplete; not nearly as good as the features provided by IDEA and Eclipse java, but which might be good enough.

19 Responses to “Control-Space”

  1. Sharon Rosner:

    I’ve always found that whole auto-complete thing soo stupid. No wonder college graduates these days can’t spell to save their lives. In the same fashion the new programmers can hardly write one line of code without resorting to IDE “services”. When I do use an IDE for programming I turn the damn thing off, just like I turn spell checking off in Word. I can do my own thinking, thank you very much.

    comment at 30. August 2005

  2. Aristotle Pagaltzis:

    Good points.

    I jotted down a point about the performance facet of the argument and musings about how it relates to another little-considered dynamic language, as well.

    I really don’t see a lot of basis on which to argue that complex user-land projects shouldn’t be developed in a dynamic language.

    comment at 30. August 2005

  3. Bill de hOra:

    “I’ve always found that whole auto-complete thing soo stupid.”

    Sharon, I found that using auto-complete leads to forgetting the Object APIs, and quickly. Sometimes it’s worth turning off just to see how far you’ve regressed, but I’ll confesss to leaving it turned on mostly ;)

    comment at 30. August 2005

  4. Ryan Tomayko:

    Aristotle, I thought the following was kind of a weird thing for Tim to say as well:

    And unless I’m missing something, the static typing ought to give the compiler and runtime enough extra information to make the code run faster; implicit in the notion of duck typing is that you’re going to spend plenty of cycles executing code like “Does this thing have a quack method and if not, does its superclass?”

    You (Aristotle) replied in a point about the performance facet of the argument:

    Isn’t this just the sort of reasoning that was levelled against Java when the beanheads started championing the virtues of virtual machines and garbage collection? Bytecode execution was made pretty fast. Is there any reason that method lookup couldn’t? Or any other thing that might happen “a lot” in a dynamic language?

    That’s what I was thinking. Many dynamic language advocates (and I thought I remember Tim being one of them) have found that there is an already wide and growing range of application domain where the performance lost to name lookup and other dynamic language type stuff have become almost irrevelant when considering Moore’s law with the fact that we’re still very often IO bound with the increased value of developer productivity.

    Not to mention that some components can actually run faster due to C based language bindings instead of native VM based implementations. For example, I expect XML processing performance using either the libxml2 or cElementTree bindings for Python could be considerably faster and might use fewer resources than a native Java parser such as Xerces.

    At any rate, I had hoped the performance and scalability myths were largely behind us. Let’s give Tim the benefit of the doubt and assume he may not have thought that argument through all the way - at least not to the point where he’d really champion it. It just seems inconsistent with other statements I’ve seen from him over the years. He can come banter with us if he thinks he has a strong argument in the area of performance.

    comment at 30. August 2005

  5. Bill de hOra:

    Aristotle,

    I had a para in the draft of the post about maybe Lisp and smalltalk people having something to say about speed wrt type inference, but left it out. In fairness the people working on JITs for Java have done a tremendous job down the years, but I hear that modern Lisps and smalltalks are damn fast. Parrot seems to be doing something similar for Perl (not that Perl is slow to begin with).

    comment at 30. August 2005

  6. Alex Schroeder:

    The nice thing about Common Lisp is that you can add so many compiler directives that it will run just as fast (and just as risky) as C, if you have a Common Lisp compiler that groks them.

    comment at 30. August 2005

  7. Ryan Tomayko:

    “I’ve always found that whole auto-complete thing soo stupid.”

    I have a hard time arguing against the value of Control+Space (I’ve tried before and was called on it, by Mr. de hOra no less). Control+Space is a rock solid feature that a great number of developers depend on.

    To argue against Control+Space, you pretty much have to make a case that static typing encumbers you out of all the benefits Control+Space provides and then some. That argument is much harder to make because it usually means relaying all of the unique benefits of dynamic languages to someone who might not have worked closely with the concepts.

    I think you nailed it Bill, the debate rests on Control+Space right now. I can pull out all the tricks and still not convince someone the benefits of dynamic languages are worth discarding their Control+Space and compiler errors.

    comment at 30. August 2005

  8. Masklinn:

    Bill, you should check SPE’s autocomplete feature, I fond it to be quite complete and (which is much more important to me) blazingly fast.

    comment at 30. August 2005

  9. Robert Sayre:

    I thought the static/dynamic typing stuff was pretty balanced and uncontroversial. I’ve had fairly accomplished Perl people look over my shoulder at Netbeans (best for J2ME, I find) and marvel at the features.

    The truly objectional part was where he mentioned that he never used closures and then event-based XML APIs in the next couple paragraphs. Closures make event APIs easy to use. I’m outraged :)

    comment at 30. August 2005

  10. Aristotle Pagaltzis:

    Robert: I thought the same thing. I occasionally dabble with GUI apps written in C and gtk+, where passing function pointers around is par of the course, and it’s amazing how much easier it is to do the same things in Gtk2-Perl with the aid of closures. Being able to scope variables tightly and reuse code without the need to write elaborate code for passing around data structures is unimaginably liberating.

    Closures are so insanely useful, I don’t understand how anyone would want to do without them once they’ve tasted the power. Closures are the real line I draw between languages I enjoy using and those I don’t — the static vs dynamic typing thing really takes a backseat.

    Which brings me to:

    Ryan: WRT compiler errors, I am in fact very curious about getting my feet wet with the modern purely functional languages, such as Haskell, which are in fact strongly typed. You just aren’t reminded of it every step of the way. And the compiler can find real logic bugs (read the talk notes to understand).

    That’s in sharp contrast with the typing in ALGOL derivatives, which seems to constantly annoy withtout ever really repaying all the labour.

    (Note to self: I’ve been dropping the “I’m curious” line without doing anything about it for way too long now.)

    I suppose both my lovesong for closures as well as my type inference tendencies put me firmly on one particular side of the IDE divide… see also the L-t-U discussion about it.

    In retrospect, I have to wonder how this discussion went for so long before I remembered that link. It seems to summarise most of what the language debate comes down to.

    comment at 30. August 2005

  11. Anon E. Mouse:

    Yes you might get the code written just as fast. And in truth you can really bomb through Java code in a tool like IDEA. But after you ship, you will have more code to deal with, you will have more tools in the chain, you will have more technology to deal with.

    Are you talking about standalone client apps? Tim mentions that the two pieces of writing that made him look at Ruby/Rails were both dealing with web applications. Since they’re web apps, you’re not releasing code into the wild.

    comment at 31. August 2005

  12. Sharon Rosner:

    I have a hard time arguing against the value of Control+Space (I’ve tried before and was called on it, by Mr. de hOra no less). Control+Space is a rock solid feature that a great number of developers depend on.

    Ryan, I’m sure you’ve read Paul Graham’s Programming Bottom-Up. I needn’t mention this approach is also at the basis of Ruby and Ruby on Rails. Ctrl+Space IS probably something many programmers depend on, but it has a lot of negative effects: it encourages illiteracy, discourages code reuse, makes the programmer dependent on a IDE and generally gives people bad habits.

    Look at .NET for instance. Microsoft has always had a pattern with developing API’s: extensive coverage and flat API, preventing people from creating their own toolset and making it impossible to memorize the API. I’ve no experience with Java, but I guess it looks similar. From a business standpoint it makes perfect sense if you’re Sun or Microsoft, but you know, some programmers regard themselves as artists…

    comment at 31. August 2005

  13. Robert Sayre:

    Sharon, I don’t think Paul Graham’s article speaks to your point. Most ‘Experienced Lisp Programmers’ use an editor with symobl completion, like Emacs/SLIME or Hemlock.

    comment at 31. August 2005

  14. Sharon Rosner:

    Granted. Point retracted. I still do think it does more bad than good. Whatever.

    comment at 31. August 2005

  15. Damian Cugley:

    Autocompletion of method names does not save me from having to type public override void over and over again (Visual Studio .Net does not autocomplete language keywords). Microsoft Visual Basic.NET was worse than C#; not only does your override of some property start with Public ReadOnly Property (three words that for some reason I can never type correctly first time), it then has to be followed with Implements. Consider that the Python equivalent of that sequence of words is the three characters def, and you can see that there is still a lot of extra keyboarding to do.

    As a more extreme example, consider the Python fragment

    cats = []
    

    The C# equivalent might require the creation of a whole extra class:

    class CatalogueCollection : CollectionBase {
       .... dozens of lines of code omitted ...
    }
    ...
    CatalogueCollection cats = new CatalogueCollection();
    

    This represents a several-hundered-to-one code-expansion ratio. (Admittedly I now generate these subclasses of CollectionBase et al. using Cog, which reduces the amount of actual typing required.)

    Lack of static declarations does not mean that autocompletion is impossible to implement–there are plenty of counterexamples. But with less-verbose languages you need it a lot less.

    comment at 07. September 2005

  16. Memo:

    I think that the guys who thinks that CTRL+SPACE is stupid ARE STUPIDS….
    if by using the CTRL+SPACE you forget the code you are the stupid, this is a tool microsoft gave us to facilitate our work… theres nothing bad in using it and i think you just posted it that comment so peopple see you are “THE BEST” for not using it (note the quotation marks)

    comment at 30. March 2006

  17. Patrick Logan:

    Control-space? What the heck is wrong with the set-mark-command?

    ;^/

    comment at 30. March 2006

  18. Another high-profile developer warms up to Ruby « Curt’s Comments:

    […] (via lesscode.org) […]

    pingback at 08. October 2006

  19. Anonymous:

    I think there is no issue with option of using ctrl space in fact it reduces lot of coding time by thinking or refering the docs.If you feel like you are unable to remember the code because of this , you have to find other way of remembering it.

    “ITS LIKE BLAMING THE VEHICLE FOR YOU ARE NOT READY TO WALK TO REACH THERE”

    comment at 03. July 2007

Leave a Reply

Note: None of this information is required but leaving a Name and URL is much appreciated. You can also register to have this stuff remembered.

Your comment can be previewed here.


Markdown: use the force, Luke.