Hostname: page-component-cd9895bd7-gvvz8 Total loading time: 0 Render date: 2024-12-28T17:33:57.716Z Has data issue: false hasContentIssue false

Coding guidelines for Prolog

Published online by Cambridge University Press:  30 June 2011

MICHAEL A. COVINGTON
Affiliation:
Institute for Artificial Intelligence, The University of Georgia, Athens, GA, USA (e-mail: mc@uga.edu)
ROBERTO BAGNARA
Affiliation:
Department of Mathematics, University of Parma, Itlay BUGSENG srl, Parma, Italy (e-mail: bagnara@cs.unipr.it)
RICHARD A. O'KEEFE
Affiliation:
Department of Computer Science, University of Otago, Dunedin, New Zealand (e-mail: ok@cs.otago.ac.nz)
JAN WIELEMAKER
Affiliation:
Department of Computer Science, VU University Amsterdam, The Netherlands (e-mail: j.wielemaker@cs.vu.nl)
SIMON PRICE
Affiliation:
Intelligent Systems Laboratory, University of Bristol, Bristol, UK (e-mail: simon.price@bristol.ac.uk)

Abstract

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.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2011

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

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.Google Scholar
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.Google Scholar
Clocksin, W. F. and Mellish, C. S. 2003. Programming in Prolog, 5th ed.Springer, Berlin, Germany.Google Scholar
Covington, M. A. 1994. Computer languages in type. Journal of Scholarly Publishing 26, 1, 3441.Google Scholar
Covington, M. A. 2002. Some coding guidelines for Prolog [online]. Retrieved 14 June 2011. Available at http://www.ai.uga.edu/mc/plcoding2002.pdfGoogle Scholar
Covington, M. A., Nute, D. and Vellino, A. 1997. Prolog Programming in Depth. Prentice-Hall, Upper Saddle River, NJ.Google Scholar
Fages, F. and Coquery, E. 2001. Typing constraint logic programs. Theory and Practice of Logic Programming 1, 6, 751777.CrossRefGoogle Scholar
Green, R. 1996–2010. Unmaintainable code [online]. Retrieved 14 June 2011. Available at http://mindprod.com/jgloss/unmain.htmlGoogle Scholar
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.Google Scholar
Hill, P. M. and Lloyd, J. W. 1994. The Gödel Programming Language. MIT Press, Cambridge, MA.Google Scholar
Hoare, C. A. R. 1962. Quicksort. The Computer Journal 5, 1, 1016.CrossRefGoogle Scholar
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.Google Scholar
Kernighan, B. W. and Pike, R. 1999. The Practice of Programming. Addison-Wesley Longman, Boston, MA.Google Scholar
Kernighan, B. W. and Plauger, P. J. 1978. The Elements of Programming Style, 2nd ed.McGraw-Hill, New York, NY.Google Scholar
Ledgard, H. and Tauer, J. 1987. Professional Software, Vol. 2: Programming Practice. Addison-Wesley Longman, Boston, MA.Google Scholar
Moura, P. 2003. Logtalk – Design of An Object-Oriented Logic Programming Language. Ph.D. thesis, Department of Computer Science, University of Beira Interior, Portugal.Google Scholar
Mycroft, A. and O'Keefe, R. A. 1984. A polymorphic type system for Prolog. Artificial Intelligence 23, 3, 295307.Google Scholar
O'Keefe, R. A. 1990. The Craft of Prolog. MIT Press, Cambridge, MA.Google Scholar
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.Google Scholar
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.Google Scholar
Sun Microsystems. 1999. Code conventions for the Java programming language [online]. Retrieved 14 June 2011. Available at http://java.sun.com/docs/codeconv/.Google Scholar
Thompson, E. M. 1893. Handbook of Greek and Latin Palæography. Kegan Paul, Trench, Trübner & Co, London, U.K.Google Scholar