<?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[Smartly.io Tech Blog - Medium]]></title>
        <description><![CDATA[Brainfood for engineers, from engineers - Medium]]></description>
        <link>https://medium.com/smartly-io?source=rss----a41e72c6f22c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Smartly.io Tech Blog - Medium</title>
            <link>https://medium.com/smartly-io?source=rss----a41e72c6f22c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/smartly-io" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Meet Our Product Development Teams: Midas]]></title>
            <link>https://medium.com/smartly-io/meet-our-product-development-teams-midas-a37d1ad2d0a1?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/a37d1ad2d0a1</guid>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development-team]]></category>
            <dc:creator><![CDATA[Siiri Hakulinen]]></dc:creator>
            <pubDate>Thu, 19 Mar 2020 13:33:31 GMT</pubDate>
            <atom:updated>2020-03-19T13:33:31.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsICRGWK49KhYRoDPhnPKw.png" /></figure><p>Team Midas owns the core areas of the Smartly.io app that handle campaign creation and management. Midas, like <a href="https://www.smartly.io/blog/meet-our-dev-teams-senators">Senators</a>, is a new team split from a large, old one that operated everything related to Facebook. “We are working with some of the oldest code in the house,” says <strong>Juha</strong>, the team lead for Midas. “It’s great to now have the bandwidth to fix some of the issues that have pained Smartlie developers for a long time.”</p><p>By chewing the old codebase into a more digestible form, Midas is building a foundation for scaling the app further as well as accelerating product development speed. “We’re slicing the legacy codebase into smaller, more manageable entities,” Juha explains. “We can’t shut the campaign engine down and wipe out the legacy code all at once. Instead, we have to refresh it piece-by-piece, without disrupting the ever-ongoing operations. It’s like doing brain surgery without anesthesia”.</p><h3>A team of experienced developers</h3><p>To accomplish this feat, team Midas is made up of very senior developers. “ <a href="https://www.linkedin.com/in/riikkakalliomaki/">Riikka</a>, <a href="https://www.linkedin.com/in/grigorii-sokolik/">Grigorii</a>, <a href="https://www.linkedin.com/in/iiro-saukkonen-96394978/">Iiro</a>, <a href="https://www.linkedin.com/in/valentin-nemcev-88a2b578/">Valentin</a>, <a href="https://www.linkedin.com/in/oksana-firtych-39731593/">Oksana</a> and <a href="https://www.linkedin.com/in/marko-kurjonen-761b874/">Marko</a> are all seniors with extensive expertise,” <a href="https://www.linkedin.com/in/juhalitola/">Juha</a> says. “Put us all together and we have close to 100 years of software development experience in the team.” The team is now looking for a <a href="https://www.smartly.io/open-positions/54c79fdd-e84d-43f5-881b-7cd63026c855?hsLang=en">Backend Developer</a> to help them improve the software architecture and build new services.</p><p>“It requires a lot of brainpower to plan a refactoring of a complex old codebase, and you have to have an archaeologist’s mindset,” Juha says. “Our work is interlinked with that of many other development teams, most importantly with Bobby Tables, Senators, and Top Gun, which means that we have to be mindful of the possible repercussions of our actions. And it only gets more difficult as we’re done with the low-hanging fruits and proceed to the trickier parts of the old codebase.”</p><h3>Something old, something new</h3><p>When they aren’t tearing down the old PHP codebase, Midas works with React, JavaScript, and TypeScript. “Our app is in the middle of a transformation, where most of the campaign editing features are moving from the original campaign overview into our new reporting tool. Midas has a key role in packaging the campaign data neatly so it’s easier for the other team to manage within reporting,” Juha recounts. “At the same time, we’re pruning the old features and functionalities, carefully assessing which ones we could do away with to simplify the app structure.”</p><p>Midas is currently aiming to fully revamp the campaign creation and management functionality. “We’re now building user prototypes for the new implementation and finishing up basic architectural components on the backend,” Juha says. “The plan is to verify our interaction models with the prototype and then go full steam ahead starting in April.”</p><p>Learn more about being a developer at Smartly.io: <a href="https://www.smartly.io/careers/developers">smartly.io/careers/developers</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/meet-our-product-development-teams-midas"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a37d1ad2d0a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/meet-our-product-development-teams-midas-a37d1ad2d0a1">Meet Our Product Development Teams: Midas</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oats — How We Learned to Stop Worrying and Love Types]]></title>
            <link>https://medium.com/smartly-io/oats-how-we-learned-to-stop-worrying-and-love-types-aa0041aaa9cc?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/aa0041aaa9cc</guid>
            <dc:creator><![CDATA[Andre Praça]]></dc:creator>
            <pubDate>Thu, 30 Jan 2020 12:40:32 GMT</pubDate>
            <atom:updated>2023-04-21T10:17:48.477Z</atom:updated>
            <content:encoded><![CDATA[<h3>Oats — How We Learned to Stop Worrying and Love Types</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_IglQmVVpgi9t7Jf" /></figure><p>We created our own library to facilitate calling and creating HTTP APIs while validating types at compile-time and runtime. In this blog post, I’ll explain the situation that led us to need such a library and the problems we seek to solve with it. Then I’ll explain how you can use the library in your own projects.</p><h3>How we got to where we are</h3><p>Back in the early days of Smartly.io, we needed a service that allowed us to iterate and grow at an incredibly fast pace. We chose to go with a PHP monolith and MongoDB, and those served us quite well for a long time. When we were only a handful of developers working very closely together on a small set of features, things worked great, and it allowed us to reach the heights we were aiming for.</p><p>But as we grew, the number of developers and features also grew. What worked for a small group of developers no longer worked for several dozens working on multiple features simultaneously. Bugs started to appear faster than we could fix them, and development slowed down and became frustrating. Most of the bugs we faced were to do with data validation (or lack thereof). We didn’t have a clear understanding of our current data model, and the stored data was a hotchpotch of numerous versions and iterations of our back-end and Facebook data models. All this caused havoc, especially once model changes were necessary, for example, when Facebook changed their API.</p><p>It was clear we needed a new and less dynamic architecture, but one that would give us more safety and security when changing existing code and implementing new features. We started to chip away at the old monolith, creating microservices that better encapsulated specific parts of our tool, and using technologies better suited for them. With this physical separation between our features, teams could better organise themselves and take better ownership of their code. All this would allow us to continue growing at speed with fewer barriers and better infrastructure for our current needs.</p><h3>The ads and creatives microservice</h3><p>The maintenance of the part of our monolith that handled Facebook ads and creatives was getting increasingly more cumbersome to maintain. Bugs cropped up all the time, and whenever Facebook released an API update, the situation only deteriorated further. We needed a microservice that would act as a sort of interface between us and the Facebook API, performing data transformations back and forth, while also providing robust data validation both ways. It would help us fix-or at least reveal-several bugs in our system in one fell swoop.</p><p>We chose to write our new microservice in TypeScript, thanks to its satisfactory type system and because most of our engineers were experienced with NodeJS or JavaScript. We also chose <a href="https://www.openapis.org/">OpenAPI</a>, as a system-agnostic standard to define our data models. It would allow us to reuse the same definition between the old monolith and the new microservice whenever they interacted.</p><p>To avoid writing tonnes of boilerplate code and to provide out-of-the-box runtime type checking (which TypeScript doesn’t have), we decided to automate the generation of clients (TypeScript and PHP) and servers (TypeScript) based on the OpenAPI specification we defined. At first, we went with the existing 3rd party libraries, <a href="https://www.npmjs.com/package/dtsgenerator">dtsgenerator</a> and <a href="https://www.npmjs.com/package/oas3-chow-chow">oas3-chow-chow</a>, but they proved inadequate due to existing bugs and incompatibilities between them, resulting in us having to write a lot of code to work around those problems. We then decided to create our own library, which would give us total freedom to adapt to our specific use case and solve all the issues we were facing.</p><h3>In comes Oats</h3><p>This is how <a href="https://github.com/smartlyio/oats">Oats</a> (OpenApi-TypeScript) was born. It can generate clients (services that consume an API) and servers (services that provide an API) that neatly wrap OpenApi specifications into classes or objects. It generates a lot of boilerplate for both, as well as all the required runtime data validation. The client is built around the <a href="https://www.npmjs.com/package/axios">Axios</a> HTTP library, and the server is built around the <a href="https://www.npmjs.com/package/koa">Koa</a> library. For the client, Oats generates an object that contains all the routes as promise-returning functions, which validate, at runtime, both the input and output of the underlying HTTP call. For the server, it creates an Endpoints interface and adapter, which ensures all the endpoints expect and return the correct types at runtime.</p><h4>How to start using Oats</h4><p>To get started, you need an OpenAPI compliant specification of your server or client. In the example below, you can see one that defines an entity “Item” which has the properties “id” and “name”, and three endpoints, “POST /item”, “DELETE /item/{id}”, and “GET /item/{id}”, for creating, deleting, and fetching an “item” entity respectively.</p><pre>openapi: 3.0.0<br>info:<br>  version: 1.0.0<br>  title: example service<br>servers:<br>  - url: http://localhost:12000<br>paths:<br>  /item:<br>    post:<br>      description: create an item<br>      parameters:<br>        - in: header<br>          description: Bearer Auth<br>          name: Authorization<br>          required: true<br>          schema:<br>            type: string<br>      requestBody:<br>        required: true<br>        content:<br>          application/json:<br>            schema:<br>              $ref: &#39;#/components/schemas/Item&#39;<br>      responses:<br>        &#39;201&#39;:<br>          description: created<br>          content:<br>            application/json:<br>              schema:<br>                $ref: &#39;#/components/schemas/Item&#39;<br>        default:<br>          description: error<br>          content:<br>            application/json:<br>              schema:<br>                $ref: &quot;#/components/schemas/Error&quot;<br>  /item/{id}:<br>    delete:<br>      parameters:<br>        - name: id<br>          in: path<br>          required: true<br>          schema:<br>            $ref: &#39;#/components/schemas/ItemId&#39;<br>      responses:<br>        &#39;204&#39;:<br>          $ref: &#39;#/components/responses/NoContent&#39;<br>    get:<br>      parameters:<br>        - name: id<br>          in: path<br>          required: true<br>          schema:<br>            $ref: &#39;#/components/schemas/ItemId&#39;<br>      responses:<br>        &#39;200&#39;:<br>          description: item found<br>          content:<br>            application/json:<br>              schema:<br>                $ref: &quot;#/components/schemas/Item&quot;<br>        default:<br>          description: error<br>          content:<br>            application/json:<br>              schema:<br>                $ref: &quot;#/components/schemas/Error&quot;<br>components:<br>  responses:<br>    NoContent:<br>      description: success but no content<br>      content:<br>        text/plain:<br>          schema:<br>            type: string<br>  schemas:<br>    ItemId:<br>      type: string<br>    Item:<br>      type: object<br>      required:<br>        - id<br>        - name<br>      properties:<br>        id:<br>          $ref: &#39;#/components/schemas/ItemId&#39;<br>        name:<br>          type: string<br>    Error:<br>      type: object<br>      properties:<br>        message:<br>          type: string<br>      required:<br>        - message</pre><h4>Creating a server</h4><p>To create a server, define the destination of the generated files:</p><pre>import { driver } from &#39;@smartlyio/oats&#39;;<br><br>driver.generate({<br>  generatedValueClassFile: &#39;./server.types.generated.ts&#39;,<br>  generatedServerFile: &#39;./server.generated.ts&#39;,<br>  header: &#39;/* tslint:disable variable-name only-arrow-functions*/&#39;,<br>  openapiFilePath: &#39;./example.yaml&#39;<br>});</pre><p>This will generate two files, one containing the necessary types, such as the “Item”, request headers, parameters, and so on and another containing the server’s Endpoints interface. Now all that is left is implementing the actual server by creating an object with the Endpoints interface type, which enforces that all the Koa endpoints are implemented correctly, receiving and returning the correct types.</p><pre>import * as api from &#39;./server.generated&#39;;<br>import * as types from &#39;./server.types.generated&#39;;<br>import * as runtime from &#39;@smartlyio/oats-runtime&#39;;<br>import * as koaAdapter from &#39;@smartlyio/oats-koa-adapter&#39;;<br>import * as Koa from &#39;koa&#39;;<br>import * as koaBody from &#39;koa-body&#39;;<br><br>// setup a db :)<br>const values: { [key: string]: types.Item } = {};<br><br>// &#39;api.Endpoints&#39; is the generated type of the server<br>const spec: api.Endpoints = {<br>  &#39;/item&#39;: {<br>    post: async ctx =&gt; {<br>      if (ctx.headers.authorization !== &#39;Bearer ^-^&#39;) {<br>        return runtime.json(403, { message: &#39;Unauthorized&#39; });<br>      }<br>      values[ctx.body.value.id] = types.Item.make({<br>        id: ctx.body.value.id,<br>        name: ctx.body.value.name<br>      }).success();<br>      return runtime.json(201, values[ctx.body.value.id]);<br>    }<br>  },<br>  &#39;/item/{id}&#39;: {<br>    delete: async ctx =&gt; {<br>      delete values[ctx.params.id];<br>      return runtime.text(204, &#39;&#39;);<br>    },<br>    get: async ctx =&gt; {<br>      const item = values[ctx.params.id];<br>      if (item) {<br>        return runtime.json(200, item);<br>      }<br>      return runtime.json(400, { message: &#39;not found&#39; });<br>    }<br>  }<br>};<br><br>// &#39;koaAdapter.bind&#39;  binds the endpoint implemantion in&#39;spec&#39; to koa-router routes using a koa adapter<br>const routes = koaAdapter.bind(api.router, spec);<br><br>// finally we can create a Koa app from the routes<br>const app = new Koa();<br>// we need a bodyparser to make body contain json and deal with multipart requests<br>app.use(koaBody({ multipart: true }));<br>app.use(routes.routes());<br><br>// start the server!<br>app.listen();</pre><p>The “Item.make” method is used for runtime validation of our types. It throws errors if required properties are missing, or are the wrong type, or if there are extra unexpected properties (although the latter can be configured to simply strip those properties away instead). We chose to throw validation errors instead of simply logging them as this will increase visibility, and prompt us to fix them faster. Nowadays, we rarely get errors related to invalid data, which means we have a high degree of confidence in what the data we’re dealing with looks like, even though it’s a third-party API.</p><h4>Creating a client</h4><p>Creating a client is very similar to creating a server. Again, you need the OpenAPI specification for the server which you’ll consume. Similarly, you have to define the destination of the generated files in your build step. The result will, again, be two files, one with the types, and another with the server’s endpoints and a consumer object, which will contain the methods mapped to the API calls of the server.</p><p>After that, performing API calls to the server is as easy as calling a Promise:</p><pre>import * as api from &#39;./client.generated&#39;;<br>import * as axiosAdapter from &#39;@smartlyio/oats-axios-adapter&#39;;<br>import * as runtime from &#39;@smartlyio/oats-runtime&#39;;<br>import * as assert from &#39;assert&#39;;<br><br>// &#39;api.client&#39; is the abstract implementation of the client which is then mapped to axios requests using &#39;axiosAdapter&#39;<br>(async () =&gt; {<br>  const apiClient = api.client(axiosAdapter.bind);<br>  <br>  const posted = await apiClient.item.post({<br>    headers: { authorization: &#39;Bearer ^-^&#39; },<br>    body: runtime.client.json({ id: &#39;id&#39;, name: &#39;name&#39; })<br>  });<br>  if (posted.status !== 201) assert.fail(&#39;wrong response&#39;);<br>  <br>  const stored = await apiClient.item(posted.value.value.id).get();<br>  if (stored.status !== 200) assert.fail(&#39;wrong response&#39;);<br>  assert(stored.value.value.id === &#39;id&#39;);<br>  <br>  const deleted = await apiClient.item(posted.value.value.id).delete();<br>  assert(deleted.status === 204);<br>})();</pre><p>And as with the server, runtime validation of the data types returned by the server is performed, ensuring all the fields are correct.</p><h3>Conclusion</h3><p>In short, I hope what you get out of this blog post is just how important types can be for the long term growth and success of your projects. Many companies like <a href="https://blogs.dropbox.com/tech/2019/09/our-journey-to-type-checking-4-million-lines-of-python/">Dropbox</a> and <a href="https://engineering.fb.com/web/flow-a-new-static-type-checker-for-javascript/">Facebook</a> have faced bugs and decreased productivity, which they attribute to the use of untyped languages. Dealing with all the boilerplate that comes with them may impede the iteration of your project. Libraries such as Oats enabled us to continue growing as fast as we needed, but in a sustainable manner, and we hope that they might do the same for you.</p><p>Getting started should be easy and straightforward if you follow our guide. Having types might actually save you time, as we described in a <a href="https://medium.com/smartly-io/testing-a-greenfield-microservice-9e8cbd5d459">separate blog post</a> having types enabled us to write fewer tests, which considerably increased how fast we could implement or overhaul existing features.</p><p>We’re more than happy to accept your contributions or answer your questions in our <a href="https://github.com/smartlyio/oats">public repository</a>, so please send issues and PRs!</p><p>Learn more about <a href="https://smartly.io/careers/developers">how developers work at Smartly.io.</a></p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/oats-how-we-learned-to-stop-worrying-and-love-types"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa0041aaa9cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/oats-how-we-learned-to-stop-worrying-and-love-types-aa0041aaa9cc">Oats — How We Learned to Stop Worrying and Love Types</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Our Development Teams: Kino]]></title>
            <link>https://medium.com/smartly-io/meet-our-development-teams-kino-c0b42e55a5af?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0b42e55a5af</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Siiri Hakulinen]]></dc:creator>
            <pubDate>Mon, 20 Jan 2020 09:25:37 GMT</pubDate>
            <atom:updated>2020-01-20T09:25:37.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oohrMiIcIyJvGi-u" /></figure><p>Team Kino owns two flagship solutions of the Smartly.io platform: the <a href="https://www.smartly.io/blog/how-we-built-a-video-templating-system-capable-of-producing-a-million-videos-a-month">video</a> and image templating tools. Their mission is to scale and automate the production of creative assets for digital advertising and help customers improve their campaign results through ad creatives. “To put it simply, we build image and video editors that allow users to create unique and customized ad videos and images at a massive scale,” says <strong>Pasi</strong>, the team lead for Kino. “During the last 30 days, our image templating tools rendered 16 billion images on hundreds of servers. During peak traffic times, we serve 30 gigabytes of data per second and generate 2.5 terabytes of videos daily.”</p><h3>The visual trend in advertising poses exciting challenges</h3><p>As advertising is becoming more visual than ever before, Kino is in an exciting position to drive the development of the Smartly.io platform towards a more visuality-centric form of advertising. “With visuality trending in the advertising industry, a whole new user group has been introduced to our platform,” Pasi explains. “Previously, we have focused on serving performance marketers, the people who create, manage and analyze advertising campaigns, but today we also build tools for designers, who are in charge of the visual look of the campaigns.”</p><p>A new user segment brings exciting new challenges as designers’ requirements for the platform are quite different from those of performance marketers. “Apart from serving the needs of both user types separately, we are finding ways to help them collaborate,” Pasi says. “Designers and performance marketers haven’t traditionally been working very closely together, so we’re trying to help bridge the gap between them.”</p><p>The growing importance of visuality leads to a higher demand for image and video rendering power, posing another intriguing challenge to team Kino. “At the moment, our image editing service relies on extensive caching to avoid any extra rendering,” Pasi says. “At the scale where we operate, optimizing rendering saves us a lot of server space and money.”</p><p>Previously, we have scaled our image templating tools to handle image generation at a massive scale. Scaling video templating is going to be even more complex to scale. “Building a browser-based video editor is a fairly exceptional task in itself, it’s not something you can do in every developer job,” Pasi says. “Our video rendering service Reindeer is a pretty inventive piece of tech, to be honest, and scaling it will be a thrilling project.”</p><h3>Now hiring a full-stack engineer</h3><p>Developing two flagship solutions keeps team Kino busy, which means they need to maintain a crystal clear focus and prioritize projects rigorously. Pasi hopes they will soon find time for some housekeeping, too: “Our image template editor was built using Angular, but we have moved on to use React.js, Redux, and TypeScript in our frontend since then, so we’re going to update the editor to use the same stack.”</p><p><a href="https://www.linkedin.com/in/pasi-tuominen-4bb4325/">Pasi</a> and his teammates <a href="https://www.linkedin.com/in/riku-laukkanen/">Riku</a>, <a href="https://www.linkedin.com/in/oluwasayo/">Sayo</a>, <a href="https://www.linkedin.com/in/hollyrgibson/">Holly</a>, and <a href="https://www.linkedin.com/in/joonas-mertanen-15403012b/">Joonas</a> make Kino a more frontend heavy than the average development team at Smartly.io. Kino also differs from other teams because it isn’t in contact with Facebook or Pinterest APIs at all. Instead, they provide the creative platform for other development teams, like Senators, Midas, AweSoMe, and Graham. Kino’s developers collaborate closely with their product manager Maria and product designer Mala, and they are currently looking for <a href="https://www.smartly.io/open-positions/e6374dde-df28-460b-b4e4-25db2abac528?hsLang=en">a full-stack engineer</a> to join their team. “We’d like to find a new teammate with a good understanding of React/Redux, as well as experience with TypeScript and in building Node.js applications,” Pasi says.</p><p>Learn more about working as a developer at Smartly.io at <a href="https://www.smartly.io/careers">www.smartly.io/careers/developers.</a></p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/meet-our-development-teams-kino"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0b42e55a5af" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/meet-our-development-teams-kino-c0b42e55a5af">Meet Our Development Teams: Kino</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Our Development Teams: Oodi]]></title>
            <link>https://medium.com/smartly-io/meet-our-development-teams-oodi-c8a4e155390?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/c8a4e155390</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development-team]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Siiri Hakulinen]]></dc:creator>
            <pubDate>Fri, 13 Dec 2019 08:00:34 GMT</pubDate>
            <atom:updated>2020-01-31T11:07:07.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aiD3U6JaBwVrV7vD" /></figure><p>Team Oodi’s mission is to determine how our customers use their media assets across the platform and make those workflows as smooth as possible. The team owns the asset library that our customers use to organize their media assets, like photos, videos, fonts and sound. “As advertising is becoming more visual, we’re playing a crucial role in building the backbone of Smartly.io’s creative tools,” says <strong>Hugo</strong>, the team lead to Oodi.</p><p>Apart from offering asset management for end users, Oodi provides its fellow development teams with components for accessing the asset library, as well as an internal asset management service. Oodi worked recently with team Senators to integrate the asset library component into campaign creation, allowing customers to search for and add assets to their ads. Next, it will buddy up with team Bobby Tables to enable customers to analyze assets in the actionable insights tool. “It’s almost like we have our own library that other teams can use,” Hugo says.</p><p>“This is why we need to be extra mindful to produce well-written and documented code,” Hugo says. “If Oodi’s code isn’t clean, other teams can’t use our service safely without the risk of breaking other components elsewhere in the product. And if those components fail, customers can’t create their campaigns. So we have a very central role in securing the stability of our platform.”</p><p>Oodi recently finished a big and hairy rewrite project, where they extracted the asset management functionality from the monolithic code base into its own microservice. “It was a real chore, but now we get to enjoy the fruits of our labor,” Hugo says. “We get to work with a modern stack and a clean codebase with very few bugs.” The assets are stored in AWS S3 managed by a Ruby on Rails microservice using PostgreSQL and Redis as data storage. The user interfaces for working with assets are built as a <a href="https://www.smartly.io/blog/how-we-built-a-seamless-user-experience-from-multiple-small-front-end-applications">micro frontend</a> with React, Redux, Styled Components, Jest and TypeScript.</p><p>At the moment, Oodi focuses on building functionality for tagging assets. Tagging allows customers to organize and search for assets more efficiently. In the future, they will also be able to analyze asset content and performance in the reporting tool. “In the future we hope to also automate tagging with AI,” Hugo says. After the tagging project is done and dusted, team Oodi will reconsider its focus. “It will be exciting to explore new projects and plan our roadmap further,” Hugo says. “The team will have a say in what projects we’ll focus on in the future.”</p><p>Team Oodi has been aptly named after the new Helsinki Central Library that neighbors our office. <a href="https://www.linkedin.com/in/hugokiiski/">Hugo</a> and his teammates <a href="https://www.linkedin.com/in/julius-hietala-8967b8a2/">Julius</a>, <a href="https://www.linkedin.com/in/jere-vaara-60773390/">Jere</a>, <a href="https://www.linkedin.com/in/luismanuelramalho/">Luís</a>, <a href="https://www.linkedin.com/in/eelis-kostiainen/">Eelis</a>, <a href="https://www.linkedin.com/in/wschrauwen/">Wesley</a> and <a href="https://www.linkedin.com/in/locke23rus/">Kirill</a> have created a strong team identity and a sense of community. They also work closely with their product manager <a href="https://www.linkedin.com/in/%C3%A7i%C4%9Fdem-%C5%9Feftalio%C4%9Flu-3a013831/">Cigdem</a> and product designer <a href="https://www.linkedin.com/in/mala-patel-47679925/">Mala</a>. “We have a culture of helping each other,” Hugo says. “We like to do a lot of pair programming, and those who are more familiar with some parts of our stack help others learn. We have also been planning to start our own mini library, where teammates can bring books for others to read and learn from.”</p><p>Oodi is currently looking for a <a href="https://www.smartly.io/open-positions/4e2dbcae-8102-40d3-9320-def9ae57d9c2?hsLang=en">frontend-focused fullstack engineer</a> fluent in current front-end development technologies like React and TypeScript. “Experience in building robust and scalable web backends with Rails or other modern technologies would be helpful, too.” Hugo says. “We don’t expect everyone to master all the technologies we use, though. It’s more important to have a self-starting attitude and to be able to orient yourself on the backlog on your own. Good communications skills are a bonus, we’re a pretty talkative team.”</p><p>Learn more about <a href="https://www.smartly.io/careers/developers">how developers work at Smartly.io</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/meet-our-development-teams-oodi"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8a4e155390" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/meet-our-development-teams-oodi-c8a4e155390">Meet Our Development Teams: Oodi</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet our Development Teams: Autopsy]]></title>
            <link>https://medium.com/smartly-io/meet-our-development-teams-autopsy-a10410a794a4?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/a10410a794a4</guid>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[team-introduction]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Siiri Hakulinen]]></dc:creator>
            <pubDate>Tue, 19 Nov 2019 08:48:51 GMT</pubDate>
            <atom:updated>2019-11-19T08:48:51.674Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-IaGq7w_o3nuCx5ELxvq8g.jpeg" /></figure><p>Team Autopsy builds <a href="https://medium.com/smartly-io/statistical-significance-for-humans-automated-statistical-significance-calculator-for-a-b-testing-49123cea1edb">A/B testing</a> and fully automated optimization tools to improve both short and long term performance for our customers. Its name, while sounding ominous, is actually an acronym for the words automation and optimization. As one of the oldest development teams at Smartly.io, Autopsy is redefining its focus and cleaning up some of its historical burden, all the while working on an exciting new project.</p><h3>Building a new tool for A/B testing</h3><p>“We’re now in the process of finding a product/market fit for a completely new A/B testing solution,” says <strong>Lauri</strong>, the team lead for Autopsy. “Our mission is to make A/B testing as easy as humanly possible for our users. While we use advanced Bayesian modeling in the backend, we want the tool to be super simple to use.”</p><p>Autopsy is an inspiring example of how an old team with lots of history can reinvent itself and kick off a new project. “It’s exciting to get to plan a fresh tool from scratch,” Lauri says. “We’re building something that doesn’t exist yet, which means that we have a huge responsibility in figuring out what is the best way to go about building it.”</p><h3>Working closely with the most advanced customers</h3><p>In their quest to find the product/market fit, the team spends a lot of time talking to customers and gaining an understanding of their needs. Lauri recently got back from a three-week stint in San Francisco, where he met with some of the most advanced Smartly.io customers. “Many of our largest customers visit our Helsinki office on a regular basis, too, and all of our team members get to meet them and workshop with them to solve their most painful problems,” Lauri says.</p><p>“Our biggest challenges at the moment have to do with prioritization and finding a balance between product development speed and writing scalable and sustainable code,” Lauri says. “While we want to produce value to the customers on a weekly basis, we don’t want to resort to quick fixes.”</p><p>Thanks to its close cooperation with customers to plan the A/B testing product, customer centricity is an important prerequisite for thriving in team Autopsy. “You have to be keen to understand the business and solving the customers’ problems,” Lauri says. “Being excited about solving technical problems only gets us so far.”</p><h3>Refactoring the old backend with modern technologies</h3><p>Team Autopsy is home to six developers: <a href="https://www.linkedin.com/in/sergey-susikov-49589b56/">Sergey</a>, <a href="https://www.linkedin.com/in/dmitry-kulikov/">Dmitry</a>, <a href="https://www.linkedin.com/in/dalibor91/">Dalibor</a>, <a href="https://www.linkedin.com/in/lukyanenko/">Andrey</a>, <a href="https://www.linkedin.com/in/janschupke/">Jan</a>, and <a href="https://www.linkedin.com/in/laurikovanen/">Lauri</a> are all experienced full stack engineers. They’re refactoring the old PHP backend with TypeScript and NestJS, and the old Angular frontend with React. The team works closely together with their product manager Martti, collaborating on projects and avoiding lonely work. Autopsy is also looking for a new team member: <a href="https://www.smartly.io/open-positions/a0c2e476-b834-4c1a-9dd0-d92cc51384fb?hsLang=en">a backend/fullstack engineer</a>, who is self-driven and excited to turn customer feedback into well-functioning solutions.</p><p>In six month’s time, team Autopsy hopes to be finished with the A/B testing project and planning its roadmap ahead. “It’s a nice place to be in: working on something new and fundamentally different, but at the same time knowing you won’t be married to that project indefinitely,” Lauri says. “It’s rewarding to be able to define a new direction for the team and the product we’re working with”.</p><p>Learn more about <a href="https://www.smartly.io/careers/developers">how developers work at Smartly.io</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/meet-our-development-teams-autopsy"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a10410a794a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/meet-our-development-teams-autopsy-a10410a794a4">Meet our Development Teams: Autopsy</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Our Development Teams: Value for Life]]></title>
            <link>https://medium.com/smartly-io/meet-our-development-teams-value-for-life-ff63ba5aa1da?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/ff63ba5aa1da</guid>
            <category><![CDATA[data-warehousing]]></category>
            <category><![CDATA[snowflake-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-architecture]]></category>
            <dc:creator><![CDATA[Siiri Hakulinen]]></dc:creator>
            <pubDate>Mon, 04 Nov 2019 08:42:53 GMT</pubDate>
            <atom:updated>2019-11-04T15:14:00.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xllQVP-bFsaSlnSsA9xTjg.jpeg" /></figure><p>Team Value for Life is on a mission to enable smart business decisions based on data. They are different from other development teams at Smartly.io because their direct customers are not our app users but other Smartlies. “We collect, warehouse, and refine data to support business intelligence, invoicing, sales operations, and product management,” Sampo, the team lead for VfL, explains. “We’re building a foundation for scaling the company by improving and expanding the underlying data architecture.”</p><h4>Data warehousing and a new invoicing service</h4><p>At present, the team has two bigger projects in its hands: data warehouse development and a Ruby on Rails project that aims to encapsulate all invoicing-related architecture into one service nicknamed Pennybags. “It’s not just refactoring,” Sampo says. “A big part of the project is to develop a new invoicing logic that empowers the future of our business, where we offer multiple product and service combinations on a variety of advertising platforms.”</p><p>Data warehouse development is another intriguing undertaking by team VfL. “Essentially, we’re moving a terabyte’s worth of data into a new database,” Sampo explains. “The old PostgreSQL database isn’t the ideal solution for analyzing big data, and we hope to fix that with the new Snowflake data warehouse.” Being able to analyze the large volumes of data our app generates is a key prerequisite for being able to produce market insights and productize optimization strategies for our users.</p><p>“One of our biggest challenges is to restructure the entire data pipeline,” Sampo says. “Before we turn to technical implementation, we need to be able to visualize what data is collected, how it is collected from a variety of endpoints, and how it is managed so that it is optimal for data analysis.” To accomplish their goal, VfL works closely with multiple teams around the company to build an understanding of how the data warehouse and pipeline should be built so that they serve the company in the best possible way.</p><h4>A team with a diverse skill set</h4><p>VfL is a unique team also because it houses professionals with a diverse set of expertise areas: <a href="https://www.linkedin.com/in/sampoverkasalo/">Sampo</a>, <a href="https://www.linkedin.com/in/beyondcompute/">Evgeny</a>, and <a href="https://www.linkedin.com/in/mikamarttila/">Mika</a> make up the developer subteam, each of them with six to 15 years of experience in software development, a backend focus and fluency in databases. They work closely together with their product manager <a href="https://www.linkedin.com/in/tiiatirkkonen/">Tiia</a>, business intelligence analysts German, Tuomas, Tomi, and Pekka, as well as business system specialist Katri. “We prepare the data in a way that it can easily be processed and refined by others,” Sampo explains. “For example, the BI team builds dashboards on top of our data warehouse, which in turn helps other Smartlies around the organization make decisions in a data-driven way.”</p><p>The team is looking for <a href="https://www.smartly.io/open-positions/39f3a820-f7a0-470f-8661-d108a335a0f7">a new member</a> to help with bringing Pennybags, the new invoicing service, towards its vision of encapsulating invoicing related logic and enabling new types of offerings. “Now that we have an opportunity to re-do the service, we want to double down on details and create a precise and sustainable system that’ll serve us well as the company scales,” Sampo says.</p><p>Learn more about how developers work at Smartly.io at <a href="https://www.smartly.io/careers/developers">smartly.io/careers/developers</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/meet-our-development-teams-value-for-life"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff63ba5aa1da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/meet-our-development-teams-value-for-life-ff63ba5aa1da">Meet Our Development Teams: Value for Life</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights from the 5th DevTalks with Talia Nassi and Gabriel Lebec]]></title>
            <link>https://medium.com/smartly-io/highlights-from-the-5th-devtalks-with-talia-nassi-and-gabriel-lebec-7c47415f9c88?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/7c47415f9c88</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[lambda-calculus]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[functional-programming]]></category>
            <dc:creator><![CDATA[Sayo Oladeji]]></dc:creator>
            <pubDate>Fri, 01 Nov 2019 08:02:14 GMT</pubDate>
            <atom:updated>2019-11-01T08:07:36.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi0a-4QjrTKnf-LfUHQOUQ.jpeg" /></figure><p>DevTalks brings seasoned developers around Helsinki together to listen to industry-recognized speakers present intriguing ideas, techniques and technologies. Last week at the fifth edition of DevTalks, we were honored to host a great crowd of 100+ software developers and two fantastic speakers: <a href="https://www.linkedin.com/in/talianassi/">Talia Nassi</a> and <a href="https://www.linkedin.com/in/glebec">Gabriel Lebec.</a></p><p>In this blog post, I’ll share highlights from both talks. You can also tune into the talks on Youtube. Find Talia’s talk <a href="https://youtu.be/cv1y13y7iAk">here </a>and Gabriel’s <a href="https://youtu.be/6BnVo7EHO_8">here </a>.</p><h3>Who were speaking?</h3><p>The first speaker of the evening was Talia Nassi, a quality-driven Test Engineer at WeWork. She has a passion for breaking and rebuilding software to the highest possible quality. Talia started as a QA intern while studying at UC San Diego and immediately knew that she had found her calling. From UCSD she was recruited to work at Visa, where she tested the payment processing system for the Prepaid Cards. After Visa, Talia started at WeWork, where she continues to do what she loves-deliver high quality software!</p><p>After Talia, Gabriel Lebec took the stage. Gabriel is a software engineer who develops Search features at Google. As a former instructor at Fullstack Academy of Code, he has helped hundreds of students launch careers in technology. He holds a BA in Mathematics and Studio Art from Georgetown University, and is an enthusiast of functional programming in Haskell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*beqmgn5P_CiLs2To.jpg" /></figure><h3>Talia Nassi: Testing in Production</h3><p>Testing in production sounds scary-isn’t production too late to detect a defect as it would already be visible to customers? Talia didn’t seem to think so. She first stumbled upon the idea when she interviewed for a job. When she asked the interviewers about their testing practices, more specifically, how they keep their staging environment up to date, she was perplexed by their answer. “We don’t have a staging environment, we test in production”. I can imagine Talia being as apprehensive about these testing practices back then as many of us felt in the audience.</p><p>Indeed our concerns aren’t entirely unfounded. Testing in production can affect real users and introduce noise into analytics that inform critical business decisions. It can also affect third parties integrated into the software, like send unnecessary API calls, or even corrupt production data.</p><p>But on the other hand, the idea of a staging environment comes with significant problems of its own. First, staging test results don’t always match production results because staging and production data are different. Similarly, staging traffic and load patterns don’t usually match production, making it hard to emulate production performance characteristics. Other critical factors that speak against testing in staging environments are that maintaining an up-to-date staging environment is expensive, and those staging environments aren’t usually as heavily monitored as production.</p><p>Given the differences between typical staging and production environments, Talia believes the only way to be entirely sure that a feature works reliably is to test it in production. However, many companies decide not to do it out of fear or because they don’t trust their tooling, products, or processes.</p><p>Safe production testing requires a few things to be in place:</p><ul><li>Use feature flags to hide newly introduced features from the public. At Smartly.io, we use feature flags extensively and have built tools around them to allow customer success managers to enable specific features for individual early-bird customers. The same infrastructure lets us perform internal rollouts to gather feedback before public releases.</li><li>Introduce a test automation framework into the development process to speed up the feedback loop. Run the tests in production regularly, like at fixed intervals or on commit.</li><li>Introduce an alert tool so that relevant people get notified if something goes wrong. At Smartly.io, we use Bugsnag for frontend error alerts.</li><li>Create and manipulate test data in production. Use consistent naming conventions for test users. Test users must look and act like real users, but be distinguishable by their name (or another attribute) to the reporting systems. Also, ensure test users only interact with other test users in automation scripts.</li><li>Write your tests (BDD is great!) and ensure clean setup and teardown. Trigger the alerting system on setup and teardown errors.</li><li>Do a production canary rollout.</li></ul><p>At Smartly.io, we have tooling in place to test changes against production. All our <a href="https://www.smartly.io/blog/how-we-built-a-seamless-user-experience-from-multiple-small-front-end-applications">micro-frontends </a>are linked to the main (host) frontend using tools like Yalc. They can then easily be launched using a webpack server against the production backend with a single command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*Cltg3zcKPuU6q-FV.png" /></figure><p>A handy command for running the main Smartly frontend code in interactive mode and connected to our production backend.</p><p>What if you can’t test in production (like for highly sensitive medical systems)? In that case, consider simulating the production environment with container technologies. When factors like privacy are considered, this makes sense.</p><p>You’ll need the buy-in of your colleagues and company’s technology decision makers to shift to testing in production..To succeed, you’ll need to map out the pros and cons of production testing, cite examples from the past where production testing could have mitigated issues, and present a sound implementation plan for the new testing strategy. Always keep in mind that <em>“ </em>it works on my computer” doesn’t cut it, nor does “it works on the CI server”; it only really works if it works reliably in production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*K0Ng211egMetXNrd.jpg" /></figure><h3>Gabriel Lebec: A Flock of Functions — Lambda Calculus and Combinatory Logic in JavaScript</h3><p>There has been a <a href="https://medium.com/@elizarov/functional-programing-is-on-the-rise-ebd5c705eaef">recent resurgence in functional programming </a>patterns with many new languages implementing first-class functions, frameworks introducing <a href="https://hackernoon.com/react-stateless-functional-components-nine-wins-you-might-have-overlooked-997b0d933dbc">functional components </a>and libraries encouraging the use of <a href="https://immerjs.github.io/immer/docs/introduction">immutable data structures </a>. This resurgence is due to the bad taste that bugs from the shared mutable state have left in many mouths, as well as the inconvenience that comes with testing and debugging large stateful software components.</p><p>In this talk Gabriel discussed the fundamentals of lambda calculus and its relationship to some functional programming patterns we use everyday in languages like JavaScript.</p><h4>Quick introduction to lambda calculus</h4><p>A lambda is a function that takes one argument and returns an expression. For example, the Identity Function takes an argument and returns that argument. An anonymous function, together with its argument and returned expression are sometimes called a <a href="https://wiki.haskell.org/Lambda_abstraction"><em>lambda abstraction </em></a>.</p><p>According to Wikipedia, “Lambda calculus ( <a href="https://en.wikipedia.org/wiki/Lambda_calculus">λ-calculus </a>) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation that can be used to simulate any <a href="https://en.wikipedia.org/wiki/Turing_machine">Turing machine </a>.”</p><p>Important notes to keep in mind about lambda calculus:</p><ul><li>In lambda calculus, there’s no such thing as a mutable variable. Instead, all variables are immutable. Variables have a definition (known or unknown) but they are never reassigned.</li><li>Lambdas take only one argument. An expression such as 𝝺abc.b means a function that takes one argument &quot;a&quot; and returns a function that takes one argument &quot;b&quot; and returns a function that takes one argument &quot;c&quot;, which then returns &quot;b&quot;. This pattern is called <a href="https://en.wikipedia.org/wiki/Currying">currying </a>. In JavaScript that would be written as . a =&gt; b =&gt; c =&gt; b</li><li>Lambdas can be nested, which means the innermost is evaluated then passed as an argument to its outer lambda and so forth.</li><li>Function evaluation means symbol replacement. Symbols in the expression are simplified and replaced “recursively”. This is also called “β-replacement <strong>“</strong>.</li><li>An expression is said to be in “β-normal” form if no further β-replacement is possible.</li></ul><h4>Example 1: the <a href="https://en.wikipedia.org/wiki/Identity_function">Identity </a>function</h4><p>This is a function that takes an argument and returns the argument, let’s denote it by I .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HHt3dRCTynku6Iv16-WBYQ.png" /></figure><p>Therefore the Identity of 1 denoted as I(1) == 1 . . I(2) == 2 (the identity of the identity function is the identity function itself). I(I) == I</p><h4>Example 2: the <a href="https://github.com/raganwald-deprecated/homoiconic/blob/master/2008-10-29/kestrel.markdown#readme">Kestrel </a>function</h4><p>The Kestrel function “takes” two arguments “a” and “b” then returns “a”. Remember that in lambda calculus functions only take one argument, so whenever we say a function takes more than one argument, the others are curried in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81HAKoWS7zZLPbuP1EjNiQ.png" /></figure><p>So it follows that K(I)(X) === I . Kestrel takes two arguments, in this case I and X , and returns the first argument, in this case I .</p><p>What about K(I)(X)(y) ? As shown above, , therefore K(I)(X) === I (y) === I (y) === y . K(I)(X)</p><p>Let’s pay a bit more attention to this conclusion: K(I)(X)(y) === y . The expression K(I) takes two arguments X and y and returns the second argument. Now we can see how these fundamental functions, even though trivial by themselves, form building blocks which could be combined to build more complicated machinery.</p><p>K takes two arguments and returns the first, while KI takes two arguments and returns the second. The expression KI is called the <strong>Kite</strong> function. There are several other fundamental functions like these, you can find the definitions of some these bird-named functions in this <a href="https://fsharpforfunandprofit.com/posts/defining-functions/#combinator-birds">F# discussion </a>.</p><h4>Why care about these functions?</h4><p>The <a href="https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis">Church-Turing thesis </a>and related works show that lambda calculus and the Turing machine are equivalent when describing <a href="https://en.wikipedia.org/wiki/Computable_function">computable functions </a>. A function is said to be computable if it can be expressed as an algorithm. A programming language is said to be Turing-complete if every possible computation can be expressed with it. Most of the programming languages we use today, including JavaScript, are Turing-complete. That means any logic expressible in a Turing-complete programming language is also expressible in lambda-calculus and vice versa.</p><p>To demonstrate the equivalence of these two systems, Gabriel derived lambda expressions for TRUE, FALSE, NOT, AND, OR and XOR from scratch with JavaScript and proved their correctness. Everything is a function! He also discussed how several advanced concepts such as numbers, arithmetic, data structures, type systems and recursion can also be expressed as lambdas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*JmHgQlRzbnRNYJll.png" /></figure><p>Common boolean operations and their <a href="https://en.wikipedia.org/wiki/Church_encoding#Church_Booleans">Church encodings </a>(lambda representation) from Gabriel’s presentation</p><p>Do we really need to know lambda calculus to write maintainable JavaScript programs? Of course not. However, while Gabriel’s presentation was fun and intellectually stimulating, a sound knowledge of functional programming gives us a fresh perspective into computational logic and immutable data structures (which might helps us write better software). It could also serve to develop a deeper appreciation for computations in general.</p><h3>DevTalks will be back!</h3><p>The fifth DevTalks was both entertaining and inspiring. I would like to thank Talia and Gabriel for the talks and all the participants who asked insightful questions and contributed to intriguing conversations after the talks. DevTalks will be back next spring. You can stay up to date by joining our <a href="https://www.meetup.com/Smartly-io-DevTalks/">Meetup.com group </a>.</p><p>Tune into DevTalks with the <a href="https://www.youtube.com/watch?v=-kJhMGLLXtQ&amp;list=PLzkNbt9Mcj6_AGhmAeF3uPiL9mLzoaEZN">Youtube playlist</a> featuring Talia and Gabriel’s talks, plus the official aftermovie👇</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-kJhMGLLXtQ%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-kJhMGLLXtQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-kJhMGLLXtQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c84053f9d59eeaf73e6047cae98a9739/href">https://medium.com/media/c84053f9d59eeaf73e6047cae98a9739/href</a></iframe><p>Feel free to <a href="https://www.youtube.com/channel/UCI3zkNSpdrBxYk9DWB_GfWA/">subscribe</a> for more brainfood for engineers, by engineers.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/highlights-from-5th-devtalks-with-talia-nassi-and-gabriel-lebec?hs_preview=CJZmxtLT-19376547134"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c47415f9c88" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/highlights-from-the-5th-devtalks-with-talia-nassi-and-gabriel-lebec-7c47415f9c88">Highlights from the 5th DevTalks with Talia Nassi and Gabriel Lebec</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minimal Coherence and Maximal Autonomy for 13 Development Teams]]></title>
            <link>https://medium.com/smartly-io/minimal-coherence-and-maximal-autonomy-for-13-development-teams-b4a219e13306?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/b4a219e13306</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[engineering-culture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-development-team]]></category>
            <category><![CDATA[engineering-mangement]]></category>
            <dc:creator><![CDATA[Otto Vehviläinen]]></dc:creator>
            <pubDate>Mon, 30 Sep 2019 08:52:03 GMT</pubDate>
            <atom:updated>2019-12-03T19:33:38.092Z</atom:updated>
            <content:encoded><![CDATA[<h3>Balancing Unity and Autonomy with 13 Development Teams</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clXave7tH8j8NMp7C-L_2A.jpeg" /></figure><p>Almost exactly two years ago, we shared how engineers work at Smartly.io in <a href="https://medium.com/smartly-io/how-engineers-work-at-smartly-io-832bf0c3d5f8">this blog post</a>. Since then, our product organization has doubled in size, and we have gone from six development teams to 13. Here’s how our ways of working have changed-and stayed the same.</p><p>We have to constantly adapt our ways of working and find new and better ways to operate in the fast-changing environment. It’s a process of creative destruction: old ways become obsolete, and new approaches are born out of new needs. In refreshing our engineering team’s working agreements, <strong>our mission has been to find the minimum level of coherence where we can function while allowing maximal autonomy to development teams.</strong></p><h3>Emphasizing the autonomy of individual teams</h3><p>Our engineering team consists of <a href="https://www.smartly.io/hubfs/careers-attachments/Becoming%20a%20Smartlie%20%E2%80%94%20what%20to%20expect/Introducing-our-development-teams_Aug2019_1.pdf">13 full-stack development teams</a>, each of which owns a particular product area. They enjoy a high level of independence that hasn’t changed over the years. The teams own their roadmap and are in charge of improving the technical solutions as well as managing the technical debt of their product area. They are equipped with frontend, backend, DevOps, product design, and product management skills which empowers them to develop their product area end-to-end.</p><p>We have chosen to build full-stack teams instead of separating each of the different skill sets to their own groups, because it empowers self-organized ways of working. The development teams are autonomous units with their own products and they have the freedom and responsibility to build and improve those products in a sustainable way. In the past two years, we have improved the full-stack team structure by recruiting more product designers and product managers. There is now one product manager per team, and one product designer supports one to three teams on average. We have also been strengthening design thinking and giving product design a more central role in product development.</p><p>Now that we have more than double the number of teams compared to two years ago, we have found that we need to find a more reasonable balance between what ways of working we standardize across teams and what teams can choose on their own. It’s not feasible to guide each team individually, so we have looked for ways to steer the whole ship in the same direction instead.</p><h3>Adding high-level philosophy</h3><p>The development teams have a lot of decision-making responsibility, and sometimes it may feel a little overwhelming. Adding layer of basic principles to the working agreements helps teams align their thinking with the general direction of the whole company. For example, one of our core principles is <em>Collaboration over silos</em>. We believe that generating a shared understanding is more valuable than the short term wins gained by solo projects. It also means that no part of the product development cycle should be a handover, but have a tight feedback loop between the agents performing the different steps.</p><p>While we allow development teams a lot of autonomy in choosing their ways of working, we want to be somewhat opinionated as to what are our preferred ways of building the product. Because one of our core principles is that we are here to solve our customers’ problems, we try to build minimum vertical solutions that produce value to our customers. We also want to push these solutions to production early on to get the feedback loop going, instead of trying to build massive releases that seek to do everything at once. At the same time, we don’t want to build features just for the sake of producing code, so we set clear expectations to the usage and measure if we meet those expectations.</p><h3>Choosing what needs to be standardized and what doesn’t</h3><p>The old working agreements didn’t make a clear distinction between binding rules and best practices that teams could either follow or discard. This ambiguity diluted the working agreements, so this time we paid extra attention to determining what we need to agree on the organizational level, and where each team can define their own approach. In short, we set out to find the best ratio of standardization and customization.</p><p>Sharing information openly between teams is something we want to stick to regardless of the size of the engineering team. Transparency needs to be routine, and that’s why we have agreed to share meeting notes in our internal chat and tag them for easy retrieval. We have also agreed to track epics, stories, and bugs in JIRA to collect the information that all teams need access to into one organization-wide communication channel. However, for monitoring team-specific tasks, the development teams are free to choose their approach and tools. Some teams use JIRA for tasks too, while others use physical kanban boards and post-it notes.</p><h3>Clarifying roles and responsibilities</h3><p>As the organization is growing, we felt it was essential to clarify the different roles (developer, team lead, product designer, and product manager) and their responsibilities within the development teams. For example, a product designer is responsible for flagging usability issues in the team’s responsibility areas, and developers are responsible for technical solution design.</p><p>Agreeing on responsibility areas on a high level doesn’t mean that they are chiseled in stone. Actually, we believe that in healthy teams, these activities are decentralized. For example, while the product manager is responsible for providing the customer perspective, everyone should have an understanding of customer needs in a well-functioning full-stack team. Similarly, the team lead is responsible for making sure the team works efficiently, but everyone should feel ownership of the team, raise issues, and help fix problems together.</p><h3>Autonomy is a defining characteristic of our way of working</h3><p>Even though our product organization has grown significantly during the past two years, we want to stick to our end-to-end full-stack teams and mandate as little process as possible to increase team autonomy. Our teams own their roadmaps, make decisions on how to improve their product area, and choose how to implement those improvements.</p><p>While our ways of working have evolved to support a larger team and a more complex product, they are still driven by largely the same principles as before. We are still on the mission to simplify things as much as possible, and avoid adding rules and processes for the sake of rules and processes.</p><p>The work is by no means finished. We still need to find new ways to support transparent communications across all the development teams, and steer clear from siloing. We also need to keep exploring the best ways to reduce dependencies between teams while at the same time setting up more platform-like teams that build solutions that other teams use. Even after we finish this round of refreshing the working agreements, we’ll need to keep a sharp eye on how well they support our evolving organization and reiterate them when needed.</p><p>Learn more about our engineering team at<a href="https://www.smartly.io/careers/developers"> smartly.io/careers/developers.</a></p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/minimal-coherence-and-maximal-autonomy-for-13-development-teams"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4a219e13306" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/minimal-coherence-and-maximal-autonomy-for-13-development-teams-b4a219e13306">Minimal Coherence and Maximal Autonomy for 13 Development Teams</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meet Our Development Teams: Senators]]></title>
            <link>https://medium.com/smartly-io/meet-our-development-teams-senators-5ec00b13c08?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/5ec00b13c08</guid>
            <category><![CDATA[openapi-specification]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-development-team]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Siiri Hakulinen]]></dc:creator>
            <pubDate>Wed, 25 Sep 2019 06:36:27 GMT</pubDate>
            <atom:updated>2019-09-25T06:36:02.993Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uxRGMiXGtzHisMrfBj9nuA.jpeg" /></figure><p>Team Senators owns one of the most business-critical areas of the Smartly.io app-the one that creates the Facebook and Instagram ads you see in your social media feed. Theirs is the responsible job of keeping the functionality live at all times, as well as making the ad creation experience as hassle-free and intuitive as possible for the app users.</p><p>“If our system goes down, our customers can’t publish their ads. And if they don’t get their ads out there, they don’t spend their budget, which in turn means that we don’t make any money,” says <strong>Valtteri</strong>, the Senators’ team lead. “This means that a lot depends on us doing our job well, and building a resilient system that can handle large volumes of data.”</p><h3>Clear-cut focus and lots of responsibility</h3><p>Senators is a new team with five experienced developers: <strong>Sakari</strong>, <strong>Juha</strong>, <strong>Pablo</strong>, <strong>Andre</strong>, and Valtteri. They work intimately together, tackling projects one by one as a team. They strive to maintain a crystal clear focus by prioritizing heavily and accepting only a few projects to their quarterly roadmap.</p><p>“Senators was born when a larger twelve-person development team was split into two smaller autonomous teams. The new team structure allows us to focus on a more clear-cut, smaller area of the app. Being more focused keeps the team’s workload more manageable and results in higher developer happiness,” Valtteri explains. “There’s still a lot of work, but now it’s easier to see how your work contributes to the team’s goals in the big picture.”</p><p>In a small team, all developers need to take on a ton of responsibility, especially as Senators is working on a challenging frontend refactoring process. “Rewrites are always risky and require meticulous planning so that you don’t break anything or mess up what the other teams are working on,” Valtteri says. “But at the same time, the team is hyped up about the opportunity to code a new frontend from scratch. Especially as we can really take time to do it, and pay the needed attention to clean code and building a resilient and sustainable system using new technologies.”</p><h3>Modern technologies &amp; tricky rewrites</h3><p>The team works with technologies like React, Redux, TypeScript, PostgreSQL, Redis, and Kubernetes. They specify their APIs with OpenAPI, and Sakari even wrote a <a href="https://github.com/smartlyio/oats">library</a> that generates Typescript clients and servers from an OpenAPI spec to make their life easier. “As we’re working on refactoring the old monolith, we also need to know our way around PHP,” Valtteri adds. “But with the rewrite, we’re doing away with the legacy PHP, which is bound to make things more convenient.”</p><p>Senators also operates a microservice, a creative service called Goya that handles the ad creation process on the backend. “Moving from a monolithic structure to separate services allows us to narrow our focus, implement code faster, and spend less time coordinating with other development teams,” Valtteri explains. “When areas of ownership and overlap are more pronounced, we’re in a better place to make other teams’ work easier and faster where our work intertwines.”</p><p>As their first task, Senators needs to tackle an oncoming migration from one version of Facebook’s API to the next. “It perhaps doesn’t sound like the most exciting thing in the world, but API migrations can produce real brain teasers. This time, for example, Facebook made some major changes in their API, like splitting one API endpoint into three new ones. We need to figure out how we can accommodate those changes in our own app, without mixing things up for our users,” Valtteri explains.</p><p>Next, Valtteri and his team turn to the frontend rewrite. “It’s another intriguing challenge. There are many variables at play when you’re making an ad, and we need to simplify this complex process for our users as much as possible. It’s also going to be interesting to plan the UI in a way that it serves both power users and less advanced advertisers.”</p><p>Learn more about how developers work at Smartly.io at <a href="https://www.smartly.io/careers/developers">smartly.io/careers/developers</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/meet-our-dev-teams-senators"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec00b13c08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/meet-our-development-teams-senators-5ec00b13c08">Meet Our Development Teams: Senators</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing a greenfield microservice]]></title>
            <link>https://medium.com/smartly-io/testing-a-greenfield-microservice-9e8cbd5d459?source=rss----a41e72c6f22c---4</link>
            <guid isPermaLink="false">https://medium.com/p/9e8cbd5d459</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[test-pyramid]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Juha Viljanen]]></dc:creator>
            <pubDate>Fri, 30 Aug 2019 08:17:42 GMT</pubDate>
            <atom:updated>2019-08-30T08:19:31.086Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QPL4cg1ikgKDI2zYjqMqoA.jpeg" /></figure><p>There are no universal rules for choosing a method for testing. You have to optimize for what is important to you. While the test pyramid might be a good fit for more stable systems, our development team decided to avoid writing unit tests and rely on more black-box API tests for our new microservice. We chose this approach to optimize for easy and safe rewrites which we expect to happen at the early stages of the microservice. In this blog post, I’ll run you through our thinking process and explain how we came to this conclusion about testing our greenfield microservice.</p><h3>Choosing a testing method</h3><p>A year ago, our team extracted a core feature of our product, the part that creates ads to Facebook, from a monolith to a new microservice. After working with legacy code, we suddenly had a greenfield project, where we could do things right from the get-go, follow best practices, and define testing standards from scratch. It soon became clear, though, that our team didn’t share a common vision of what would be <em>the perfect way</em> to do testing for our microservice.</p><p>Some of us, including me, thought that we should follow textbook testing practices now that we had a chance. In other words, we should follow the test pyramid’s proportions of finer and coarser-grained tests. Other team members believed that it made more sense to rely on API tests solely. To reach a decision, we debated the topic in our team retrospective. In the retro, we examined the typical pros and cons of API tests and unit tests, and then discussed which tradeoffs we could live with. I have summarized the benefits and disadvantages of the different testing methods below.</p><h4>Textbook pros and cons of API tests and unit tests</h4><p><strong>API tests</strong></p><ul><li>Ensure the API contract is held to give good confidence that code works as intended.</li><li>No need to change API tests when refactoring or rewriting functionality, which makes API tests a useful safety harness.</li><li>Slower to run, as setting up the full service with databases and other dependencies takes time.</li><li>If a test is failing, it typically takes more time to pinpoint what is broken.</li><li>Doesn’t affect code design, since it’s treating the system as a black box.</li><li>Since API tests are treating the system as a black box, they should not require a lot of mocking, other than some external services. Still, testing corner cases leads to more setup code than when testing the same corner case in isolation in a unit test.</li></ul><p><strong>Unit tests</strong></p><ul><li>With only unit tests, the test suite may pass while the feature is broken, which can happen if a failure occurs in the interface between modules.</li><li>Since unit tests are more tied to the implementation, the tests might need updating when you’re refactoring code. Tests may even become useless when rewriting some functionality. This is why unit tests don’t provide as good of a safety harness for refactoring as API tests.</li><li>Fast to run, hence provide a faster feedback cycle for development.</li><li>Usually easy to pinpoint what is causing a unit test to fail.</li><li>Writing code that is easily unit testable can help in designing cleaner code, for example, with fewer side effects and cleaner interfaces.</li><li>Depending on how strict you want to be about the level of isolation of unit tests, they may require a lot of mocking, which, in the worst case, makes them slow to write.</li></ul><h3>Test pyramid</h3><p>Of course, we aren’t restricted to only one type of tests, be it on the unit, API, integration or UI level, or something completely different. Most projects will have many types of tests in varying amounts. A common way of thinking of a sensible distribution of lower and higher-level tests is the test pyramid.</p><p>The concept was popularized as the Test Automation Pyramid by <strong>Mike Cohn</strong> in his book <em>Succeeding with Agile</em>. The main idea behind this is that you should have more tests with a higher granularity that are fast to run, and fewer tests with more coarse abstraction level that are typically slower to run.</p><p>Testing on different abstraction levels shouldn’t mean having testing duplication, for example, testing the same thing in API tests and unit tests. In his blog post <a href="https://martinfowler.com/articles/practical-test-pyramid.html"><em>The Practical Test Pyramid</em></a>, <strong>Ham Vocke</strong> recommends deleting higher-level tests cases that are already covered by lower-level tests. He argues that higher-level tests should focus on testing the functionality that isn’t possible to test by lower-level tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/0*AjMLPtmTVOIfPCZC.jpg" /><figcaption>The test pyramid as illustrated by <a href="https://martinfowler.com/bliki/TestPyramid.html"><strong>Martin Fowler.</strong></a></figcaption></figure><h3>Optimizing for easy rewrites</h3><p>In the end, we had to pick our poison. After carefully considering the pros and cons of API and unit testing, we decided to optimize our testing approach for painless rewrites. In our case, this meant being able to rewrite the part of the code while not having to rewrite the tests at the same time.</p><p>The winning argument for sticking to API tests was that as our service is still relatively young, significant architectural changes are expected. In rewrites and refactorings, it’s essential to guarantee that the functionality doesn’t change. API tests are a good fit here since they ensure that the API contract is held and will only need changing when the API contract itself changes. Unit tests, on the other hand, are likely to become useless in rewrites, when the code they were testing no longer exists.</p><p>We have some early examples that seem to prove our hypothesis. <a href="https://medium.com/smartly-io/scaling-our-analytical-processing-service-sharding-a-postgresql-database-with-citus-46685e6aef17">Our neighboring team, Bobby Tables</a>, who owns the reporting functionality of our app, has already done several rewrites to the pipeline that is used to query reporting data. They are happy about not having had too many unit tests since it would have been more cumbersome to keep the tests on par with the new code while safeguarding that the new code works as it should.</p><h3>Dealing with the issues API tests spawn</h3><p>All solutions have their flaws, and so do API tests. Now that we’ve adopted our approach, we’re trying to mitigate the problems generated by the disadvantages of our chosen method: slowness, flakiness, and duplicate manual work.</p><h4>Speeding up API tests</h4><p>API tests require setting up the microservice and all its dependencies, such as databases and worker processes. A simple way to work around the performance issue is to run the tests in parallel. Team Bobby Tables did this and managed to bring the API test execution time down from around ten minutes to one minute.</p><p>However, as with any performance issues, you should first find the root cause-what is it that slows the code down-and try to fix the bottleneck before reconsidering the whole testing approach and going all-in with unit tests.</p><p>One possible issue can be that the setup for each test is too heavy. Dealing with global application state, for example in the database, is difficult, and we could have chosen to clean up the database between each test run to be able to always start with a clean slate. Still, this will make the test setup slower and also will make it impossible to run tests in parallel that are using the same database. In our microservice, we don’t clean up the database between tests. Instead, we try to be careful with global state shared between tests since we don’t want our API tests to be <a href="https://martinfowler.com/articles/nonDeterminism.html">flaky</a>.</p><h4>Making API tests less flaky</h4><p>Because they have a broader scope, API tests are more likely to share global state and so are more likely to become flaky. Flakiness can result from, for example, tests sharing the same database and accidentally using the same data.</p><p>To avoid flakiness, we aim to only use randomly generated data-instead of hardcoded data-in any of the test data’s identifiers. For example, we might get flaky test results with the following test data, if multiple tests were using the same hardcoded videoId but with different uploadStatus, and if that data was written into the database.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22afb6194d982756ef041e10f781450e/href">https://medium.com/media/22afb6194d982756ef041e10f781450e/href</a></iframe><p>To mitigate this risk, we would only use randomly generated videoId’s:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab3593f628c221ab96322e25dbc38d11/href">https://medium.com/media/ab3593f628c221ab96322e25dbc38d11/href</a></iframe><p>All the tests need to be written with the thought in mind that there may be <em>any </em>data in the database, which means tests asserting things like the number of videos stored in a database won’t work. You should only assert data that was inserted by your test.</p><h4>Reduce duplicate work</h4><p>One main issue we face with our monolith’s API tests is that adding or removing properties to centrally used data models, such as accounts or ad campaigns, may lead to having to add that same property to 200 tests’ test data. Luckily, we can easily avoid this issue if we use factories to generate all the test data from the start. Then we only need to make changes to data structures in one place: the factory class for the data model that is in the making.</p><h3>When should we write unit tests?</h3><p>We try to avoid getting too married with either API or unit tests, and instead, keep our options open for when our reality changes. If at some point we find ourselves spending too much energy on mocking or writing setup code, it may make sense to start writing tests on a different abstraction level.</p><p>For example, team Bobby Tables has begun writing unit tests to test particular corner cases more thoroughly. Testing these corner cases in API tests while covering all the combinations through modifying the API parameters would have resulted in lots of repetitive test code, whereas in a unit test the combinations they want to test are simply different arguments to a function. The unit tested parts are mostly stateless data transformation functions, which also makes them easy to unit test. The tradeoff is that when we rewrite the unit tested part, we need to rewrite the tests as well.</p><p>We also expect that black box testing a system with more responsibilities will be more complicated than testing a more narrowly scoped microservice. In our case, our team’s Facebook ads microservice has a smaller scope than the monolith we extracted it from, which leads to the API test setup required by the monolith being a lot longer than that of the microservice, even when testing the same cases. In a way, the API tests of the microservice could be seen as component tests of single modules of a monolith.</p><p>So if the test setup starts becoming too complex due to the system having too many responsibilities, it may be our cue to start testing on a lower level. For loosely coupled functionality with clean interfaces, like in the case of a <a href="https://www.youtube.com/watch?v=kbKxmEeuvc4">modular monolith</a>, we can write tests for those components in isolation. If we later extract the module as a new microservice, those component tests can serve as useful documentation on the requirements of the new microservice.</p><h3>Testing interoperability between services</h3><p>A microservice architecture adds its own problems to the mix. Testing that everything works together in a microservices architecture is more difficult because the test setup needs to have multiple services running simultaneously. We aren’t running these kinds of large scale tests that include running several microservices that would ensure the interoperability between the monolith and our Facebook ads microservice. Our microservices are mocked out in the monoliths tests.</p><p>To tackle this problem, we have found it invaluable to enforce rigorous <a href="https://swagger.io/docs/specification/about/">OpenAPI</a> specifications that define the schema of the data passed to and returned by our microservice’s endpoints. A request will fail if the data <a href="https://github.com/smartlyio/oats">doesn’t match the expected form</a>, which allows us to rely on the input data. The verification is done on both the monolith and the microservice.</p><p>Apart from running verifications in production, we also run them in the automated tests. So even if the microservice is mocked in the monoliths API tests, the tests guarantee that the data passed to the mock and the canned response returned by it are in the correct form. Therefore forgetting to update either the data passed to the mock or the canned response returned by it gets caught by the tests as the microservices OpenAPI specification is updated. We also rely heavily on our monitoring system, and alerts for relevant metrics, which has enabled us to react quickly is something goes wrong.</p><h3>Learning: system maturity counts</h3><p>My biggest learning from the debates we had as a team was that the optimal way to test systems depends on the maturity of the system. In the case of our rather new microservice, it makes sense to rely on more coarse-grained tests to make the system more adaptable to change. As the system matures and becomes more complex, it starts to make sense to invest in unit tests and eventually have fine and coarse-grained tests, possibly in the proportions suggested by the test pyramid.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/testing-a-greenfield-microservice"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e8cbd5d459" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/testing-a-greenfield-microservice-9e8cbd5d459">Testing a greenfield microservice</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>