HackerPapers

arXiv:0911.2899cs.PL

Coding Guidelines for Prolog

Michael A. Covington, Roberto Bagnara, Richard A. O'Keefe, Jan Wielemaker, Simon Price

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Coding standards and good practices are fundamental to a disciplined approach to software projects, whatever programming languages they employ. Prolog programming can benefit from such an approach, perhaps more than programming in other languages. Despite this, no widely accepted standards and practices seem to have emerged up to now. The present paper is a first step towards 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 programming 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 fully-fledged coding standard for the project.

arXiv comments
39 pages, 4 figures, 2 tables
Journal reference
DOI
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 1 identifiable commenter in 4 comments across 4 threads, from Oct 2016 to Oct 2024. Found in 3 HN submissions from Dec 2009 to Sep 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments4 threads

    • >> Right now this seems to have all the downsides of programming exclusively with "magic strings", and I haven't been able to find any cure for it or even seen this problem discussed elsewhere. The cure is to not try to program with "magic strings". You don't need to, and if you…

      YeGoblynQueenneView on HNParent context

  1. The Power of Prolog 1 comment
    • Do I have any hints? Oh dear. The advice in this technical report is sound: Coding Guidelines for Prolog https://arxiv.org/abs/0911.2899 It goes over some style matters but also makes more practical recommendations about using the language for best results. I have followed those…

      YeGoblynQueenneView on HNParent context

    • Nice, but this: should_isolate(Person) :- has_symptoms(Person); tested_positive(Person); ( lives_with_others(Person), format(atom(LivingWithPeople), 'anyone living with ~w', Person), ( has_symptoms(LivingWithPeople); tested_positive(LivingWithPeople) ) ); ( in_bubble(Person)…

      YeGoblynQueenneView on HNParent context

    • >> getting Prolog to do cool things quickly involved knowing precisely where to put cut operators, and that was basically black magic. But it's been a while. To add to tom_mellior's much upvoatable reply, I find that the cut is much less painful if you keep your predicates small…

      YeGoblynQueenneView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.