4 ms·
Having programmed at least 10k locs in all major paradigms, I've come to the conclusion that relational programming (prolog and sql) are the best. Haskell talks
by unono 13y ago
Having programmed at least 10k locs in all major paradigms, I've come to the conclusion that relational programming (prolog and sql) are the best. Haskell talks a good game and a lot of OO procedural code has been written, but for programming succinct, elegant code, which also happens to be the most lucrative - sql databases underlying most business - the relational paradigm cannot be beat.
It's the most beautiful invention of computer science, Programming in prolog, especially, is the closest a programmer can come to achieving a state of nirvana. A place where the mind is at one with the problem at hand.
- VMG 13y agoWhy do you think aren't those languages more popular?
- unono 13y agoSql is extremely popular, that's the LAMP stack. Rails and Django led people astray for a while but that's ending. Prolog should be more popular, it should be at least embedded in every program, even in the browser. If there are more than a few for loops or if else statements than the majority of the program should be encoded in sql/prolog. If you look at all these javascript frameworks, the core concept they're missing is relational programming. The program should be a loop that takes all input events like mouse clicks, etc. and then queries a prolog engine about to what actions to take. It's getting more popular steadily. Map/reduce is being replaced/complemented with distributed sql, and the frontend will also come around as people starting embedding prolog into their guis (LAMP stack in the browser).
- helloTree 13y agoDo you know of any major prolog programs that are in use and where you think that they really are successful because of prolog's strengths? I did a little bit of prolog in a logic course, but it never felt natural to me compared to functionl programming. But of course, maybe that's just because I did not dive into it and there are people who think FP feels unnatural. However I really would like to see some real world software in it (with "real world" I mean no AI system, planning system or inference system, but something very small, e.g. a web server, a text editor, a graphics engine, a synthesizer, an operating system, etc.)
- unono 13y agoThe semantics of sql and prolog are the same, so in one sense it's everywhere - relational databases. Prolog specifically is not commonplace because historically the gui's have been written with OO and then the web came and frontend was stateless (html pages sent to browser). As gwt-style single page apps become popular again, hopefully this time prolog will replace OO.
- tome 13y agoI'm rather uninitiated into all this. What's your basis for claiming the semantics are the same? Isn't backtracking present in Prolog and absent in SQL?
- jacquesm 13y agoGood luck controlling your ABS system using prolog. Having programmed more than I care to remember (since we're establishing credibility by tossing unverifiable facts in there) I think it takes the right tool for the right job. Sometimes that's prolog, sometimes that's assembly and sometimes it's something else entirely. Every language that is in use today has a niche, no single language manages to span more than a few such niches and the larger the impedance mismatch between the problem and the language the more work you have to do.
- tome 13y agoRelational programming is indeed excellent, but how can you put up with writing in SQL? Of all the programming languages I've ever used, it's the one that allows the least abstraction.
- unono 13y agoAbstraction in sql are views, done with left joins (rules in prolog). It doesn't seem like much, but that's the beauty of of it, you only need one concept and that's all you need. Contrast that with other languages where you have hundreds of little functions.
- tome 13y agoNot all abstractions are relations though. In SQL can you abstract the functionality of "take a relation with one int column, one string column, one double column, sum the int column, group by the string column and average the double column"? Do views support the notion of primary keys and foreign keys? I wouldn't be able to program in SQL without the former, and the latter would also be useful.
- rbanffy 13y ago> Having programmed at least 10k locs in all major paradigms I don't want to sound insulting, but 10 KLOC is not nearly enough to get a reasonable understanding of even very concise languages. 10 KLOCs of APL, maybe, but certainly not with C, Java (certainly not with Java) or even Ruby or Python. Beware of Maslow's hammer.