Programming with ØMQ

Having seen some examples, you must be eager to start using ØMQ in some apps. Before you start that, take a deep breath, chillax, and reflect on some basic advice that will save you much stress and confusion:

  • Learn ØMQ step-by-step. It’s just one simple API, but it hides a world of possibilities. Take the possibilities slowly and master each one.

  • Write nice code. Ugly code hides problems and makes it hard for others to help you. You might get used to meaningless variable names, but people reading your code won’t. Use names that are real words, that say something other than “I’m too careless to tell you what this variable is really for.” Use consistent indentation and clean layout. Write nice code, and your world will be more comfortable.

  • Test what you make as you make it. When your program doesn’t work, you should know which five lines are to blame. This is especially true when you do ØMQ magic, which just won’t work the first few times you try it.

  • When you find that things don’t work as expected, break your code into pieces, test each one, and see which one is not working. ØMQ lets you make essentially modular code; use that to your advantage.

  • Make abstractions (classes, methods, whatever) as you need them. If you copy/paste a lot of code, you’re going to copy/paste errors, too.

Get ZeroMQ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.