ToC for today's professional prolog programmer book

What in your opinion would a table of contents look like for a book focused on the professional prolog programmer today.

Curious to hear your thoughts …

3 Likes

Too long to write in a post … and to my point of view as there are mutltiples types of different programmers with different skills and interests i believe more into some kind of “book” for any type of user with entries easy to use / follow according to the profile to fit to their needs which is something not really existing yet :slight_smile: I already experienced such a case into another field where said “profesionals” had big holes into their knowledge as nobody can know all and a good way was to provide a permanent update of their knowledge.

A few ideas for Prolog though =
1/ better educate on the concepts (if it is to attract programmers from other languages)
2/ understand the different ways to write the same thing and why one is better than another, as at the end efficiency matters
3/ better valorize libraries so that they don’t spend time renventing the wheel or getting scared of the unknown Prolog World “complexity” …
etc.

Anwyay any professional programmer keeps in mind 2 things : 1/ what is the size of the targeted market (need to pay the bill at the ned of the month like any other programmer) 2/ how much time can be gained in a daily programming life … and for now Prolog is far far from being among the top 10 most used programming languages, which leads to the question of how to make it mainstream and not just glue style.

1 Like

Prolog, and in particular swi-prolog, as a programming environment, has many new things going for it – which is not known to people glancing through, or reading up, on books that were written a decade or more ago.

A professional programmer will want to know about advanced features such as tabling, concurrency using various techniques from multi-threading to engines, constraint solving and more.

I wonder what an advanced book / curriculum would look like to make all this accessible …

Dan

1 Like

I totally agree with you as for the fact that most online books are most of the time outdated and for many of them even teaching things that are deprecated … also why i believe that a “book” approach is also deprecated …

Better have a more open approach with documentation + concrete examples illustrating the predicates and concepts. The Prolog libraries are already focused by themes. Moreover most professional programmers do not have hours or days to spend learning, they prefer an easy way to find what they are looking for. To my point of view one thing also lacking on the SWI Prolog site is a better collapse / expand.

Once said that means having a team of people focused on documentation … moreover to go further … dedicated to some parts of SWI Prolog too as some are more focused on the VM, others on some domains of AI etc. and in the middle of that you have professional programmers also having their domains of expertise as AI is not just one but with many faces …

Just look at the different discussions on SWI Prolog discourse … of which many are great and would deserve having a dedicated education / documentation area to go much further than just discussions.

I think it would be interesting to consider what a modern professional programmer would really need from Prolog. Let’s assume there are introductory books for the curious and the motivated. I really love Ivan Bratko’s book, and other than the need for periodic updates, it is probably probably sufficient for basic and intermediate needs.

What I at least would find interesting is a book on modern applications, showing how to deal with objective problems of scale and performance. Example: I work in NLP. For a while I have been thinking about writing implementations of various recent-ish papers on transforming dependency trees from software parsers into logical forms. This is a difficult conceptual and engineering problem. I understand this may be a very specific use case, but information on how to do lambda calculus at scale in Prolog would be very useful.

Another area that I’m not sure is covered well is contraint programming. Again, real-world, contemporary use cases would be useful. The existing texts that I’ve seen feel old-fashioned.

I must admit that although I am already programming in Prolog for more then 3 years, it quite often happens that a discussion by more experienced members (probably with many years of experience) are going way over my head.

Just to give an example, i understand tabling – that it’s a memo’ing feature – but tabling has much more depth – along various dimensions – from how it deals with deferred goal achievement – to its contribution to a new semantics for prolog – to a discussion thread – and sswi prolog enhancement – about a kind of virtual tabling for without underlying dynamic predicates –

All this could and should be made easily accessible to professional programmers …

Dan

I’m afraid I never read Bratko :frowning: I’ve learned Prolog from Clocksin and Melish and later studied Richard O’Keefe’s The Craft of Prolog. The latter is a great book, dealing with how you engineer using Prolog. The problem is that it is dated. It was based primarily on Quintus and there were no constraints, no tabling, etc. The scope of Quintus was more or less what is now in the ISO standard. Bratko handles constraints (from the ToC). I don’t know to what extend. It (still) doesn’t do tabling, while that is now readily available in many implementations and does need some learning to properly understand when and how to use it. Then SWI-Prolog has threads, engines, delimited continuations, destructive assignment, global variables and more. Most of this stuff is around in one or more other implementations. A lot of this should probably considered too immature to get a place in textbooks aiming at students. Ideally we would see best practice documents appearing and gain experience in using this stuff.

A wiki is probably the way to go. There have been several initiatives though, so far with little result :frowning:

2 Likes

How to use modern technology to communicate is a favourite topic of mine, and SWI-Prolog has great resources for this, specifically Swish and PLDoc.

To get some first-hand experience at Learning Mangement Systems (aka MooCs), a couple of months ago accepted an invitation from Coursera and did Prolog for Beginners to mixed reviews.

I’m not a professional teacher, so tried to keep my goal modest: just introduce people to Swish and point them to the online documentation, plus point out basic stuff that tripped me up coming from the “C-family” to Prolog. I found what I knew about SQL really helpful, and still tend to think of Prolog as mainly an alternative high-level relational database query language.

A problem most of us face these days is the abundance of tools: The reason I went with Coursera rather than just do a DIY project using one of the open-source LMSs (Blackboard, Canvas, Moodle… I’ve no idea) is I hoped for guidance from experienced online teachers. Instead found I was expected to peer review equally clueless newbies, most of whom hardly spoke English and were giving courses on things I found cliched and/or dishonest (eg stock-picking by torturing historical data, or “time series analysis” as this modern form of astrology is called).

Personally, I’m more of a reader than a listener. Especially with maths and programing find I have to struggle with problems myself. Watching someone else do it in a lecture is just extremely boring. The projects done by my fellow Coursera volunteers were pretty awful, so I understand why Coursera canned everything, (but then quietly resurrected my course without telling me, which hardly motivates me to update or improve it).

Given the low cost of web hosting and enormous choice of open source technology, getting something started is easy. But as the many attempts we’ve seen in these forums shows, gaining traction and keeping it going is the hard part.

2 Likes

The only way to get traction on Prolog is to have a structure dedicated to it and having a real consequent budget to do so. That way Prolog will not be lost among hundreds of other languages or used as a smart glue known by happy fews.

SWI-Prolog itself is a long run project from 1987 stil existing because it created its own community, which seems to be mainly into the edcuation and research area. And it must be respected because it is still alive …

As for budgets, keep in mind that a major university is more than € 500M per year, GITHUB got sold for USD 7.5 billions, or in the Metaverse that Facebook seems to be looking for those latest times, Second Life was making USD 1 billion earnings per year in its great years …

As Prolog is not Fortnite or so, there is a good balance to have in the middle but due to the small size of the Prolog’s programmers market, developping it has a cost, knowing that a wiki style is certainly better than a book as the language is in perpetual evolution and AI too …

There are plenty of good things to grab from old books about Prolog but let’s say that most of the time only 30 to 50% are still valid in those books moreover a book is too much static and often boring to read. Readers changed and young generations no more spend time reading … they want things to be useful, easy and quick to learn. Less therory more concrete practice …

1 Like

My first touch with Prolog has been with Turbo Prolog when it got launched in old times … but let’s say that it is now a Windows Prolog and i’d say more of a dialect compared to SWI Prolog.

1 Like

I believe that there are more members in the community that use Prolog in a commercial development setting than we might think.

If the members in the community could dedicate a few percent of their time to post after posting a technical question related to the use of a language or library feature and getting a satisfactory result – to then also write a short example and explanation for its use – as a summary.

Best on a wiki …

Dan

Maybe it is considered IP and people are not too willing to give it away?

I imagine that often its possible to show an example in a “sanitized” way that doesn’t give away the specifics but does show the technical problem addressed.

You do realize that this is a LOT of work, right? So a professional would have to take a considerable amount of their time and put a lot of effort, and the only immediate result is that others can pick apart whatever they did. The more useful the code and demonstrations become, the more you give away…

What would be the other incentives for someone to start writing?

Maybe they get it published and get revenue? We know that this is not a way to make fast money. Unless you are in academia and need the publication counts, writing books takes more than it gives.

Maybe they could use it as a promotional vehicle? To promote themselves, or something they did, or build and maintain a brand? There are examples of this going on every way you look, the most popular in the professional circles I have been in is Robert C. Martin. But those books do not serve the best interest of the reader as much as they serve the interests of the writer.

What else can you do to incentivize the right people to do the needed heavy work? This is a genuine question.

@j4n_bur53 has mentioned gamification before. It is an interesting idea, but I have very serious doubts about this helping to create anything novel. (Note the difference between competing within a gamified system and real-world competition; those are very different, but this is a separate topic.) But maybe I am wrong about this.

Any other ideas?

EDIT: say I want to promote SWI-Prolog as a technology to use professionally at my work place. This is a very hard sell. It would be an easier sell if the tutorials, books, and endless blog posts already existed. The quality doesn’t even matter if you just want to build up familiarity and popularity. Still, you’d have to create a large enough network of works that cite/reference each other, promote a few names to build up their expert reputation, and so on.

This can be done if you have enough money: Java and Go are examples. It sometimes happens on its own, kinda: Python is an example (but recreating the long chain of accidents that got Python there… I have no idea).

Getting from “existing” to “popular enough” has this high energy barrier between them; what is the enzyme that can lower it?

I have had the idea that a good enough, heavily promoted tutorial intro to SWI-Prolog might help a tiny bit. However, this is, again, a lot of work; and it cannot be meaningfully done as a crowd effort (that’s a personal opinion).

1 Like

I don’t think the impedance mismatch is at the implementation level, but at the conceptual level.

As an example, consider relational databases using SQL. There’s a big mismatch between SQL queries and conventional languages, and the interfaces are pretty ugly; but that still doesn’t stop people using SQL. (I’ll ignore LINQ because the majority of SQL usage doesn’t use LINQ; also, SQL became popular decades before LINQ appeared)

When they first appeared, relational databases were dismissed by the majority because they were far less efficient than hierarchical or network databases. However, the flexibility of relational databases gradually won over the sceptics, together with ever improving implementations that reduced the efficiency issues (programmers also had to learn to “trust the optimizer” and not worry so much about how the queries were done). Even so, I’ve noticed that beginning programmers have a difficult time understanding relational databases. Programming is an unnatural activity and, despite what the popularizers say, it’s not easy for many people to master to concepts. Relational databases are also an unnatural activity, and even harder to understand from the point-of-view of imperative programming. And Prolog is like SQL on steroids from a conceptual point of view, with a more powerful and simpler syntax.

My hope is that Datalog will gradually supplant SQL and act as the “gateway drug” for Prolog, and that programming will shift to a more data-centric approach. But it’ll take at least another generation of programmers for this to happen (a “generation” is about 5-10 years). In the meantime, the best we can do is keep the flame alight and work on improving the conceptual framework of logic programming (tabling, constraints, etc.)

I don’t think its a lot of work.

Its not much more than providing a bit more context to a forum question.

And, its fair to ask – given the time experts on the forum take to answer questions, so a good question and useful answer can be elaborated on.

And the incentive is clear – diffuse Prolog knowledge – to make it more used.

Dan

I think that in parallel to describe Prolog uses in commercial settings to solve problems is part of this.

I guess, key is also to identify the key selling point for Prolog, such as done in other new languages, e.g.

Rust – memory safety guarantees at compile time – leading to significant reducing in costly bugs.

Go – simplified language and effective concurrency model for server side processing at google scale.

<how about …>
Prolog --: simplfied language supporting problem-oriented programming in data rich problem domains through relational structures – significantly reduced development, maintenance and evolution cost

Dan

Why do you care? Copying typically happens with other languages’ implementation of ODBC. And in most cases, a no-copy implementation probably wouldn’t gain much performance, even with an in-memory database (and with Prolog, you get an in-memory database).

:slight_smile: depends what else you’ve got to do.

This is interesting. What is the expert’s incentive in making Prolog more used? I know my own reasons but I am not an expert so this disqualifies me.

No person is an island – if you want to use a language commercially, you want to know that you can delegate work – and this is worth money, sometimes a lot of money.

Dan