Why Learning Prolog Can Make You a Better Programmer
In Computer Science programs, there is a tradition of having a course of two that represent the watershed between people that can grok CS concepts and the ones that can’t. Although anyone can do some programming in a language like Java, where anecdotal evidence seems to show that the most complicated concept is class, it takes real intelligence to do something useful in C or Lisp.
At my Alma mater, a course in Prolog was the division line between the hopeful and the real CS guys. The reasoning being that if you could get your head around a Prolog interpreter written in Prolog, then you can probably handle any programming concept.
These days however, CS programs are more interested in teaching marketable languages such as Java, Python, or Ruby. It seems like that they are looking for ways of getting people through the program as quick as possible (maybe before they realize where they are really going into).
A little of Prolog
Nowadays Prolog is not as trendy as it used to be, although at one time it was the main competitor of Lisp as a high level language for complex applications (at least for AI-people living in Europe). However, it is often said that it is an advantage to learn Lisp even if it is just for the learning experience.
I think it is just as fair to say the same of Prolog, and here are some of the reasons why Prolog still has something to teach most programmers.
Prolog can be though as a pure functional language. In fact, it is so pure that the only values it returns are the literals true or false! In Prolog, everything happens as a binding of parameters, so there are no variables to update — only method calls, which will match parameter values to formal arguments.
The language provides a simple mechanism for accessing databases. Databases are viewed in Prolog as a set of facts that can be consulted by the rules. In this way, access to external data is treated in a logical fashion, instead of requiring imperative actions to fetch and read data. The Prolog model provides reduced impedance between code and data, which is a good thing.
Provides a simple way to represent declarative programs. Prolog is based on matching rules in a way that is transparent to developers. It tries to satisfy the requirements of each declared boolean function using its internal rule-matching engine. It is easy to think of this as a non-deterministic machine that just does the right thing as needed, without programming intervention. Of course, this machinery won’t solve any problem without some additional help, but by necessity it frees the developer from thinking on how things are done, and concentrate instead in what is being done.
In summary, I think that good programmers should explore alternative ways to create software. Learning languages with a different paradigm, such as logic programming, is an excellent way of challenging traditional thinking processes. Understanding how things could be written in Prolog may provide better solutions to practical problems, even if you need to write the resulting code in C.
Further Reading
There are not many new books devoted to Prolog, but here are some of the classic along with a few more recent ones:
The Craft of Prolog (by R. O’Keefe), which has been the source of a lot of fun since I first started playing with the language. That is still the best source of wisdom when working with Prolog.
The Art of Prolog (by Sterling and Shapiro) is another classic that describes the language in detail, along with some more advanced applications.
Programming in Prolog: Using the ISO standard is a more recent one, worthy the price because it describes the Prolog standard in detail. It should be part of any serious Prolog developer’s bookshelf.
Prolog Programming For Artificial Intelligence (by I. Bratko): a best-selling guide to Prolog and Artificial Intelligence, which has been updated to include key developments in the field.
Logic Programming with Prolog (by M.Bramer): a great tutorial of logic programming using Prolog as the main implementation language.
Clause and Effect: Prolog Programming for the Working Programmer (W. Clocksin): A subset of Prolog is used to demonstrate important concepts of the language.
758467 227092extremely nice post, i undoubtedly enjoy this fabulous web site, persist with it 576771
626730 587072Jeden Tag stellt man sich die Frage Was Koche Ich Heute?! Zerbrechen Sie sich nicht den Kopf, besuchen Sie uns am besten direkt auf unserer Webseite uns lassen Sie sich inspirieren 459326
142699 124927Thank you pertaining to giving this superb content material on your web-site. I discovered it on google. I could check back once again in the event you publish extra aricles. 352788
614396 51486Wow actually glad i came across your internet site, i??ll be certain to pay a visit to back now i??ve bookmarked it??. 358853
612072 217668[…]the time to read or pay a visit to the content or websites we have linked to below the[…]? 700166
958164 985391You got a quite amazing website, Sword lily I observed it by means of yahoo. 458023
797799 228574Thank you for your very great info and feedback from you. car dealers san jose 215262