Hacker News new | past | comments | ask | show | jobs | submit login

This is what I was looking for. I gather the framework is allergic to conditionals.



Behavior can be provided through directives via elements, attributes, css class names, and comments.

It isn't "allergic to conditionals". It just drives the logic elsewhere to keep the presentation layer looking as clean as possible to the developer so that you can either focus on the view (template) or the controller or model.


I think you described exactly what I meant by "allergic to conditionals": a philosophy that conditional logic never belongs in the presentation layer. I didn't intend to imply a value judgement.


> I didn't intend to imply a value judgement.

I will. That seems dumb.

Why are conditionals not allowed in presentation layer but repetition is ?


It's a judgement call. Some people are wary that going nutty with conditionals in templates could result in littering bits of 'business logic' in them - they prefer to take an all-or-nothing stance and go for nothing.

Personally I like the sort of middle-ground approach that Handlebars [1] has, I'm fine with basic 'truthy/existence' type checks, but will avoid templating languages that allow 'any old code'.

I think this sort of discipline (picking a deliberately restrictive library) is probably more useful for teams than individuals (who are capable of limiting their own conditional crazy).

[1] http://handlebarsjs.com/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: