Building a Distributed, Pluggable App with Plugin Oriented Programming (POP)
Updated: May 24
Plugin Oriented Programming (POP) is an evolution of the Salt Loader, bringing a revolutionary programming paradigm to the software world. With its structure built around plugins, contracts, and dynamic subsystems, POP moves beyond object-oriented programming (OOP), prioritizing modular flexibility over traditional classes, inheritance, and polymorphism. In this blog post, we delve into the world of POP and learn how to build a distributed, pluggable app using its unique approach.
Unpacking POP: Origins and Philosophy
POP's genesis can be traced back to its predecessor, the Salt Loader. As a core component of SaltStack, the Salt Loader was instrumental in managing Salt's modular components. Thomas Hatch, creator of SaltStack, observed the potential for such a modular, pluggable system to be made accessible to other Python projects. Thus, POP was born.
Everything in POP is a plugin. By replacing the complexity of classes with flexible plugins, Hatch introduced a more streamlined programming model. Each plugin in POP fulfills a contract, which specifies the functions and parameters expected by a subsystem. The ability to replace or extend every element makes POP extremely adaptable, opening up a new horizon of app development.
Building with POP: Simplicity and Power
Creating an application using POP is refreshingly straightforward. A couple of lines of code is all it takes to set up a "hub", a global namespace for the rest of the app:
import pop.hub hub = pop.hub.Hub()
Once the hub is established, dynamic subsystems can be added using:
The flexibility of POP comes to the fore here, as it scans Python projects in the same environment for conf.py files and uses them to extend subsystems dynamically.
Even for those new to POP, starting an app is simple. The pop-create tool, installed easily from pip, generates all the boilerplate code needed for a POP app. This includes subsystems, an entrypoint run.py, test folders, docs, pre-commit, and more.
POP in Action: Pluggability and Extensibility
POP's inherent pluggability provides a platform for unlimited extensibility and integration. Core POP apps, such as idem, heist, pop-create, rend, acct, pop-serial, and pop-evbus, lay the groundwork by defining contracts for various subsystems. Independent projects can then extend these subsystems, fostering innovation without waiting for approval or review by the original maintainers.
Idem is the poster child for POP, utilizing subsystems created by rend, pop-config, pop-evbus, pop-serial, acct, and more. The core idem runtime language is rather barebones, but its power lies in the various plugins that extend its functionality.
Despite their pluggable nature, POP apps are designed to work harmoniously with each other, thanks to the principle of maintaining flexible requirements. Carefully managing dependencies ensures that changes in one don't inadvertently disrupt the whole system.
Challenges, Future, and Resources for POP
Building distributed, pluggable apps like POP introduces unique challenges. Documentation and testing across distributed plugins can be complex. However, these challenges are not insurmountable. Already, the POP team has found effective ways of managing pipeline dependencies and consolidating distributed plugin documentation.
The future of POP holds exciting possibilities. Thomas Hatch has been considering the creation of a new programming language built on POP concepts called "Bond." This language would be entirely pluggable, based on a hierarchical namespace, and could potentially power an entire operating system.
To start your own POP project, pop-create is the best tool to rapidly prototype. You can also find various open-source Apache License apps built using POP on PyPi. For more learning resources, you can visit idemproject.io and pop.readthedocs.io. Feel free to connect with the community in the #salt or #idem channels on IRC. The beauty of Plugin Oriented Programming (POP) lies in its inherent modularity and the scalability it offers. As a paradigm shift in the world of programming, it empowers developers with unparalleled flexibility and extensibility for building distributed, pluggable apps.
For those eager to explore POP's potential, the pop-awesome resource on GitLab serves as an excellent starting point. This repository provides a curated list of POP projects, offering a comprehensive view of the ecosystem.
And remember, the POP community is open and welcoming. I encourage you to reach out and join the conversation. You can also find my email through a 'git blame' on practically any POP project on GitLab. Together, we can drive the evolution of POP and shape the future of programming.
That's the spirit of POP—building together, towards a future that's pluggable and flexible. Dive in, and let's create something awesome together.