Live data from Hacker News

Autocomplete from Stack Overflow

emilschutte.com

81–90 of 151 posts

Re: Autocomplete from Stack Overflow

#81
post #62

It still astounds me that we haven't solved reusable modules in 2016. Sure, we have libraries, apis, package managers etc. but every time I read a code base, there is always a utility function reinventing the wheel. Someone wrote it because it is still difficult to discover modular code and reuse it easily. It's pretty nuts when you think about it. Imagine mechanical engineers having to recreate the same CAD file bec…

What makes you think that utility function you saw wasn't copied from somewhere?

Re: Autocomplete from Stack Overflow

#82
post #80

Earlier quoted context omitted.

Haskell has Hoogle[1], which allows you to search for functions using a type signature. This is surprisingly effective. Let's say you want that `contains` function from the original post. You'd search for `(Eq a) => a -> [a] -> Bool`, which describes a function that takes two parameters and returns a boolean. The first result[2] is the `elem` function, which is exactly what we wanted! This is a bit of a contrived exa…

Does the order of the parameters matter? It's been a while since I've touched Haskell, so maybe it's obvious that this isn't [a] -> a -> Bool for some idiomatic reason. I guess that would be `isContained` instead of `contains`, so it probably wouldn't be the first thing I search for, but there's at least some potential for ambiguity.

Order doesn't matter! And it still returns similar results without the `Eq` typeclass constraint.

Re: Autocomplete from Stack Overflow

#83

If it's a joke "Ahah", if not it's just depressing. SO is a valuable resource to confront and understand concepts. Let's not encourage this copy/paste culture

The OS/SDK/Browser/Protocol/Firmware which you used to type this comment is a compiled copy/paste of a zillion lines of code, of which you probably typed none. If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. Now, if a programmer decides whether or not study and understand the pasted code has nothing to do with the quality of the final…

I disagree that they encourage copy and pasting, what they really encourage is auto completion of well structured code.

Even if you find yourself copy and pasting your -own- written code, you should question why you're having to do that.

Is what you're doing perhaps better abstracted to somewhere else? Be that in an abstract class, a helper class, or even in a separate library from which you can reuse it.

IDEs excel in understanding your code, which helps finding where you've stored something and allows auto-completing access to it, which is almost definitely their most important strength.

Re: Autocomplete from Stack Overflow

#84

I had a conversation with a coworker a few days ago where I jokingly suggested building an AI system that you give a failing test suite and it uses stackoverflow answers to make your tests pass. Sounds like we are one step closer to making that happen.

That actually sounds realistic. A well defined test suite is probably a good target for AI. Main issue is no partial wins, which are needed for training, so you'd need to break all functionality down into absolutely minimal units.

Re: Autocomplete from Stack Overflow

#86
post #62

It still astounds me that we haven't solved reusable modules in 2016. Sure, we have libraries, apis, package managers etc. but every time I read a code base, there is always a utility function reinventing the wheel. Someone wrote it because it is still difficult to discover modular code and reuse it easily. It's pretty nuts when you think about it. Imagine mechanical engineers having to recreate the same CAD file bec…

What makes you think that utility function you saw wasn't copied from somewhere?

Maybe it was, but that's a problem if so - it's not going to benefit from updates, and it will have to be maintained on its own indefinitely.

Re: Autocomplete from Stack Overflow

#87
post #62

It still astounds me that we haven't solved reusable modules in 2016. Sure, we have libraries, apis, package managers etc. but every time I read a code base, there is always a utility function reinventing the wheel. Someone wrote it because it is still difficult to discover modular code and reuse it easily. It's pretty nuts when you think about it. Imagine mechanical engineers having to recreate the same CAD file bec…

It gets more daft when every time someone tries to solve the problem, they make it worse. See the 200 version of visual C++ restributable you end up installed. I'm tempted to say developers shouldn't have been able to target specific dll versions, but that would cause different problems.

> See the 200 version of visual C++ restributable you end up installed.

In the grand scale of things that are wrong with programming that's somewhere between non-problem and minor irritation. Disk space is cheap.

Re: Autocomplete from Stack Overflow

#88
post #62

It still astounds me that we haven't solved reusable modules in 2016. Sure, we have libraries, apis, package managers etc. but every time I read a code base, there is always a utility function reinventing the wheel. Someone wrote it because it is still difficult to discover modular code and reuse it easily. It's pretty nuts when you think about it. Imagine mechanical engineers having to recreate the same CAD file bec…

What are you talking about? Every framework has reusable modules. Perhaps you mean package management?

Re: Autocomplete from Stack Overflow

#89

If it's a joke "Ahah", if not it's just depressing. SO is a valuable resource to confront and understand concepts. Let's not encourage this copy/paste culture

The OS/SDK/Browser/Protocol/Firmware which you used to type this comment is a compiled copy/paste of a zillion lines of code, of which you probably typed none. If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. Now, if a programmer decides whether or not study and understand the pasted code has nothing to do with the quality of the final…

> If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm.

No, it's the opposite. The whole point of DRY is you don't copy/paste, you put the thing in a common place and have references to it.

Many SO answers are good enough to be libraries. But they should be libraries, not snippets that are copied and pasted. Fortunately we're moving in that direction - our library infrastructure is becoming good enough that it's worth releasing even small pieces of code as reusable libraries, and people are.

Re: Autocomplete from Stack Overflow

#90
post #88
post #62

It still astounds me that we haven't solved reusable modules in 2016. Sure, we have libraries, apis, package managers etc. but every time I read a code base, there is always a utility function reinventing the wheel. Someone wrote it because it is still difficult to discover modular code and reuse it easily. It's pretty nuts when you think about it. Imagine mechanical engineers having to recreate the same CAD file bec…

What are you talking about? Every framework has reusable modules. Perhaps you mean package management?

I think that's part of the problem he's talking about. Why do new modules have to be made for a new framework? The framework should play nicely with standard modules written vanilla for that specific language. This way we're not staying over whenever a new framework is made.
Post reply on HN