Live data from Hacker News

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

news.ycombinator.com

1–10 of 51 posts

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

#1
To me it seems obvious that code should be stored in a database rather than a hierarchical, text-based format.

The main way we navigate and organize code is by folder hierarchies. Everyone has a different approach: by feature, by module, by file type (template, component, etc.), by environment (backend/frontend).

Rather than folders and file names, everything could just be tagged in different ways.

Who has tried this and what is the best tool for working like this today?

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

#3
what problem should it solve? you can store anything in a db fetch it and run it. binaries, what not. parts of then. web components.

id ask, is it really a bottleneck. fetching code. maybe in some systems or types of execution environments it could be worth it. really dont know.

Id assume data is stored in databases because it needs to be viewed from different angles. (join statements etc ) and it has different peeformance and layout requirements.

most code is 'read only' too, so theres no need to do stuff like synchronization / locking on writes and ordering stuff.

then again, there might be systems that dont have this aspect, and somehow have very high load on fetching code, and maybe code is writable too, and could have queries to extract certain parts of code, or combined code from various files/tables.

i think tho the main reason is this difference between how code and data are fetched and used will be the reason why in the general case it works like it works. its not been needed to work differently. so no one looked for a solution. no big problems in the space. (my guessing)

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

#7
Hmmm... Smalltalk, a pure object-oriented language, stores everything in an image, and has tons of different browsers to inspect its "object soup". Install a Squeak Smalltalk if you're curious :-)

Userland Frontier was a wonderful scripting environment born on macOS and ported to Windows. It was a mix of an object database, storing code and data, an extensible scripting language called UserScript, and very powerful InterApplication capabilities, based on Apple's Open Scripting Architecture. Dave Winer, its author, worked on the XML-RPC standard afterwards.

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

#8
post #7

Hmmm... Smalltalk, a pure object-oriented language, stores everything in an image, and has tons of different browsers to inspect its "object soup". Install a Squeak Smalltalk if you're curious :-) Userland Frontier was a wonderful scripting environment born on macOS and ported to Windows. It was a mix of an object database, storing code and data, an extensible scripting language called UserScript, and very powerful I…

Smalltalk stores:

memory snapshot "image"

AND "change log" text file

AND "sources" text file.

https://cuis-smalltalk.github.io/TheCuisBook/Code-Management...

If the "sources" file is missing the byte code will be decompiled to show class and method definitions, but the original names will be unknown.

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

#9
"ENVY/Manager augments this model by providing configuration management and version control facilities. All code is stored in a central database rather than in files associated with a particular image. Developers are continuously connected to this database; therefore changes are immediately visible to all developers.""

https://www.google.com/books/edition/Mastering_ENVY_Develope...

~

pdf 1992 Product Review: Object Technology’s ENVY Developer

http://archive.esug.org/HistoricalDocuments/TheSmalltalkRepo...

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

#10
post #8
post #7

Hmmm... Smalltalk, a pure object-oriented language, stores everything in an image, and has tons of different browsers to inspect its "object soup". Install a Squeak Smalltalk if you're curious :-) Userland Frontier was a wonderful scripting environment born on macOS and ported to Windows. It was a mix of an object database, storing code and data, an extensible scripting language called UserScript, and very powerful I…

Smalltalk stores: memory snapshot "image" AND "change log" text file AND "sources" text file. https://cuis-smalltalk.github.io/TheCuisBook/Code-Management... If the "sources" file is missing the byte code will be decompiled to show class and method definitions, but the original names will be unknown.

It is only an implementation detail. It is a matter of change of a few methods only to store sources directly in methods. I tried that once.
Post reply on HN