Composing behavior with resources