Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming

This AI-powered Auto-Completer is Helping Developers Write 25% Less Code (thenextweb.com) 67

Ivan Mehta, writing for The Next Web: For years, IDEs (Integrated Development Environment) have tried to make development quicker by predicting the next part of a developer's code. Now, startups like Codota are using AI to help developers with code completion on any code editor. The Israel-based startup was found in 2015 by Dror Weiss and Eran Yahav. Codota's free-to-use autocomplete plug-in supports major languages such as Java, Python, Javascript, PHP, and Rust across major IDEs such as Eclipse and Android Studio. Yahav told me that Codota differs from other code completion AIs as it's able to predict the next token completion by leaning on an AI-based code 'dictionary.'
This discussion has been archived. No new comments can be posted.

This AI-powered Auto-Completer is Helping Developers Write 25% Less Code

Comments Filter:
  • Has been doing this since... 2019? #Slownews.
    • Re:Visual Studio (Score:4, Informative)

      by 140Mandak262Jamuna ( 970587 ) on Thursday May 14, 2020 @05:30PM (#60061292) Journal
      MsDev is nothing compared to Visual Slick Edit. When it comes to tagging, building tokens and mapping and indexing them, Visual Slick Edit speed is fantastic. Then context sensitive drop down box for possible arguments, function names etc, very very good.

      MsDev is getting better but it is so damned slow. Try loading 60 vcxproj files with 100,000 source/header files...

      But context sensitive auto complete has been there for a long time.

  • Not really (Score:5, Insightful)

    by aardvarkjoe ( 156801 ) on Thursday May 14, 2020 @05:22PM (#60061260)

    When we say that developers are "writing code," that really entails more than just the mechanical work of transferring the code from your head into the computer. There's design, research, tracing existing code, laying out data structures, and all sorts of other tasks that this plugin can't possibly help with.

    Reducing the number of keystrokes that you have to make by 25% may be helpful, but there's no way that it actually saves 25% of the effort in coding. At best, it's probably low single-digits in terms of percentage of effort saved.

    I'd also be interested in finding out whether developers perceive an increase in effort in checking over what the autocomplete added to make sure it's really what was intended. I can certainly imagine an increase in bugs where the autocomplete added something that looked right when coding quickly (which is the point, right?), but was actually subtly wrong.

    • Re:Not really (Score:4, Insightful)

      by darkain ( 749283 ) on Thursday May 14, 2020 @05:31PM (#60061298) Homepage

      All of this! And especially that last part. I've found myself fighting with code completers doing batshit insane thing or wrong things or unwanted things so often, that the majority of their features I disable. It just isn't worth the extra headache, when as you state, the primary job is focusing on solving complex logical issues, NOT pounding keys.

      • Re: (Score:3, Informative)

        by etrusco ( 576870 )

        This! And Codota for Java frequently causes slowdowns in Eclipse, sometimes even causes freezes and exceptions in other functionality.

        • Then they really could automate cut and paste.

          Somewhere, long ago, somebody must have written an original line of code...

          • somebody must have written an original line of code...

            Yes. I am fairly sure I did - but it was Macro11 assembler in 1974.

            Since then, we have had C - which converts your thoughts into pre-prepared assembler cliches.

            One day, you millenials will reinvent Borland and "drag and drop".

            • Macro11? With 16bits!

              When I was lad, used to code 12 bits on PDP 8. None of this Macro nonsense, via the toggles on the front of the box. Cut the paper tape by hand (well, actually using a hole punch).

              Macro 11 did the work for you.

    • Re:Not really (Score:4, Interesting)

      by 140Mandak262Jamuna ( 970587 ) on Thursday May 14, 2020 @05:40PM (#60061320) Journal
      That 25%, at best, saving of key stroke comes with most dangerous kind of bug, subtle ones that is not easily spotted.

      For example many functions support passing an argument by value as well as by reference. The auto suggest offers might offer by value. All the simple unit test cases will pass without issues. But it will have difficulty in scaling when you throw real world data.

      (Yes, I am speaking from personal experience. A missed & passed a container by value, calling copy constructor on the fly, all simple test cases went through, then the real world data was passing the container, an std::map actually, with several million entries. Choked, took so long to find because, debug builds are too slow for real world data to step through, release debugging to find the time sink in the function call was really painful.)

      • by Junta ( 36770 )

        I suppose it could depend upon the training.

        If training including code written against that specific function and library, it may prioritize and remind the coder that usually arguments passed to that function have a '&' in front of it. Particularly if it is trained against a body of code from other developers, it may point that out where a newcomer to the codebase otherwise might not think about having to pass by reference.

        In some scenarios it may be less likely to fat finger or forget to include someth

      • That reminds me of one of the most painful bugs I ever tracked down. I can't remember the exact details but it was a list where the input was sorted and binary search was used to find stuff quickly. The tests passed but with real data weird things sometimes happened. It took a very very long time to find the cause which was a missing * or &. The "less than" operator used pointer comparison and not object comparison. During testing, objects were almost always created ordered in memory so sort order for o

    • The article makes it sound as though it really only saves on the most brain-dead type of code that doesn't require much in the way of thought to begin with. One example given is that if you make a Student class it suggests name and ID as fields.

      They include a video (YouTube link [youtube.com]) where because you created a function called calculateRunTime the AI is able to infer that startTime and endTime might be good identifiers when you start typing start and end so it populates the auto-complete suggestions with tho
      • The funny thing is that the problem in the video was solved a very long time ago [clhs.lisp.se]. And even augmenting it for things like cost centers [github.io] is basically a fun homework if you have nothing better to do at the weekend. Helping people retype the same thing repeatedly in many places all over again even faster than before is an anti-pattern, if I've ever seen one.
      • One example given is that if you make a Student class it suggests name and ID as fields.

        Seems their AI was trained with badly written OOP.

        It is far more likely that this class represents a student record of some specific kind, and not the generic idea of a student.

        Once badly named, it becomes the kitchen sink of all things student related. What courses is the student enrolled in? Throw it in there! What tuition payments have been made? Throw it in there! Scholarship? Jam that bitch in there! Food budget? Yep ram that one in there too! Emergency contact info? You betcha that gets stuck in

        • by bn-7bc ( 909819 )
          I don’t know why, but i tend to think databases first, so we gave on table fir students, wirh name, conract info etc, thibgs lije oayments pelong on a payments table with studenumoer as an fk, course enrollment is one if those many ti many relations so a new table is needed lets call it StudenrCourseEnrollement with fxs from the student table and the course table, oh yea the course table, well what is logical to have here ? Name description, professor, start date etc. how to map rhis to objects is an
    • by arglebargle_xiv ( 2212710 ) on Thursday May 14, 2020 @11:15PM (#60062096)

      It looks like you're writing some Internet-facing code.

      Would you like help?

      * Insert a buffer overflow.

      * Add some SQL injection.

      * Just write buggy code without autocomplete.

      [ ] Don't show me this tip again.

    • When we say that developers are "writing code," that really entails more than just the mechanical work of transferring the code from your head into the computer.

      Quite right, and very important indeed.

      "...well over half of the time you spend working on a project (on the order of 70 percent) is spent thinking, and no tool, no matter how advanced, can think for you. Consequently, even if a tool did everything except the thinking for you -- if it wrote 100 percent of the code, wrote 100 percent of the documentation, did 100 percent of the testing, burned the CD-ROMs, put them in boxes, and mailed them to your customers -- the best you could hope for would be a 30 perce

    • by skids ( 119237 )

      Reducing the number of keystrokes that you have to make by 25% may be helpful, but there's no way that it actually saves 25% of the effort in coding.

      I wonder if the continual degradation in keyboard quality has anything to do with people actually thinking crap like TFA is actually useful. If you're hunting and pecking on a touchscreen soft keyboard...

  • by Fly Swatter ( 30498 ) on Thursday May 14, 2020 @05:26PM (#60061280) Homepage
    Sure they claim privacy, but it is in constant communication with their servers. From the same country that has computer infiltration firms operating freely. Anyone using this that is employed by a government agency should be tried for espionage on the spot.
  • ...then there's redundancy in the expression of the programmer's intent. Presumably such code with the redundancy removed would have been equally shorter.
    • Or it is just really better implementation of what the IDE does now. Calling a method that takes object type foo as an argument, and if you only have one object of type foo in your scope many IDEs will autocomplete it for you since it is the only thing that you could possibly enter other than maybe null...

    • by Junta ( 36770 )

      So for one, source code is for humans, not for computers. A computer is just fine with exceedingly terse code (hexdump your compiled binary, particularly with optimizations enabled, computer is fine with that but human is not). We need verbose variable names and redundant structure to keep up with what is going on.

      For another, completion has the benefit of not having to be 100% correct without human review. In their example, they see 'dif' as a variable name, and make the language-based guess that 'diff' is

      • I wasn't really talking about variable names. But if there's a *significant* amount of predictable patterns in code, much like the presence of design patterns, that indicates an "I've run out language" kind of situation.

        We need verbose variable names and redundant structure to keep up with what is going on.

        Do we really? I very much prefer (map 'vector #'1+ data) over vector <int> result; for (std::vector<int>::iterator i = data.begin(); i != data.end(); ++i) result.push_back((*i)+1); return result;. Clearly even C++ people didn't think that we "needed the redundant structure to kee

        • by Junta ( 36770 )

          Eh, the demo seems to be a bit more tame. It guesses short trivial logic and nothing more. That's the way it goes with tech press releases, whoever exaggerates their approach to the most unbelievable levels without *quite* lying (and sometimes lying) wins.

    • In some cases that might be true. In other cases, the model is predicting what you MIGHT want next - you do need to specify what you ACTUALLY I want to do.

      If I say to my wife "I love", she can predict that the next word may be "you", but I've also said to her many times "I love cake".

      Even where it's entirely predictable, after 20 years I've learned how to write very compact code - which few people can read. Compact isn't always good. Coming from the ed, sed, grep, awk line, Perl has a default argument for

      • Obviously, there are different kinds of compactness. But I bet that this tool won't be advertised as a way to achieve the esoteric things you're describing.
        • Perhaps I misunderstood what you were saying. I interpreted your comment as saying you could write more compact code WITHOUT the tool. Yes, you could - and they may not be a good thing.

          Still, it seems it would mostly be useful to those who are knowledgeable about programming but NOT knowledgeable about the language they are using. As someone else said, actually writing the code itself is a small part of programming*. If you know the language, you'll spend very little time typing code. Of course very good pr

          • Ps the "lots of little functions" you end up with is pretty much Linus' style and the kernel style. Of course when writing kernel code you sometimes have to think about how your code interacts with or matches the other 28 million lines in the kernel. But not as much as one might think, because modules and subsystems.

      • but I've also said to her many times "I love cake".

        You are a very lucky man. The average wife on hearing this would immediately ask for a divorce, citing cake as the co-respondent, and sue for enough alimony to keep her lawyer rolling in Vegas for the next hundred years.

        "Careless words cost lives"

  • Surely the take home message should be "programming languages are 33% more verbose than they need to be"?
    • by green1 ( 322787 )

      In many cases, yes, that's exactly what it means. The issue is that "many" != "all", and if you eliminate the "complexities" you also eliminate the possibility of accomplishing those cases that fell between many and all. The simpler you make it, the less it can do.

      Something like this promises a middle ground where the complexity is still there, but it suggests options to cover most of the use cases, even if not the more complex ones which you can still do by hand.

      That said, promises like this are very commo

    • by Junta ( 36770 )

      Much of it is completing longer variable names that are longer for the sake of humans. Sure you could name your symbols a, b, c, d... but no human could read it. This of course is normal and AI is not needed.

      The portion where AI comes in is guessing what you want to do. In their demo, they assume you want a variable named 'diff' and based on historical data, 'diff' usually represents something subtracted from something else and you only have two variables so you probably want to subtract them.

      The key word i

    • Or it means that programmers are lazy who think the greater number of letters typed means they're unproductive.

      Code is about understanding, not some code golf terseness game.

      If it were otherwise, the entire codebase of the planet would be written in perl.

  • by sdinfoserv ( 1793266 ) on Thursday May 14, 2020 @05:41PM (#60061322)
    Fire 1/4 of our development staff immediately. I'll take 1/2 the savings as a bonus and the board gets the rest.
    - CEO
  • by burningcpu ( 1234256 ) on Thursday May 14, 2020 @05:46PM (#60061332)
    Write faster code with this one crazy trick!
  • I was putting comments that the AI missed!

  • Yawn! (Score:5, Funny)

    by xanthos ( 73578 ) <[xanthos] [at] [toke.com]> on Thursday May 14, 2020 @07:20PM (#60061578)
    I'll be impressed when they can auto complete Perl Most Perl developers have trouble doing that with their own code.
  • by darenw ( 74015 ) on Thursday May 14, 2020 @08:32PM (#60061732) Homepage Journal

    Nice, but can it save me time by automatically putting in "vodi", "pirnt", "flaot" and other important keywords?

  • by bb_matt ( 5705262 ) on Friday May 15, 2020 @12:19AM (#60062192)

    I think I'll wait around on this, till the add stackoverflow automation - the ability to lift code automatically from the highest scoring stackoverflow answers, even if they are solving a different problem.

    This will then more closely match my coding style, which generally consists of 'copy / paste', followed by days of debugging, until the realisation that the code I copied wasn't fit for purpose, followed by watching hours of online tutorials which teach you how to make applications nobody ever makes, followed by many more hours of refactoring, followed by a punishing PR where people who can code circles around you pretty much rewrite everything you coded in one line. So, yeah, your code actually worked, but somehow you managed to recreate core language functionality, because you didn't know it was there.

    Automate that with AI, please! - I can then spend my time planning an early retirement, as my company finally realises I can't actually code - but that's OK, because my IDE now does it all for me.

  • Helping Developers Write 25% Less Code

    I don't need AI for this - I'll happily write 25% less code!

    (Willing to negotiate up to 100% less)

  • Other langs are basic autocomplete using TabNine which Codata acquired. Full predictive autocomplete is for Java only at this time.
  • What will their AI do with this?

    const NAKBA = "BOYCOTT_DIVESTMENT_SANCTIONS";

    $bds = N

"Trust me. I know what I'm doing." -- Sledge Hammer

Working...