DEV Community

Cover image for Top 5 DEV Comments from the Past Week
Gracie Gregory (she/her) for The DEV Team

Posted on • Updated on

Top 5 DEV Comments from the Past Week

This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.


@mileswatson offers up some great advice for keeping on task in how do you guys keep your productivity?:

  1. Pomodoro timer - work for 25 minutes, then a break for 5 minutes
  2. A todo list app - write down the tasks you want to get done that day BEFORE starting
  3. Take regular leisure breaks to keep your mind clear
  4. Try and remove distractions as much as possible during the working periods.

@thorstenhirsch offers some excellent constructive feedback + additional info to the already awesome article Redis, Kafka or RabbitMQ: Which MicroServices Message Broker To Choose?:

Nice & comprehensive overview of one of my favourite topics, message oriented middleware (MOM), thank you Assyahid. :-)

Just some remarks from my side:

  • RabbitMQ is far from being one of the first brokers. Messaging was invented and/or became popular in the 90's with IBM MQ and several JMS implementations. However RabbitMQ might be one of the earliest free message brokers (together with ActiveMQ).

  • While the 1:1 pattern makes use of queues (where messages are just being queued), I would suggest to explain the 1:n pattern with topics and subscriptions (publish/subscribe). Kafka works that way. RabbitMQ is a bit more complicated, but also doesn't just use queues for 1:n message routing, but introduces exchanges for that matter. I think exchanges are specific to RabbitMQ, at least I haven't seen them anywhere else, so the more popular 1:n implementation is definitely publish/subscribe.

  • One of the best features of Kafka is its ability to replay messages. It is based on Kafkas append-only log with pointers to the last message that has been fetched from each subscriber. So while message brokers were initially not designed for persistency, Kafka has indeed managed to provide a pretty good persistency. However there's no good way to query data, because Kafka has no idea of the data structures in the messages, so in the end it's still a bad way to persist your data and should only be used additionally (e.g. for streaming) to a database.

@michi points out that using classes is all about code organization for them in You don't need classes:

It's more about code organisation more than anything else for me. I rather have one class be responsible for something than 10 loose functions all transforming a piece of data slightly differently.

One use case I like to use classes for is ORMs like in Adonisjs:

const user = await User.find(userId)
user.name = 'new name'
await user.save() // user.delete(), etc.

// Or

const user = new User
user.name = 'new name'
await user.save()

// Or

await user.projects().create({ name: 'new project' })
Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode

Enter fullscreen mode Exit fullscreen mode

All the above just reads very natural to me, the API is very pleasing and simple.

But I agree that they are not needed in many cases.

</div>
Enter fullscreen mode Exit fullscreen mode

@golangch gave the best possible compliment imaginable to I've created an awesome painting app using React and Canvas API:

Do you listen to music while coding? @mindninjax does so long as the task doesn't require too much attention:

(https://dev.to/mindninjax/comment/19iok)

That's exactly what I do too...

Here's the algorithm:

if task == 'attention required':
   music = False
else:
   music = True
Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode

Enter fullscreen mode Exit fullscreen mode
</div>
Enter fullscreen mode Exit fullscreen mode

See you next week for more great comments ✌

Top comments (0)