Here is a comparison of two pieces of code that do basically the same thing.
So what we have here is a chain of functions depending on each other, each consecutive takes the result of the previous one for further processing. If either of them fails, the rest shall not be executed.
- validate parameters received from the outside world in a Hash
- convert one of the parameters into an object
- do a search in the database