News for hackers. Stuff that matters.
Re:Copilot regurgitating Quake code, including sweary comments by jacurtis on Friday July 02, 2021 @11:44AM (#27712984)
> The ruby one isn't outright terrible, but shows a very Americanized way to do street addresses that would probably become a problem later.

As someone who has been coding up address storage and validation for the past week in my current job, that one really made me laugh. Mostly because it tries to simplify all the stuff I have been analyzing and mulling over for a week into a single auto-complete.

Spoiler: The Github Copilot's solution simply won't work. It would barely work for Americanized addresses, but even then not be ideal. Of course trying to internationalize it, this thing isn't even close.

I get what Copilot is trying to do. But at the same time I don't get it. Because from my experience, typing code is the fastest part of my job. I don't really have a problem typing. I spend most of my time thinking about the problem, how to solve it, and considering ramifications of my decisions before ever putting code in the IDE. So Copilot comes around and it autocompletes code for me. But I still have to read what it suggested, making edits to it, and consider if this is solving the problem appropriately. I'm still doing everything I used to do, except it saved me from typing out a block of code initially. I still have to most likely rebuild, edit, or change the function somewhat. So it just saves me from typing that first pass. Well that's the easy part of the job.

I have never had a manager come to me and ask why a project is taking so long where I could answer "it just takes so long to type out the code, i wish I had a copilot that could type it for me". That's why we call it software engineering and not coding. Coding is easy. Software engineering is hard. Github Copilot helps with coding, but doesn't help with Software Engineering.

Re:Copilot regurgitating Quake code, including sweary comments by ph0rque on Friday July 02, 2021 @12:02PM (#27713242)
> I spend most of my time thinking about the problem, how to solve it...

A few years ago, I got a small but painful cut on my fingertip. I thought I would have a hard time on the job as a dev. To my surprise, I realized I spend 90-95% of my time thinking, and only 5-10% of the time typing. It turned out to be almost a non-issue.

Re:Copilot regurgitating Quake code, including sweary comments by amluto on Friday July 02, 2021 @01:01PM (#27714033)
As the owner of a fairly normal American address that is either corrupted by the UPS address validation service, this is a good time to remind everyone: accept the address that your customer enters. If you offer a service to try to improve your customer’s address, keep in mind that it’s a value added service, it may be wrong, and you MUST test the flow in which your customer tells your service to accept the address as entered. And maybe even collect examples in which the address change is accepted to make sure it does something useful.

Vendors have lost sales to me because they were too incompetent to allow me to ship things to my actual address. Oops.

P.S. for the US, you need to offer at least two lines for the address part. And you need to accept really weird things that don’t seem to parse at all. I know people with addresses that have a PO Box number and a PMB number in the same address. Lose one and your mail gets lost.

P.P.S. If you offer discounted shipping using something like SurePost, make sure you let your customers pay a bit extra to use a real carrier. There are addresses that are USPS-only and there are addresses that work for all carriers except USPS (and SurePost, etc). Let your customer tell you how to ship to them. Do not second-guess your customer.

Re:Copilot regurgitating Quake code, including sweary comments by shados on Friday July 02, 2021 @01:00PM (#27714017)
> I don't really have a problem typing.

Im absolutely with you and want to upvote that part of the comment x100. Unfortunately it's often considered a fairly spicy opinions.

Entire frameworks (Rails) are built around the idea of typing as little as possible. Others can't even be mentioned without the topic of boilerplate/keystroke count causing a flame war (Redux).

A lot of engineers equate their value with the amount of lines they can pump out, so there's definitely a demand for tools like these.

There's also some legitimate stuff. There's a lot of very silly thing I have to google every time I do because I have a bad memory. It saves the step of googling. In a way, it was the same debate around autocomplete at the very beginning, but pushed to the next level. Autocomplete turned out to be a very good thing (even though new languages and tools keep coming out without it).

Re:Copilot regurgitating Quake code, including sweary comments by theshadowknows on Friday July 02, 2021 @01:28PM (#27714327)
I never commit something that I can easily google (with a high quality solution) to memory
Re:Copilot regurgitating Quake code, including sweary comments by lwhi on Friday July 02, 2021 @12:12PM (#27713388)
>Because from my experience, typing code is the fastest part of my job. I don't really have a problem typing. I spend most of my time thinking about the problem, how to solve it, and considering ramifications of my decisions before ever putting code in the ID

So very true.

[1] Understanding the problem > [2] thinking about all possible solutions > [3] working out which solution fits best > [4] working out which implementations are possible > [5] working out the most suitable implementation

... and finally, [6] implementing via code.

Re:Copilot regurgitating Quake code, including sweary comments by neutronicus on Friday July 02, 2021 @12:29PM (#27713643)
A lot of my job is thinking hard about how to do [X], incidentally needing to remember how to do [trivial thing Y] and looking it up.

Like, I did it before, remember that it was trivial, I just forget the snippet and I have to break focus to look it up - often by scrolling through my own commit history to try and find the time I did [trivial thing Y] four months ago.

I do kind of wish I could automate that. Skipping the actual typing of the snippet is sort of gravy on top of that.

Re:Copilot regurgitating Quake code, including sweary comments by nitrogen on Friday July 02, 2021 @12:33PM (#27713700)
It would be nice if there were a way to automate the "remembering what that one function is called and what order the parameters are in" portion of my job.

IME the best thing for this is looking at the method listing in the docs for the classes I'm using. E.g. for Ruby, it's usually looking at the methods in Enumerable, Enumerator, Array, or Hash. Or I'll drop a binding.pry into the function, run it, and then type ls to see what's in scope.

Re:Copilot regurgitating Quake code, including sweary comments by shados on Friday July 02, 2021 @01:03PM (#27714045)
Even in the 90s that was a solved problem in Visual Basic with autocomplete. That a lot of dev environments "lost" the ability to do it is mind boggling. With that said, doesn't Rubymine let you do that with autocomplete with the prompt giving you all the info you need? (I haven't done Ruby in a long time).

Still, having to look up the doc or run the code to figure out how to type it is orders of magnitude slower than proper auto complete (be it old school Visual Studio style, or something like Copilot).

Re:Copilot regurgitating Quake code, including sweary comments by nitrogen on Friday July 02, 2021 @03:28PM (#27715768)
orders of magnitude slower than proper auto complete

Having worked extensively with verbose but autocomplete-able languages like Java, compact dynamic languages like Ruby, and a variety of others including C, Scala, and Kotlin, I've come to the conclusion that, for me, autocomplete is a crutch and I develop deeper understanding and greater capabilities when I go to the docs. IDE+Java encourages sprawl, which just further cements the need for an IDE. Vim+Ruby+FZF+ripgrep+REPL encourages me to design code that can be navigated without an IDE, which ultimately results in cleaner designs.

If there's any lag whatsoever in the autocomplete, it breaks my flow state as well. I can maintain flow better when typing out code than when it just pops into being after some hundreds of milliseconds delay. Plus, there's always the chance for serendipity when reading docs. The docs were written by the language creators for a reason. Every dev should be visiting them often.

Re:Copilot regurgitating Quake code, including sweary comments by shados on Friday July 02, 2021 @05:31PM (#27717169)
That's totally cool but the grandparent was talking about remembering shit they already knew. Not everyone has a fantastic memory, and remember the arguments are A then B or B then A doesn't deepen your understanding of a language. Most of the time the autocomplete and the official doc use the exact same source anyway, formatted the same way, with the same info.

But if it works for you, more power to you!

Re:Copilot regurgitating Quake code, including sweary comments by nitrogen on Saturday July 03, 2021 @03:44PM (#27724233)
remember the arguments are A then B or B then A doesn't deepen your understanding

What I meant is that you will coincidentally learn new things by going to the docs for old/simple things. In addition to remembering that method ordering, you might learn about a new method that simplifies your task.

Re:Copilot regurgitating Quake code, including sweary comments by greyfox on Friday July 02, 2021 @12:40PM (#27713793)
this sounds super interesting, is there a video or upload somewhere that i can watch this being performed in real time?
Re:Copilot regurgitating Quake code, including sweary comments by nitrogen on Friday July 02, 2021 @04:17PM (#27716350)
I very briefly show some of the interactivity of Ruby+Pry here: https://youtu.be/Gy7l_u5G928?t=805 (the overall code segment starts at https://www.youtube.com/watch?v=Gy7l_u5G928&t=626s)

I'd be happy to hear about better demonstrations, and there's also Pry's website (https://pry.github.io/) where they link to some screencasts.

Re:Copilot regurgitating Quake code, including sweary comments by reaperducer on Friday July 02, 2021 @12:29PM (#27713634)
I spend most of my time thinking about the problem, how to solve it, and considering ramifications of my decisions before ever putting code in the IDE. So Copilot comes around and it autocompletes code for me. But I still have to read what it suggested, making edits to it, and consider if this is solving the problem appropriately.

So, rather than helping people program better, all its done is replace a bunch of the offshore cut-and-paste shops with "AI."

Re:Copilot regurgitating Quake code, including sweary comments by JamesAdir on Friday July 02, 2021 @01:02PM (#27714038)
Isn't address storage and validation a solved problem? Why is it so complicated?
Re:Copilot regurgitating Quake code, including sweary comments by ezfe on Friday July 02, 2021 @02:30PM (#27715041)
You are right that USPS maintains a database of canonical delivery points. However, it's inevitable this database might not be correct or up to date.

If you don't want to validate, then yes addresses are just a series of text fields. However, mapping them to that delivery point is where the problems arise.

Re:Copilot regurgitating Quake code, including sweary comments by mgsouth on Friday July 02, 2021 @01:27PM (#27714320)
Ex:

412 1/2 E E NE

412 1/2 A E

1E MAIN

1 E MAIN

FOO & BAR

123 ADAM WEST RD

123 ADAM WEST

123 EAST WEST