Skip to content

Instantly share code, notes, and snippets.

@ngallazzi
Last active February 4, 2022 13:45
Show Gist options
  • Save ngallazzi/07cc7bc5533cdafcba73cf3818ea2ff2 to your computer and use it in GitHub Desktop.
Save ngallazzi/07cc7bc5533cdafcba73cf3818ea2ff2 to your computer and use it in GitHub Desktop.
Mastering refactoring - Change function declaration, final code
private fun printInvoiceSheet(invoice: Invoice) {
printInvoiceHeader(invoiceNumber = invoice.number, invoiceDate = invoice.date)
printInvoiceItemsSection(invoice.items, 22.0)
}
private fun printInvoiceHeader(invoiceNumber: Int, invoiceDate: LocalDate) {
val invoiceHeader = "INVOICE N° ${invoiceNumber}, ${invoiceDate}\n\n"
binding.tvInvoicePreview.text = invoiceHeader
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment