Live data from Hacker News

Ask HN: Code should be stored in a database. Who has tried this?

news.ycombinator.com

41–50 of 51 posts

Re: Ask HN: Code should be stored in a database. Who has tried this?

#41
I looked into four interesting incarnations of this over the years:

1. During the peak phase of couchDB as application server (2006 - 2009) it was common to store not just the data but all the app assets and code in the database and replicate everything together. Plenty of the community tried to bring this to the extreme with every function being stored as versioned document (i see it as precursor to FAAS) and the whole application being editable with an integrated IDE. Also functions in my incarnation of this system were not loaded by filename but with a content addressed manifest. You would reference functions by name but the name would be resolved with a hash manifest.

2. There were several systems with erlang/BEAM to take the hot code replacement to the extreme in similar way, storing code in i believe mnesia.

3. I think bloomberg (i cannot find the hn post to confirm it was them, if someone has the link that would be great) has/had a bespoke code database with custom version control and fully integrated IDE. They leveraged this for some pretty interesting workflows

4. Probably not exactly what you mean as it does not include the runtime integration, but google and sourcegraph are building code databases with indices on symbols and semantic understanding of references and more. I hear great things from people who worked with it especially

Re: Ask HN: Code should be stored in a database. Who has tried this?

#42
Slang code at Goldman Sachs is all stored in a database, which is very useful 'cos if someone is having a problem with part of the infra that you're responsible, you can access their scripts and dependent libraries (assuming they decide to make them public)

Re: Ask HN: Code should be stored in a database. Who has tried this?

#45
Yes.

And the keyword here `database` not need to mean the typical one. In fact, most tools (like git) are databases over the code. IDE, parsers, etc. POOR ONES, and probably in the way of 'any program is a poorly implemented half of lisp', but intentionally create a database interface with a relational(enhanced!) view with intentional CRUD+Queries make a lot of sense.

Re: Ask HN: Code should be stored in a database. Who has tried this?

#46

I implemented something similar for Common Lisp: https://github.com/marcecoll/rekishi The idea was that you don't have files, just functions that you can bring in and out of scope while editing. You have branches per-function. This all worked more or less transparently to the user using the normal emacs Sly Common Lisp flow. It was implemented overriding the +DEFUN+ macro, so function re-definitions automatically ser…

I bet you could do something similar with Prolog

Re: Ask HN: Code should be stored in a database. Who has tried this?

#48
the key idea is to admit/realize that a program is a graph, and that a flat string of characters is not an ideal way to store such complex structures.

once that leap is made, a whole lot of the complexities of namespaces, modules, source control, and parsing become much simpler/better. this comes at the cost of more complexity in the editor/infrastructure, but that is a singular place while in return it is simplifying every program written.

Post reply on HN