Navigation  without Java Scripts

Advantages of Prolog

Short Development Time

In Prolog the number of program lines required to solve a given problem is typically only a fraction of that required by a procedural programming language like C or Pascal. Clearly this can reduce development costs considerably, and since the code is easier to modify, ongoing maintenance costs are often lower as well.

        

Easy to Read - Easy to Modify - Easy to learn

Many of the common programming errors in languages like C or Pascal -for example a loop that iterates one too many times or an uninitialized variable - are eliminated in Prolog. Prolog code can be thought of as a well-structured problem specification, in addition to being executable. Such code is easily read and easily modified when aspects of the domain in question change.

The code explains the problem it solves; here it is a rule that says: a person is qualified for the job if he has a proper education and is above the minimum age for that job.

/* Is the person qualified for the job? */
person_qualified(PersonId,Job):
  job_description(Job,Educations,MinAge),
  person(PersonId,Education,Age),
  member(Education,Educations),
  Age > MinAge.

The code explains the problem it solves; here a person is qualified for the job if he has the proper education and is above a minimum age. This same code could be used either to test a particular person as being qualified, or to find a qualified person, where the mechanism of backtracking automatically generates possibilities to be tested against these constraints.

Easy Manipulation of Complex Data Structures

Working with complex data structures like trees, lists or graphs often means big and complex programs managing allocation and deallocation of memory. Procedures operating on such data structures are almost impossible to keep up to date when the design of the data structure is changed. By contrast, Prolog has a simple and elegant notation for recursively defining and accessing such data structures, shielding the programmer from all details of pointers and explicit storage management.