📜 ⬆️ ⬇️

How Emoji can improve your code (actually)

Translator's note: in the breaks between holivars about JS, I propose to discuss a frivolous, Friday topic:


Who doesn't love emoji? By actively using them in instant messengers and email applications, I decided to experiment with how you can apply them wisely in everyday application development. Although at first it was just a joke, Emoji really proved useful in a number of cases. How so?


We, programmers, read a lot of text - be it code, logs, comments to commits, documentation, or anything else. Emoji is conspicuous, and it is much easier to find them on a sheet of text than a regular line. Faster search - higher productivity. Although even if it doesn’t affect your productivity, it’s fun to use emoji! Here are some things I tried out in practice:


Emoji in the comments


For example, you need to add a warning to a code like this:




I regularly write similar notes in the code, but years of experience show that no one reads them, including myself. What could make a comment more visible and eye-catching? For example, emoji:




Since Emoji is easier to read when you scroll through text, they can be useful if you and your colleagues agree to flag certain things with them:




Well, again, even if you have no practical use for emoji in the comments, it is fun to communicate with teammates:


// ?
// O(n²)


And since these are just comments, the chance to break something is very small.


Emoji in commit descriptions


The commits' descriptions are mostly pretty dreary, but the emoji dilute the setting. I adhered to the rule "no more than one emoji in the message" and while in it I was not disappointed:



Translator’s note: the author violated his rule in one place


Although this is not a serious example, I want to repeat it - Emoji improves readability. If you are looking at a huge list of commits, which is not uncommon in large projects, it becomes much easier to find a specific commit in the list. The Github Atom editor even has a guide on how to use emoji in commits .


Emoji code


I have not used Emoji in the "combat" code yet, but I still think that there is an application there too. Most languages ​​support the use of emoji in strings, which may be convenient for reviving logs:




Emoji also makes it possible to explain a serious programming concept in light, fun examples:




How to recruit emoji


Productivity in using Emoji depends on how convenient it is for you to recruit them. I use the global keyboard Ctrl + Cmd + in OS X, which brings up the menu with emoji in most applications. It looks like this (you can judge me by the list of frequently used characters):



By the way, in Windows 10 there is a built-in emoji support in the on-screen keyboard , which also seemed to me quite comfortable.


Emoji and editors


Emoji is fun to use, but if your editor doesn't support them, alas. Fortunately, most modern development environments are joining the Emoji Revolution. I am writing this article in Sublime Text and there is support there, although some characters are still distorted.




I also use Visual Studio Code, and this editor copes with the task with a bang:




My favorite iTerm2 terminal also supports emoji. This is how I post a new commit:




Unfortunately, not all programs support emoji yet. Many of us have to work with legacy tools, which also have problems with ordinary symbols. But we can change that. If you use a program in which there is no support for emoji, create a ticket or send a request to add functionality. And may the Emoji revolution be accomplished!


Translator's note: Habraparser is absolutely not friendly with Emoji, so I had to use pictures and emoticons.


')

Source: https://habr.com/ru/post/308362/


All Articles