# Constrained Programming Created: 2023_04_05 13:51 Tags: [[Technology]] From the beginning of computation, we described a sequence of steps that the computer should follow to execute a program. In this paradigm we described *how* it should take inputs and every step along the way how it should transform the data. This is **Imperative programming**. Another way of expressing a program is by declaring what transformations should be made in a more mathematical sense. In this paradigm we described *what* transformations should be used to make the intended transformations. This is **Declarative programming**. In a sense, we are attempting to convey to a computer what the *intent* of our desired program is. For example, we intend to create a banking app but to do that we need to describe *how and what* operations can be performed and on *what data*. Some tasks may be better suited to different paradigms (e.g. SQL, being declarative, is the language for describing database operations and storage). But all programs require intent, what is being solved? Why? Under what constraints?With this, I introduce a new paradigm. ## Constrained Programming Constrained programming is: *given a set of constraints, a solution can produced that satisfies those constraints*. Whether the intent of the program is a program that adds two numbers or a banking app, it is the natural progression to an even higher level of programming. | Programming Paradigm | Mode of operation | Unit of operation | | -------------------- |:-----------------:| ------------------------- | | Imperative | How | Commands and control-flow | | Declarative | What | Transformations functions | | Constrained | Intent | Constraints | An idea might be that in many languages you will need to describe something that operates on the HTTP spec. What if the HTTP spec was formally described, and from that specification you could generate something that complies with the spec in any language. Do people really care that software is well-designed? The majority of people involved (users) could care less, they just want something that works. Software engineers sometimes confuses the means for the ends, likely because they write the code and are forced to deal with it again (across large amounts of time even) and they would prefer it to be easily understandable for modification later. But what if you didn't need to modify it? What if your description of intent was the only thing you had to modify? Here are a set of loose ideas on possible implementations of this paradigm [[Constrained Programming Scratchpad]]. ## References -