Kotlin

TDD Pro-Tip: Suspect Sentinel Returns

TDD Pro-Tip: I suspect sentinel returns, and though I still use them, it’s generally because I haven’t found the right formulation yet. I’m working on the TSD project today, and I’ve got a nasty little chunk of code I wish weren’t nasty. (It’s in this file, and of course, you’re welcome to grab the whole repo, which will enable you to really make fun of me.) You don’t have to look at the code, I’m not going into it, but …

TDD Pro-Tip: Suspect Sentinel Returns Go to Post »

Using Kotlin for Data Builders

In Kotlin, functions whose last argument is a lambda, i call them end-lambda’s, make natural expressions of tree-shaped data builders. Say you’re building Performances, where a Performance includes (possibly) the list of songs being performed. making shit up here, it might look like: performance { song { } song { } } First thing you notice: this thing is building some tree-shaped data, and it’s tree-shaped. None of this "song1= … song2= … performance = Performance(song1, song2) shit. If you’re …

Using Kotlin for Data Builders Go to Post »

Scroll to Top