I have a class which uses a connection object to send the request data created by a request_builder object.
The code looks like this:
connection.send_request(request_builder.build_request(customer))
This in turn is called by
build_report(customer, connection.send_request(request_builder.build_request(customer)))
Ugly! Any ideas on how to make it more expressive? Usually in ruby and OOP we chain objects like this: “string”.make_it_bigger.flash_it.send
It’s code, that how it looks. But you can make yourself a favour by not trying to cram everything together on one line:
if you told us more about your code base we might be able to suggest something else, but you don’t give us very much to go on. What does the
request_builderobject do? Doesconnection.send_request(...)return a response? Why does a report need a customer and a response (assuming that’s what is returned byconnection.send_request(...)), and so on.