Tuesday, June 26, 2018

Next.js (contemporary of Socket.io?)

I just read an article describing another real-time javascript library, next.js.  I have enjoyed using socket.io for sometime now.  It's easy to overlook competitors when you're happy with what you know, love and use.  I'm curious as to what advantages next.js brings to the table and may be a point of study in the near future.

That being said, it's always fun learning something new.

https://codeburst.io/build-a-chat-app-with-sentiment-analysis-using-next-js-c43ebf3ea643

This leads me to wonder what other real-time libraries might be competitors to Socket.io and Next.js.

Monday, June 25, 2018

Custom Properties (Singel pattern)

I'm always trying to find ways to make my code more maintainable.  How many times have you come back to your code 2 months down the road only to ask yourself, "What's going on here?"  Admittedly, I have a short term memory, so it's definitely a good idea to use techniques that create self-documenting code, re-use common patterns and make it easy to hop in and add features without necessitating a 4 hour audit of the code first.

I recently read an article by Diego Haz that suggests that one favor creating more components versus simply passing in custom properties to determine how a component gets rendered.
Unless you're creating a well-documented open source library, resist that. Besides introducing the need of documentation, it's not scalable and will lead to unmaintainable code. Always try to create a new single element — such as AvatarRounded — which renders Avatar and modifies it, rather than adding a custom prop.
Diego admits that custom properties are not evil, but should only be used after carefully considering their need.