🤔 @mpj wrote an interesting gist & discussion on JSX vs Templating which has prompted me to think about how you judge complexity and how you decide to take on complexity. Got any thoughts?
Gist here: https://gist.github.com/mpj/d37bb421efe1e3eda4a6da7e18864362
@dnrvs @mpj for me Vue templates look more understandable and clear than that compact JSX. I know JS but I have no idea what will be rendered after looking into that JSX for 5 seconds. I also think it is bad to mix 'programming' style (Array.filter, map) in JSX. It is hard to see where logic goes. In templates (lodash, angular, etc) it is separated.
@DmytroGladkyi @dnrvs I updated the example a bit now, based on this feedback. I went for terseness because JSX was made out to be verbose.
@dnrvs @mpj On my project we had a lot of logic introduced in lodash templates. It was impossible to debug what would be rendered (or why). I refactored view templates to just accept final values which are then placed in divs, checkbox etc. All logic was left in JS controllers.
So you could call $el = this.template(viewModel) and it will be directly mapped into some HTML elements. viewModel is prepared by controller from REST/some other source.
@DmytroGladkyi @dnrvs I get that all these things are problems, but I still don't think there is any sense in introducing a whole programming language into your stack just to get rid of bad habits in your team. If you have problems with logic in your templates, you can solve that by educating your team or some linter rules or something.
@mpj @DmytroGladkyi @dnrvs love this answer. It's so much easier to throw technology at a people problem. But so much more valuable to focus on the people.
@pavsaund @DmytroGladkyi @dnrvs thanks for the kudos. I'm often self-consious and uncertain when making these statements, but I really think that we need to think about culture first and then build tools to support that culture, and not fall into the trap that we can replace culture with safeguards. The culture needs to be strong in the first place, in order for the tools to work and make the culture stronger.
@mpj @dnrvs @DmytroGladkyi it really works both ways. When a teammate is passionate about something it's worth listening and actually be willing to try it. Then also to be able to have the candid discussions afterwards about which parts worked.
We recently did this with remote #MobProgramming. Some things worked, others didn't. Result: more pairing, some mobbing, but in general more conversation and trust.