How to Hidden Temporal Couplings / In Kotlin and Android

override fun bakeOne(menu: MENU): Dish {
this.selectedMenu = menu
prepareIngredients() // Prepare the "Mise en place".
prepareDough()
// Prepare the dough.
prepareSauce()
// Prepare the sauce.
topDough()
// Top dough with the sauce.

return bake()
}
override fun bakeOne(menu: MENU): Dish {
val selectedMenu = menu
val ingredients = prepareIngredients(selectedMenu)
val dough = prepareDough(ingredients)
val sauce = prepareSauce(ingredients)
topDough(dough, sauce)


return bake(dough)
}

in Android,

    initToolbarTitle()
initBreadcrumb()
initListOfElements()
initCloseButton()
initSearchExperience()
collectDataAndSubmit()
val listOfInitTaskForTheView = arrayListOf(
initToolbarTitle,
initBreadcrumb,
initListOfElements,
initCloseButton,
initSearchExperience,
collectDataAndSubmit
)
listOfInitTaskForTheView.forEach { it.invoke() }
private val initToolbarTitle = { // Do something. }

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store