|
|
|
|
|
by mopierotti
2185 days ago
|
|
I agree with the gist of your post, but one positive about single use functions is that you can be explicitly clear about data visibility. In this contrived example, you can tell that formatting a title is not affected by user preferences, but formatting the body is. (And additionally that formatting a body has no information about the other fields of an entry) def formatRssFeedEntries(userSettings: UserSettings, data: List[Entry]) {
val titles = data.map(entry => formatTitle(entry.title))
val bodies = data.map(entry => formatBody(entry.body, userSettings))
...
}
|
|