#If I have 10 functions that I want to
1 messages · Page 1 of 1 (latest)
You might want to look into Fluent Interface design https://en.wikipedia.org/wiki/Fluent_interface
In software engineering, a fluent interface is an object-oriented API whose design relies extensively on method chaining. Its goal is to increase code legibility by creating a domain-specific language (DSL). The term was coined in 2005 by Eric Evans and Martin Fowler.
What kind of variables do you need to pass between the functions?
in response to your question, I would personally say that it depends on the actual nature of the data that you're passing around - I think 1 can be pretty easy to refactor, so long as the functions are as Functional as possible
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state o...
The idea with fluent is that, for each step in a set of operations, a function acts on some sort of data object, and the function returns the data object in its modified form
I think it sounds kinda odd, but in practice it reads really well
And so I suppose that implies that Fluent works best when your set of operations are all being applied to the same object