I've found the SOLID principles quite useful when thinking about object-oriented design.
Is there a similar / equivalent set of language-agnostic principles tailored for functional programming?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
It is a bit difficult to find equivalents but I can try:
SOLID turns out to be a good idea for the functional/imperative realms too.
SRP - 'Only do one thing' was taken from imperative programming in the first place. Having small, focused functions is good.
OCP - Allowing you to change behaviors without modifying code is good. Functional programming uses higher order functions more than inheritance, but the principle holds.
LSP - Abiding by some interface contract is just as good in functional programming as in object oriented. If a sort function takes a comparator, then you would expect the '0 is equals, less than provides negative results, greater than positive results' behavior.
ISP - Most functional languages still have structs. Specifying the smallest set of data required by a function is still good practice. Requiring the least specific interface to the data (why use Lists of ints when Enumerations of T work just as well?) is still good practice.
DIP - Specifying parameters to a function (or a higher order function to retrieve them) rather than hard coding the function to go get some value is just as good in functional programming as in object oriented.
And even when doing object oriented programming, many of these principles apply to the design of methods in the objects too.