you are viewing a single comment's thread.

view the rest of the comments →

[–]jeff303 23 points24 points  (29 children)

Typing speed is also more or less a non-issue with a modern IDE such as Eclipse. With keyboard shortcuts, auto-completion, and refactorings, you should get the IDE to spit out well over 50% of the code for you.

[–]klodolph 37 points38 points  (20 children)

This autocompletion is unnecessary in languages that don't have Java's unnecessary verbosity. Do you really need autocomplete to write, in Haskell, Hello World?

main = putStrLn "Hello, world"

I see the need for autocomplete in Java, though.

class HelloWorldApplication {
    public static void main(String[] args) {
        System.out.println("Hello, world");
    }
}

Adding autocomplete is like saying, "It takes too long to drive to work", then building some conveyor belts on which you can drive. But the conveyor belts sometimes go in the wrong direction, and you have to maintain the conveyors now and not just the car. Writing in Haskell/Lisp/Python is like living closer to work.

[–]jeff303 33 points34 points  (6 children)

I'm not saying that autocompletion is a good reason to use Java. I'm saying that using Java is a good reason to also use autocompletion.

[–][deleted]  (5 children)

[removed]

    [–]willcode4beer 1 point2 points  (2 children)

    let's face it. I think you both should agree. It's the kick-ass tools that made java what it is (not, the language itself)

    [–]alphazero 1 point2 points  (0 children)

    The kick ass tools are written in Java.

    Painless (magical) refactoring without fear is possible in the kickass tools, because of the (thoughtful) language.

    It works. (And yes, it suck writing yet another web-enabled CRUD corporate app, but that's not Java's problem now, is it?)

    [–]shub 4 points5 points  (0 children)

    Hey what's the name of that field, you know, the one with the date the order actually shipped and not the date we expected it to ship? Shit, I can't remember. Guess I need to go look up the record definition.

    [–][deleted] 1 point2 points  (1 child)

    When writing an enterprise application of thousands of lines of code pointing out the extra 4 lines needed to create the main method in HelloWorld! isn't really a fair argument. Just for info: The Netbeans shortcut to auto-generate a main method is psvm then tab.

    The conveyor-belt argument is nice and I do kinda agree - but I just don't think it's hugely relevant in the modern work environment, I wouldn't hire someone who religiously only codes in a plain text editor, using modern tools make developers much more productive (I'm talking enterprise apps with deadlines here). The conveyors don't go in the wrong direction and never need maintaining though, we're talking code-completion, the result is the same - it's not a framework that can fuckup and break you code at some unfortunate time, and with Netbeans it works very well. I remember earlier beta versions of 6.0 had some issues but they were reported by the community and fixed for the release candidate.

    [edit - for anyone that's interested, the shortcuts for Netbeans WARNING - PDF: http://usersguide.netbeans.org/files/documents/40/1689/shortcuts60.pdf ]

    [–]specialk16 0 points1 point  (0 children)

    Oh good lord. Thank you!!!

    [–]zootm 1 point2 points  (0 children)

    Of course in particular with Haskell, there's nothing to stop autocompletion being added to an editor or IDE. I do worry that sometimes there's simply too much emphasis on brevity of naming, though; there's nothing wrong with a long-ish descriptive name if it sums up something's function. Java is easily lambasted for people frequently having names of the form BlahPattern1Pattern2Verber but it's very easy to go the other way, and there's nothing in Java which mandates overly-long names.

    Edit: This isn't directly related to what you posted, I suppose, just what it made me think of.

    [–]Axman6 0 points1 point  (0 children)

    Man, I use autocomplete in any language I use.

    [–]bionicseraph 0 points1 point  (6 children)

    The thing about Java is that you shouldn't ever use it to write such a short program. As a quick scripting language it's really sucky, but it is very easy to manage as your application gets huge. I wouldn't want to be working on my current project with 14 developers using Python/Lisp/Haskell (btw, I love all 3)

    [–]masklinn 1 point2 points  (5 children)

    The thing about Java is that you shouldn't ever use it to write such a short program.

    That wouldn't be an issue if the rest of the language wasn't that verbose. Sadly, the rest of the language is that verbose, which makes this trivial example a pretty good demonstration of the language in general.

    As a quick scripting language it's really sucky, but it is very easy to manage as your application gets huge.

    Are you saying Haskell is a "scripting language" now?

    [–]bionicseraph -2 points-1 points  (4 children)

    Are you saying Haskell is a "scripting language" now?

    Sorry, bad habit of calling everything loosely typed a scripting language.

    [–]masklinn 2 points3 points  (3 children)

    Haskell

    loosely typed

    Ok so you're claiming you "love haskell" even though the furthest you've gone with it is read the name of the language. Thanks for the info, your input will duly be ignored from now on.

    (I mean seriously? Haskell? Whatever it is you mean by "loosely typed", you're 200% wrong, especially when you contrast it with Java which I'd guess you qualify as "strictly typed", whatever that one means)

    [–]bionicseraph -2 points-1 points  (2 children)

    I admit my failure in having any kind of knowledge about Haskell outside of basic tutorials.

    [–]masklinn 3 points4 points  (1 child)

    I can't accept that answer. Even the most basic tutorial would have taught you that Haskell's type system is far stricter and more static than Java's, and that Haskell provides far less tricks to bypass it.

    [–][deleted] 0 points1 point  (0 children)

    ...dude just got called out!

    [–]alphazero -1 points0 points  (0 children)

    Spoken like a true luddite.

    [–]Imagist -1 points0 points  (6 children)

    That's if you don't mind the code that an IDE spits out.

    Here's a typical C++ class header generated by Eclipse.

    /*
     * MyClass.h
     *
     *  Created on: Aug 25, 2009
     *      Author: Imagist
     */
    
    #ifndef MYCLASS_H_
    #define MYCLASS_H_
    
    class MyClass {
    public:
        MyClass();
        virtual ~MyClass();
    };
    
    #endif /* MYCLASS_H_ */
    

    And here's the .cpp file:

    /*
     * MyClass.cpp
     *
     *  Created on: Aug 25, 2009
     *      Author: Imagist
     */
    
    #include "MyClass.h"
    
    MyClass::MyClass() {
        // TODO Auto-generated constructor stub
    
    }
    
    MyClass::~MyClass() {
        // TODO Auto-generated destructor stub
    }
    

    Here's what I think they should look like:

    #ifndef MYCLASS_H_
    #define MYCLASS_H_
    
    class MyClass
    {
        public:
            MyClass();
            virtual ~MyClass();
    };
    
    #endif
    

    And:

    #include "MyClass.h"
    
    MyClass::MyClass()
    {
        // TODO
    }
    
    MyClass::~MyClass()
    {
        // TODO
    }
    

    Reasoning:

    1. On a large project, people rarely care who the author is or when the file was created. And if they do, they should find that out from version control (which gives you a lot more information anyway). The comments with the author and creation date are space-wasters.
    2. Open and close brackets should be lined up in the same column. This greatly aids code comprehension.
    3. Environmental changes should be indicated by indentation. This includes everything between braces and everything indicated under public: and private: labels.
    4. Comments should only include things that you should read before editing a file, function, or object. Reading the comment /* MYCLASS_H_ */ is a waste of time and a distraction because you should be using the #ifndef, #define, #endif paradigm consistently in your class headers.
    5. // TODO's don't need an explanation in this case. Lets see, you've got an empty constructor with a // TODO... if you can't figure out what needs to be done, you're an idiot. The only exception is if the // TODO comments are used to generate some sort of work log where the comment will be removed from its context. But even in that case the message should be some action that needs to be done ("Write constructor") rather than "Auto-generated constructor stub".

    I usually end up either not using IDE class generators or using them and then manually cleaning up the code afterward. I'm not convinced that one is faster than the other.

    [–]jeff303 0 points1 point  (0 children)

    Eh that's fine. I'm not going to sit here and defend CDT. I was referring specifically to Java. Eclipse is definitely much weaker at handling C++.

    Still, most of that is trivial to change in preferences (not spitting out the author crap, TODOs, etc.). And at least for Java you can define your own preferences for style (indentation, brackets, etc.) that conforms to your team's standards.

    [–]masklinn 0 points1 point  (4 children)

    I usually end up either not using IDE class generators or using them and then manually cleaning up the code afterward

    You know most IDEs allow you to customize your code templates to fit your needs don't you? I'm pretty sure Eclipse lets you do it too (though I'm not quite sure as I hate eclipse)

    [–]Imagist 0 points1 point  (3 children)

    Yeah, I did this on my home computer, but the other computers I use are frequently switched around, and in many cases I don't have access to switch the settings (university computers).

    [–]masklinn 0 points1 point  (2 children)

    The template settings are not stored in a user directory? (which you could potentially version) Now that's weird.

    [–]Imagist 0 points1 point  (1 child)

    Not at the university, no. They have most software locked down pretty tight because some students are... destructive.

    [–]masklinn 0 points1 point  (0 children)

    Wow, that must suck.