Skip to main content Accessibility help

Coding guidelines for Prolog


Coding standards and good practices are fundamental to a disciplined approach to software projects irrespective of programing languages being employed. Prolog programing can benefit from such an approach, perhaps more than programing in other languages. Despite this, no widely accepted standards and practices seem to have emerged till now. The present paper is a first step toward filling this void: It provides immediate guidelines for code layout, naming conventions, documentation, proper use of Prolog features, program development, debugging, and testing. Presented with each guideline is its rationale and, where sensible options exist, illustrations of the relative pros and cons for each alternative. A coding standard should always be selected on a per-project basis, based on a host of issues pertinent to any given programing project; for this reason the paper goes beyond the mere provision of normative guidelines by discussing key factors and important criteria that should be taken into account when deciding on a full-fledged coding standard for the project.

Hide All
Ausnit-Hood, C., Johnson, K. A., Pettit, R. G. IV, and Opdahl, S. B., Eds. 1997. Ada 95 Quality and Style, Guideline for Professional Programmers, Lecture Notes in Computer Science, vol. 1344. Springer-Verlag, Berlin, Germany: Springer-Verlag.
Brady, M. H. 2005. ‘Runsort’—An A daptive Mergesort for Prolog. Computer Science Technical Report TCD-CS-2005-34, Computer Science Department, Trinity College Dublin, Ireland.
Clocksin, W. F. and Mellish, C. S. 2003. Programming in Prolog, 5th ed.Springer, Berlin, Germany.
Covington, M. A. 1994. Computer languages in type. Journal of Scholarly Publishing 26, 1, 3441.
Covington, M. A. 2002. Some coding guidelines for Prolog [online]. Retrieved 14 June 2011. Available at
Covington, M. A., Nute, D. and Vellino, A. 1997. Prolog Programming in Depth. Prentice-Hall, Upper Saddle River, NJ.
Fages, F. and Coquery, E. 2001. Typing constraint logic programs. Theory and Practice of Logic Programming 1, 6, 751777.
Green, R. 1996–2010. Unmaintainable code [online]. Retrieved 14 June 2011. Available at
Hermenegildo, M. V. 2000. A documentation generator for (C)LP systems. In Computational Logic: Proceedings of the First International Conference (CL 2000), Lloyd, J. W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Palamidessi, C., Pereira, L. M., Sagiv, Y., and Stuckey, P. J., Eds. Lecture Notes in Computer Science, vol. 1861. Springer-Verlag, London, UK, 13451361.
Hill, P. M. and Lloyd, J. W. 1994. The Gödel Programming Language. MIT Press, Cambridge, MA.
Hoare, C. A. R. 1962. Quicksort. The Computer Journal 5, 1, 1016.
Jeffery, D., Henderson, F. and Somogyi, Z. 2000. Type classes in Mercury. In Proceedings of the 23rd Australasian Computer Science Conference (ACSC 2000), Edwards, J., Ed. IEEE Computer Society, Canberra, Australia, 128135.
Kernighan, B. W. and Pike, R. 1999. The Practice of Programming. Addison-Wesley Longman, Boston, MA.
Kernighan, B. W. and Plauger, P. J. 1978. The Elements of Programming Style, 2nd ed.McGraw-Hill, New York, NY.
Ledgard, H. and Tauer, J. 1987. Professional Software, Vol. 2: Programming Practice. Addison-Wesley Longman, Boston, MA.
Moura, P. 2003. Logtalk – Design of An Object-Oriented Logic Programming Language. Ph.D. thesis, Department of Computer Science, University of Beira Interior, Portugal.
Mycroft, A. and O'Keefe, R. A. 1984. A polymorphic type system for Prolog. Artificial Intelligence 23, 3, 295307.
O'Keefe, R. A. 1990. The Craft of Prolog. MIT Press, Cambridge, MA.
Schimpf, J. 2002. Logical loops. In Proceedings of the 18th International Conference on Logic Programming (ICLP 2002), Stuckey, P. J., Ed. Lecture Notes in Computer Science, vol. 2401. Springer, Copenhagen, Denmark, 224238.
Somogyi, Z., Henderson, F. and Conway, T. 1995. Mercury: An efficient purely declarative logic programming language. In Proceedings of the 18th Australasian Computer Science Conference (ACSC '95), Glenelg, Australia, February 1995, (Kotagiri, R., Ed.) Australian Computer Science Communications 17, 1, 499512.
Sun Microsystems. 1999. Code conventions for the Java programming language [online]. Retrieved 14 June 2011. Available at
Thompson, E. M. 1893. Handbook of Greek and Latin Palæography. Kegan Paul, Trench, Trübner & Co, London, U.K.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *



Altmetric attention score

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed