<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jonathan Fielding</title>
    <description>The latest articles on Forem by Jonathan Fielding (@jonthanfielding).</description>
    <link>https://forem.com/jonthanfielding</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F82979%2Fdc62523e-7ece-46e9-87a2-357831c310ad.jpg</url>
      <title>Forem: Jonathan Fielding</title>
      <link>https://forem.com/jonthanfielding</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jonthanfielding"/>
    <language>en</language>
    <item>
      <title>Typesafe application configuration in TypeScript</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Sat, 24 Jan 2026 08:05:07 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/typesafe-application-configuration-in-typescript-ngh</link>
      <guid>https://forem.com/jonthanfielding/typesafe-application-configuration-in-typescript-ngh</guid>
      <description>&lt;p&gt;If you've ever had a deployment succeed but then the service acts &lt;em&gt;weird&lt;/em&gt;, there's a decent chance config was the culprit.&lt;/p&gt;

&lt;p&gt;Config bugs are painful because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;they often pass code review ("it's just config")&lt;/li&gt;
&lt;li&gt;deployments can look healthy until the broken path is hit&lt;/li&gt;
&lt;li&gt;secrets make debugging harder (you can't safely log everything)&lt;/li&gt;
&lt;li&gt;and TypeScript can give a &lt;em&gt;false sense of safety&lt;/em&gt; because config is often a quiet loophole where &lt;code&gt;any&lt;/code&gt; creeps back in&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;why typesafe config matters (and what goes wrong without it)&lt;/li&gt;
&lt;li&gt;why validating config at startup is a big deal&lt;/li&gt;
&lt;li&gt;how &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/zodified-config" rel="noopener noreferrer"&gt;zodified-config&lt;/a&gt;&lt;/strong&gt; solves both using &lt;strong&gt;Zod&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;copy/paste examples you can drop into your app&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why typesafe configuration matters (and what can go wrong without it)
&lt;/h2&gt;

&lt;p&gt;A common pattern in Node.js apps is using a config library like &lt;code&gt;node-config&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;port&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The issue is that &lt;code&gt;config.get()&lt;/code&gt; is often effectively untyped inside your app. In many setups it returns &lt;code&gt;any&lt;/code&gt; (or &lt;code&gt;unknown&lt;/code&gt;), which means TypeScript can't catch mistakes.&lt;/p&gt;

&lt;p&gt;For example, you &lt;em&gt;expect&lt;/em&gt; &lt;code&gt;port&lt;/code&gt; to be a number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;port&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This compile but if your config value is &lt;code&gt;"3000"&lt;/code&gt; (a string), you may run into runtime problems when you do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even worse are subtle bugs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;enableMetrics&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;metrics.enabled&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;enableMetrics&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;startMetricsServer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;metrics.enabled&lt;/code&gt; is the string &lt;code&gt;"false"&lt;/code&gt;, it's &lt;strong&gt;truthy&lt;/strong&gt;, and suddenly metrics are enabled in production when they shouldn't be.&lt;/p&gt;

&lt;p&gt;That's how config issues turn into scattered, confusing “ghost bugs”.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why validating configuration at startup is a big deal
&lt;/h2&gt;

&lt;p&gt;Types help you &lt;em&gt;use&lt;/em&gt; config safely. Validation helps you ensure the config is actually &lt;strong&gt;valid&lt;/strong&gt; before the app starts serving traffic.&lt;/p&gt;

&lt;p&gt;Without startup validation you often get this pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;app boots “fine”&lt;/li&gt;
&lt;li&gt;first request hits a codepath that needs config&lt;/li&gt;
&lt;li&gt;runtime explosion&lt;/li&gt;
&lt;li&gt;sometimes the service crashes entirely&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A rule I like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If the app can't run correctly without a config setting, fail fast before you start serving traffic.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is especially useful in Kubernetes: new pods should only become “ready” if their config is valid.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practical wins of startup validation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prevent broken deployments&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Missing values (DB URLs, API keys, queue names) should crash immediately, not halfway through a request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Faster feedback loops&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Misconfiguration becomes obvious in startup logs (and CI/CD), rather than waiting for a user to trigger it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clear error messages&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Schema validation can tell you exactly what's wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which key is missing&lt;/li&gt;
&lt;li&gt;which key has the wrong type&lt;/li&gt;
&lt;li&gt;which nested value failed validation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Introducing zodified-config
&lt;/h2&gt;

&lt;p&gt;Once you want &lt;strong&gt;typesafe config&lt;/strong&gt; &lt;em&gt;and&lt;/em&gt; &lt;strong&gt;startup validation&lt;/strong&gt;, you end up wanting the same workflow everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;define a schema (runtime contract)&lt;/li&gt;
&lt;li&gt;validate config once, on boot&lt;/li&gt;
&lt;li&gt;access config with types and autocomplete across your app&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's what &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/zodified-config" rel="noopener noreferrer"&gt;zodified-config&lt;/a&gt;&lt;/strong&gt; is for.&lt;/p&gt;

&lt;p&gt;It lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;define your config schema using &lt;strong&gt;Zod&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;keep using the familiar &lt;code&gt;node-config&lt;/code&gt; file structure (&lt;code&gt;config/default.json&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;validate at startup (fail fast)&lt;/li&gt;
&lt;li&gt;get TypeScript types for config access everywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's built as a wrapper around &lt;code&gt;node-config&lt;/code&gt;, so you keep existing behaviour just with Zod-backed validation and type safety.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to use zodified-config (step-by-step)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) Install
&lt;/h3&gt;

&lt;p&gt;If you're using CommonJS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i zodified-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're using ESM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i zodified-config-esm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2) Define your schema
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/schema.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;configSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;configSchema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This schema is the &lt;strong&gt;runtime contract&lt;/strong&gt;, and &lt;code&gt;z.infer&lt;/code&gt; gives you &lt;strong&gt;compile-time types&lt;/strong&gt; from that same source.&lt;/p&gt;




&lt;h3&gt;
  
  
  3) Define your configuration files
&lt;/h3&gt;

&lt;p&gt;Because this wraps &lt;code&gt;node-config&lt;/code&gt;, you use the same structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;config/default.json&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hello world"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  4) Validate at startup (fail fast)
&lt;/h3&gt;

&lt;p&gt;Declare your validated config type using TypeScript module augmentation, then validate on boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/index.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zodified-config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;configSchema&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./schema&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./schema&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;declare&lt;/span&gt; &lt;span class="kr"&gt;module&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zodified-config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ValidatedConfig&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;configSchema&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If config is invalid, validation throws at startup, exactly when you want to find out.&lt;/p&gt;

&lt;p&gt;(You can wrap it in a try/catch if you want to customise the error output.)&lt;/p&gt;




&lt;h3&gt;
  
  
  5) Access values with type safety
&lt;/h3&gt;

&lt;p&gt;Now anywhere in your app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/other.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zodified-config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// value is typed as string&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where it starts to feel &lt;em&gt;really&lt;/em&gt; good:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;autocomplete for config keys&lt;/li&gt;
&lt;li&gt;compile-time safety for config usage&lt;/li&gt;
&lt;li&gt;fewer “stringly-typed” surprises&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  A more realistic example
&lt;/h2&gt;

&lt;p&gt;Here's what this looks like for a typical service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/schema.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;configSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]),&lt;/span&gt;
  &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;url&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;poolSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;positive&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="na"&gt;features&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;infer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;configSchema&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After validating at startup, access becomes boring (in the best way):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zodified-config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;port&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// number&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dbUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;database.url&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// string&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;metricsEnabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;features.metrics&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// boolean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If someone breaks config in an environment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the app fails immediately&lt;/li&gt;
&lt;li&gt;you get a clear validation error&lt;/li&gt;
&lt;li&gt;you don't ship a “looks healthy but is doomed” deployment&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;TypeScript gives you a lot of safety but configuration is often the escape hatch where untyped values creep back in and quietly undermine it.&lt;/p&gt;

&lt;p&gt;Defining a schema for config:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;makes config access typesafe&lt;/li&gt;
&lt;li&gt;improves editor autocomplete and catches key mistakes earlier&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Validating config at startup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prevents broken deployments&lt;/li&gt;
&lt;li&gt;makes issues obvious in logs and CI/CD&lt;/li&gt;
&lt;li&gt;reduces “works on my machine” surprises&lt;/li&gt;
&lt;li&gt;gives you confidence changing config over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools like &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/zodified-config" rel="noopener noreferrer"&gt;zodified-config&lt;/a&gt;&lt;/strong&gt; keep your code and config in sync and it's one of those small changes that makes a big difference to reliability.&lt;/p&gt;

&lt;p&gt;If you try it, I'd love to hear how it goes.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>programming</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>5 Habits of Great Software Engineers</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Sun, 16 May 2021 20:08:02 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/5-habits-of-great-software-engineers-5795</link>
      <guid>https://forem.com/jonthanfielding/5-habits-of-great-software-engineers-5795</guid>
      <description>&lt;p&gt;I first started my journey as a software engineer back in 2008 when I joined ADP, building software for building merchants. This was my first experience working at a tech company, and as someone new to the industry, I couldn’t tell the difference between what were the good habits I should be picking up from my colleagues and what were their bad habits.&lt;/p&gt;

&lt;p&gt;Since that first role, I have worked at 7 different companies across a variety of different industries, which as a result, gave me the opportunity to work with some incredible engineers that I have been able to pick up some good habits from.&lt;/p&gt;

&lt;p&gt;Today I want to share with you some of those habits, focusing on the five habits which I believe all developers could benefit from having.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Admit when you don’t know something
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F7168%2F1%2AGRFgBpodAsYVhi6Oi019vQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F7168%2F1%2AGRFgBpodAsYVhi6Oi019vQ.jpeg" alt="Photo by [Jon Tyson](https://unsplash.com/@jontyson?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/question?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)" width="800" height="500"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@jontyson?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Jon Tyson&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/question?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The first habit it is important to instil in yourself is to admit when you don’t know something and accept that you can never know everything.&lt;/p&gt;

&lt;p&gt;To give you some perspective on this, if we take a look at Wikipedia, we will find it lists over &lt;a href="https://en.wikipedia.org/wiki/List_of_programming_languages" rel="noopener noreferrer"&gt;700 programming languages&lt;/a&gt; alone, and when we consider that each will have its own frameworks and languages, it is clear that no one could be knowledgeable about everything.&lt;/p&gt;

&lt;p&gt;Instead of pretending you know all the answers, you should instead admit when you are unsure and feedback to the team that you will need to take the time to learn and research about the area your exploring. Besides allowing you to get help when you need it, being known for admitting when you don’t know something can instil trust within your team that when you say you know something, you actually do.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Learn from your team’s mistakes instead of assigning blame
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F12000%2F1%2A8xZkF6mq2knNGxbaAHt2sw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F12000%2F1%2A8xZkF6mq2knNGxbaAHt2sw.jpeg" alt="Photo by [Sarah Kilian](https://unsplash.com/@rojekilian?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/mistake?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)" width="800" height="533"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@rojekilian?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Sarah Kilian&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/mistake?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As software engineers, we are often building complex systems and solving complex problems on a daily basis. Inevitably sometimes we will make mistakes; however, the focus shouldn’t be on blaming the individual who made the mistake, but instead on identifying what we can learn as a team from the mistake to prevent it from happening again.&lt;/p&gt;

&lt;p&gt;The way in which I do this in my teams is that for mistakes that result in an incident that affects our users, we will write a post mortem. In this post mortem, we will document what happened, what was the cause, what was the impact and what the actions are to prevent this from happening again.&lt;/p&gt;

&lt;p&gt;In other cases where the mistake doesn’t impact our users, we will normally talk about it as part of our team retrospectives, where we can safely talk about what has gone wrong and the learning we can take from it.&lt;/p&gt;

&lt;p&gt;This approach means we spend our time focusing on team growth rather than assigning blame to whoever made the mistake. As a team, we get to share the learnings and as a whole, the whole team has much better morale.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Put your user’s needs above your own
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10368%2F1%2AhyO-lxRlkV0AW3sx_CMduA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10368%2F1%2AhyO-lxRlkV0AW3sx_CMduA.jpeg" alt="Photo by [Taras Shypka](https://unsplash.com/@bugsster?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/user?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)" width="800" height="533"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@bugsster?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Taras Shypka&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/user?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As software engineers, we often need to make decisions about what technologies we use. The choices we make every day have an impact on both our experience as developers and the experience of our users using our products. This means we should always consider the user cost of the decisions we make.&lt;/p&gt;

&lt;p&gt;Let’s take the example of delivering a new feature for our users. As part of the research into developing the feature, we find a library that will enable us to deliver the feature faster. At first glance, this is a win for both the user who will benefit from the feature being ready sooner and the developer who is building it. To validate this, it is important to consider the cost of using the library, this could result in a couple of scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Perhaps it is a 1KB library that will have a negligible impact on the user’s experience of the application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alternatively, maybe it is a 1MB library that will negatively impact the performance of the application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If it is the first option, then choosing the library might have a net benefit to both the user and the engineer, however, if the latter is true then only the developer sees the benefit of using the library. In this example, I would always prioritise putting the user first to ensure they have a great experience even if it means it will take me a bit longer to deliver the feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Have strong opinions, but hold them weakly
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F8482%2F1%2A5GmJjeYDYxddysV4s1tLYw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F8482%2F1%2A5GmJjeYDYxddysV4s1tLYw.jpeg" alt="Photo by [Steve Johnson](https://unsplash.com/@steve_j?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/opinion?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)" width="800" height="533"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@steve_j?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Steve Johnson&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/opinion?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In your lifetime, you might have come across the phrase, “Strong Opinions, Weakly Held”. The phrase originated from a post written back in 2008 by Paul Saffo regarding how he approaches writing long-term technology forecasts, wherein in the face of uncertainty, it’s important to form an opinion on something even if that opinion is later proven incorrect. The post itself can be found on &lt;a href="https://www.saffo.com/02008/07/26/strong-opinions-weakly-held/" rel="noopener noreferrer"&gt;Paul Saffo’s blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While it originated in technology forecasting, it has quickly been applied as a framework for thinking.&lt;/p&gt;

&lt;p&gt;If we apply this to software engineering, you might propose a solution you believe to be correct for the problem at hand. Further down the road, you might then find your original solution will not work; however, with the additional information you learnt, you then can get to the correct solution to solve your user’s problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Listen first, speak later
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10368%2F1%2AnGERCJtdS95T8AsQDNefLQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10368%2F1%2AnGERCJtdS95T8AsQDNefLQ.jpeg" alt="Photo by [Brett Jordan](https://unsplash.com/@brett_jordan?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/listen?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)" width="800" height="600"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@brett_jordan?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Brett Jordan&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/listen?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is a common misconception that software engineers are shut-ins that don’t like to communicate with others. The reality of being a successful software engineering is quite the opposite; we work in multi-functional teams bringing together people from different disciplines, and we work together to build great products for our users.&lt;/p&gt;

&lt;p&gt;When working in this way, communication between everyone in the team is incredibly important so that everyone has a good understanding of what the team is trying to achieve. This communication must be 2 way, with an emphasis on listening first to all the opinions in the team and then giving your input.&lt;/p&gt;

&lt;p&gt;This becomes even more important as you grow into a more senior engineer, where your words will carry more weight, making it difficult to not sway the conversation. Listen to your colleagues, they will have great ideas that as a team you can build on to build great products.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;It goes without saying that there is much more to being a great software engineer than the five habits I have written about here. Software engineering is a broad complex field and what works at one company might not work at another.&lt;/p&gt;

&lt;p&gt;These habits came from my own experiences and I would love to hear about your own experiences, what habits do you think make a great software engineer?&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>leadership</category>
      <category>codereview</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Starting a tech meet-up during a global pandemic</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Sun, 16 May 2021 20:04:05 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/starting-a-tech-meet-up-during-a-global-pandemic-33nd</link>
      <guid>https://forem.com/jonthanfielding/starting-a-tech-meet-up-during-a-global-pandemic-33nd</guid>
      <description>&lt;p&gt;My 2020 started like most peoples; I was going to work on the weekdays and enjoying my weekends with my family. Sometimes I would attend tech meetups after work. I even managed to host a couple in my workplace, first London Web Performance, and then on the last week before we entered lockdown, we hosted a JS Monthly London International Women’s Day event.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flknjkonj1r0yfb37b620.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flknjkonj1r0yfb37b620.jpeg" width="800" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then came lockdown, and with it came a sudden break in tech events, with conferences and meetups all being cancelled.&lt;/p&gt;

&lt;p&gt;Shortly into this, I got talking to Natalie, an associate engineer I work with at RVU, and we came up with the idea of starting a meetup ourselves, we then found our another colleague Ricardo had similar ideas, so we combined forces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Figuring out what we wanted to create a meetup about
&lt;/h2&gt;

&lt;p&gt;Having had the idea we wanted to create a meetup we decided to put a session in so we could ideate what we wanted our meetup to focus on.&lt;/p&gt;

&lt;p&gt;These discussions focused on two things, the topics that we wanted to cover and the audience we wanted to reach. When it came to topics we wanted to be fairly web-focused, with a focus on product development in particular. When it came to the audience we wanted to appeal to a broad spectrum, from associate engineer right through to lead.&lt;/p&gt;

&lt;p&gt;In our discussions, we decided that as we were all product engineers the meetup should focus loosely on product engineering, with talks around the area of building great products.&lt;/p&gt;

&lt;h2&gt;
  
  
  Naming our meetup
&lt;/h2&gt;

&lt;p&gt;Having decided to start our meetup, the first priority was to give it a name. We created a slack channel called #an-unnamed-meetup and started to throw name ideas back and forth.&lt;/p&gt;

&lt;p&gt;After some thinking, we came up with a wide variety of names, and then we shared them in a poll with the rest of the RVU engineering team, the choices being:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Product Engineering People&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programmed in Pencil&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build Right, Scale Fast&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Core Red&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;London Product Engineering&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Product Engineering Monthly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ventures in Engineering&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Shipping Code&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a total of 13 votes, we settled on the name Programmed in Pencil which we had come up with based on our company belief that “Everything is written in pencil”.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the website
&lt;/h2&gt;

&lt;p&gt;Having named our meetup, the next step was to register the domain name and create a website.&lt;/p&gt;

&lt;p&gt;For the website, I cheekily forked a website I built for a conference called Web Progressions back in 2016. The primary reason for this was the site was open-source, and this would save me time as it already had everything I needed from a template point of view. It also was already set up in a way that Jekyll could compile the Sass when deployed to GitHub pages.&lt;/p&gt;

&lt;p&gt;After spending some time skinning the template to have a unique look and feel to this meetup, I then sent a screenshot across to my colleague Rob Newport who is a designer in my team. He then did an amazing job of tweaking the design to the lovely site design you see today, and then we paired on implementing the changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1j1b7syn26la220vxtta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1j1b7syn26la220vxtta.png" width="800" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We then pushed the page up to GitHub, the cloud team at RVU kindly bought the domain name and then we pointed it at the site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding Speakers
&lt;/h2&gt;

&lt;p&gt;So we had a name, a potential date to run our meetup and a website ready to go, we now needed to find some people who would like to speak at the meetup.&lt;/p&gt;

&lt;p&gt;Early on in discussing the meetup, we agreed that it was essential to ensure that the speaker lineup wasn’t just those from RVU. This wasn’t to be a marketing event for our business but instead to be an event that would help share knowledge and be an opportunity for us to give back to the tech community.&lt;/p&gt;

&lt;p&gt;That said, for our first speaker, we actually were fortunate enough that one of our colleagues had already recently prepared a talk for a conference which unfortunately been postponed due to Coronavirus. He, therefore, was happy to give the talk at our meetup.&lt;/p&gt;

&lt;p&gt;Fortunately having been attending meetups for a good number of years and spoke at them myself I have made many friends in the tech community so for the other two talks I reached out to my friends Jo Franchetti and Katie Fenn, both of which were happy to talk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Promoting the meetup
&lt;/h2&gt;

&lt;p&gt;With everything in place, the next step was to promote the meetup.&lt;/p&gt;

&lt;p&gt;As a self-confessed Twitter addict, this was the primary place I promoted the event. I regularly tweeted about it to my followers to encourage them to attend. I also reached out to other meetups, JS Monthly London and Frontend London and asked them to also tweet out to their followers.&lt;/p&gt;

&lt;p&gt;Besides Twitter, I also promoted the event on various slack groups I am in focused on engineering including FEL slack and Codebar.&lt;/p&gt;

&lt;h2&gt;
  
  
  The night of the event
&lt;/h2&gt;

&lt;p&gt;When it came to the night, we were all ready; we had agreed among, Natalie, Ricardo and I, who would introduce each speaker.&lt;/p&gt;

&lt;p&gt;At the beginning of the event, I introduced the event along with myself and my co-hosts Ricardo and Natalie. Then for each speaker, a different host would introduce them. The talks were all really good, and I was really proud to have been part of organising this great event.&lt;/p&gt;

&lt;p&gt;After the event, we regrouped and discussed what went well, and we summarised it into the following:&lt;/p&gt;

&lt;p&gt;What went well&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Amazing talks with live demos that worked well&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We had about 40 people attend&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Zoom webinars worked well for both registrations and people joining the meetup&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What didn’t go so well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;One of the speakers had connection problems which lead to us having to do some quick shuffling of the order of the talks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We were awful at keeping on time, with this being remote some people dialled in for specific talks however by being&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While there is little we can do regarding connection issues of speakers or attendees, we did think about how we could resolve the second issue. What we came up with was tweaking the format to better take into account keeping on time. We inserted “Interviews” in between each of the talks, which would be an opportunity for us and the audience to ask questions.&lt;/p&gt;

&lt;p&gt;This served a dual purpose where it provided buffer time in between each talk, if a talk ran short we could ask more questions, and if it ran longer, we would simply have less time for questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  In Summary
&lt;/h2&gt;

&lt;p&gt;Running Programmed in Pencil with my work colleagues has been a great experience and allowed me to finally live my dream of running my own tech event.&lt;/p&gt;

&lt;p&gt;Would I recommend others give it a try, definitely, I think diversity of thought is incredibly important so I would love to see more remote tech meet-ups to pop up all with their own focus to give people lots of different places to learn about things in different ways.&lt;/p&gt;

&lt;p&gt;A few people have asked why I haven’t yet spoken at Programmed in Pencil myself, to be honest, I wanted to provide a stage for others to share their knowledge, I always felt that if I were to talk it would be if we were short of a speaker one month, but I wouldn’t be aiming to speak at the event.&lt;/p&gt;

&lt;p&gt;Our next meetup is on the evening of Wednesday 26th May, and we welcome those from all over the world to join us. Register at &lt;a href="http://www.programmedinpencil.com." rel="noopener noreferrer"&gt;www.programmedinpencil.com.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>meetup</category>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Getting past my insecurities by talking at tech events</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Fri, 05 Mar 2021 13:08:40 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/getting-past-my-insecurities-by-talking-at-tech-events-25kh</link>
      <guid>https://forem.com/jonthanfielding/getting-past-my-insecurities-by-talking-at-tech-events-25kh</guid>
      <description>&lt;p&gt;As a person, I am very insecure. I struggle to introduce myself to people I haven’t spoken to before and this something that has often left me feeling isolated when attending &lt;strong&gt;tech events&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;When at a tech event if I don't already know someone at the event I can struggle to start a conversation with people at the event. This results in the majority of people I have spoken to at events are those who I have either seen speak (so I can ask a question to start a conversation), those that introduce themselves or I have been introduced too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfwij2m6ol60hwvo9ixa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfwij2m6ol60hwvo9ixa.png" alt="Speaking at Halfstack London 2019" width="800" height="395"&gt;&lt;/a&gt;&lt;em&gt;Speaking at Halfstack London 2019&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I think part of this stems back to being bullied in high school, so much so that I changed schools at the beginning of year 9. This was a terrible experience and it was during this time I changed from being someone who would express his emotions to someone who kept them to myself. since then I have had to relearn how to not keep these feelings bottled up inside and to express myself better. This hasn’t really helped with my inner confidence at all, while outwardly I may come across as a confident person, I still have these deep down insecurities which leave me often feeling worried unnecessarily about things.&lt;/p&gt;

&lt;p&gt;Where there is one place I am confident however is in my coding, since I was 9 years old learning BASIC on an Acorn I have loved to code and I have been confident in speaking to others about it. &lt;/p&gt;

&lt;p&gt;After changing school at the beginning of Year 9 I found a book in my new school's library about HTML and I then launched my first website, which as I was 13 was aptly named Jonathan’s World. Ever since I have loved the web, I even attempted running a web hosting company when I was 15, then by the time I was 17 I realised there was no money in it unless you can do it on a huge scale so I got out of the hosting game.&lt;/p&gt;

&lt;p&gt;With this confidence in talking about technology, I have tried to get past the awkwardness of attending an event by starting to talk at them. The theory being that if I was speaking people would approach me rather than me having to approach them. &lt;/p&gt;

&lt;p&gt;Since I started speaking at events I have given over 20 different talks at conferences and meetups across London. I reuse those talks as well so the number of talks I have actually given is probably close to 50 by now. What I found is that this gave me the opportunity to share with others what I know and to also build my own confidence. &lt;/p&gt;

&lt;p&gt;This also validated my hypothesis, and usually, after I have given a talk people will start a conversation with me instead of the other way round. With this, I have been able to start real conversations and make new friends which in turn has meant I have been introduced to many new amazing people I wouldn’t have otherwise met.&lt;/p&gt;

&lt;p&gt;As a developer there are many different places we can talk about what we do, there are online forums, sites like Reddit, Twitter and even through GitHub but nothing quite compares to the interactions you get and the knowledge that is shared at a meetup or a conference. The bringing together of like minds is amazing, and it gives you an amazing opportunity to share problems you might have faced, learn from one another and talk about the cool web things you are passionate about. I love to attend meetups like &lt;a href="http://londonwebstandards.org" rel="noopener noreferrer"&gt;London Web Standard&lt;/a&gt;s, &lt;a href="https://meetup.com/londonweb/" rel="noopener noreferrer"&gt;London Web&lt;/a&gt; and &lt;a href="http://www.frontendlondon.co.uk/" rel="noopener noreferrer"&gt;Front-end London&lt;/a&gt; and if you find yourself at one of these events and you see me there, I would love it if you introduced yourself, and I myself will be looking to try being more confident in my ability to introduce myself as well. &lt;/p&gt;

&lt;p&gt;If your running an event like a meetup or a conference and you want someone to come and talk, I am always looking for places to talk so just get in touch, I am very easy to get hold of either through this site or on &lt;a href="https://www.twitter.com/jonthanfielding" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From talking to other people in the development community, I know there are others who went through bullying and/or are in the situation of feeling awkward and out of place when going to development events and as a community, we have a duty to try and ensure everyone is included. So next time you see someone at a meetup or conference who you think might be feeling to insecure to introduce themselves, maybe you should introduce yourself to them, start a conversation because by being at the same event you clearly already have one thing in common, that you share an interest in whatever the talk is about. I think it's up to the development community to make sure everyone feels welcome and valued because without the people that make up the community, there is no community.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>speaking</category>
      <category>mentalhealth</category>
      <category>career</category>
    </item>
    <item>
      <title>Working with variables and conditionals in Go Lang</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Fri, 05 Mar 2021 12:48:44 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/working-with-variables-and-conditionals-in-go-lang-461i</link>
      <guid>https://forem.com/jonthanfielding/working-with-variables-and-conditionals-in-go-lang-461i</guid>
      <description>&lt;p&gt;I recently started to learn Go Lang, and as part of this I have been learning about variables and how they differ to variables in other languages I have worked with such as JavaScript and PHP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting to grips with variables
&lt;/h2&gt;

&lt;p&gt;In Go, &lt;strong&gt;variables&lt;/strong&gt; are explicitly declared and when you compile your application, Go will infer the type of the initialized variables and use this to check the type-correctness of your code.&lt;/p&gt;

&lt;p&gt;To define a &lt;strong&gt;variable&lt;/strong&gt; in Go Lang we use var followed by the name of the variable, equals, and the value we want to assign to the variable. We can update our ‘Hello World’ application from earlier to use variables for each of the words.&lt;/p&gt;

&lt;p&gt;The first step is to create a new file, in this case, I used using-variables.go. We can then take the original code from our hello world application and create 2 variables, one for each of the words. We then update our fmt.Println to instead join the strings, adding a space in between.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"fmt"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"hello"&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"world"&lt;/span&gt;

    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can then run this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go run 02-using-variables.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will result in the words hello world being logged to the console. While this is a fairly contrived example, is shows us how we can easily update code which previously hard coded to now be customisable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing conditional logic to our application
&lt;/h2&gt;

&lt;p&gt;The next thing we are going to learn about is how we can introduce conditional logic to our &lt;code&gt;hello world&lt;/code&gt; application. In this case I want to allow the user to have the option to provide a name and instead of saying hello to the world we will say hello to that individual person instead 😀.&lt;/p&gt;

&lt;p&gt;The first step is to create our new file for the new version of the application. I have called my file conditional-logic.go and as a starting point I copied and pasted the code from our previous application.&lt;/p&gt;

&lt;p&gt;We now need to allow our application to get user input. To do this we need to import the os package which will make the arguments available to us as an Array. To access this Array we use &lt;code&gt;os.Args&lt;/code&gt;, the first item of which will be the path to our application and the rest of the values will be the arguments we passed to it.&lt;/p&gt;

&lt;p&gt;We only want to set the name when an argument has been passed, to do this we can use an if statement. In this if statement we want to check that the length of the arguments, excluding the application path is equal to one, we do this with the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we incorporate this into our completed code it will look as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s"&gt;"fmt"&lt;/span&gt;
  &lt;span class="s"&gt;"os"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"hello"&lt;/span&gt;
  &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"world"&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run our application we can simply run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go run conditional-logic.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will still output hello world however if we now pass a name as an additional argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go run conditional-logic.go jonathan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output will now be hello jonathan, this is exactly what we wanted to achieve 🤗.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Thank you for taking the time to read about using variables in Go Lang, it was good to start playing with variables and conditionals and I can definitely see similarities to how I would write the same thing in JavaScript.&lt;/p&gt;

</description>
      <category>go</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Writing your first `Hello World` in GoLang</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Wed, 03 Mar 2021 22:51:23 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/writing-your-first-hello-world-in-golang-3oa8</link>
      <guid>https://forem.com/jonthanfielding/writing-your-first-hello-world-in-golang-3oa8</guid>
      <description>&lt;p&gt;Recently I was given the feedback that I needed to broaden my skillset when it comes to the technologies I use to enable me to progress further in my career as an Engineer.&lt;/p&gt;

&lt;p&gt;As a more ‘frontend focused’ full-stack engineer, the backend languages I have had experience with so far are those more commonly picked up by frontend engineers, that being PHP early on in my career and then later moving to Node.js.&lt;/p&gt;

&lt;p&gt;I decided to pick Go Lang as a technology RVU already uses as the programming language to learn. The benefit is that I would immediately have use for it in the workplace, giving me a chance to apply what I have been learning.&lt;/p&gt;

&lt;p&gt;With all this in mind, I will try to document my learning here to help others who are trying to learn Go Lang as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Go Lang
&lt;/h2&gt;

&lt;p&gt;Before we can get started with Go Lang, we first need to set up our development environment. As a Mac user, I will document how to do this on Mac using the command line (Terminal) however, Windows instructions can be found at &lt;a href="https://golangdocs.com/install-go-windows" rel="noopener noreferrer"&gt;https://golangdocs.com/install-go-windows&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Homebrew
&lt;/h3&gt;

&lt;p&gt;The first step is to install homebrew if you do not already have it installed. Homebrew is a package manager for macOS that allows you to install different command-line tools and programming languages onto your computer.&lt;/p&gt;

&lt;p&gt;Installing homebrew is fairly straight forward; we simply run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/bin/bash &lt;span class="nt"&gt;-c&lt;/span&gt; “&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will then be asked for our password, and the install script will then do all the hard work for us. If you get stuck, the documentation can be found at &lt;a href="https://brew.sh" rel="noopener noreferrer"&gt;https://brew.sh&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure your system paths
&lt;/h2&gt;

&lt;p&gt;Having installed homebrew we now need to configure some system paths.&lt;/p&gt;

&lt;p&gt;The system paths will need to be added to your systems shell configs. The file you will need to edit will differ based on the Shell your command-line interface is using. To find out what Shell we are using, we can run echo $SHELL in our CLI; this will tell us the path to the Shell we are currently using.&lt;/p&gt;

&lt;p&gt;If the output is /bin/zsh or similar, you are using zsh and will need to edit the .zshrc file located in your users’ home directory.&lt;/p&gt;

&lt;p&gt;If the output is /bin/bash or similar, you are using bash and will need to edit the .bashrc file located in your users’ home directory.&lt;/p&gt;

&lt;p&gt;You will need to copy and paste the following paths to your Shell config file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Go development
export GOPATH=”${HOME}/.go”
export GOROOT=”$(brew — prefix golang)/libexec”
export PATH=”$PATH:${GOPATH}/bin:${GOROOT}/bin”
test -d “${GOPATH}” || mkdir “${GOPATH}”
test -d “${GOPATH}/src/github.com” || mkdir -p “${GOPATH}/src/github.com”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Go Lang using homebrew
&lt;/h3&gt;

&lt;p&gt;Finally, we can install Go Lang, to do this we simply run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will automatically install Go for us on your computer, once this is done we are ready to setup our text editor and then write our first app 😀&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring Visual Studio Code
&lt;/h2&gt;

&lt;p&gt;As a heavy user of Microsoft’s Visual Studio Code (aka VS Code), the next step before writing any code is to install some plugins to add Go Lang support. If you are not a VS Code user, please feel free to skip this step.&lt;/p&gt;

&lt;p&gt;As this is my first day using Go Lang I don’t have any life-changing suggestions for extensions right now however the official plugin for VS Code by the Go Team at Google seems pretty good. It can be found at &lt;a href="https://marketplace.visualstudio.com/items?itemName=golang.Go" rel="noopener noreferrer"&gt;https://marketplace.visualstudio.com/items?itemName=golang.Go&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing your first &lt;code&gt;hello world&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Having set up my environment I can finally write my first code in Go Lang, as is customary in the tech space this will be a hello world application that simply logs ‘hello world’ to the console.&lt;/p&gt;

&lt;p&gt;To start with we need to create a file for our hello world application, we will call it hello-world.go. We will open this in our text editor and then write out code, for our ‘hello world’ application, the code looks like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"fmt"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see we imported the Go Lang library &lt;code&gt;fmt&lt;/code&gt; and then used that to simply log to the console using &lt;code&gt;fmt.Println("hello world")&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can run our code by running the following in our CLI from the folder that we are using.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go run hello-world.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What’s next?
&lt;/h2&gt;

&lt;p&gt;Today I managed to get my environment setup and write my first application😁. It was super fun getting this all setup and hopefully, this can be helpful to others trying to learn Go Lang for the first time.&lt;/p&gt;

</description>
      <category>go</category>
      <category>codenewbie</category>
      <category>100daysofcode</category>
      <category>webdev</category>
    </item>
    <item>
      <title>5 Less Known JavaScript Features That You Should Know About</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Wed, 03 Mar 2021 20:14:51 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/5-less-known-javascript-features-that-you-should-know-about-2e4p</link>
      <guid>https://forem.com/jonthanfielding/5-less-known-javascript-features-that-you-should-know-about-2e4p</guid>
      <description>&lt;p&gt;JavaScript is an ever-evolving programming language, with yearly EcmaScript versions debuting new features every year. That makes it difficult to keep up with all the changes that are being made to the language so I thought I would write a short post of 5 features that you could use to improve your own code.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. JavaScript string padding
&lt;/h2&gt;

&lt;p&gt;The first JavaScript feature I wanted to talk about is the result of an incident that happened back in 2016 in the JavaScript ecosystem.&lt;/p&gt;

&lt;p&gt;The incident involved a JavaScript package called left-pad which was published to NPM. The purpose of the package was to pad a string with extra characters, and while simple in nature the package was a dependency of thousands of JavaScript projects worldwide.&lt;/p&gt;

&lt;p&gt;The incident happened when it was removed from NPM and as it was depended on by many packages it caused a domino effect breaking software builds all over the world.&lt;/p&gt;

&lt;p&gt;While NPM fixed the issue, it became evident to the folk at TC39 that a lot of people were preferring to use a library to pad strings than write the code themselves thus as part of ES2017 they introduced .padStart() and .padEnd().&lt;/p&gt;

&lt;p&gt;To add 0’s to the beginning of a string we would use .padStart(), passing the target length for the string and the string to pad the current string with. In the below example I am padding the string "1" so that it has a length of "4".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// output is 0001&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, we might want to pad the end of our string and for this, we can use &lt;code&gt;.padEnd()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Similar to the example above, we pass both the target length for the string and the string to pad the current string with to &lt;code&gt;.padEnd()&lt;/code&gt;. In the below example I am padding the string “1” so that it has a length of “4”. This time however it will add the padding to the end.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// result is 1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Spread operator
&lt;/h2&gt;

&lt;p&gt;The Spread operator isn’t the newest and shiniest of JavaScript features, arriving back in 2015 as part of the ES2015 specification however some of its use cases are often overlooked.&lt;/p&gt;

&lt;p&gt;The first use case of the spread operator is to add the items from one array to another array. In the example below I have an array with 3 fruit however I want a second array which has the fourth fruit so I use the spread operator to copy the original fruit, and add the fourth fruit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Orange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pear&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;arr1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Banana&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// ["Apple", "Orange", "Pear", "Banana"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can do a similar thing with objects, however with the added benefit that we can override values in the original object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;personA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jonathan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;personB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;personA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Charlie&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;personB&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// {name: "Charlie", age: 21}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Rest parameter
&lt;/h2&gt;

&lt;p&gt;Following on from the Spread operator, we have the Rest parameter, which is kind of like its opposite. The rest syntax collects multiple elements and “condenses” them into a single element.&lt;/p&gt;

&lt;p&gt;A good use case for the rest parameter is to group the remaining elements of an array when it is being destructured. In the below example we have some fruits which we destructure so the apple is on its own, with the remaining fruit are left in a fruits array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;apple&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;pear&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;apple&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// output is "apple"&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// output is ["orange", "pear"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Array.prototype.includes
&lt;/h2&gt;

&lt;p&gt;The next feature I want to talk about is Array.prototype.includes, this feature allows you to find if an array contains an item.&lt;/p&gt;

&lt;p&gt;Prior to Array.prototype.includes, this would have been achieved by looping through the array and setting a variable to true if the item is found, see below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Dragonfruit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Kiwi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pear&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Starfruit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Kiwi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;found&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs `true`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, with Array.prototype.includes, we can reduce this significantly to the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Dragonfruit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Kiwi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pear&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Starfruit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Kiwi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;found&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs `true`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note: as developers, we don’t need to worry about how this search is now implemented so the browsers have the opportunity to optimise this behaviour themselves.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Optional Chaining
&lt;/h2&gt;

&lt;p&gt;The fifth and final feature I want to talk about is Optional Chaining.&lt;/p&gt;

&lt;p&gt;Optional Chaining allows us to attempt to retrieve data nested deeply within an object without having to handle the situation where the data might not exist.&lt;/p&gt;

&lt;p&gt;Lets take a look at the below example, in this we are defining Jonathan with some meta data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;jonathan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jonathan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jonathan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gender&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jonathan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;gender&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Will throw error&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gender&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we run this code it results in an error as the other section of the object does not exist.&lt;/p&gt;

&lt;p&gt;With optional chaining we can prevent this error by saying, don’t go further in the objects tree if a property does not exist. I updated the code below with optional chaining.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;jonathan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jonathan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jonathan&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gender&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Jonathan&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;other&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;gender&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// outputs 21&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gender&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// outputs "undefined"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we run this now, there will no longer be an error and the gender will simply be undefined which we can handle separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;JavaScript is rapidly advancing faster than it has ever before, with yearly updates the language keeping it fresh it's very easy to forget about all the cool things we can do with features that are even just a couple of years old.&lt;/p&gt;

&lt;p&gt;In my own experience, writing this post actually led to me learning more about each of the features I talked about. Helping me to reinforce my own knowledge along the way.&lt;br&gt;
Thank you for taking the time to read, if you want to read similar posts please follow me on Medium.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codequality</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
    <item>
      <title>5 Tech Talks That Changed How I Approached Software Engineering</title>
      <dc:creator>Jonathan Fielding</dc:creator>
      <pubDate>Tue, 02 Mar 2021 22:24:53 +0000</pubDate>
      <link>https://forem.com/jonthanfielding/5-tech-talks-that-changed-how-i-approached-software-engineering-2gl1</link>
      <guid>https://forem.com/jonthanfielding/5-tech-talks-that-changed-how-i-approached-software-engineering-2gl1</guid>
      <description>&lt;p&gt;The first conference I attended as a web developer was the first jQuery UK conference back in 2012. After this, I was hooked and would regularly find myself attending conferences to help me to learn and grow.&lt;/p&gt;

&lt;p&gt;I really love to hear from all the amazing speakers that conferences I have attended offer and learn about how they solve software engineering problems. This in turn has had an impact on my own approach to software engineering.&lt;/p&gt;

&lt;p&gt;With it being a year since I was last able to attend an event in person I thought I would write a post about my favourite talks I have seen over the years, all of which I feel remain very relevant to this day.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. "Getting more from Git" by Alice Bartlett
&lt;/h2&gt;

&lt;p&gt;First up, I want to mention an awesome talk by Alice Bartlett on how to use Git more effectively. &lt;/p&gt;

&lt;p&gt;Git is a tool we use every day as developers and the way in which we use it can have a huge impact on how our teams interact with our code. If we use it well it can streamline the way in which teams work, if we use it badly the history doesn't tell us anything and we are effectively using it as a shared file system.&lt;/p&gt;

&lt;p&gt;In this talk, Alice Bartlett takes us through Git in more detail than we are normally used to and share her learnings of using it over the years.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  4. "From Milliseconds to Millions" by Harry Roberts
&lt;/h2&gt;

&lt;p&gt;Web performance is really important, and in this talk by Harry Roberts, he talks about how milliseconds in load time can impact both your users and your business significantly.&lt;/p&gt;

&lt;p&gt;The thing that I really liked about the way in which Harry presented this talk is that it really helps the audience understand the benefits of investing in web performance.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  3. "Bet you didn’t think your browser could do that" by Monica Dinculescu
&lt;/h2&gt;

&lt;p&gt;In this talk, Monica helps us to reconsider the preconceptions we have of what can be achieved when building a static website.&lt;/p&gt;

&lt;p&gt;As part of this, she demonstrates how browsers and technology have been evolving so there is a lot more you can build without resorting to building a serverside application.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  2. "Building an interactive IoTshirt with MQTT" by Jo Franchetti
&lt;/h2&gt;

&lt;p&gt;I love playing with the Internet of Things and home automation so while this talk didn't impact my day job it did play on my heartstrings of what I code in my spare time.&lt;/p&gt;

&lt;p&gt;While demonstrating how to build her IoT t-shirt she does an awesome job of also demonstrating some cool tech along the way. This is probably what resulted in me going back to playing with JavaScript powering my Lego robots.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  1. "You should use [insert library/framework], it’s the bestestest!" by Paul Lewis
&lt;/h2&gt;

&lt;p&gt;Finally, we have this talk from Paul Lewis that I saw at ffconf all those years ago that busts myths around JavaScript Frameworks. It is by far my favourite talk I have ever seen.&lt;/p&gt;

&lt;p&gt;It's worth noting that while some of the tooling he uses looks a bit different now, it still all remains very relevant. I recommend this talk to any engineer I manage as the talk to watch to make them think more about the tech decisions they make.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;I picked these 5 talks as I found that they are still as relevant today as they were when I saw them. I hope you enjoyed them as much as I did.&lt;/p&gt;

&lt;p&gt;As a final part, I want to thank all the amazing speakers I have seen speak at meetups and conferences over the years. Your teachings have really helped me grow as an engineer and I appreciate all the time you all put into writing the talks you gave.&lt;/p&gt;

&lt;p&gt;If you are interested in reading more of my writing please follow me here on dev.to and on Twitter at &lt;a href="http://twitter.com/jonthanfielding" rel="noopener noreferrer"&gt;http://twitter.com/jonthanfielding&lt;/a&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>codenewbie</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
