Brace expansion works wonders. Use it.
If ever in doubt what it expands to you can run this in your Ember app’s console:
Or play with it interactively with this ember-twiddle.
Brace expansion can be use in all kinds of nice ways and in any place where you would use a dependency string or set of strings. For example I do this a lot:
myValue is either the previous value while the current value is still loading and then switches over when ready. I can even use
myValue in liquid-fire to allow animations when the current value updates. There is lots more. Mostly if you can express things with brace notation do so it is so much easier to read.
Don’t use observers You’re asking for a world of hurt. Every time I’ve used them they brought on weird bugs and hours of lost time trying to understand them. They also introduce race conditions and circular loops.
The only two times an observer is worth it is:
- When you have reached the end of the line with computed properties. Usually you never need to worry about this because the end of the line happens in glimmer internals and you never have to think about it. But if your wrapping a jQuery plugin which requires you to call a method when something changes then the wrapper is the end of the line and you forced to use an observer.
- Or you are debugging something and the only thing in the observer is
But that should be the only time. Any other time can be refactored and changed. I would fight tooth and nail against observers.
There is no ugly; Ember is awesome!