White paper


Basic software engineering principles are universal and apply to any programming paradigm. Logic programming is no exception. Principles such as encapsulation, separation of concerns, and separation between interface and implementation help make programming in the large effective. A comprehensive set of development tools that supports code writing, documenting, and testing using modern software development methodologies is also key. Yet, a large number of Prolog applications are developed on an ad-hoc basis and with incipient tools.

The traditional Prolog solution for encapsulation is a module system. There is even an official ISO Prolog standard for modules. But it is ignored by the Prolog vendors and implementers due its shortcomings. Prolog implementation of modules (for those systems that do implement them) differ, hindering portability. Worse, most modules systems do not enforce encapsulation and do not provide even basic support for separation between interface and implementation. Simple tasks such as having multiple implementations for the same interface have no clean solution and can only be approximated by hacking. In addition, the lack of strong standards results in each Prolog system effectively living in its own ghetto and creates barriers for application migration and for an effective exchange of tools and libraries.

Logtalk: Logic Programming meets Software Engineering

Logtalk is designed from the ground up to provide modern, proven, code encapsulation and code reuse mechanisms based on a declarative interpretation of object-oriented concepts. It allows clean and elegant implementations of well-know programming patterns. It provides a venue to apply software engineering know-how to the development of declarative solutions for complex problems.

Logtalk implementation is focused on wide portability, providing an effective abstraction layer over the differences between Prolog systems, which are used as back-end compilers. Most Prolog specific features can be, however, leveraged and used from within Logtalk.

The Logtalk distribution features portable libraries and portable debugging, profiling, documenting, diagraming, and testing tools plus extensive code editing and publishing support. Integration with selected Prolog back-end development tools is supported. Third-party tools are also available.

Logtalk, its libraries, and its development tools are examples of non-trivial and fully portable code running as-is on most modern, standards-compliant, back-end Prolog systems. Together, they provide an ecosystem that fosters development of portable applications and helps shifting application maintenance from porting code to writing portable code.

Portable solutions: porting code versus portable code

Porting code running on legacy Prolog systems  to a modern implementation allows keeping customer investments on their applications but also gives an opportunity for refactoring and for making the code more portable.

Portable code capable of running on multiple back-ends minimizes obsolescence risks, maximizes resilience, and simplifies migration whenever alternative Prolog back-end implementations offer better value.

Common scenarios include using different back-ends for development and deployment, deployment using multiple back-ends, and shifting the decision on the deployment back-end to the end of the development process when final integration testing results become available.