Prefer composition over inheritance?
Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?
In a Swift protocol definition, what does it mean if there's ": class" after the protocol name?
Safe integer parsing in Ruby?
I have a string, say `'123'`, and I want to convert it to `123`.I know you can simply do `some_string.to_i`, but that converts `'lolipops'` to `0`, which is not the effect I have in mind. I want it... more
Map and Remove nil values in Ruby?
I have a map which either changes a value or sets it to nil. I then want to remove the nil entries from the list. The list doesn't need to be kept.This is what I currently have:<!-- language:... more
In Ruby, how do I skip a loop in a .each loop, similar to 'continue'?
In Ruby, how do I skip a loop in a `.each` loop, similar to `continue` in other languages?