<?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: Alexandra Yeo</title>
    <description>The latest articles on DEV Community by Alexandra Yeo (@yeo_alexandra).</description>
    <link>https://dev.to/yeo_alexandra</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%2F413317%2Fc901d768-0407-4852-b06b-d9c092e6fecd.jpg</url>
      <title>DEV Community: Alexandra Yeo</title>
      <link>https://dev.to/yeo_alexandra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yeo_alexandra"/>
    <language>en</language>
    <item>
      <title>Keeping workplace connections warm and genuine with Teamo</title>
      <dc:creator>Alexandra Yeo</dc:creator>
      <pubDate>Thu, 02 Jul 2020 01:45:01 +0000</pubDate>
      <link>https://dev.to/yeo_alexandra/keeping-workplace-connections-warm-and-genuine-with-teamo-1cfj</link>
      <guid>https://dev.to/yeo_alexandra/keeping-workplace-connections-warm-and-genuine-with-teamo-1cfj</guid>
      <description>&lt;p&gt;Hi DEV community! As a NodeJS and React developer, I've been building a platform for teams to stay connected, happy and appreciated: &lt;a href="https://teamo.team/"&gt;Teamo&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;These days, most teams are working remotely. Remote work can be bittersweet – staying connected and feeling that sense of camaraderie may become harder when work calls become mostly work. &lt;/p&gt;

&lt;p&gt;Teamo aims to help build a sense of camaraderie and genuine workplace connections when you celebrate another teammate with more than just a Slack message – and instead, a lively social group card with thoughtful messages.&lt;/p&gt;

&lt;p&gt;A little appreciation and shoutout goes a long way. We want to help teams stay strong, build genuine connections, and make work fun and fulfilling for all  🎉&lt;/p&gt;

&lt;p&gt;Feel free to ask me anything about Teamo, how I built it, etc!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>career</category>
      <category>womenintech</category>
    </item>
    <item>
      <title>Creating User-Facing, Short Unique IDs: What are the options?</title>
      <dc:creator>Alexandra Yeo</dc:creator>
      <pubDate>Thu, 02 Jul 2020 01:28:24 +0000</pubDate>
      <link>https://dev.to/yeo_alexandra/creating-user-facing-short-unique-ids-what-are-the-options-8mn</link>
      <guid>https://dev.to/yeo_alexandra/creating-user-facing-short-unique-ids-what-are-the-options-8mn</guid>
      <description>&lt;h6&gt;
  
  
  &lt;em&gt;Hi all! Here's my first post to share with the DEV.to community!&lt;/em&gt;
&lt;/h6&gt;




&lt;p&gt;Generating short, unique ID that’s user-facing is not an uncommon feature: Zoom URLs, before its whole security hooha, looked something like this: &lt;em&gt;&lt;a href="https://domain.zoom.us/j/92607701764"&gt;https://domain.zoom.us/j/92607701764&lt;/a&gt;&lt;/em&gt;, while Coderpad (throwback to interviewing days) looked like &lt;em&gt;&lt;a href="https://coderpad.io/EZ6YP9RY"&gt;https://coderpad.io/EZ6YP9RY&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;When designing a service with IDs that’s user-facing, e.g. a URL link for sharing purposes, we would ideally want to create one that’s short, sweet and mnemonic-able. But the shorter it is, the higher the rate of collision is and therefore, the ID won’t be unique. But in theory, if the short ID generator is good (i.e. random), short IDs are not that easy to collide: an 8 character short ID consisting of 26 alphabets + 10 numbers has 36⁸ permutations. Throwing in special characters would increase the number of permutations.&lt;/p&gt;

&lt;p&gt;You may be thinking, do I need to create such an ID for the items in the service I’m building? What about just using the object id from my database (e.g. MongoDB), which I can guarantee that it’s unique?&lt;/p&gt;

&lt;p&gt;That works for sure, but suppose we are trying to create a shorter unique ID for easy peer-to-peer sharing and elegance. My product Teamo, a platform where teams can create lively group cards to build genuine workplace connections, also refers to cards with its shorter unique ID, even though each still has a longer object id. Another reason could be for decoupling, as explained by Redgate’s engineering blog.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1 (not-so-good but works): Store short ID as an item field in DB and search for duplicates&lt;/strong&gt;&lt;br&gt;
One way to do it is to create a short ID, store it as an item field in the database. Every time a new random short ID is generated, we do a quick check of the database to make sure that it is unique.&lt;/p&gt;

&lt;p&gt;You may recognize why that is not such a good idea — creating a new item that relies on an initial search through DB for duplicated short ID takes time. However, a good improvement would be to use an in-memory Redis cache instead of a DB, if the items are ephemeral (e.g. CoderPad rooms).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2: UUIDs (guaranteed unique, but too large for our notion of short IDs)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You may be wondering… what about UUIDs? Unfortunately, UUIDs are pretty large (128-bit hexadecimal number). They do have wonderful guarantees: the chances of the same UUID getting generated twice is a negligible — here’s what Wikipedia says:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%. Or, to put it another way, the probability of one duplicate would be about 50% if every person on earth owned 600 million UUIDs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;UUIDs are also great in that they work in distributed environments, as they do not require coordination between different nodes and can be generated independently. This is because a UUID contains a reference to the network address of the host that generated the UUID, a timestamp (time of a transaction), and some randomly generated component.&lt;/p&gt;

&lt;p&gt;Yet, a UUID is too big for our requirement of short ID. A UUID looks something like this: f4fdfd2b-d1f1–4156–86e6–533f9cf91416. Indexing items is also an issue since UUIDs takes up more size and would affect query performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 3: Creating an independent service that generates short ID&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By creating such a service, we can avoid that initial search through the DB for duplicate short IDs. The question now is thus, how do we generate a short ID that we know for sure is not duplicated, and when we scale this service over different nodes?&lt;/p&gt;

&lt;p&gt;Let’s look at some current implementations that may give us inspiration. Twitter Snowflake, the open-source version of which is unfortunately archived, is an internal service used by Twitter for generating 64-bit unique IDs at a high scale. The IDs are made up of the components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Epoch timestamp in millisecond precision — 41 bits (gives us 69 years with a custom epoch)&lt;/li&gt;
&lt;li&gt;Machine id — 10 bits (thus allowing uniqueness even when we scale the short ID generator service over different nodes)&lt;/li&gt;
&lt;li&gt;Sequence number — 12 bits (A local counter per machine that rolls over every 4096)&lt;/li&gt;
&lt;li&gt;The extra 1 bit is reserved for future purposes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’d imagine components to be different based on how your service is used. If you don’t envision items to be created so rapidly, perhaps the unique ID does not need up to millisecond precision, or if peak traffic is not that high, you may not need that many machines (2¹⁰ = 1024 machines). You could also use the name of the item, the creator of the item, the object ID or component as components to generate the ID, based on your service.&lt;/p&gt;

&lt;p&gt;Hoping that this was a fun discussion about the possible options to generate short IDs! Feel free to correct us for any inaccurate details, and all suggestions are welcomed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Creating a warmer team culture and celebrating your workplace connections go a long way. Whether you’re looking to welcome a new hire, thank a summer intern or celebrate a teammate’s birthday, Teamo works for you. Check us out at &lt;a href="https://teamo.team"&gt;teamo.team&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>architecture</category>
      <category>api</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
