Exception { this.isSuite = isSuite if (isTestPage(pageData)) includeSetupAndTeardownPages(); return pageData.getHtml(); } Actual example from “Clean Code” Book
== 200) { val responseBody = JSONObject(response.body()) return Profile( name = responseBody["name"], age = responseBody["age"] ) } else { Log("fetch fails with responseCode: ${response.code}) Snackbar.show("Fail to get profile data") } } Deep Functions
= new FirebaseAnalytics() fun trackAction(...) { adobeAnalytics.trackAction(values) } fun trackEvent(...) { adobeAnalytics.trackAction(values) firebaseAnalytics.logEvent(values) }
In SearchUseCase SearchRepository.searchUser("username") // In SearchRepository SearchNetworkDataSource.searchUser("username") // In SearchNetworkDataSource executeApiCall("https://api/search?query=$username") Pass-through functions/variables
zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification—and then shouldn’t be used anyway.”
of abstraction allows solving 80% of use cases with a simple API, then 80% of the remaining 20% with a more detailed API, and then the final slice with a low-level API. Each layer is built on top of the next one with a measured reduction in API complexity.” https://jakewharton.com/slope-intercept-library-design/