Live data from Hacker News

Most of the code you write, has probably been written before. Why not reuse it?

news.ycombinator.com

1–10 of 28 posts

Most of the code you write, has probably been written before. Why not reuse it?

#1
Would love some feedback on a feature I am validating for a startup.

The feature "Code Seeker" finds the code you need. It shows you real code from your, your teams, your organization or even public repositories. You can navigate the code by selecting next or previous and zoom in or out to see more of the code.

The benefit is code reusability as well as learning from existing code.

Any feedback is welcome - thanks

Re: Most of the code you write, has probably been written before. Why not reuse it?

#2
Sounds great - where is it? Can I test it? I'm not sure what you mean by "next" and "previous", or what you mean by zooming in and out.

How do I specify what I'm looking for? What level of granularity does it work at? What languages does it cover? How is this different from using libraries? How can I trust the code I find?

Does it exist yet?

Re: Most of the code you write, has probably been written before. Why not reuse it?

#3
I love code reuse!

However...

License matters.

Control matters (what if I need to make a change to fit a certain scenario? How does that happen? Is it propagated upstream? How/when?)

Searchability matters. How do I know what I am looking for, especially across domains and companies?

Re: Most of the code you write, has probably been written before. Why not reuse it?

#5
I think it's difficult to search a functionality by words. For example, if I want to fund matrix multiplication, the function name could mulmat, matrixProduct .... could be anything.

second, even code is found, building requires lots of work. missing dependency, mismatching interfaces, unsupported os...

Re: Most of the code you write, has probably been written before. Why not reuse it?

#6

I think it's difficult to search a functionality by words. For example, if I want to fund matrix multiplication, the function name could mulmat, matrixProduct .... could be anything. second, even code is found, building requires lots of work. missing dependency, mismatching interfaces, unsupported os...

type interface is usually enough

https://www.haskell.org/hoogle/

Re: Most of the code you write, has probably been written before. Why not reuse it?

#7
I doubt most of the code I have written has been done before, as most of it relates to the business domain and specifically the parts of the business domain that are currently under focus.

Anything that is generic, e.g. a double entry accounting system, an Actor model, etc. should be in a package management system - a Gem, a Nuget Package, a NPM pacakage etc. rather than copy pasted.

At the micro level for specific line-of-code level problems (usually due to language/platform quirks) we have StackOverflow.

Re: Most of the code you write, has probably been written before. Why not reuse it?

#8
I am always reusing code from prior programs that I've written. No point in re-writing it again, especially if i need it to do the same exact thing. Even if it only needs a few changes, I'll just copy and paste the code and tweak it.

Re: Most of the code you write, has probably been written before. Why not reuse it?

#10

I think it's difficult to search a functionality by words. For example, if I want to fund matrix multiplication, the function name could mulmat, matrixProduct .... could be anything. second, even code is found, building requires lots of work. missing dependency, mismatching interfaces, unsupported os...

Smalltalk had a neat solution to this. You gave some arguments and a result, then it tried all the methods with the right types, and listed the ones that gave the result. Searching for '(a b c) and 'a would tell you what car is called in Smalltalk.
Post reply on HN