<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: koba-yu</title>
    <description>The latest articles on DEV Community by koba-yu (@kobayu).</description>
    <link>https://dev.to/kobayu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F55314%2F19e9d82a-9c67-495a-8f3e-79dfc11c6a63.jpeg</url>
      <title>DEV Community: koba-yu</title>
      <link>https://dev.to/kobayu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kobayu"/>
    <language>en</language>
    <item>
      <title>Convert legacy Japanese encoding by Red</title>
      <dc:creator>koba-yu</dc:creator>
      <pubDate>Sat, 06 Aug 2022 07:42:18 +0000</pubDate>
      <link>https://dev.to/kobayu/my-red-story-3-converting-legacy-japanese-encoding-to-utf-8-31d6</link>
      <guid>https://dev.to/kobayu/my-red-story-3-converting-legacy-japanese-encoding-to-utf-8-31d6</guid>
      <description>&lt;p&gt;In this post, I talk about coding with Red programming language. The repo is &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8"&gt;here&lt;/a&gt;. Red has great feature to parse and convert string/binary data. I hope this post helps you understand Red's ability!&lt;/p&gt;

&lt;h2&gt;
  
  
  Encoding is a curse in Japan
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;This paragraph does not explain codings but the Japanese cultural context. Skip if you are not interested.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Japanese is probably one of the most suffering people from encoding trouble in the world. We have 3 traditional character types - hiragana, katakana, and kanji - and even unique symbols like ♨(hot spring) and emojis! Especially kanji has too many characters. For example, &lt;code&gt;辺&lt;/code&gt;, &lt;code&gt;邉&lt;/code&gt;, and &lt;code&gt;邊&lt;/code&gt; have the semantically same meaning but we need to select the character correctly when it is used as surname kanji, especially in a formal context like weddings. It depends on which character was chosen when his/her ancestor registered his/her surname to the government in the Meiji era(around 1900). Anyway, we needed custom Japanese encoding until Unicode was established. In those days, Japanese people mainly used encoding called "ShiftJIS" and many legacy systems still output their files by this encoding. To make matters worse, Microsoft Excel in Japan can open the file as UTF-8 &lt;strong&gt;only when it has BOM&lt;/strong&gt;. Without BOM, its default choice is "ShiftJIS" (and there are fewer chances the file has BOM...). If you open a UTF-8 file without BOM by Japanese Excel, it cannot show characters correctly. This has been continuing to spread confusion for people unfamiliar with IT, and many people still think "System should be able to output a ShiftJIS file". These are why even nowadays Japanese programmers (like me) need to deal with "ShiftJIS" encoding files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's convert ShiftJIS to UTF-8 by Red
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Motivation
&lt;/h3&gt;

&lt;p&gt;I often use Red programming language for my data processing. Though Red is a fantastic language, it is young and does not support easy encoding transformation at least now. Of course, most popular languages can read/convert a ShiftJIS file to UTF-8 so I can handle encoding by using those languages. However, it is more useful for me if I can convert only by Red, without other language. Therefore I tried to implement the code. This post explains how to code it.&lt;/p&gt;

&lt;h3&gt;
  
  
  About codes
&lt;/h3&gt;

&lt;p&gt;The code I made is &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8"&gt;here&lt;/a&gt;. I explain what I did and some points of the code in this post.&lt;/p&gt;

&lt;h4&gt;
  
  
  1st Step, make a map for byte mapping (by C#)
&lt;/h4&gt;

&lt;p&gt;Unfortunately, there is no logical codepoint conversion rule between ShiftJIS and UTF-8. Therefore I had to get a byte map, from 1 Shift-JIS character bytes to corresponding UTF-8 character bytes. However, I could not find any reliable comparison table on the internet. So I wrote &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/tools/ShiftJIS-UTF8-mapping.linq"&gt;C# code&lt;/a&gt; to make it. You can run this code by &lt;a href="https://www.linqpad.net/"&gt;LINQPad&lt;/a&gt; app, a very famous C# scratch pad. It is free for basic features. This code loops through all of the possible int values from the beginning of ShiftJIS codepoint to the end, gets a char instance from the int value and then gets a byte array from the char. You think it is easy, don't you? But there are a lot of "pitfalls" - ShiftJIS has "undefined" codepoints everywhere! So I have to skip them but there is no logical way to judge whether a certain codepoint is "defined" or not. I have to hard-code specific codepoints to skip...&lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/tools/ShiftJIS-UTF8-mapping.linq#L50"&gt;here&lt;/a&gt; is a list of the value ranges where I had to skip. It was too many to type😂. &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/tools/shift-jis-utf8-bytes.txt"&gt;shift-jis-utf8-bytes.txt&lt;/a&gt; is the resulting output of the code. In this file, a pair of the byte expressions are in each line, separated by &lt;code&gt;|&lt;/code&gt;. The left part is a hexadecimal ShiftJIS byte expression and the right is the corresponding UTF-8 one. Some of the lines are listed below as an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;80|C280
8150|EFBFA3
8151|EFBCBF
8152|E383BD
8153|E383BE
  ・
  ・
  ・
EAA0|E6A787
EAA1|E98199
EAA2|E791A4
EAA3|E5879C
EAA4|E78699
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2nd Step, make Red map! value as a conversion table.
&lt;/h4&gt;

&lt;p&gt;Now I have got the byte table so I can process the table to convert it to Red’s &lt;code&gt;map!&lt;/code&gt; value. This is very easy. The code is &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/tools/save-bytemap.red"&gt;here&lt;/a&gt;. The step is just;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Split each line by &lt;code&gt;|&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Convert hexadecimal string to binary! value by &lt;code&gt;dabase/base xxxx 16&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The resulting file is &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/bytemap.red"&gt;bytemap.red&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Final Step, parse and replace binary value for converting.
&lt;/h4&gt;

&lt;p&gt;Finally, I can write actual code to convert. &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/shiftjis-to-utf8.red"&gt;shiftjis-to-utf8.red&lt;/a&gt; is the final file. The code is really short and neat thanks to Red's &lt;code&gt;parse&lt;/code&gt; feature. &lt;/p&gt;

&lt;p&gt;In &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/shiftjis-to-utf8.red#L11"&gt;line 11&lt;/a&gt;, I include the &lt;code&gt;bytemap.red&lt;/code&gt; file that I created in the previous step. Then I make a rule block &lt;code&gt;special-bytes&lt;/code&gt; to judge whether the binaries are ShiftJIS-defined bytes or not. If not, the bytes must be inside the ASCII code range. ShiftJIS has the same codepoints up to ASCII's code end as UTF-8 does. &lt;code&gt;Special-bytes&lt;/code&gt; block looks like below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
    #{80} | 
    #{8150} | 
    #{8151} | 
    #{8152} | 
    #{8153} | 
    #{8154} |
    　・
    　・
    　・
    #{EAA0} | 
    #{EAA1} | 
    #{EAA2} | 
    #{EAA3} | 
    #{EAA4}]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/shiftjis-to-utf8.red#L17"&gt;This line&lt;/a&gt; is the part processing ShiftJIS bytes. If current bytes match any of the &lt;code&gt;special-bytes&lt;/code&gt;, the code &lt;code&gt;(select bytemap sb)&lt;/code&gt; is executed and ShiftJIS bytes are replaced with UTF-8 ones as a result. If the bytes do not match as ShiftJIS bytes, &lt;a href="https://github.com/koba-yu/ShiftJIS-to-UTF8/blob/main/shiftjis-to-utf8.red#L18"&gt;this line&lt;/a&gt; is executed and the code &lt;code&gt;(make binary! reduce [ascii])&lt;/code&gt; just keep the byte without changing since they are ASCII bytes.&lt;/p&gt;

&lt;p&gt;In the last line, I append &lt;code&gt;binary!&lt;/code&gt; value &lt;code&gt;#{EFBBBF}&lt;/code&gt; to the head of the converted binary. This is BOM. Because I am poor Japanese, I need to add this to let Excel open the file correctly...😭&lt;/p&gt;

&lt;h2&gt;
  
  
  How is the code? It is very clear!
&lt;/h2&gt;

&lt;p&gt;I love the code style of Red. Binary processing code tends to be complicated in many languages but I could write it as very declarative and readable code in Red. If you get interested in Red or have any questions about the code, feel free to ask!&lt;/p&gt;

</description>
      <category>red</category>
    </item>
    <item>
      <title>My Red Story #2 Red to interact with WEB API 2/2</title>
      <dc:creator>koba-yu</dc:creator>
      <pubDate>Sat, 02 Jan 2021 06:46:03 +0000</pubDate>
      <link>https://dev.to/kobayu/my-red-story-2-red-to-interact-web-api-2-2-15nc</link>
      <guid>https://dev.to/kobayu/my-red-story-2-red-to-interact-web-api-2-2-15nc</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In my &lt;a href="https://dev.to/kobayu/my-red-story-1-make-a-tool-with-interacting-web-api-1-2-1oim"&gt;previous post&lt;/a&gt;, I describe Red's good points, mainly focused on non-functional aspects. In this post, I am talking about actual coding and some practices about using WEB API by Red.&lt;/p&gt;

&lt;p&gt;Let's use &lt;a href="https://jsonplaceholder.typicode.com"&gt;JSON Placeholder&lt;/a&gt;'s WEB APIs as example codes, that can be accessible for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling Get API
&lt;/h2&gt;

&lt;p&gt;The 1st example is just to &lt;code&gt;get&lt;/code&gt; the "posts" data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;read https://jsonplaceholder.typicode.com/posts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ultimately easy! You have to do no package-installing, &lt;code&gt;import&lt;/code&gt; or anything like that before running the code above. To look at the result, put &lt;code&gt;print&lt;/code&gt; or &lt;code&gt;probe&lt;/code&gt; before the code and execute it GUI console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sJ81dZ9Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/709gjslfs2wx4djv520c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sJ81dZ9Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/709gjslfs2wx4djv520c.jpg" alt="Alt Text" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling with request headers
&lt;/h2&gt;

&lt;p&gt;If you need to set a request header, you can use &lt;code&gt;write&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;write https://jsonplaceholder.typicode.com/posts [
    get [Content-type: "application/json; charset=UTF-8"]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 2nd argument is a block that contains a http method name(like &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;post&lt;/code&gt;) and an inner block that contains the header's key/value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling Post API with request body
&lt;/h2&gt;

&lt;p&gt;When you have to set a request body value, you can add it as a JSON value after the header.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;json: to-json #(
    title: "foo"
    body: "bar"
    userId: 1
)

write https://jsonplaceholder.typicode.com/posts compose [
    post [Content-type: "application/json; charset=UTF-8"]
    (json)
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is what the code does. &lt;code&gt;to-json&lt;/code&gt; converts Red value to JSON string and &lt;code&gt;#( )&lt;/code&gt; is a Red's &lt;code&gt;map!&lt;/code&gt; type literal value to be converted. Then you can pass the JSON next to the request header. &lt;code&gt;compose&lt;/code&gt; function is one of the Red's elegances. This function evaluates only inner words of &lt;code&gt;()&lt;/code&gt;. Therefore after &lt;code&gt;compose&lt;/code&gt; executed, the code line of calling &lt;code&gt;write&lt;/code&gt; becomes below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;write https://jsonplaceholder.typicode.com/posts [
    post [Content-type: "application/json; charset=UTF-8"]
    {{"title":"foo","body":"bar","userId":1}}
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want the code shorter, you can do like below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;write https://jsonplaceholder.typicode.com/posts compose [
    post [Content-type: "application/json; charset=UTF-8"]
    (
        to-json #(
            title: "foo"
            body: "bar"
            userId: 1
        )
    )
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Save response at any time
&lt;/h2&gt;

&lt;p&gt;When you are making a program to interact with the WEB API of the other company, you might feel like to save the API response, because the response is not always stable. For example, WEB API often limits the number of calls during certain minutes and returns a 429 response when your API calls exceed it. In JSON Placeholder, the remaining count to call is set &lt;code&gt;X-Ratelimit-Remaining&lt;/code&gt; header and if you exceed it, you have to wait until the time indicated by &lt;code&gt;X-Ratelimit-Reset&lt;/code&gt; header. While you are writing code to handle this restriction properly, it is helpful to save API responses once you get it, instead of repeatable calling API until it gets over the limit. To get response header, you can use &lt;code&gt;read/info&lt;/code&gt; or &lt;code&gt;write/info&lt;/code&gt;. Here is a 'read' example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;r: read/info https://jsonplaceholder.typicode.com/posts/1

save %response.red r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code saves API response as a "response.red" file at the folder Red binary exists. The saved data is like this;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EdzdxY6e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/2dpznbrfmmsw1uyxedn4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EdzdxY6e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/2dpznbrfmmsw1uyxedn4.jpg" alt="Alt Text" width="688" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also put the saved data on my &lt;a href="https://gist.github.com/koba-yu/9973b450e30e3bd0d8ca311c9390bb4d"&gt;GitHub Gist&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a really understandable format. The 1st is the HTTP response code, the 2nd is the header represented by &lt;code&gt;map!&lt;/code&gt; data type and 3rd is response body as a string. By the way, if you do not prefer for the 3rd value to be JSON, you can convert it to a Red value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;r: read/info https://jsonplaceholder.typicode.com/posts/1
r/3: load-json r/3
save %response-2.red r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here is the value to be saved: &lt;a href="https://gist.github.com/koba-yu/3fda709dae32c1c5cbab0fd125cda0c7"&gt;GitHub Gist&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, you have saved response as a file, and you can restore it simply by doing this;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;r: load %response.red
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This set the same value of the API response to a word &lt;code&gt;r&lt;/code&gt; (in Red there is no variables but words). That's why you can resume your coding immediately even after you restart GUI console, without calling API again. When you want to test your code of handling a special condition, like when the limit number is 1 or 0 and you have to wait until the limitation is reset, just rewrite the value &lt;code&gt;X-Ratelimit-Reset&lt;/code&gt; in "response.red" and load it. Then you can run the handling code and check the code behaves as you expect. As another choice, you can save 429 response after intentionally occurring it once.(Unfortunately, JSON placeholder's API seems not to return 429 response so I can not write an example data here). In any case, you are freed from calling API so many times.&lt;/p&gt;

&lt;h1&gt;
  
  
  Seems great? Try Red!
&lt;/h1&gt;

&lt;p&gt;I hope I could introduce the Red's attractiveness to you. If you want to check a more practical code with interacting WEB API, here is my &lt;a href="https://github.com/koba-yu/ChatWorkKeeper"&gt;GitHub repo&lt;/a&gt;. This code saves data from ChatWork(a popular business chat service in Japan) to local disk. I am still not an expert Red coder so any advice to the repo is welcome. Feel free to put a message on Issues, Discussions of the repo if you have something to talk with me.&lt;/p&gt;

</description>
      <category>red</category>
    </item>
    <item>
      <title>My Red Story #1 Red to interact with WEB API 1/2</title>
      <dc:creator>koba-yu</dc:creator>
      <pubDate>Sat, 02 Jan 2021 06:40:02 +0000</pubDate>
      <link>https://dev.to/kobayu/my-red-story-1-make-a-tool-with-interacting-web-api-1-2-1oim</link>
      <guid>https://dev.to/kobayu/my-red-story-1-make-a-tool-with-interacting-web-api-1-2-1oim</guid>
      <description>&lt;h1&gt;
  
  
  Make a tool with Red-lang, it's fun!
&lt;/h1&gt;

&lt;p&gt;This year I have released a simple tool coded by &lt;a href="https://www.red-lang.org"&gt;Red-lang&lt;/a&gt;. It saves ChatWork's messages and files to local. ChatWork is a chat service for business, very popular in Japan. Because my company stopped using ChatWork, I wanted to save my data in ChatWork. That was the motivation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repository
&lt;/h2&gt;

&lt;p&gt;Here is my repository for the tool, &lt;a href="https://github.com/koba-yu/ChatWorkKeeper"&gt;ChatWorkKeeper&lt;/a&gt;. Sorry the description in the repo is in Japanese only, but most people who need this tool are Japanese. 😅&lt;/p&gt;

&lt;h2&gt;
  
  
  Why using Red?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;This post mainly explains non-functional aspects. If you are interested in only codes, take a look at my &lt;a href="https://dev.to/kobayu/my-red-story-2-red-to-interact-web-api-2-2-15nc"&gt;next post&lt;/a&gt;!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Red is an alpha stage programming language, not so many production use cases yet(maybe). However it already has amazing capabilities and is comfortable to code. Following points are benefits with coding Red, I think.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;REPL included, official VS Code plugin is awesome&lt;/li&gt;
&lt;li&gt;Simple and immersive coding, not requiring powerful PC&lt;/li&gt;
&lt;li&gt;Typing comfortability - less times to press Shift key and symbol keys&lt;/li&gt;
&lt;li&gt;Compiled to single binary - easy to share and no worries about runtime installed&lt;/li&gt;
&lt;li&gt;Interacting with WEB API is very easy (written in next post)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  1. REPL included, official VS Code plugin is awesome
&lt;/h3&gt;

&lt;p&gt;Red has a REPL called GUI console. It is very comfortable especially to code a program interacting with WEB APIs of other companies. Since I am not sure how the API returns response, GUI console gives an efficient process to write a code, run it and see the results. Also Red has an official &lt;a href="https://marketplace.visualstudio.com/items?itemName=red-auto.red"&gt;VS Code pulgin&lt;/a&gt;. It's very handy.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Simple and immersive coding, not requiring powerful PC
&lt;/h3&gt;

&lt;p&gt;Red is a very simple language and does not force you to consider much other than coding. I have used C# in my business for 10 years. Though I like and thank C#, I need to consider many things before I start coding when use it. For example, what version of .NET I use (and is the version available for all of the users I expected?). Which types of project I use?(Console app or WPF app? The project files' structure decided by the type). In Red it is a really easy choice whether my app has GUI or not. All I need is to use &lt;code&gt;view&lt;/code&gt; function. It does not shake project level structure at all. With Red, I can write codes that directly match with what I am thinking, at any time. It helps me motivate myself a lot to keep coding at my leisure time. Also, Red and its editor do not require quite high resources, I can develop my app on my modest spec laptop.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Typing comfortability - less times to press Shift key and symbol keys
&lt;/h3&gt;

&lt;p&gt;If you took a glance at my repo above, you might find there are fewer symbols in the source code. We are too used to seeing many symbols in traditional programming languages to have doubts about that. But is it really readable using &lt;code&gt;?&lt;/code&gt; and &lt;code&gt;??&lt;/code&gt; to conditional operators? Isn't it uncomfortable to type &lt;code&gt;()&lt;/code&gt; every place method called? (it means, most lines of the codebase in practice!) After meeting Red, I have gotten too lazy to type &lt;code&gt;()&lt;/code&gt; because it needs to press the Shift key (and &lt;code&gt;(&lt;/code&gt; is a little far from Shift!).&lt;/p&gt;

&lt;p&gt;Let's look at an example, JavaScript's code below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, 2020!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2020&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2021&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; Hello, 2021!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;would be in Red,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;result: replace "Hello, 2020!" "2020" "2021"
print result
; =&amp;gt; Hello, 2021!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Red is much neater and more readable, isn't it?&lt;/p&gt;

&lt;p&gt;Or if you want to write in one line,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, 2020!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2020&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2021&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;would be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print replace "Hello, 2020!" "2020" "2021"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Probably, it seems possible even for a non-programmer person to read and guess what Red's code means. Great readability!&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Compiled to single binary - easy to share and no worries about runtime installed
&lt;/h3&gt;

&lt;p&gt;While I can use the GUI console when stacking codes, I can compile the Red code after coding done. It makes a single machine code binary file so really easy to share it. Because it's machine code binary, &lt;a href="https://upx.github.io"&gt;UPX&lt;/a&gt; can be used to compress the file. Final compressed size of my tool is only 369KB!&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Calling WEB API and handling response are very easy
&lt;/h3&gt;

&lt;p&gt;This post has been a little long, so I have written &lt;a href="https://dev.to/kobayu/my-red-story-2-red-to-interact-web-api-2-2-15nc"&gt;one more post&lt;/a&gt; about this topic. Let's focus on the actual code next!&lt;/p&gt;

</description>
      <category>red</category>
    </item>
  </channel>
</rss>
