Day 19, coffee script and backbone

Coffee script. Yeah… I miss you, Python… Overall feeling is Coffee is trying to be just like Python, but might have overdone it. Anyway, not a big deal.

Key features of Coffee:

– Same language features as Javascript, meaning no performance boosts(?)

– Indentation matters

– @ means this

– -> means function

– => means function with the correct this binding, useful for callbacks

– no ternary operators, but has “if … then … else …”

– return is not necessary

– scoping might be confusing sometimes

– arguments can have default values (c=4) or be optional ([c])

– check for existence is “if obj?”

– keywords include: is, not, or

– ‘ is different from “; “” allows variable interpolation such as “his username is #{}”

– easy list comprehension, similar to Python?

Under the hood stuff for js:

– Event system

— where events are registered, including callbacks and setTimeouts

– Execution queue

– Run loop

while (true){

work on system process such as repainting ?

consider all events firing

run queued user code


– needs to read more on this topic

This sprint is a flexible sprint. You can choose to work on a Backbone project with Coffee script or review previous sprints. Jake and I paired again and we chose to work on the Blackjack Backbone Project with Coffee. It was fun and we had a blast. However, our game started with some random bugs due to our still superficial understanding of both Backbone and Coffee script. The most interesting bug is that we forgot to remove the old event listener after user resetting game. As a result, in the second game, user will lose/win twice the amount of his bet, third game will be three times the amount. It takes a while to figure out why there are multiple winning or losing event firing, but I laughed so hard that once I knew what was going on. It was like a snow ball gambling game. The system forces you to go big or go home baby.