Dienstag, 17. März 2015

Why combining React and Meteor is a bad idea

If you haven't read Dan Yoders post on why React is a terrible idea in general, I strongly encourage you to do so since I am not going to repeat all the excellent arguments he presented already. Instead I would like to add some of my thoughts on why using React together with Meteor is a bad conceptual idea.
I don't want this to be perceived the wrong way, I am a big fan of Percolate Studio and the things they build. And of course I also appreciate the support of React in Meteor in terms of broadening the Meteor community. While I think it is a great way to get new Developers who are already familiar with React on board with Meteor, I think it is important to stick with the paradigms a platform like Meteor was built for.


viewmodel-05.png
One of Meteor's core concepts - the MVVM pattern

If you start a new Meteor project (and remove the autopublish/insecure package - which you should do anyway) you get an amazing  implementation of the Model View ViewModel pattern out of the box. Again this applies as long as you don't fiddle around with Meteors core packages like DDP, Tracker or Blaze -  oh wait, yes that is exactly what React is doing here: trying to replace Blaze.
So you don't really care about patterns or best practices as long as things work and things work fast? Good for you, but here are some reasons why you should probably reconsider:

Collaboration

Even though you might be a React master, someone else in your team might not have the same knowledge and struggle reading your React code. I would not blame them, it is bad practice to combine Model, View and Controller code!!

Maintenance

The strict separation of your views and the underlying model is good for your applications in the long term. You always know where you have to look for the problem if something goes wrong. Also new team members will get up to speed much faster if they find a common ground.

Scale-ability

Keeping your application loosely coupled will allow you to massively scale once the time has come. Ever since I learned about the cluster package and its possibility to create MicroServices I think there is almost no limit there.

Standards <3

Last but not least there is a reason why W3C is developing web standards and browsers implementing them. If we all need Reacts virtual DOM so badly, maybe we should spend more effort on optimizing the existing one and have all web applications benefit from it.