<?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: Tamás Szelei</title>
    <description>The latest articles on DEV Community by Tamás Szelei (@tamas).</description>
    <link>https://dev.to/tamas</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%2F836%2Fddaf75f7-cc59-435e-b0be-6e5d66d2e0ae.jpg</url>
      <title>DEV Community: Tamás Szelei</title>
      <link>https://dev.to/tamas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tamas"/>
    <language>en</language>
    <item>
      <title>How do I keep track of the vocabulary of my code?</title>
      <dc:creator>Tamás Szelei</dc:creator>
      <pubDate>Mon, 15 Apr 2019 14:01:00 +0000</pubDate>
      <link>https://dev.to/tamas/how-do-you-keep-track-of-the-vocabulary-of-my-code-53ja</link>
      <guid>https://dev.to/tamas/how-do-you-keep-track-of-the-vocabulary-of-my-code-53ja</guid>
      <description>&lt;p&gt;I often find code I've written that uses different vocabulary for the same things. For example, we have a term &lt;code&gt;variant&lt;/code&gt; (referring to a variant of our product), but sometimes it's written as &lt;code&gt;variation&lt;/code&gt;. It's an absent-minded, honest mistake, but once it's in and used in different interacting codebases, it's really hard to get rid of.&lt;/p&gt;

&lt;p&gt;Another common source of confusion is using the same word to mean different things. If I sat down I bet I could find at least three completely different usages of the term &lt;code&gt;build&lt;/code&gt; (just from the top of my head, it could mean: a configuration, a build artifact, a ci job, a particular run of a ci job - hey, that's four already!). &lt;/p&gt;

&lt;p&gt;So my question is: how do I improve this? I'd like to be mindful of my word choices because I feel like it has a huge impact on the readability and maintainability of the code (not only positively: when it's less than ideal, those metrics suffer, too). At the same time, working on 6-7 interacting codebases, it feels impossible to keep all the wording the same. Any advice?&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>RESPectful APIs</title>
      <dc:creator>Tamás Szelei</dc:creator>
      <pubDate>Tue, 25 Jul 2017 21:24:31 +0000</pubDate>
      <link>https://dev.to/tamas/respectful-apis</link>
      <guid>https://dev.to/tamas/respectful-apis</guid>
      <description>

&lt;p&gt;There is a famous video featuring Bobby McFerrin where he demonstrates the power of the pentatonic scale. To be fair, there are a number of videos that fit the description, but I want to talk about one in particular, in which Bobby McFerrin is on the stage at the World Science Festival. He stands up and starts making small jumps while giving a sound, as if he became an instrument himself, and asks the audience to join in singing the same note. He takes a step to the left and sings a different note. Now silent, he starts jumping left and right, and the audience follows by alternating between the two notes. He then proceeds to do something seemingly unexpected: he jumps to a &lt;em&gt;third&lt;/em&gt; position, which was previously unintroduced. The audience, without a hitch, hits the exact right note in unison. Watch the video:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/ne6tB2KiZuk"&gt; &lt;/iframe&gt;&lt;/p&gt;

&lt;p&gt;Quite interesting and even cathartic, isn't it? Presumably, this was possible because there is a common wiring in our brains that allows using our shared cultural knowledge and maybe our inherited traits to find that third note without really thinking about it.&lt;/p&gt;

&lt;p&gt;So what is a "RESPectful" API and what does it have to do with the pentatonic scale? &lt;/p&gt;

&lt;p&gt;RESPectful, spelled this way, is a play on "RESTful" (obviously), and it is a superset of RESTful. This post is intended to highlight a set of good API design practices. In my experience people express joy about working with a particular tool (be it an API or a toaster) when it allows them to reach their goals quickly and without standing in the way.&lt;/p&gt;

&lt;p&gt;The RESPectful API &lt;em&gt;respects&lt;/em&gt; the time of its users. It is humble and acknowledges that using it is not a goal by itself but a means to an end. The RESPectful API does not require its users to learn completely new concepts unless it's unavoidable. It walks and talks like an average being in the particular ecosystem it exists in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Drawing the line
&lt;/h2&gt;

&lt;p&gt;Yet, this is more than simply a "when in Rome..." advice. This is also about consciously &lt;strong&gt;drawing the line&lt;/strong&gt; between &lt;em&gt;implementation details&lt;/em&gt; and the &lt;em&gt;interface presented&lt;/em&gt; to the library user. You might think that hiding implementation details is obvious, but it is more than just declaring private members. It is the GUI analog of &lt;em&gt;not&lt;/em&gt; filling half of the screen with heaps of icons that expose various functionality.&lt;/p&gt;

&lt;p&gt;Why? Because every bit of complexity exposed to the user will increase the cognitive overhead of using the library and require more time investment from the user. If you remove the casing of a tablet, you have access to all the bits and pieces which you can solder on or remove, given you have sufficient knowledge to do so without breaking the device. Still, 99% of your API users don't want to mess with the internal circuits of your system. They just want to push that one button to take a picture or connect their headphones. And that is the kind of time investment they expect from your API, not soldering on a jack connector. You don't have to make everything tweakable just because you can. Strike a good balance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Naming things
&lt;/h2&gt;

&lt;p&gt;Correctly naming things is another element of RESPectful API design. A good approach is to imagine the kind of StackOverflow questions your users would ask and use the same wording for naming things in the API. To illustrate this point, let's take a look at the excellent &lt;a href="http://docs.python-requests.org/en/master/"&gt;requests&lt;/a&gt; library:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I make a &lt;strong&gt;GET&lt;/strong&gt; request? Use the &lt;strong&gt;&lt;code&gt;get&lt;/code&gt;&lt;/strong&gt; function. Its return value is the response object.&lt;/li&gt;
&lt;li&gt;How do I get the &lt;strong&gt;status code&lt;/strong&gt; after a response? Read the &lt;strong&gt;&lt;code&gt;status_code&lt;/code&gt;&lt;/strong&gt; attribute.&lt;/li&gt;
&lt;li&gt;How do I get the &lt;strong&gt;encoding&lt;/strong&gt; of a response? There is an attribute named &lt;strong&gt;&lt;code&gt;encoding&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You get the idea. This, of course, implies that you are aware of the use-cases of your API. This allows making conscious, focused decisions about what to expose to the user, what kind of defaults to use and to choose the right wording. &lt;/p&gt;

&lt;h2&gt;
  
  
  The third note
&lt;/h2&gt;

&lt;p&gt;The motto of &lt;code&gt;requests&lt;/code&gt; is "HTTP for Humans". In other words, it is designed with human thinking in mind, which is illustrated by the language choices and workflows that are presented to the user. &lt;/p&gt;

&lt;p&gt;In a sense, this is a kind of UI (a library users' UI). Yes, your API will have a UX regardless of your designing it or not. Go ahead and ask a friend to perform a specific task with your API. If and when they get stuck, take notes. Those are the points of user friction in your API. &lt;/p&gt;

&lt;p&gt;Once you know how to make a GET request in &lt;code&gt;requests&lt;/code&gt;, you will also know how to make a POST request. Or PUT. Or DELETE. And so on. Why is that? You probably read only the GET example in the docs and your intuition told you &lt;em&gt;"if I change this &lt;code&gt;get&lt;/code&gt; to &lt;code&gt;post&lt;/code&gt;, I will make a POST request"&lt;/em&gt;. And your intuition was right.&lt;/p&gt;

&lt;p&gt;Bobby McFerrin showed two notes, and the audience knew what the third one was going to be. So design your API like that. Give it a clear, logical structure, have third, fourth, fifth notes that your users can guess without digging through your docs or asking on StackOverflow. That is what makes a good and RESPectful API.&lt;/p&gt;


</description>
      <category>apidesign</category>
      <category>api</category>
    </item>
  </channel>
</rss>
