<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Uncountable Engineering - Medium]]></title>
        <description><![CDATA[Stories from our Engineering team’s journey to build the future of R&amp;D. - Medium]]></description>
        <link>https://medium.com/uncountable-engineering?source=rss----675d4deb3e95---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Uncountable Engineering - Medium</title>
            <link>https://medium.com/uncountable-engineering?source=rss----675d4deb3e95---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 22:06:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/uncountable-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[React Hooks Demystified: The mechanics of useState]]></title>
            <link>https://medium.com/uncountable-engineering/react-hooks-demystified-the-mechanics-of-usestate-12ce9b925bbf?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/12ce9b925bbf</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Fri, 26 Sep 2025 06:51:35 GMT</pubDate>
            <atom:updated>2025-09-26T06:51:31.568Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Hooks Demystified: The mechanics of “useState”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3l4KzDFTWAv5PFsAz9zGcQ.jpeg" /><figcaption>Photo by <a href="https://pixabay.com/users/soramang-1594796/">soramang</a></figcaption></figure><p>React’s functional components introduce a powerful yet unconventional programming model — one that can create subtle bugs even for experienced developers. To truly master React, it’s essential to understand how it renders components and manages state. In this article, I take a detailed look at the useState hook. I&#39;ll explain what a component instance is, how state values persist across renders, and why these details matter for building reliable components and unlocking advanced React techniques.</p><p>Let’s start with a simple hook function that has a single use of state. Assume we have an Input component that emits a plain string in the onChange handler.</p><pre>function EchoText() {<br>	const [text, setText] = useState(&quot;Initial&quot;)<br>	<br>	return (<br>		&lt;div&gt;<br>			&lt;Input value={text} onChange={setText} /&gt;<br>			&lt;p&gt;{text}&lt;/p&gt;<br>		&lt;/div&gt;<br>	)<br>}</pre><p>To understand what useState does, we need to first understand how this component function, EchoText will be called. React component functions are ultimately regular JavaScript functions. The special syntax for elements is compiled to a jsx function — see the appendix “Compiled JSX” for an example. Other than that though, the rest of the function remains the same. React functions like useState, at the surface level, behave like normal JavaScript functions. But clearly they do something special. Understanding how is important to writing proper React code.</p><h3>Rendering Nodes</h3><p>Taking a step back, we know some higher component has emitted this one, of the simple form &lt;EchoText/&gt;. This goes all the way to a root level render function that establishes the base of the tree — somewhere you’ve likely forgotten about in your top-level index file. There’s nothing about the function that indicates it’s a component until you attempt to render it.</p><p>It can be tempting to think of function components as similar to classes and instances. For example, assume that our EchoText is a class, and React instantiates it with inst = new EchoText(), then later calls inst.render(). We could then think of useState as creating a member property, and useCallback creating member functions. This is indeed how class components used to work. And while logically a similar relationship exists with hook functions, the implementation is distinct, and the class analogy might be an impediment to a true understanding of what’s happening. React does instantiate components, but that’s unrelated to JavaScript’s class system.</p><p>When a component is rendered, the higher level component that renders &lt;EchoText /&gt; is creating an instance of that component. An “instance” here refers to a real object React stores internally. We have no access to this instance except via functions like useState. When our EchoText function is called, it’s called in the context of a particular instance, which is why its state persists.</p><p>To understand this relationship, let’s look at some theoretical React code. I’m going to use the prefix TR, or tr to match name-case rules, to refer to a “theoretical React” function type, class, or functionality. React behaves as-if it works this way, but the actual implementation varies. Indeed, the system hides how it works beyond the as-is theoretical.</p><p>So, this is our theoretical code for how our component is instantiated and rendered.</p><pre>// some higher level component does `return &lt;EchoText/&gt;`<br>const renderNode = ... ; // the result of &lt;EchoText /&gt;, or `jsx( EchoText )`</pre><pre>// So React creates a new object to store data for that instance.<br>const node = new TRNodeInstance()</pre><pre>// And tracks it somehow...</pre><pre>// Then, to render the component, it stores that instance in global memory<br>trComponentInstance = node</pre><pre>// Then it calls our function to render it, where `function` here will be `EchoText`<br>const renderResult = renderNode.function()</pre><p>The key point to get from this is that React has created an instance for a particular rendering our component. This instance is some generic React data structure: TRNodeInstance. When our EchoText function is called, React will have stored this instance in the global variable trComponentInstance. Our function will store and retrieve data from this object, via React’s hook functions. We don’t directly know about this instance, or where it’s exactly stored, but the React hook functions do.</p><p>For this article, I will mostly skip how React tracks the ‘TRNodeInstance’ across several render phases. The code above only shows the creation of a new instance. We’re going to have to accept as given that during a rerender the same logical node will get mapped to the same TRNodeInstance.</p><p>We will give them ids to help track them though. For example, we create multiple instances in the below code.</p><pre>function Higher() {<br>	return &lt;div&gt;<br>		&lt;EchoText/&gt;<br>		&lt;EchoText/&gt;<br>	&lt;/div&gt;<br>}</pre><p>On the first rendering of this Higher component, we create two instances of the EchoText component, let&#39;s give them ids of echo1 and echo2. When Higher is rendered again, it will reuse the echo1 and echo2 instances. The trComponentInstance is the same object across rerenders of the same logical component in the node tree.</p><h3>useState</h3><p>Go back to the EchoText function. Nothing special happens until we call useState. This is called like a normal JavaScript function. Inside, however, it will look at the trComponentInstance global variable, using it to register its state and setters.</p><p>Our code:</p><pre>function EchoText() {<br>	const [text, setText] = useState(&quot;Initial&quot;)<br>	...<br>}</pre><p>In the React library:</p><pre>// Theoretical, not actual React code. useState works &quot;as-if&quot; it does the below<br>function useState(initValue) {<br>	const thisInstance = trComponentInstance <br>	const index = thisInstance.nextStateIndex++<br>	<br>	// on the first call we need to initialize, on other calls keep as is<br>	if( thisInstance.firstRender ) {<br>		thisInstance.stateValue[index] = initValue<br>		thisInstance.stateSetter[index] = (newValue) =&gt; {<br>			thisInstance.stateValue[index] = newValue<br>			trDirtyComponentSet.add( thisInstance.id )<br>		}<br>	}<br>	<br>	return [thisInstance.stateValue[index], thisInstance.stateSetter[index]]<br>}</pre><p>Let’s break this down line-by-line.</p><pre>const thisInstance = trComponentInstance</pre><p>This takes a local copy of trComponentInstance, ensuring its stable for the entire body of our function. This will matter most when we define the setter.</p><pre>const index = thisInstance.nextStateIndex++</pre><p>React component functions can have several calls to useState, so each one needs a unique index. It seems sensible to start at 0 and count upwards, which then allows the user a simple array to track the values. You can see that the order in which the calls to useState are made is important due to this indexing. This is why hook functions can’t be called conditionally. If not all the same number of hooks are called, the logically same state variables would be assigned a different index, and get different values.</p><blockquote><em>Why an index? Recall that this is normal JavaScript code. React has no special knowledge about the calls to </em><em>useState other than the order in which they’re called. An index is the simplest way to track this call order.</em></blockquote><blockquote><em>If React had wanted to, it could have provided a named state function, like </em><em>useState( “text”, “Initial” ) and use the name as a lookup key. This would be less efficient, but also potentially confusing, as that name wouldn’t have to be related to the variable we assign it to, for example </em><em>var [cakeType, setCakeType] = useState(“car”, CakeType.Chocolate ). With names, the order of the declarations wouldn’t matter; thus conditional state would be possible.</em></blockquote><pre>if( thisInstance.firstRender ) {</pre><p>Component functions will be called multiple times: each time the parent component renders, the child component functions could be called. Let’s assume the first render call is tracked explicitly with a firstRender variable on the instance. For each call to EchoText, nextStateIndex will be reset to zero, but all other properties will remain the same, and firstRender will be true only on the first call.</p><p>It’s critical to understanding React that our component functions, and these hooks, are called again for each render. These have to be understood as following normal JavaScript flow rules. In our EchoText component, the illusion of a persistent text state value is created by execution of the code in the same order, against the same trComponentInstance. I said components behave something like a class and instance, but this is the first sign that their implementation is anything but.</p><pre>// if( thisInstance.firstRender ) { ...<br>		thisInstance.stateValue[index] = initValue</pre><p>In this line, we see a stateValue array that will track all the variables for an instance. Here we are setting the value for this particular state, using the index. The initValue is whatever is passed to the useState function. This is the first place where React can get confusing. React will only use the value provided to ‘useState’ in the first render pass. This instance will ignore all future values.</p><pre>// if( thisInstance.firstRender ) { ...<br>		thisInstance.stateSetter[index] = (newValue) =&gt; {<br>			thisInstance.stateValue[index] = newValue</pre><p>We also need a way to set the state variable, something to pass to the Input component. We create a simple lambda function to do this. This is where the local thisInstance is vital. This setter function can be called anywhere from our entire code base. When it’s called, we can’t rely on trComponentInstance having the right value. By copying to a local variable, we have ensured that this lambda function always refers to the same instance.</p><p>Having the same instance and the same index, let’s update the state value by copying a new value into the stateValue array.</p><p>We store the setter in a stateSetter. This ensures that for the future render passes, the returned setter is the exact same lambda function, and not just a new function that does the same thing. This type of stability is paramount to React’s processing.</p><pre>// if( thisInstance.firstRender ) { ...<br>			trDirtyComponentSet.add( thisInstance.id )<br>		}</pre><p>Only setting the state value would not be enough. stateValue is, after all, just some array in memory. React needs a way to know that it’s been updated. While it could in theory just scan all components for changes on each render, that’d be horribly slow. It must have a way of tracking particular dirty nodes. In this line, we’re telling that system that thisInstance is dirty and needs to be re-rendered. The Set is likely a gross oversimplification of how this dirty tracking actually behaves.</p><pre>return [thisInstance.stateValue[index], thisInstance.stateSetter[index]]</pre><p>Finally, pass the current value and the setter back to the caller. Again, every time EchoText is rendered, the function is called. The persistence of values, the thing that makes it look somewhat like class with properties, is due to useState tracking and returning the same values for a particular trComponentInstance.</p><pre>return (<br>		&lt;div&gt;<br>			&lt;Input value={text} onChange={setText} /&gt;<br>			&lt;span&gt;{text}&lt;/span&gt;<br>		&lt;/div&gt;<br>	)<br>}</pre><p>After the useState call, we use those values in the node-tree we return. Every time our function is called, we create a new node tree. This node-tree will contain the state values at the time the function was executed. It doesn’t know that text is a state value, or that setText is a state setter. It just sees variables. They could be other local variables or global variables.</p><p>The key feature of React is the ability to take these unique node-trees and compare them to the node tree the function produced previously, looking for differences. It then optimizes the rendering by excluding nodes that do not need to be updated. This is where the stability of setText is so important. It’s not enough to just do the same thing; it must be the exact same function in order for React to avoid re-rendering Input.</p><p>It’s not defined precisely when the final rendering and calling of other component functions is done. This is where some of the difficulty in using React comes from, in particular for the other hook functions, such as useMemo.</p><h3>Conclusion</h3><p>Understanding how useState works under the hood reveals a lot about React’s programming paradigm. Hooks aren’t magical — they operate within plain JavaScript rules, relying on consistent execution order and internal tracking of component instances.</p><p>This article gives us the basic understanding of hooks, via the useState function. In future articles I’ll look at the useMemo and useCallback hook functions.</p><h3>Appendix: Compiled JSX</h3><p>In the introduction, I showed this component, in a JSX file.</p><pre>function EchoText() {<br>	const [text, setText] = useState(&quot;Initial&quot;)<br>	<br>	return (<br>		&lt;div&gt;<br>			&lt;Input value={text} onChange={setText} /&gt;<br>			&lt;p&gt;{text}&lt;/p&gt;<br>		&lt;/div&gt;<br>	)<br>}</pre><p>Using elements directly in the code distinguishes JSX from plain JS code. When transformed, it’ll look like the below. It can vary depending on the translator and version.</p><pre>function EchoText() {<br>  const [text, setText] = useState(&quot;Initial&quot;);<br>  return jsxs(&quot;div&quot;, {<br>    children: [jsx(Input, {<br>      value: text,<br>      onChange: setText<br>    }), jsx(&quot;p&quot;, {<br>      children: text<br>    })]<br>  });<br>}</pre><p>The transformation is relatively simple, and changes only the node tree part. The code keeps the rest of the JavaScript unchanged. This means that functions like useState have no special support; they’re implemented as normal JavaScript functions.</p><p>You can use <a href="https://babeljs.io/repl">Babel’s tool</a> to see the above transformations.</p><h3>Appendix: useState Initial Value</h3><p>I mentioned that the value passed to useState is used only on the initial render pass. This can lead to defects.</p><p>One issue I have encountered involves component instability. The concept of “initial render” can be fuzzy if the application’s node tree isn’t stable. Remounting a component results in a new instance, and consequently, another first render pass. So it’s possible that code that is wrong can work in an unstable call tree.</p><pre>function ServerPost( props: {<br>	message: string<br>}) {<br>	const [toSend, setToSend] = useState( createTextMessage( props.message ) )<br>	const onClick = useCallback( () =&gt; apiPost( toSend ), [ toSend] )<br>	<br>	return &lt;Button onClick={onClick}&gt;Post &quot;{props.message}&quot;&lt;/Button&gt;<br>}</pre><p>The ServerPost component will render with the correct current message. The callback is also correct, as it lists toSend as a dependency. However, only the first render pass uses the value of ‘props.message’. If it changes, and the user clicks the button, the wrong message can be sent.</p><p>It’s an obvious error, but how could it go unnoticed? It’s possible that it’s sitting inside an unstable render tree and gets remounted every time the message changes. Or perhaps the message rarely changes, so it usually works.</p><p>Why did a coder make this error? Could just be a momentary mental blip, a confusion between a useMemo and useState. Or perhaps they come from a framework where the initial value is used until an explicit call to setToSend is made. The actual errors I’ve seen are more complex than this. I’ve seen it more often in relation to Redux selectors, which are complex wrappers to useState, where there’s more potential for things to go wrong. But that’s a whole other topic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12ce9b925bbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/react-hooks-demystified-the-mechanics-of-usestate-12ce9b925bbf">React Hooks Demystified: The mechanics of useState</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Universal id to name mapping for the frontend and backend]]></title>
            <link>https://medium.com/uncountable-engineering/universal-id-to-name-mapping-for-the-frontend-and-backend-663d49b7a588?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/663d49b7a588</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[erp-software]]></category>
            <category><![CDATA[enterprise-technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Mon, 30 Jun 2025 12:01:49 GMT</pubDate>
            <atom:updated>2025-06-30T12:01:49.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6gg13rnJrFBW38vk.jpg" /></figure><p>Across any app of scale, you’ll encounter the same challenge over and over: how to take an internal ID like 17 and turn it into something meaningful like “Plastics”. Entities — like invoices, ingredient, or projects — are represented as IDs in the database. But users want readable names, searchable in the right language, with contextual labels, and icons.</p><p>We built a system to solve this: id-source. It’s a universal mechanism that maps identifiers to user-friendly labels across the entire product. Whether you’re showing a dropdown list, rendering a name in a table, or doing a fuzzy search, id-source handles the lookup, the localization, the formatting, and the performance optimization — automatically.</p><p>This article details system architecture, provides code samples, and explores specialized features. I’ll focus on how we implemented this system with our sibling system: structured loading. Many iterations shaped the id-source system.</p><p>The high-level features of the id-source system are:</p><ul><li>Efficiently mapping entity identifiers to names</li><li>Language dependent translations of ids for user defined entities</li><li>Searching by name on lists</li><li>Custom labelling based on one or more entity fields, not just name</li><li>Progressive loading and search in dropdown select controls</li><li>Handles deprecated / removed ids</li><li>Filtered lists for limited user selection</li><li>Additional entity metadata, such as icons and colour tags</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z7BVnWCPI_dumMxS.png" /></figure><h3>High-level use overview</h3><p>The core feature of the id-source is to take an identifier and produce a user-readable name for id. For example, given project id 13 return the string “Plastics”, which is the name the user gave that project. When a page of the app loads data from the backend, and it gets the project id, it can use the id-source system to display the name to the user.</p><p>We use diverse abstractions here. One of the simplest is the DisplayId React component.</p><pre>&lt;DisplayId value={data.projectId} idSource={constructEntityIdSource(EntityType.project)} /&gt;</pre><p>The idSource tells the DisplayId component how it should resolve that name. The constructEntityIdSource is a universal way to create id-sources. In this case it produces the string entity/project. As an added bonus, some entity types have pages for them, like a project overview. The DisplayId componment can link to that page.</p><p>This will end up calling an id_source API endpoint that translates this value into a name.</p><h4>Lower-level use-cases</h4><p>Not all code wants to display the name, instead needing the name for other reasons. For those cases, we created a React hook function that resolves one or more ids into names.</p><pre>const name = useSelectIdName( constructEntityIdSource(EntityType.project), data.projectId )<br>const names = useSelectIdNames( constructEntityIdSource(EntityType.ingredient), data.ingredientList )</pre><p>The hook functions are async, returning undefined until the value is loaded. We generally don’t show loading feedback, like a spinner, while loading, since the calls are quite fast and we want to avoid layout flicker.</p><p>Part of the motivator for id-sources was our form system. We allow user defined fields, and those need to select id-based entities as well. So while we do have a lot of static id-source construction like the above, we also have a lot of generic lookups. In these situations we refer to an id-source stored on the field definition.</p><pre>const name = useSelectIdName( field.idSource, field.value )</pre><h3>Backend id-source loader</h3><p>Now let’s move on to to the backend, where these calls are all ultimately resolved. A function like useSelectIdName( idSource, idValue ) will get passed to a list_id_source endpoint passing those two properties.</p><p>I mentioned briefly before that idSource has a structure of a schema and a path, like entity/project. When the backend sees entity as the first part of the schema, it signals that the structured loading system will resolve the id. It uses the second part of the schema to determine which entity is being referred to.</p><p>A concept we have in our structured loading system is “essential fields”. These are fields, or columns, on a store, that have generic meaning — in contrast to the fields which are relevant only for custom business logic.</p><p>In the id-source system, there are two key essential fields we’re interested in: name and id. We can lookup these fields on the store and produce a standard query to access them.</p><p>In summary, given the id-source entity/project:</p><ul><li>entity says to use the structured loading system</li><li>project says to find the Project store</li><li>we then look for the id and name essential fields</li><li>we then produce a query with id and name filtering by ids to find the correct names</li></ul><p>Since we model all our entities in the structured loading system, our id-name resolution is effectively free. This wasn’t always the case though, as the id-source system existing prior to the structured loading system. We still have remnants of that system, named “custom loaders”, which were quite structured in their own right — perhaps the beginnings of the structured loading system.</p><blockquote><em>We have different loaders for enumeration values and field options. The general idea applies, but with a different structure to the loader. I can cover this in a future article for comparison.</em></blockquote><h3>Deprecated and removed values</h3><p>A common use-case of ids is the archiving or deprecation of an entity. For example, you have a process workflow where a user needs to be assigned to approve a step. The list of users should only show those people who are available, not the complete list of users on the system. However, what happens when a previously assigned user leaves the company?</p><p>In our system, we decided that if you view the assignee field, on a form or in a list, you’d still see the name of removed users, but if you edit the field, you cannot select those removed users. How does the id-source system gather and relay this information to the front-end?</p><p>First, we don’t actually delete entities in our system, instead marking them archived. When you have a lot of cross-linked entities, actual deletion is not a realistic option. That means our removed user still exists in the DB, but with an archived flag set on it.</p><p>Then, in the loader, we distinguish between fundamental and selective filters. The fundamental filters define the entire space of potential entities. For most id-sources, this is simply the entire database table. Then there are selective filters. These further limit which entities should be available for selection in the UI. This is where we exclude archived entities. Think back to the store’s essential fields. We have one called “archived” which we use for this purpose. But users can also define custom filters.</p><p>The front-end makes two different calls to the id-source system. The two calls share one API and they could be combined, but rarely are anymore. These two requests are:</p><ul><li>Give me a list of names for a specific list of ids</li><li>Search for these terms and return the results</li></ul><p>Let’s illustrate the first one with the HTTP request properties:</p><pre>endpoint: /api/list_id_source<br>parameters:<br>   id_source: entity/project<br>   need_ids: [13, 258, 1932]</pre><p>In this case, for the need_ids properties, the backend omits the selective filters. Even if the entity is archived or excluded, the backend loads it if the front-end specifically requests its ID.</p><p>For the second case we can have an HTTP request like this:</p><pre>endpoint: /api/list_id_source<br>properties:<br>   id_source: entity/project<br>   count: 100<br>   search_terms: [&quot;rubber&quot;, &quot;stable&quot;]</pre><p>In this case, the search_terms and count indicate we&#39;re producing a list for the user to select from. The backend will include the selective filters, hiding all the archived items. This prevents the old items from being found in a dropdown control.</p><h3>Use in a dropdown control, universal progressive loading optimization</h3><p>The common dropdown control, which lists values for selection by a user, is perhaps the apex feature of the id-source system. It combines a lot of features into a seemingly simple control. We never aimed for this control; it emerged from combining several other features.</p><p>The initial focus was on progressive loading, not on naming. We have massive lists of entities in the project, those with over 100k entries. There’s no way to load that in the front-end for searching — indeed, anything above 1k becomes problematic. You required a control that presents part of that list but allows for searching, which dynamically loads via an API. For places that needed to select from those large lists, we built custom controls against their APIs — not a sustainable approach.</p><p>I had to write another such control, but saw a problem if we kept repeating this for all types in the system. So I attempted to write something reusable. I created a dropdown control that worked against a generic progressive loader. This is mostly just a standardized function signature and lookup table. You pass this loaders to the control and it handles the control part dynamically.</p><p>Then I needed one for this new id-source system (which was still in its early stages then). This worked well, and suddenly exposed a lot more entities and lists for progressive selection. Add in the structured loading and we now have a near universal abstraction for progressive select controls.</p><p>From the view of this control, the deprecated values is perhaps easier to understand. When the control doesn’t have focus, it shows only its current value. This calls the id-source API with the specific ids needed, which in turn uses only the fundamental filters, thus can find deprecated values. When the user opens the control, and types in a search term, that is sent to the API as a search request. The backend then applies the selective filters, removing all deprecated items.</p><h3>Custom Labels</h3><p>There was a recurring problem that came up with relying on the essential name field: some entities in the system don’t have names of their own. For example, entries in the inventory system. They are inventory for something else, such as an ingredient or a recipe, thus the inventory item itself doesn’t need its own name. It uses the name of what it links to, the ingredient or recipe name.</p><p>At the SQL level, this is problematic. You can’t produce an efficient query that dynamically joins to the correct target table to get the name. Consider that in a list, each row of the inventory may link to a different type of entity. However, since the list of targets is limited, we can link to all of them and coalesce the results, assuming one will not be null.</p><p>But that single coalesce would be too limited, and hard to implicitly determine based on the source entity. It is also not efficient to search such a query.</p><p>Instead, we have a label building system. A dynamic label has two parts:</p><ul><li>A set of columns to use as raw data</li><li>An expression on how to combine them.</li></ul><p>This breaks the problem into two parts: the loading and searching, and the label production.</p><p>For example, we might have a specification for the inventory items:</p><pre>columns:<br>   - recipe.name<br>   - ingredient.name<br>label: (join_non_null_str (array (ref:columns.c0) (ref:columns.c1)) “, “)</pre><p>By having distinct columns, we can solve the search problem. Instead of searching the resulting name, we search each of the source columns. While not identical, this result will suffice for the majority of situations. It’s also quite efficient, since it can use the indexes on the individual columns.</p><p>We wrote the expression in our value-spec language, which would require its own series of articles to cover. This language is more flexible than SQL commands. We can also call it once we have the raw results; nothing on the SQL side cares about this expression.</p><p>This lets us do more than coalesce or join values. For example, our lab requests, while they have a name, they also have a run-number. Prior to id-source, we would present these names as the name, an icon separator, and the run number, for example: “Rubber Sample 📋 LR2134”. We can recreate this in the id-source system with this specification:</p><pre>columns:<br>   - lab_request.name<br>   - lab_request.run_number<br>label: (text ref:columns.c0 “ 📋 “ ref:columns.c1)</pre><p>The application uses these labels in most places, from dropdown controls and list pages to forms and links.</p><p>Because of a few limitations, we will use the raw name sometimes; this is problematic for entities without proper names. Explaining the reason would require a lot of deeper details. I know the solution, but it requires a high time investment. The limitations are not yet problematic enough to justify that effort.</p><h3>Structured select configuration</h3><p>The lists in our systems allow an administrator to configure the listings, such as setting defaults, add extra tabs, configure filters, assign to user groups. Part of this is selecting the columns to display in the listing. In the previous section on custom labels, there was a columns part to the definition.</p><pre>columns:<br>   - lab_request.name<br>   - lab_request.run_number<br>label: (text ref:columns.c0 “ 📋 “ ref:columns.c1)</pre><p>Some of these are hard-coded in our defaults files, and some on the structured stores themselves. But this is all backed by the same structured list configuration. This means that our users can edit the configuration used for the id-source system. They can select the columns they want to see in the names.</p><p>For example, say our user doesn’t like this standard formatting of the lab request. They may not be using the run number, but they do consider project important. So they can select the name and project column instead.</p><pre>columns:<br>   - lab_request.name<br>   - lab_request.project_id</pre><p>I’ve left the label out, as the default will comma-separate the values. There’s an interesting twist here. Notice that I said project_id, which is not the project name. Clearly, the user would like to see the project name. How is this resolved? Well, we use the id-source system! This recusrion gets complicated, but we end up with only a single SQL query.</p><p>These custom configurations also provide the search basis, not just visuals. By modifying the custom columns, the user can control what properties they can search by to help them find what they’re interest in. In the previous example, this means the user can search by request name and project name. This is useful when naming is not globally unique, but only unique in conjunction with the project.</p><h3>Wrapping up with some metadata</h3><p>There’s one last feature I mentioned at the start, but didn’t cover. That’s loading metadata, such as custom icons and tag colours. Our entities can also be locked, so we can show a lock symbol along with the name.</p><p>This feature directly results from using structured loading for the id-sources. Similar to the essential fields, we also have standard entity fields available to all entities. It’s no extra effort for the id-source loader to pull in a few of those as well. Since the select control, and form fields, are completely generic on the front-end, it’s also no problem for them to format this extra information.</p><p>There’s obviously a lot of details I’ve skipped in this article, focusing on the general architecture. I’ve also ignored non-structured loading based id-sources. That might be of interest if you want to implement such a system, so let me know if you want more details.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=663d49b7a588" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/universal-id-to-name-mapping-for-the-frontend-and-backend-663d49b7a588">Universal id to name mapping for the frontend and backend</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structured loading: Universal data access and interaction]]></title>
            <link>https://medium.com/uncountable-engineering/structured-loading-universal-data-access-and-interaction-b5573c91706d?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/b5573c91706d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Fri, 07 Mar 2025 12:07:50 GMT</pubDate>
            <atom:updated>2025-03-07T12:07:49.999Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cqZ2pBCBpG2voXVPoCCwnA.jpeg" /><figcaption>Photo by <a href="https://pixabay.com/users/astama81-71731/">astama81</a></figcaption></figure><p>Enterprise applications are all about data management. Beyond data entry, the ability to explore and analyze data boosts the productivity of a company. <a href="https://www.uncountable.com/">Uncountable</a> R&amp;D solutions span an increasing scope of data, from experiments to lab requests, from tasks to inventory management, certification, and more. While each of these have their specific business uses, we continually find more ways to work with the data. From filterable lists, editing values, and to the more ambitious pivot tables and charting — the need to surface more of our client’s data and deal with ever-present performance requirements drove us to a new solution: <em>structured loading</em>.</p><p>Uncountable’s product differentiation comes from it’s expressive data model for storing structured experiment information. We had already started abstracting access to this data, from the representations of lists, to re-use front-end code. We used common filter expressions, but while some queries were shared, most loaders remained specific to each data type. Reaching the limits of standard <a href="https://en.wikipedia.org/wiki/Object-relational_mapping">object-relational models (ORM)</a>, we needed a better solution. We created <em>structured loading</em> to provide a host of data management and exploration features without having to create redundant code.</p><p>In this article I’d like to go over a few basics, and what sets <em>structured loading</em> apart from other systems.</p><h3>Features of Structured Loading</h3><p>Here are some of <em>structured loading’s</em> high-level features:</p><ul><li><strong>Editable Lists:</strong> If you can edit something in a form, then why not also in a list? We continue to work towards universal data entry.</li><li><strong>Aggregated Data:</strong> Users can configure grouping and aggregation calculations to produce statistics and draw charts.</li><li><strong>Naming System:</strong> We provide a standard “id to name” mapping system based on our modelling, usable on forms, lists, and even supporting external copy-paste.</li><li><strong>Column and Filter Discovery:</strong> The UI automatically shows all columns available for a list as well as their filter options.</li><li><strong>Virtual Columns:</strong> These provide data that isn’t available as a single database column, but result from a subquery.</li><li><strong>Data Relations:</strong> For entities that point to other entities, such as an Invoice pointing to a Customer, data from that transitive entity can be added to the same listing. This is recursive, to any depth.</li><li><strong>Equation Columns:</strong> The user can build equations combining the results of other columns. This works on aggregated data and supports sorting and filtering.</li><li><strong>Type Safety:</strong> Our data format is highly expressive and we ensure it’s valid. From simple constraints on numeric fields, to typing and validation of JSON blobs on the database.</li><li><strong>Security:</strong> Not all users are allowed to see all entities, nor all fields in those entities.</li></ul><h3>Basic Operations with a Store</h3><p>The core piece of data modelling is called a store. We define these for each of our entity types in the system. For example, lab requests have a store, projects have a store, experiments have a store, and so on. Each store maps onto a database table, and at a minimum describes each column in the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0_ut9ks7CivDTlPc.png" /></figure><p>For example, the store for the lab request will define fields such as below:</p><pre>LabRequest:<br>	table: lab_request<br>	fields:<br>		name:<br>			column: name<br>			value_type: text<br>			name: Name<br>		lab:<br>			column: lab_id<br>			value_type: id<br>			id_source: entity/lab<br>			name: Lab<br>		dueDate:<br>			column: due_date<br>			value_type: date<br>			name: Due Date</pre><p>From this bit of information, we can build most of the features of the system. For example, you can see how, if the user is in the Lab Request page, we can present a list of columns from this table. Since we have the database table and columns, we can generate the SQL needed to load this data. Given the high-level value_type, we can also present a form field to the user, and then store it to the table if they enter it. We also know which types of filters we can support on these fields, and present a selection to the user.</p><p>In the simplest case, the stores express columns that are present in the database model directly to the user. However, there are also cases where the user should see only a derived version of the underlying database model. For example, users can “watch” lab requests, meaning they get notices about them. This is stored in a separate table and has a filtered join condition. A user may want to see who is watching a lab request in the list of lab requests, but more importantly, filter to lab requests they themselves are watching. Some of these columns were difficult to model directly, so we introduced custom loaders. The store entry for this might look like below:</p><pre>watchers:<br>       type: ExtraColumn<br>       name: Watchers<br>       loader: LabRequestWatchers<br>       value_type: ids</pre><p>Where LabRequestWatchers is a Python class that implements the particulars of the query. However, there is a tradeoff here. By not making the full underlying database model accessible, in the future you may need to build even more ExtraColumns to satisfy user needs. We’re finding the more we expose, the easier it is to scale the application. It doesn’t have to be direct exposure, instead, we try to build generic semantic concepts. For example, we’ve recently added ORM style backlinks, where you can join across stores via indirect field references.</p><h3>Naming and linking entities</h3><p>The naming system is a central part of our application. It’s a mechanism to give all entities names when the user sees them. Beyond that, it’s used as the basis for data relationships, allowing navigation between entities, and drilling down for information.</p><p>The example has a field called lab with a value type of id. This is a typical foreign key on the database. The lab request table’s lab_id contains the primary key of another table, lab in this case. When a user sees this field, they don’t want to see the id, they want to see the name of the lab. This applies both in the static view in a list and while editing in a form.</p><p>The id_source for a field tells us what entity type the id refers to. In the example, the entity/lab source tells us that the lab field refers to the lab entity.</p><p>In brief, the id-source system provides this functionality:</p><ul><li><strong>Display Name:</strong> In a list, a user wants to see the name of the entity, rather than its id.</li><li><strong>Selection:</strong> While editing a field, we can use this to show a list of names to select from, as well as provide search functionality. We also offer a filtering mechanism for this selection.</li><li><strong>Search:</strong> In a list, the general text search can search over the names of these linked entities.</li><li><strong>Data Relations:</strong> This builds the relations between tables, allowing a user to look into linked entities.</li></ul><p>The id-source system existed prior to <em>structured loading</em>, but the two have grown to be sibling systems, with tightly interwoven functionality. The <em>structured loading</em> system replaced much of what us used to write manually for the id-source system. Now, naming is automatic as long as we follow a few rules about “essential fields” in the stores.</p><p>The id-source system has solved a lot of challenges in our application.</p><h3>Backing forms and Stores as their own System</h3><p>Our system already had generic forms. We incorporated this system into <em>structured loading</em>. User defined fields were available in lists, just the same as all the hard-coded store fields. Then, we added the ability to show lists inside forms, as well as pull out columns from lists and put them as individual fields in some entry systems.</p><p>The ability to edit a value in a list was initially driven by the system backing our forms. But at some point we realized the stores had all the information we needed. So we rewrote several of the middle pieces of the software, so the form system was backed by the stores. The boundaries between the systems blurred, allowing us to remove a lot of redundant code.</p><p>We eventually took the logical step of treating stores as a separate concept from the list system. They now form the basis to <em>structured loading</em> and the form system. The push to universal systems continues to expose new features and reduces the surface area of our code.</p><h3>An Evolving System</h3><p>The <em>structured loading</em> system is an actively developed part of our architecture. We continue to find new ways to push its boundaries and help our customers to get more value out of their data. We’ve created a system where a small bit of data modelling exposes a rich set of data management and exploration tools.</p><p>As a unique system, new programmers need to familiarize themselves with it when they join the team. Once learned, it saves us countless hours of development. Instead of worrying about basic data management and access APIs, we can focus on the higher-level business functions of the code.</p><p>It’s obviously a complex system with a long history. I will follow up with articles about specific aspects and sub-systems, as well as non-functional aspects that I find interesting. There’s so much more to uncover, such as query generation and the optimizations that go well beyond what the database itself can do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5573c91706d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/structured-loading-universal-data-access-and-interaction-b5573c91706d">Structured loading: Universal data access and interaction</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shared Data Loading Across Components]]></title>
            <link>https://medium.com/uncountable-engineering/shared-data-loading-across-components-5ca4d8f199ca?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/5ca4d8f199ca</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Wed, 24 Jul 2024 14:13:04 GMT</pubDate>
            <atom:updated>2024-07-24T14:13:04.138Z</atom:updated>
            <content:encoded><![CDATA[<h4>Avoiding duplicate network requests in web applications</h4><figure><img alt="Butterflies Exotic Pairing photo" src="https://cdn-images-1.medium.com/max/1024/1*4WC-c7Y24MbL10cZrlv-Dg.jpeg" /></figure><p>Web applications need to load data from the server to render content to the user. In a complex application, there are often multiple components in view at the same time that all depend on the same data. How can we write a modular app that promotes building independent, reusable components while avoiding loading the same data multiple times from the server?</p><p>This is a problem we needed to solve at <a href="https://www.uncountable.com/">Uncountable</a>. We use React and Redux, with a variety of components spread over several pages. As we modularized and encapsulated behaviour, we walled off knowledge about what data a component needed to load. This was good, since it reduced the burden of using shared components. However, we had a problem: if two components both need the same data, how can we prevent it from being loaded twice?</p><p>To manage this, we created a data loader, which is a central system that can manage loading across apps.</p><blockquote><em>We use Redux in our app, but this was more of a hindrance than a help. While it does provide a way to share data, it’s inimical to the idea of reusable-and-encapsulated components. The concept below is easy, if not easier, to implement with pure React. For more on state management using React, see my article on </em><a href="https://mortoray.com/a-mini-redux-in-react/"><em>A mini-redux in React</em></a><em>.</em></blockquote><h3>Example</h3><p>Let’s start with an example to demonstrate the problem and identify the parts needed for the solution. Say we have an endpoint /api/get_user_data which retrieves some basic information about the user, including their name, team, and basic permissions. Now say we’re on a team dashboard page that shows several cards of information.</p><p>There are three different components that want the user information:</p><ul><li><strong>Navbar:</strong> This appears on every site page and contains a link to the team page, for which it needs to know the team, or at least its name.</li><li><strong>Grid Layout:</strong> Some cards have privileged information and should not be shown for all users, therefore the grid layout needs to know the user’s permissions to decide which cards to display.</li><li><strong>Profile Card:</strong> One of the cards shows a quick profile overview, including the user’s name, team, and whatever details are available from the get_user_data endpoint.</li></ul><p>They each want access to the same user data. There are three approaches one could use to ensure each component gets access to this data:</p><ul><li><strong>Page Coordinated:</strong> The top-level page code, in this case, the team dashboard page needs to load all the data needed by the components of the page and provide it to them. This is hard to manage and breaks the encapsulation of components. You have to hard-code all the needed data at the top-level, outside of where it’s actually needed.</li><li><strong>Uncoordinated:</strong> Every component simply loads their own data. It’s easy, but we end up with duplicate loads.</li><li><strong>Data Manager:</strong> The approach I’m describing in this article. The team page doesn’t know what data is being loaded; each component requests its own data; the central data loader coordinates the load.</li></ul><h3>Keys and Loaders</h3><p>In order to coordinate the loading of shared data we need to know which data should be shared, as well as have a way to load that data. Here’s some pseudo-code showing how a component would provide that information to the data manager.</p><pre>const userData = dataManager.useLoadData( `user-data`, requestGetUserData )</pre><p>Where requestGetUserData is a function, called a loader, that the data manager can use to load the data on demand. The data manager needs the loader since it has no former knowledge of any data; it’s a relatively pure component that has no knowledge of business logic. This was an architectural choice to ensure we could support segmented loading of apps, avoid monolithic feature maps, minimize code executed at load-time, and keep business logic out of the generic utilities. It’s easier to maintain this way.</p><p>The goal is that any component can make the same request to the data manager. The data manager will collect these requests, make a single call to the loader, and return the same data to all of them. I’ll get back to how it coordinates a bit later. In our React architecture, we’re using a hook function, thus the use… prefix. Until the data is loaded, this function returns <a href="https://mortoray.com/the-many-faces-of-undefined-in-javascript/">undefined</a>.</p><blockquote><em>Our data loader hooks use React’s </em><a href="https://react.dev/reference/react/useState"><em>useState</em></a><em> function. When the data manager has new data, it calls the listeners (described later), which call the state setter, which causes React to rerender the component.</em></blockquote><p>That’s basically it. We now have a system where each component can independently request the data; the data manager collects those requests and makes a single call. Albeit, there are a few issues here, and a few details to cover.</p><h3>Mismatched keys and loaders</h3><p>What’s the problem if each component has to use the exact same code below?</p><pre>dataManager.useLoadData( `user-data`, requestGetUserData )</pre><p>It’s error prone.</p><p>If I make a typo on the key, I’ll still load the data but end up with an extra server request.</p><p>What if I accidentally use the wrong loader? This is the trouble case. The data manager expects all keys map to the same loader. If the different callers provide different loaders, it is undefined which loader is used. This can cause the wrong data being returned to all components.</p><p>The most straight-forward solution here is to use the loader itself as the key. The JavaScript Map type supports this. Our application uses dynamic loading though, so could we rely on functions being singletons? Interesting question, but actually not relevant in our case. There’s a weird history to our code that forced us to use an object, where functions aren’t valid keys. By the time a Map was possible, the data manager pattern was already widespread.</p><p>Nonetheless, there is a simple fix that works even if you can’t use the function as the key. Instead of using the key and loader directly, you can wrap them to create a loader object. This exact form didn’t actually exist in our code, as we jumped from ad-hoc solutions to a handful of system-specific solutions.</p><pre>export const getUserDataLoader = {<br>	key: `user-data`,<br>	loader: requestGetUserData,<br>}<br><br>...<br><br>dataManager.useDataLoader( getUserDataLoader )</pre><p>This doesn’t completely solve the problem. We could have two distinct loader objects using the same key by accident. We need to prevent that from happening. For data loaded directly from API endpoints, the simple answer is to use the endpoint string as the key. Instead of user-data, use /api/get-user-data. These are unique paths that won’t overlap with any other loaders.</p><h3>Arguments</h3><p>I’ve simplified the scenario by using an endpoint that doesn’t take any arguments. /api/get_user_data doesn’t have any options and always returns the same data for the given session.</p><p>Let’s instead consider the endpoint /api/get_team_data. Unlike the user data, we need to provide the id of the team. We can no longer define a single key for this data. Two different components loading different team data would clash on a singular team-data key.</p><p>So we added an arguments parameter to the data manager calls, and the loaders. The component requests data like below.</p><pre>var teamData = dataManager.useDataLoader( getTeamDataLoader, { id: teamId } )</pre><p>The second argument to the useDataLoader function is passed to the underlying loader, as well as used to construct a unique key.</p><p>To construct the final key, we JSON serialized the arguments and append it to the basic key. If teamId == 123 we’d end up with team-data:{&quot;id&quot;:123}. Any change of the arguments results in a new key.</p><p>It’s important here to use a stable JSON serializer: one that sorts the keys. Otherwise, when there are multiple properties in the arguments structure, you could end up with different serializations of logically equivalent arguments. We actually went further, and for each API specify some array arguments that should also be sorted — they represent sets where the order doesn’t matter.</p><h3>How does the data manager coordinate loading?</h3><p>Now that we’ve seen how the components interact with the data manager, we’ll take a short look at what the data manager itself has to do.</p><h4>The Loader</h4><p>First, let’s see what the loader function signature looks like. Or rather, what a simplified and cleaned version could look like — ours is a bit marred with history.</p><pre>type OnData&lt;ResponseT&gt; = (data: ResponseT) =&gt; void<br>type OnError = (response: any) =&gt; void<br>type LoaderFunction&lt;ArgumentsT, ResponseT&gt; = (<br>	arguments: ArgumentsT,<br>	onData: OnData&lt;ResponseT&gt;, <br>	onError: OnError,<br>) =&gt; void</pre><p>We’re using TypeScript generics to ensure that the components will get a type-correct view of the data they are loading. The useDataLoader function is also a generic that can infer the types from the loader. Internal to the data-manager, we treat the typed values as opaque objects. We still have a requirement that they must all be JSON compatible to use in redux.</p><p>The arguments are whatever was passed as arguments in the useDataLoader function.</p><p>As the loader is most likely making an endpoint call, the loading is asynchronous. The data manager can’t expect the data to be immediately available and provided in a return statement. Instead, an onData function is provided, which should be called with the data when it is available. An onError function is provided in case the data cannot be loaded.</p><blockquote><em>We had, at one point, a loader that wasn’t asynchronous: it reported a static enum of values. This tripped up our data loader since it wasn’t expecting the </em><em>onData function to be called prior to the function returning. An easy fix was to defer the </em><em>onData via a </em><em>setTimeout call — that’s easier than trying to handle this exceptional case in the data manager.</em></blockquote><h4>The Status</h4><p>When a component calls useDataLoader, the data it wants, identified by the key, can be in one of these states:</p><ul><li><strong>Unloaded:</strong> This is the first request of data with this key.</li><li><strong>Loading:</strong> The data is currently loading.</li><li><strong>Loaded:</strong> The data is available now.</li><li><strong>Error:</strong> The data failed to load.</li></ul><p>The interesting case is the Loading case: why do we need it?</p><p>When a call comes in and the data is Loaded we can simply return the data. If the data is Unloaded, we can schedule a call to the loader and return undefined. If another call comes in now, and we left the state as Unloaded, then we’d schedule a second call to the loader. To avoid this, we switch the state to Loading the moment we schedule the first call. Any further calls while Loading will have undefined returned immediately, without scheduling another loader call.</p><p>In the error case, we return undefined. We do not attempt to reload the data, nor do we schedule another try later. Instead, the user will see the error, our log server will log the error, and we’ll fix whatever caused it. Keep in mind that this entire data state lives for only a single page in the app. An ephemeral error will be clear as soon as the user navigates elsewhere.</p><h3>Reload</h3><p>Our system evolved from rather simple beginnings, and has a bit of debt we’ll eventually clean up. One sore point was an explicit reload feature: if a component modifies the data, it should be able to tell the data manager to reload it. In theory, this could be a simple dataManager.reset( someLoader ) call, but due to some initial design choices, this was hard to implement. Just be aware you need this from the start and you won’t have a problem.</p><blockquote><em>To work around our initial design choices, we ended up creating an additional load key argument to the load functions. The key doesn’t change what is loaded, but when changing key forces a reload. We used the name “version” for this load key, which is quite misleading. Each call to the data-manager has it’s own tracking, so we avoid any need to coordinate a proper “version”.</em></blockquote><p>Reloading shared data actually doesn’t come up that much. The data manager only shares the limited amount of data that is commonly used across components. Aside from this shared data, each of our pages has its own set of primary data they are modifying. This is often a larger set of data and uses multiple API calls to load and save on demand. By limiting the data manager to a small set of mostly immutable data, we avoid needing to reload it. It’s the rare case where a page modifies data that might be shared and needs to inform the data manager of this.</p><h3>Generalized Use</h3><p>But doesn’t Product XYZ do this? Our data manager does feel like something that should have a packaged product, but is there one that fits into Redux and our app structure? I didn’t think it would involve much code, nor did I want to fall victim to <a href="https://mortoray.com/invented-here-syndrome/">invented here syndrome</a>, so I wrote the data manager after only a brief search. It would be nice to generalize, and clean up, this library to publish. If not for re-use, then just for a full demonstration of the concept.</p><p>Having our own code let us go further than the abstractions I’ve shown here. We built API specifications into <a href="https://mortoray.com/sharing-data-types-on-a-multilanguage-project/">type-spec</a>, which is our cross-language portable type system. Because we generate all the wrappers and setup automatically, most coders only see something like ApiGetUserData.dataLoader.useLoadAndSelect. Apart from the term dataLoader there, they won’t have any exposure to the data manager.</p><p>In this article, I’ve focused mostly on a 1:1 key -&gt; api endpoint mapping, but the data manager is quite generic. We also use it for a generic naming service. In that system we merge the arguments from multiple callpoints into a single API call. But I’ll need another article to talk about this naming service.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ca4d8f199ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/shared-data-loading-across-components-5ca4d8f199ca">Shared Data Loading Across Components</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The many faces of undefined in JavaScript]]></title>
            <link>https://medium.com/uncountable-engineering/the-many-faces-of-undefined-in-javascript-7e0be78040af?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/7e0be78040af</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Wed, 26 Jun 2024 06:29:21 GMT</pubDate>
            <atom:updated>2024-06-26T06:29:21.842Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ukXDXP_1as_KOTkSjSdzuA.jpeg" /></figure><p>Why does JavaScript have so many ways to represent unknown values? Of the ones I’ve found, only a couple seem necessary. The rest of these unknowns create confusion and lead to defects in code. It’s an unfortunate situation, so one worth understanding if you code in JavaScript.</p><p>Below, I summarize how we can represent missing data, unknowns, or undefined values in JavaScript. In this article, I’ll give more details to each of them.</p><p>The Simple Cases</p><ul><li><strong>null:</strong> A real value with a distinct type</li><li><strong>undefined as missing:</strong> A generated value when a field isn’t known</li><li><strong>undefined as value:</strong> A real value with a distinct type assigned to a variable</li></ul><p>The Interpretative Cases</p><ul><li><strong>Falsy:</strong> When a real value looks undefined</li><li><strong>ReferenceError:</strong> When a symbol isn’t known</li><li><strong>&lt;empty slot&gt;:</strong> In sparse arrays</li><li><strong>-1 as undefined:</strong> Returned from some functions</li><li><strong>undefined replacement:</strong> A confusing situation</li></ul><p>The TypeScript Cases</p><ul><li><strong>function arguments:</strong> unspecified arguments and explicit undefined</li><li><strong>void:</strong> a special TypeScript version</li></ul><h3>The Simple Cases</h3><h4>null</h4><p>Null is the classic null value. It is generally used to mean that a value is optional, but has not been provided. I assume many coders would be happy if this were the only undefined value in a language. Indeed, many other languages get away with just one. But not JavaScript; we’re just getting started.</p><h4>undefined as missing</h4><p>The concept of undefined initially seems to make sense. Whereas null specifies an actual value, an undefined would indicate the value doesn’t actually exist. This makes sense if you consider this structure, using TypeScript notation:</p><pre>interface Arguments {<br>	nullable_value: number | null<br>	optional_value?: number | null<br>}</pre><p>We’re saying that nullable_value is a required property of this structure: you can’t omit it. It can, however, be a null value. optional_value is also nullable, but it doesn’t need to exist at all. undefined lets us distinguish between a specified null value, and the value not existing at all.</p><pre>const a = {<br>	nullable_value: null,<br>	optional_value: null,<br>}<br><br>const b = {<br>	nullable_value: null,<br>}</pre><p>With these variables, a.optional_value === null. In b however, b.optional_value !== null but b.optional_value === undefined, since optional_value isn’t defined in b at all. On casual use, this feels like a decent way to report, or detect, values that are missing from a structure.</p><p>Alas, lossy comparison has made this confusing. I used === null to check strictly for the null value. The expression b.optional_value == null is true, since an undefined value loosely compares as equal to null. Since equality is the same with the arguments swapped, that means that b.nullable_value == undefined is also true.</p><blockquote><em>Most other languages don’t have this concept of undefined. </em><a href="https://mortoray.com/the-uninitialized-variable-anathema-non-deterministic-c/"><em>In the C++ space</em></a><em>, undefined isn’t a specific value, but means precisely the value is undefined: it does not have a determinate state and could be anything at all.</em></blockquote><h4>undefined as a value</h4><p>The comparison to undefined requires that undefined is a symbol in the language. And for consistency of syntax, it is a real value in the language. This is a choice JavaScript made, likely for implementation simplicity, instead of keeping undefined a special symbol.</p><p>Here’s where the first bit of oddity shows up, in case undefined itself wasn’t already odd enough for you. What if I specify this constant:</p><pre>const c = {<br>	nullable_value: null,<br>	optional_value: undefined,<br>}</pre><p>I explicitly said optional_value is undefined. So does this structure actually define the optional_value property?</p><p>If I serialize to JSON and back, using the standard JSON module, the explicit undefined will be stripped, like we didn’t specify it at all. That’s perhaps good. Additionally, the expression c.optional_value === undefined is true. That is good. It seems like it’s equivalent to not specifying the value at all…</p><p>…but wait? Object.hasOwn( c, ‘optional_value’ ) is true. So c does have the optional_value property. Indeed, if I emit c on the console, it will print out optional_value: undefined. This is in contrast to the object b I defined before, where Object.hasOwn( b, ‘optional_value’ ) is false.</p><h4>A Confusing Convention</h4><p>This establishes that undefined as a property value is distinct from a property not existing. This inconsistency is a common source of undefined-value-related defects in code.</p><p>This also undermines, and confuses, the purpose of undefined. It does not mean a value does not exist, but is rather just an alternate form of null. It’s only by convention that we consider undefined values to be equivalent to missing values. And not all libraries uphold this convention, not even the standard JavaScript library.</p><blockquote><em>This convention caused problems when I </em><a href="https://mortoray.com/sharing-data-types-on-a-multilanguage-project/"><em>wrote a cross-language serialization format</em></a><em>. To ease the Python side of things, I ended up treated any types as </em><em>null | undefined in JavaScript that could have just been </em><em>undefined. But I also created a more complex </em><em>MissingSentryType to match a true unknown.</em></blockquote><h3>The Interpretative Cases</h3><p>Now, let’s look at some of the more esoteric undefined values. These are language semantics that clearly introduce undefined values, but in indirect ways.</p><h4>falsy</h4><p>We have to consider <a href="https://developer.mozilla.org/en-US/docs/Glossary/Falsy">falsy</a> values in this discussion. A lot of code checks for null in conditional statements like below:</p><pre>if( someObject ) {<br>   someObject.call()<br>}</pre><p>This if-expression is false someObject is null or undefined, which is what was desired here. It’s also false for a boolean false. Additionally, it’s false for the value 0 and an empty string; I’ve seen these two cause defects in code that thinks it’s checking for null.</p><blockquote><em>We find this falsy pattern in other languages, like C. However, in C it cannot lead to the same defects as in JavaScript. Pointers are distinct types and require explicit dereferencing. You can’t accidentally interpret a zero integer as an null pointer. If you had an </em><em>int* someObject in C, the above JavaScript if-statement would be equivalent to </em><em>if( someObject &amp;&amp; *someObject ).</em></blockquote><h4>ReferenceError</h4><p>If I type an unknown symbol into the browser console, I get a ReferenceError exception.</p><pre>&gt; nothing_here<br><br>Uncaught ReferenceError: nothing_here is not defined</pre><p>Yet if I type window.nothing_here I get an undefined value. window is supposedly a view on the global data (or `global` in NodeJS). Why does nothing_here have a different way of reporting it’s missing depending on how I access it?</p><p>This inconsistency also happens with functions.</p><pre>function missing() {<br>    console.log( this.nothing_here )<br>    console.log( nothing_here )<br>}</pre><p>Calling this function emits undefined followed by a ReferenceError. It’s easy to understand the difference that leads to the inconsistency. It’s, however, hard to understand why we’d want this inconsistency.</p><h4>&lt;empty slot&gt;</h4><p>Arrays in JavaScript can be sparse, which introduces yet another way to create missing values.</p><pre>arr1 = []<br>arr1[0] = &quot;Zero&quot;<br>arr1[2] = &quot;Two&quot;</pre><p>If I emit arr1 to the console, I get Array(3) [ “Zero”, &lt;1 empty slot&gt;, “Two” ] as the short output, at least in Firefox. Except, if I expand the console output, I get the below.</p><pre>0: &quot;Zero&quot;<br>2: &quot;Two&quot;<br>length: 3</pre><p>It shows only two elements, which makes sense, but the length is still 3. Accessing arr[1] results in undefined.</p><p>But what if I create an array with an explicit undefined value?</p><pre>arr2 = [&quot;Zero&quot;, undefined, &quot;Two&quot;]</pre><p>Emitting arr2 to the console produces Array(3) [ “Zero”, undefined, “Two” ]. So an empty slot is not the same as an undefined value in the array, even if they have the same length and the value at index 1 is undefined in both cases. You can tell they are different if you call .flat() on them. arr1.flat() == [“Zero”, “Two”] whereas arr2.flat() == [“Zero”, undefined, “Two”]. The core language seems to ignore the convention about treating undefined as a missing value.</p><p>If you do wish to get an empty slot in an existing array, you can use the delete operator. delete arr2[1] removes the undefined value, replacing it with the empty slot.</p><h4>-1 as missing value</h4><p>Despite having both undefined and null values, Array.indexOf returns -1 if it can’t find an element in an array. Though Array.find is happy to return undefined when it can’t find an element.</p><p>Arrays aren’t strictly arrays in JavaScript, though. They are objects which can behave somewhat like an array. They can also be sparse, as we saw previously. These leads to a bit of fun with the indexOf function.</p><pre>arr = [&quot;Zero&quot;, &quot;One&quot;]<br>arr[-1] = &quot;Minus&quot;<br>arr.indexOf(&quot;Minus&quot;) // returns -1</pre><p>indexOf here returns -1, not because it found it at that index, but because it only checked the proper indexes and didn’t find it. This can lead to odd defects if you forget to check the return value.</p><pre>const someArray = [];<br>const at = someArray.indexOf(&quot;Source&quot;);<br>someArray[at] = &quot;Target&quot;;<br>someArray[someArray.indexOf(&quot;Target&quot;)] == &quot;Target&quot;</pre><p>I’ve permanently stuck something at the “not found” index, such that if I look for it, it’ll be not found, yet also found just the same.</p><h4>undefined replacement</h4><p>undefined isn’t a reserved symbol in JavaScript, at least not in a function. This lets us create a custom value for undefined.</p><pre>undefined = 123<br>console.log(undefined) // prints &quot;undefined&quot;<br><br>function stupidCode() {<br>   const undefined = 123<br>   console.log( undefined ) // prints &quot;123&quot;<br>}</pre><p>Oddly, if I attempt to write const undefined = 123 in the global scope, I get a syntax error, though undefined = 123 is fine, but does nothing.</p><h3>The TypeScript Cases</h3><h4>function arguments</h4><p>TypeScript adds an extra twist with optional arguments in function signatures. Consider this function:</p><pre>function missingValue(a: number, b?: number) {<br>    console.log(arguments)<br>    console.log(a, b)<br>}<br><br>missingValue(1)<br>missingValue(2, undefined)</pre><p>b? is an optional argument. In the body of the function, it has the type number | undefined, but that’s not strictly correct. It has either the type number or it has a missing value which evaluates to undefined. We can see this when we print out the arguments value. In the first call, it has only one element, and in the second it has two elements, with an explicit undefined in the second position.</p><p>Thus, this function works differently when called as missingValue(1) versus missingValue(1, undefined).</p><h4>void</h4><p>TypeScript introduces one additional form of unknown: void. You probably recognize this most when declaring a function that doesn’t define a return value.</p><pre>function noReturn() {<br>}<br><br>type CallWithoutReturn = () =&gt; void<br>const proc : CallWithoutReturn = noReturn</pre><p>However, void is just another type in TypeScript. If you have strict null checks enabled, it’s equivalent to undefined, otherwise it’s equivalent to undefined | null. That is, it seems to serve no purpose at all. Consider this code, in which all statements and expressions are valid.</p><pre>function noReturn() {<br>	return undefined<br>}<br><br>function undefinedReturn() : undefined {<br>	// no explicit return<br>}<br><br>function impliedMismatch() : void {<br>  const a = undefined<br>  return a<br>}<br><br>const a : void = undefined<br>const b: void = noReturn()<br>const c : undefined = noReturn()<br>const d : void = undefinedReturn()</pre><p>I could have replaced all void with undefined. void doesn’t introduce any new semantics to the language.</p><h3>Undefined Conclusion</h3><p>In short, the meaning of undefined is “undefined”.</p><p>While this may not matter in many places, it has adverse effects in a few common use-cases: serialization and dictionaries. For serialization, one has to decide whether all missing values are the same, or explicit undefined’s are treated specially, or even distinct from null for that matter. When using a JavaScript object as a dictionary, which we all so often do, also has pitfalls. Iteration differs between missing values and explicit undefined values. Calls to introspection functions, like hasProperty, also have to be used carefully.</p><p>It’s likely that these inconsistencies arose due to the evolution of the language, trying to account for the oddity of the original unspecified JavaScript. TypeScript also kept this all as-is, thus failing to add significant safety to the most commonly used values in code. It’s unfortunate, since it means people introduced to coding through the web are exposed to the most confused system of missing values of any common programming language.</p><h3>Recommendations</h3><p>But in the end, you have to use this language and you can’t avoid undefined values. Here are some things I’ve found that can limit the exposure to the defects created by the many faces of undefined.</p><ul><li><strong>Don’t use falsy comparisons:</strong> Always use an explicit comparison operator, especially when checking for null. This will avoid ever having an unintended equality. That is, don’t write if( someObject ), instead write if( someObject != null)</li><li><strong>Defensively treat undefined as null:</strong> As much as possible, assume that an optional value can be undefined or null. Rely on undefined loosely comparing to null, for comparisons such as someObject == null, which is true if someObject is null or undefined.</li><li><strong>Avoid distinguishing null and undefined:</strong> Avoid creating code that produces distinct null and undefined values. If a function has multiple undefined results, instead return an object with explicit flags in it.</li><li><strong>Distrust convention:</strong> In places where you truly need a distinct undefined and null, such as serialization, you need to be rigorous in analysing code. Assume that all libraries, including JavaScript’s own, don’t do what you need. Test each called function and be strict on the TypeScript typing.</li><li><strong>Don’t use clever tricks:</strong> Do not exploit any of the weird things I’ve shown. Do not rely on any of the inconsistencies.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e0be78040af" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/the-many-faces-of-undefined-in-javascript-7e0be78040af">The many faces of undefined in JavaScript</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sharing data types on a multi-language project]]></title>
            <link>https://medium.com/uncountable-engineering/sharing-data-types-on-a-multi-language-project-dd41b55b7ccf?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/dd41b55b7ccf</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 18:50:56 GMT</pubDate>
            <atom:updated>2023-08-14T18:50:55.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZDq31INORnzoY17v_vbnw.jpeg" /></figure><p>At <a href="https://uncountable.com/">Uncountable</a>, we use a common client-server architecture of Python on the backend and JavaScript on the front. As the project grew we moved away from dynamic types, introducing MyPy and TypeScript. But we hit a problem: we had to specify our types multiple times. It was both annoying, and led to mismatched types. To solve this, I wrote a tool that would let us share types.</p><p>To get both a feel for the tool, and understand the challenges, let’s take a look at a few areas:</p><ul><li><strong>Basic Syntax:</strong> What it looks like and how it works with Python and TypeScript</li><li><strong>Nulls:</strong> How to deal with missing, undefined, and optional values</li><li><strong>Dates:</strong> An example of serializing non-native types in JSON</li></ul><h4>Basic Syntax: type_spec</h4><p>The initial goal of type_spec was to write types once and use them in multiple locations. Over time this grew to include self-documenting types, dynamic form generation, and boilerplate reduction. But let’s look at the base case here, to see where it started.</p><p>This is an example of some types defined in type_spec. I’m making up types that can hopefully be understood without context. I write the below in a file called product.yaml.</p><pre>CurrencyValue:<br>    type: Object<br>    properties:<br>        amount:<br>            type: Decimal<br>        currency:<br>            type: String<br>            <br>Widget:            <br>    type: Object<br>    properties:<br>        title:<br>            type: String<br>        product_code:<br>            type: Integer<br>        description:<br>            type: String<br>        cost:<br>            type: CurrencyValue<br>        expiration?:<br>            type: Date<br>        feature_tags:<br>            type: List&lt;String&gt;<br>            default: []</pre><p>I’ve defined two types, where Widget uses a CurrencyValue for its cost property. This example introduces many of the basics of type-spec, from defining types, to using fundamentals and collections, as well as defaults and optional values. I&#39;ll get back to these, but let&#39;s first look at what type-spec actually does with this definition.</p><p>For Python, the tool currently emits the below dataclasses in the product.py file. I say “currently”, as we continue to adapt this to Python’s maturing type system.</p><pre>@dataclass<br>class CurrencyValue:<br>	amount: Decimal<br>	currency: str<br>	<br>@dataclass<br>class Widget:<br>	title: str<br>	product_code: int<br>	description: str<br>	cost: CurrencyValue<br>	expiration: Optional[date] = None<br>	feature_tags: list[str] = field( default_factory=list )</pre><p>For TypeScript, we get these types emitted to the product.ts file:</p><pre>interface CurrencyValue {<br>	amount: String<br>	currency: String<br>}<br><br>interface Widget {<br>	title: String<br>	description: String<br>	productCode: number<br>	cost: CurrencyValue<br>	expiration?: String | null<br>	featureTags?: String[]<br>}</pre><p>There are a few things that differ from the Python to the TypeScript version.</p><ul><li>It uses camel-case naming instead of snake-case naming convention, to match each language’s best practice: productCode vs product_code</li><li>Both Decimal and Date have become String. We need to use substitutes for when TypeScript doesn&#39;t have the precise types we want to model.</li><li>The expiration property became both a ? field, as well as allowing null. This is actually something we don&#39;t want, but Python poses a limitation here.</li></ul><h4>Serialization</h4><p>We need a bit more than the types to be useful. We need a serializer that converts the dataclasses into <a href="https://en.wikipedia.org/wiki/JSON">JSON</a> for sending to the front-end, and parses incoming JSON back into dataclasses.</p><p>type_spec does all serialization work on the Python side. The JSON it emits to the front-end matches the TypeScript interfaces, so the client can use it directly. It is however, limited to the reduced type set, such as a decimal value being represented as a string. Our control library is designed to work with the limited types. For example, our DateSelector takes in and emits an ISO string.</p><p>Our serializer also deals with a lot of special cases. In existing code there may be inconsistent names, like a snake_case value reaching the front-end. We also have some implied optionals, defaults, and some Union types expecting strict ordered evaluation. The clean examples I showed above avoid these special cases, but it is important to us that we can migrate to the tool without having to change code. We will eventually change the code, but we&#39;d prefer not to do it all at once.</p><h3>Optional Values, Question-Mark</h3><p>We had a bit of an issue with optional values, as we need to represent both a “null” value that does exist, and a value that doesn’t exist. In JavaScript this is simply null and undefined, but Python&#39;s dataclasses don&#39;t have a concept of &quot;undefined&quot;.</p><p>First, the easy case, where a value can be null, is defined using an Optional wrapper.</p><pre>User:<br>	type: Object<br>	properties:<br>		handle:<br>			type: String<br>		name: <br>			type: Optional&lt;String&gt;<br>		email:<br>			type: Optional&lt;String&gt;</pre><p>In the User type, the name can be a string or a null value. This is mapped to str | None in Python and string | null in TypeScript. This is a decent approach for modeling data. Code that uses the User object doesn&#39;t care about the difference between a null or undefined value; it can easily use the above data type.</p><p>But API endpoints are different. Consider a list_players API that has several options for filtering the players. We don&#39;t want the caller to have to specify optional arguments. That&#39;s both inconvenient and not future-compatible: you couldn&#39;t add new arguments to the API without changing all call-sites. Therefore, we added TypeScript&#39;s question-mark notation to mean a value doesn&#39;t have to be specified.</p><pre>ListUserArguments:<br>	type: Object<br>	properties:<br>		handle_regex?:<br>			type: String<br>		with_name?:<br>			type: Boolean<br>		sort?:<br>			type: Boolean<br>		offset?:<br>			type: Integer<br>		limit?:<br>			type: Integer</pre><p>The ListUserArguments API can be called with any combination of those arguments, or without any at all. This creates a natural feeling familiar to REST APIs.</p><p>Handling these in Python is the same as the “Optional” case. For example, the field handle_regex is emitted as type str | None.</p><p>In TypeScript you might expect String | undefined, which is a match to TypeScript&#39;s own question-mark notation. But we actually emit String | undefined | null, and it&#39;s a bit of a pain point in the system.</p><p>For incoming APIs we wouldn’t need the null part, but what about when we send an object from the server back to the front-end. Since Python doesn&#39;t support undefined, the field may contain a null in it. And unfortunately, at the time we wrote this our serializer was incapable of removing fields from the output objects, thus sticking null into the output Therefore, we need to support null on the front-end as well.</p><p>This is something I want to fix. Making changes to serialization is hard though, as there’s always a chance something depends on some oddly specific behavior. Most places won’t care about null versus undefined, but some do.</p><h4>Non-extant, missing values</h4><p>What happens if you have an API that needs to distinguish between a null and undefined value? For example, we could have an API that modifies a user: it can change the user’s name or email. In the below I’ve tried to encode this in two different ways.</p><pre>ModifyUserArguments:<br>	type: Object<br>	properties:<br>		user_handle:<br>			type: String<br>		name?:<br>			type: String<br>		email:<br>			type: Optional&lt;String&gt;</pre><p>From the front-end, it’s clear to the caller that if they don’t wish to modify the name, they simply don&#39;t put it in the arguments. But what about email, does specifying null mean they don&#39;t wish to modify it, or they wish to set the value of null? In Python it gets worse, as we have only None and can&#39;t distinguish whether the caller didn&#39;t specify a value, or they specified null.</p><p>For cases where we need to distinguish between null and undefined, this isn’t going to work. While these are the outlier cases, used in only a fraction of APIs, we do need to support them. For this we introduced a formal extant property.</p><pre>ModifyUserArguments:<br>	type: Object<br>	properties:<br>		user_handle:<br>			type: String<br>		name:<br>			type: Optional&lt;String&gt;<br>			extant: missing<br>		email:<br>			type: Optional&lt;String&gt;<br>			extant: missing</pre><p>extant has three values:</p><ul><li><strong>required:</strong> This is the implied value if there is no extant specified and no question mark. It means this property is required.</li><li><strong>optional:</strong> This is specified by the question-mark operator. It means the field may not be specified, in which case Python should interpret this as None, and the front-end should interpret it as null | undefined.</li><li><strong>missing:</strong> The only one we need to specify explicitly as extant: missing. This means the property may not exist and it&#39;s important to track the difference between not existing and null.</li></ul><p>As I mentioned before, Python’s dataclasses don’t support the concept of undefined values. To support them, I added a placeholder type called MissingSentryType. In Python, the ModifyUserArguments property name gets encoded as name: string | None | MissingSentryType. This gives a unique value that the API endpoint can use to detect if the value is available. It&#39;s a bit annoying to work with, especially as <a href="https://www.mypy-lang.org/">MyPy</a> doesn&#39;t understand what&#39;s going on, but it works, and we see no alternative.</p><h3>Date and Decimal</h3><p>Date and Decimal are both types that Python supports but JavaScript does not. JavaScript has a DateTime, but not a plain date. When serializing either of these values for the front-end they end up as strings.</p><p>We could parse the strings using a library like Decimal.js or moment on the front-end, but that would require having a parsing layer on the front-end. It’d also require all requests go through that parsing library. We find it easier to leave the strings as-is, safely passing them around, and parse them only in controls that need the semantic information.</p><h4>Decimal</h4><p>As a scientific application, precision is important to us. If the user enters a value like 0.123 then we want to preserve that exact value. Python, and our backing database Postgres, are both comfortable working with decimal values and exact representations.</p><p>JavaScript however is not; it uses floating point. The JSON data format does support decimals, but when JavaScript parses it, it’ll parse them into floats. Thus we can’t rely on that and need to emit them as strings.</p><p>Mostly the front-end doesn’t do operations on the decimal values, so this system works well. It gets a string from the backend, it puts the string, as-is, into an edit box. The user then edits the string and it sends it as-is to the backend. Using a regex our front-end controls can still validate the value is correct without having to convert it to a number.</p><blockquote><em>You might reasonably be wondering what happens if the user formats their decimals, such as </em><em>1,000 or </em><em>3 234 932.12. Those are both natural ways to enter numbers, and this does indeed complicate things. We have string-based decimal normalization, but that&#39;s another story. Suffice to say, only a plain decimal string reaches the API endpoints.</em></blockquote><h4>Dates and non-native types</h4><p>Date is similar: JavaScript does not have a date format. But perhaps more importantly here, when we emit values for the front-end, we don’t expect it to do any parsing at all. For example, even though JavaScript does have a datetime format, we also emit datetime as a string and it remains as a string. The caller of the endpoint has to manually parse that into a DateTime if they want.</p><p>We rely entirely on JSON for the front-end representation. Consider this type_spec definition.</p><pre>AuditLogEntry:<br>	type: Object<br>	properties:<br>		value:<br>			type: Decimal<br>		timestamp:<br>			type: DateTime<br>		clearing_day:<br>			type: Date</pre><p>While the emitted Python code retains all these high-level types, the emitted TypeScript type uses strings.</p><pre>interface AuditLogEntry {<br>	value: string<br>	timestamp: string<br>	clearingDay: string<br>}</pre><p>In each case we use a normalized string format, such as ISO formats for dates and times. As mentioned before, we then build controls around these string normalized formats. The date controls do end up parsing the values, but most of the UI can safely pass around the string value.</p><p>Stricter Types</p><p>I am considering introducing stricter types here. Though not officially supported by TypeScript, we can use trickery to build strong string derived types. This would let me define a DateString format. These have the advantage that while they function as a string, a string cannot implicitly convert to them. This would allow me to define specific functions that convert known arguments into the strict format.</p><p>I’ve done this in a few places in our code, where it’s very helpful to distinguish between different identifiers. It’s difficult to introduce stricter types into an existing code-base though, thus I’ve been holding off implementing more in type_spec.</p><h4>And More</h4><p>That’s a quick look at type_spec, our answer to sharing types between Python and Javascript. We’ve extended the tool a lot. We emit <a href="https://www.openapis.org/">OpenAPI</a> docs from the type-spec form. Our Flask routing tables are generated by it. It supports shared constant values as well as enums — I recently added a “complete” flag to ensure an enum mapping covers all possible keys. We also now use runtime type information in TypeScript to generate forms dynamically.</p><p>When we first created type_spec we evaluated some other options. OpenAPI itself was considered — you’ll notice some fragments are reminiscent of that format — but it’s a limited format that isn’t friendly to human developers. Protobuf is another library to handle cross-language serialization, but wouldn’t offer us the flexibility to add all the other features we now have — plus, it was a binary serialization when I last used it.</p><p>type_spec continues to evolve as we find more uses for it. Some of these are big features, some of them are plugging gaps in the code. Every step gives us a bit more type safety or reduces our coding effort.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd41b55b7ccf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/sharing-data-types-on-a-multi-language-project-dd41b55b7ccf">Sharing data types on a multi-language project</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A mini-redux in React]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/uncountable-engineering/a-mini-redux-in-react-14c9eae2ff7c?source=rss----675d4deb3e95---4"><img src="https://cdn-images-1.medium.com/max/1280/1*y_X_TE_NlwblOI8Oxt6Z3A.jpeg" width="1280"></a></p><p class="medium-feed-snippet">How I created a redux-like store in React to improve my rendering efficiency and connect to a websocket multiplayer game state.</p><p class="medium-feed-link"><a href="https://medium.com/uncountable-engineering/a-mini-redux-in-react-14c9eae2ff7c?source=rss----675d4deb3e95---4">Continue reading on Uncountable Engineering »</a></p></div>]]></description>
            <link>https://medium.com/uncountable-engineering/a-mini-redux-in-react-14c9eae2ff7c?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/14c9eae2ff7c</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Edaqa Mortoray]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 08:37:05 GMT</pubDate>
            <atom:updated>2023-01-12T08:37:05.124Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Starting From Scratch: Engineering Management At Uncountable]]></title>
            <link>https://medium.com/uncountable-engineering/starting-from-scratch-engineering-management-at-uncountable-4182b86983ce?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/4182b86983ce</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[engineering-mangement]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Will Goldie]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 16:40:50 GMT</pubDate>
            <atom:updated>2022-08-17T16:40:49.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*WNARP5z4sN8uEZJ3_LjG_w.jpeg" /></figure><p><em>Many software engineering orgs have a dual advancement ladder, with both individual contributor (IC) and management paths for engineers to grow into over the course of their careers. As a result, engineers often have a thoughtful answer ready if you ask which career path they’d like to pursue in the long term. At the same time, I’ve also found that early- and mid-career engineers often have the mistaken belief that they need to be a perfect senior engineer before they can succeed in an engineering management (EM) role.</em></p><p><strong><em>We’re currently making our first </em></strong><a href="https://jobs.lever.co/uncountable/4f0530a2-a77a-4244-b773-29b09f0abefc"><strong><em>external engineering manager hire at Uncountable [Apply Here]</em></strong></a><strong><em>. We’re considering both first-time and experienced managers for this position, </em></strong><em>so with aspiring managers in mind, I’ve decided to write about what skills a new engineering manager does (and doesn’t) need to succeed at a startup like ours.</em></p><p><strong>Introduction: Management Priorities</strong></p><p>As a full-time IC engineer, technical contribution is your core competency. If you’re knocking it out of the park building features, cleaning up code and systems, and responding quickly to customers hitting bugs, this is a great sign: you’re probably creating a lot of value for customers and for the company. In contrast, <strong>if a full-time manager is one of the biggest technical contributors on the team, something is probably going wrong — </strong>they should be focusing on management tasks that accelerate their reports.</p><p>Since a manager’s highest leverage daily task is accelerating their team, individual technical skill is no longer the most important prerequisite for the role, and they’re not “leveling up” from an IC position. In fact, <strong>an engineer moving onto a full-time management role is not getting a promotion: they’re starting a new job from scratch. </strong>The new manager will need a new set of skills for this role that they drew upon rarely, if ever, as an IC engineer. At the same time, they’ll need to reach into the IC toolbox from time to time as they make judgment calls and work closely with their reports. For the rest of this blog, I’ll cover the new skills a first-time EM will need to develop in order to succeed.</p><p><strong>The EM toolkit</strong></p><p>Although it’s important, weekly engineering output by the team isn’t the only way to measure an EM’s contribution to the company. In the long run, <strong>retention and motivation of employees is more important than endlessly optimizing short-term engineering output</strong>. A manager needs to create a great working environment and a positive culture on their team. Their negative or positive contributions to the working environment will not only affect their reports, but also the broader engineering organization, the company as a whole, and the team’s external reputation as a great place to work.</p><p>If everyone on a manager’s team is operating at peak productivity, that’s great. However, <strong>if engineers are burning out, frustrated in meetings, and even considering leaving the company, then the high engineering velocity won’t last long</strong>. A lot of the work that contributes to retention is less tangible, but everything from a well-timed shoutout to an improved project management process can create an atmosphere where engineers are highly motivated to do their best work and meet the high standards you’re setting for them.</p><p>Mentoring and career development is another important responsibility. Positioning your team to succeed with their existing set of skills and knowledge is step 1, but an effective manager is always planning how their reports can be more effective in 6 months than they are today. This could mean:</p><p>- Strategic project selection:<em> Emily is stronger on backend than frontend, so we’ll assign her a new plotting project instead of a database design project</em></p><p>- Generating learning opportunities: <em>Pairing up junior and senior engineers on projects, guiding the code review process, organizing tech talks and other education</em></p><p>- Active mentoring: <em>Taking an hour to sit down with a new hire and train them on code review</em></p><p>- Giving feedback: <em>Make sure Joe knows that his attention to detail on a recent, highly visible feature was worth the effort; but his pace on MVP projects isn’t fast enough to get early feedback.</em></p><p><em>- </em>Advocating for engineers: <em>Communicating each engineer’s strengths and successes to leadership, and advocating for them appropriately in review and advancement discussions</em></p><p>While senior engineers and tech leads may take on some of these tasks, <strong>none of them are core competencies for an IC engineer,</strong> so a new manager should expect to focus on expanding their skills in these areas during their first 6 months.</p><p>At Uncountable, we ask engineers to take a big role in project management and prioritization of their own individual tasks. However, not every company is the same: many teams use a structured Agile process to assign and prioritize tasks across the team, and others have dedicated project or program managers. So a new manager may be coming in with a lot of project management experience, a little bit, or none at all.</p><p>In any case, they’ll have plenty of chances to sharpen their skills at tracking projects, planning timelines, and making judgment calls. Every week<strong>, a manager at Uncountable might be tracking 10–100 tasks of different scopes, and making calls about who should work on them, how long they’ll take, and even when to kill projects that have gone off the rails.</strong></p><p>To inform all of these decisions, they’ll need an understanding of the larger business value and urgency of each project. That means <strong>spending time with product and business development teams to understand the direct revenue and intangible opportunities associated with each engineering task,</strong> along with any relevant timelines. They’ll also need to perform communication in the other direction, informing the rest of the company about feature and bugfix timelines, based on engineers’ own judgements and measurements of their progress on those tasks.</p><p>Finally, <strong>upon taking on a management role, you may find that you’ve also taken on a sales role: Building the team</strong> is an important responsibility for managers, especially at small companies without a dedicated recruiting organization. Recruiting software engineers is a famously competitive game, and at Uncountable we’ve made the game harder for ourselves by holding ourselves and everyone who joins the team to a high bar.</p><p>While many engineers on the team sit in on interviews and even run technical screens, managers have the final responsibility for the recruiting process. This means developing and maintaining a full recruiting funnel: generating marketing collateral, sourcing candidates, reviewing resumes, designing interview questions, and leading interviews. If a candidate does well, they’ll need to sell the hire to the team (including company leadership), and then sell the candidate on joining the team!</p><p>This is a long set of responsibilities and it might seem intimidating. Keep in mind the core thesis we have for engineering management at Uncountable:<strong> Engineering managers are not the “head engineer”, they’re someone doing a different job completely</strong>. You’re not going to have all the skills for a new job on day 1, and it’s okay to feel like you have a lot to learn when starting out.</p><p>In my next post in this series, I’ll cover where technical skills <em>do</em> come into play for engineering managers. This includes both support of IC tasks across the company, and new engineering problems related to organizational design and more. I’ll also address the fundamental ambiguity of a role that sits between technical work and people management.</p><p><em>Are you considering in making the switch from engineering work to management</em>? Uncountable is hiring an Engineering Manager for our San Francisco office<em> [</em><a href="https://jobs.lever.co/uncountable/4f0530a2-a77a-4244-b773-29b09f0abefc"><em>Apply Here</em></a>, or reach out directly to <a href="/service/mailto:willgoldie@uncountable.com">jason@uncountable.com</a>]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4182b86983ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/starting-from-scratch-engineering-management-at-uncountable-4182b86983ce">Starting From Scratch: Engineering Management At Uncountable</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About the Author: Niklas Vatn is a student at the Royal Institute of Technology in Stockholm…]]></title>
            <link>https://medium.com/uncountable-engineering/about-the-author-niklas-vatn-is-a-student-at-the-royal-institute-of-technology-in-stockholm-64634911faf4?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/64634911faf4</guid>
            <category><![CDATA[internship-experience]]></category>
            <dc:creator><![CDATA[Jason Hirshman]]></dc:creator>
            <pubDate>Thu, 06 Jan 2022 15:59:53 GMT</pubDate>
            <atom:updated>2022-01-06T15:59:53.394Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PLRcVv7pDPUrBLvRid8g5Q.jpeg" /><figcaption>Uncountable’s Engineering Team in Munich</figcaption></figure><h3>My Uncountable Internship: Niklas Vatn</h3><blockquote>Niklas Vatn is a student at the Royal Institute of Technology in Stockholm, Sweden studying computer science. Niklas interned at Uncountable’s Munich office during the summer of 2021.</blockquote><p>I couldn’t be more grateful for the time I spent as an intern at Uncountable and I hope this post can inspire somebody else to take a chance to work at Uncountable.</p><p><strong>How I found the position</strong></p><p>In late October, last year, I found Uncountable advertising at Kattis.com. I browsed their website and quickly concluded that this San Francisco startup looked like a great place to work. It felt like it was a bit out of my reach, especially since their only internship opportunity was in the US. At the time, I was applying for other jobs and had an updated resumé, so I figured that there is no harm in applying to Uncountable as well. To my surprise, I received an answer within 24 hours, and an initial interview was scheduled for the coming week. I was nervous, to say the least, and realizing I was about to talk to one of the founders did not help ease my apprehension. The rest of the interview process was quick and those interviews made it apparent how much they value their employees.</p><p>In December, I was offered a summer position as a full-stack intern at their Munich office. Eager to make a good impression when starting, I tried to make the most of this seemingly infinite wait by improving my React, Redux, and Python skills. I got some suggestions on good learning material from Jason (my boss) and tried to work my way through most of it. Reading books and watching tutorials can be helpful to get you going, but you won’t get far without practising the skills by creating something with them. I seized the opportunity to get involved in a development project at my student association at KTH. I worked together with a more senior student and he helped me to further deepen my React and Typescript knowledge.</p><p><strong>The internship</strong></p><p>When June arrived, I was permitted to travel to Munich but had to work the first few days from home due to the quarantine rules. I had imagined the first couple of days would be challenging, but I had clearly underestimated how different working in a large, unfamiliar codebase would be. I had never felt so underprepared before, and feelings of not being good enough plagued me for the first few weeks. My colleagues reassured me that this is something that they still grapple with and almost all software engineers have experienced this, especially on their first job. Realizing that I wasn’t bad helped me open up and I started asking more questions. And with the help of my team, it didn’t take long before I felt confident enough to produce new features on my own. My manager assigned me progressively harder tasks, and I had to take more responsibility for the design of features. Constantly being challenged was a cool experience, and I can’t remember that I have ever learned so much in such a short amount of time. Not only did I develop as a programmer, but also I learned general engineering skills and received plenty of career advice from my talented and generous colleagues.</p><p>The intensity of the workload was high, and I was expected to create at least one pull request for a new feature each day and, over time, this number increased. The features I developed varied drastically in scope and type. This diversity of tasks taught me multiple ways to handle changes of various sizes, and also introduced me to a diverse set of challenges. To name a few things I worked on: I implemented new types of statistics and ways of visualising them, created the first version of temperature tracking of locations in a lab, and added a feature to visualize DNA files in the platform (shoutout to Tim W. for improving on my draft).</p><p>But to finish it up, I want to mention that Uncountable is a company of highly skilled and helpful people, that values rapid action and progress, and (it might sound clichéd but I believe it to be true) makes that world a better place. Uncountable may not be the place for everyone, but if you like being challenged and aren’t afraid of hard work, I highly encourage you to talk to them. Thanks again for an amazing summer and I hope to come back sometime!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64634911faf4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/about-the-author-niklas-vatn-is-a-student-at-the-royal-institute-of-technology-in-stockholm-64634911faf4">About the Author: Niklas Vatn is a student at the Royal Institute of Technology in Stockholm…</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Full Stack Engineer Vivian Li]]></title>
            <link>https://medium.com/uncountable-engineering/meet-full-stack-engineer-vivian-li-7c223d627185?source=rss----675d4deb3e95---4</link>
            <guid isPermaLink="false">https://medium.com/p/7c223d627185</guid>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[industry]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Josh Wagner]]></dc:creator>
            <pubDate>Wed, 15 Dec 2021 02:39:39 GMT</pubDate>
            <atom:updated>2021-12-15T02:39:39.496Z</atom:updated>
            <content:encoded><![CDATA[<h4>Faces of Uncountable</h4><h4>Vivian talks about the freedom and control engineers have over the Uncountable platform</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F656334122%3Fh%3De8243ac95c%26app_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F656334122&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1325554689-3ba17b310bac7ee74659034d0e9c5034ccca64b2a874e86b812f274153cf2d00-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ffd567fbfb1c37340d15162f0c30299/href">https://medium.com/media/6ffd567fbfb1c37340d15162f0c30299/href</a></iframe><p><em>We’re happy to share a series of interviews with members of the Uncountable team. The purpose of these is to shed light on the people behind our platform, including their professional backgrounds, what led them to join our team, and what they work on behind the scenes.</em></p><p><em>Today’s interview is with Vivian Li, Full Stack Engineer at Uncountable.</em></p><p><strong>Employee profile: </strong>Vivian Li — Full Stack Engineer</p><p><strong>UNC: What projects are you leading at Uncountable?</strong></p><p><strong>Vivian: </strong>So, right now and through the past year, I’ve essentially taken over a lot of what’s going on with our Enter Data pages (for Enter Recipes and Enter Measurements). Recently, [I] just redid an entire design audit of those pages, and am working on just improving those features and fulfilling a lot of customer requests. I’m also leading some of the management and UX [design] in both the Reports and Inventory. And then I work a lot on other newer projects such as our Workflow Editing feature, as well as well plating.</p><p><strong>UNC: Are these projects what you expected to work on when you joined Uncountable?</strong></p><p><strong>Vivian:</strong> I have never worked for a startup before, so I think that was kind of a shock coming in. There were just so many different things I could do, and so many parts of the code that I could touch. Whereas in previous jobs that I had, it was like: “here’s your one project, and you’re going to work on this every day for 10 weeks.”</p><p>I don’t think I was surprised that I would be picking up a lot of things, but I had never really experienced that, so there was definitely a learning curve. But, it’s been really great to dabble in a lot of different topics and learn a lot of things that I had previously never really done before.</p><p><strong>UNC: What are some of the things you’ve learned over the past year?</strong></p><p><strong>Vivian: </strong>Definitely better code quality! I think in school, they teach you maybe the fundamentals of coding and, here are some principles. But you never really learn to apply it to production code. So, things like worrying about your code performance is something you don’t have to worry about in classes — because in class, it’s like “fulfill these test cases.” And then I think, especially at Uncountable, you have the whole spectrum of designing our feature, then afterwards building our feature, going through all these iteration processes, going to customers, and iterating on our feature again. I’ve never really had to do the full process like that, especially working with actual clients, instead of made-up clients for classes.</p><p><strong>UNC: What made you accept the job at Uncountable?</strong></p><p><strong>Vivian:</strong> The work that we’re doing at Uncountable was very different. And no one’s really in this space. As you said, this isn’t a challenge that most people think of when they think of technology challenges. I just thought that it was a cool combination of what I’d enjoyed doing before with front-end data visualizations, and also solving this problem that I previously had when I was working in the lab.</p><p><strong>UNC: Has there been anything surprising or unexpected about this job that you didn’t know coming in?</strong></p><p><strong>Vivian:</strong> I think I’ve just been really surprised at the growth. I think that one of the things I was worried about when joining the company was that the team was really small; I was worried that I wouldn’t get as much guidance as I would in other companies. But I think having joined this team, I realized that everyone was just very, very capable. Even if there aren’t as many people to reach out to, I found that everyone I have been able to reach has been super friendly, receptive, and just super smart. So, I’ve been able to learn so much from everyone.</p><p><strong>UNC: Do you have any advice for someone considering joining Uncountable?</strong></p><p><strong>Vivian:</strong> Yeah! I think that one thing that’s important is to stay focused on what you want to get out of the experience. Because as much as you’re working for our customers and providing value for them, this is also providing a lot of value to you as an engineer, or whatever kind of role you stepped into in the company. Because our team is so flexible on what you’re doing, and because there are always new projects to come, you get a lot of freedom in saying, I want to do something that’s more math heavy, or I want to do something that’s more visuals heavy. So, if you’re able to ask yourself, “what makes me fulfilled in my role?” then you’re also able to have more fulfillment and enjoyment from your work because you can just take more control.</p><p>And I think that’s something I also just really appreciate about being here: that [at my previous jobs,] it’s like you get assigned a project and you’re just required to do it. But now, you can kind of pick your projects and you get a say in how they’re designed and how they’re executed. And your input really matters. So, just being able to have a voice and a company with what you believe in and how you want the company to be.</p><p><em>This transcript has been condensed and lightly edited for clarity.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgsdFvXyk19sEe5H4oZp-w.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c223d627185" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uncountable-engineering/meet-full-stack-engineer-vivian-li-7c223d627185">Meet Full Stack Engineer Vivian Li</a> was originally published in <a href="https://medium.com/uncountable-engineering">Uncountable Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>