<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bradley Winter's Blog | Full Stack Software Engineer based in London]]></title><description><![CDATA[I'm a Full Stack Software Engineer based in London building scalable, reliable, and secure digital solutions.]]></description><link>https://blog.bradleywinter.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Apr 2026 19:48:25 GMT</lastBuildDate><atom:link href="https://blog.bradleywinter.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Implement Your Own Array List in Java]]></title><description><![CDATA[Introduction
Have you ever wondered how Java’s ArrayList works under the hood? While the standard ArrayList is efficient and easy to use, building your own version from scratch can significantly enhance your understanding of data structures, memory m...]]></description><link>https://blog.bradleywinter.dev/how-to-implement-your-own-array-list-in-java</link><guid isPermaLink="true">https://blog.bradleywinter.dev/how-to-implement-your-own-array-list-in-java</guid><category><![CDATA[Java]]></category><category><![CDATA[data structure and algorithms ]]></category><category><![CDATA[#codenewbies]]></category><dc:creator><![CDATA[Bradley Winter]]></dc:creator><pubDate>Thu, 16 Jan 2025 19:06:37 GMT</pubDate><content:encoded><![CDATA[<h4 id="heading-introduction"><strong>Introduction</strong></h4>
<p>Have you ever wondered how Java’s <code>ArrayList</code> works under the hood? While the standard <code>ArrayList</code> is efficient and easy to use, building your own version from scratch can significantly enhance your understanding of data structures, memory management, and Java programming in general.</p>
<p>In this blog post, we’ll walk step by step through implementing a custom <code>ArrayList</code> in Java, covering its core features such as dynamic resizing, adding, removing, and accessing elements. By the end, you’ll have a solid grasp of how <code>ArrayList</code> operates and the confidence to experiment with other custom data structures.</p>
<h4 id="heading-prerequisites"><strong>Prerequisites</strong></h4>
<p>Before diving in, make sure you’re familiar with:</p>
<ul>
<li><p>Basic Java programming concepts.</p>
</li>
<li><p>Arrays and object-oriented programming principles.</p>
</li>
</ul>
<p>If you're comfortable with these topics, you’re ready to proceed!</p>
<h4 id="heading-what-is-an-arraylist"><strong>What Is an ArrayList?</strong></h4>
<p>An <code>ArrayList</code> is a dynamic array. Unlike a traditional array with a fixed size, an <code>ArrayList</code> can grow or shrink as needed. This flexibility makes it an essential tool in many applications. Key features of an <code>ArrayList</code> include:</p>
<ul>
<li><p><strong>Dynamic resizing</strong>: Automatically increases capacity when needed.</p>
</li>
<li><p><strong>Element manipulation</strong>: Easy addition, removal, and access of elements.</p>
</li>
<li><p><strong>Random access</strong>: Elements can be accessed using an index.</p>
</li>
</ul>
<p>We’ll implement these features in our custom <code>ArrayList</code>.</p>
<h4 id="heading-step-1-define-the-structure"><strong>Step 1: Define the Structure</strong></h4>
<p>To get started, we’ll create a generic class called <code>MyArrayList</code>. It will include:</p>
<ol>
<li><p>An internal array to store elements.</p>
</li>
<li><p>A <code>size</code> variable to keep track of the number of elements.</p>
</li>
<li><p>A default capacity for the initial size of the array.</p>
</li>
</ol>
<p>Here’s the code:</p>
<pre><code class="lang-java"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyArrayList</span>&lt;<span class="hljs-title">E</span>&gt; </span>{
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> DEFAULT_CAPACITY = <span class="hljs-number">10</span>;
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> size = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">private</span> E[] arr;

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">MyArrayList</span><span class="hljs-params">()</span> </span>{
        arr = (E[]) <span class="hljs-keyword">new</span> Object[DEFAULT_CAPACITY];
    }
}
</code></pre>
<p>This creates the foundation of our <code>ArrayList</code>.</p>
<h4 id="heading-step-2-implement-core-methods"><strong>Step 2: Implement Core Methods</strong></h4>
<p>Now, let’s add the essential functionality.</p>
<h5 id="heading-adding-elements"><strong>Adding Elements</strong></h5>
<p>We’ll start with a method to add elements to the <code>ArrayList</code>. When the array is full, we’ll resize it to accommodate more elements.</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">add</span><span class="hljs-params">(E e)</span> </span>{
        <span class="hljs-keyword">if</span> (size == arr.length) {
            increase();
        }
        arr[size++] = e;
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">increase</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">int</span> newSize = arr.length * <span class="hljs-number">2</span>;
        arr = Arrays.copyOf(arr, newSize);
    }
</code></pre>
<p>The <code>ensureCapacity</code> method doubles the array size when needed, and the <code>add</code> method appends a new element.</p>
<h5 id="heading-accessing-elements"><strong>Accessing Elements</strong></h5>
<p>To retrieve elements, we’ll implement a <code>get</code> method that includes bounds checking to avoid accessing invalid indices.</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> E <span class="hljs-title">get</span><span class="hljs-params">(<span class="hljs-keyword">int</span> i)</span> </span>{
        <span class="hljs-keyword">if</span> (i&gt;=size || i&lt;<span class="hljs-number">0</span>) {
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> IndexOutOfBoundsException(<span class="hljs-string">"Index: "</span> + i + <span class="hljs-string">", Size "</span> + size);
        }
        <span class="hljs-keyword">return</span> (E) arr[i];
    }
</code></pre>
<h5 id="heading-removing-elements"><strong>Removing Elements</strong></h5>
<p>The <code>remove</code> method deletes an element by shifting all subsequent elements to the left.</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> E <span class="hljs-title">remove</span><span class="hljs-params">(<span class="hljs-keyword">int</span> i)</span> </span>{
        <span class="hljs-keyword">if</span> (i&gt;=size || i&lt;<span class="hljs-number">0</span>) {
            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> IndexOutOfBoundsException(<span class="hljs-string">"Index: "</span> + i + <span class="hljs-string">", Size: "</span> + size);
        }
        E removedElement = (E) arr[i];
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> j=i; j&lt;size-<span class="hljs-number">1</span>; j++) {
            arr[j] = arr[j+<span class="hljs-number">1</span>];
        }
        arr[--size] = <span class="hljs-keyword">null</span>; <span class="hljs-comment">// Prevent memory leaks</span>
        <span class="hljs-keyword">return</span> removedElement;
    }
</code></pre>
<h4 id="heading-step-3-add-utility-methods"><strong>Step 3: Add Utility Methods</strong></h4>
<p>To make our <code>ArrayList</code> easier to use, we’ll add some helper methods:</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">size</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> size;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">isEmpty</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> size == <span class="hljs-number">0</span>;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">clear</span><span class="hljs-params">()</span> </span>{
        arr = (E[]) <span class="hljs-keyword">new</span> Object[DEFAULT_CAPACITY];
    }
</code></pre>
<p>These methods provide basic information about the list and allow users to reset it.</p>
<h4 id="heading-step-4-testing-the-custom-arraylist"><strong>Step 4: Testing the Custom ArrayList</strong></h4>
<p>Let’s write a <code>main</code> method to test our <code>MyArrayList</code>:</p>
<pre><code class="lang-java"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Tests</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">runTests</span><span class="hljs-params">()</span> </span>{
        testAdd();
        testDelete();
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">testAdd</span><span class="hljs-params">()</span> </span>{
        MyArrayList&lt;Integer&gt; le = <span class="hljs-keyword">new</span> MyArrayList&lt;Integer&gt;();
        le.add(<span class="hljs-number">10</span>);
        <span class="hljs-keyword">int</span> result = le.get(<span class="hljs-number">0</span>);
        <span class="hljs-keyword">if</span> (result == <span class="hljs-number">10</span>) {
            System.out.println(<span class="hljs-string">"testAdd passed."</span>);
        } <span class="hljs-keyword">else</span> {
            System.out.println(<span class="hljs-string">"testAdd failed. Expected 10 but got "</span> + result);
        }
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">testDelete</span><span class="hljs-params">()</span> </span>{
        MyArrayList&lt;Integer&gt; le = <span class="hljs-keyword">new</span> MyArrayList&lt;Integer&gt;();
        le.add(<span class="hljs-number">10</span>);
        le.add(<span class="hljs-number">20</span>);
        le.remove(<span class="hljs-number">0</span>);
        <span class="hljs-keyword">int</span> result = le.get(<span class="hljs-number">0</span>);
        <span class="hljs-keyword">if</span> (result == <span class="hljs-number">20</span>) {
            System.out.println(<span class="hljs-string">"testDelete passed."</span>);
        } <span class="hljs-keyword">else</span> {
            System.out.println(<span class="hljs-string">"testDelete failed. Expected 20 but got "</span> + result);
        }
    }
}
</code></pre>
<p>With this simple test, you can verify the core functionality of your custom <code>ArrayList</code>.</p>
<h4 id="heading-step-5-driver-code"><strong>Step 5: Driver Code</strong></h4>
<p>Lastly our driver code to run the tests</p>
<pre><code class="lang-java">    <span class="hljs-comment">// Driver method </span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        MyArrayList&lt;Integer&gt; le = <span class="hljs-keyword">new</span> MyArrayList&lt;Integer&gt;();
        le.add(<span class="hljs-number">10</span>);
        le.add(<span class="hljs-number">20</span>);
        System.out.println(le.get(<span class="hljs-number">0</span>));

        Tests tests = <span class="hljs-keyword">new</span> Tests();
        tests.runTests();
    }
</code></pre>
<hr />
<h4 id="heading-step-6-comparing-with-javas-built-in-arraylist"><strong>Step 6: Comparing with Java’s Built-In ArrayList</strong></h4>
<p>Our implementation provides basic functionality similar to Java’s <code>ArrayList</code>. However, the built-in <code>ArrayList</code> includes advanced features like:</p>
<ul>
<li><p>Iterators for traversing elements.</p>
</li>
<li><p>Thread-safety options (with <code>Collections.synchronizedList</code>).</p>
</li>
<li><p>Better error handling and performance optimizations.</p>
</li>
</ul>
<p>While our version is more limited, understanding its inner workings lays the groundwork for deeper insights into Java’s standard library.</p>
<h4 id="heading-conclusion"><strong>Conclusion</strong></h4>
<p>In this blog post, we implemented a simple version of an <code>ArrayList</code> in Java, covering dynamic resizing, adding, removing, and accessing elements. This exercise is an excellent way to strengthen your understanding of data structures and Java programming.</p>
<p>Ready to take it further? Try adding features like iterators, sublists, or synchronization to enhance your custom <code>ArrayList</code>. The possibilities are endless!</p>
<p>If you'd like to explore the complete code, check out the <a target="_blank" href="https://github.com/GoldenRatio3/ADS/tree/main/arraylist">GitHub repository</a>. Happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[How to Start Using the Serverless Framework with AWS]]></title><description><![CDATA[What is the Serverless Framework
There is a distinction to be made here between Serverless and the Serverless Framework.
Serverless is the new buzzword in technology but what exactly is it?
The basic premise is allowing the developer to focus on the ...]]></description><link>https://blog.bradleywinter.dev/how-to-start-using-the-serverless-framework-with-aws</link><guid isPermaLink="true">https://blog.bradleywinter.dev/how-to-start-using-the-serverless-framework-with-aws</guid><category><![CDATA[aws lambda]]></category><category><![CDATA[lambda]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[serverless]]></category><dc:creator><![CDATA[Bradley Winter]]></dc:creator><pubDate>Wed, 22 Dec 2021 17:51:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/vII7qKAk-9A/upload/v1640194775974/MO7z6duYX.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-what-is-the-serverless-framework">What is the Serverless Framework</h3>
<p>There is a distinction to be made here between Serverless and the Serverless Framework.</p>
<p>Serverless is the new buzzword in technology but what exactly is it?</p>
<p>The basic premise is allowing the developer to focus on the application and not the infrastructure.</p>
<p>It's a cloud computing model where your provider e.g. Amazon (AWS), Google, or others manage the provision of servers. The provider spins up the server when needed so you only pay for what you use. You just focus on the code and everything else is taken care of.</p>
<p>For a more detailed introduction to Serverless and its pros and cons take a look at my 'The Complete Beginners Guide to Serverless' article</p>
<p>This article is about the Serverless Framework, an open-source framework for building and operating serverless applications including;</p>
<ul>
<li><p>Developing</p>
</li>
<li><p>Deploying</p>
</li>
<li><p>Monitoring</p>
</li>
</ul>
<h3 id="heading-why-use-the-serverless-framework">Why use the Serverless Framework</h3>
<p>There are many ways to set up, develop, deploy and monitor serverless applications and I encourage you to research them.</p>
<p>I find the Serverless framework to be the most efficient. It's a complete open source solution for developing serverless applications. If you want to delve deeper feel free to take a look at my article on the pros and cons of the serverless framework</p>
<h3 id="heading-creating-an-account">Creating an account</h3>
<p>First things first we need to create a serverless account, which can be done from https://dashboard.serverless.com/</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1640195114639/iXK183IZ5.jpeg" alt="create-account.jpeg" /></p>
<h3 id="heading-installing-serverless">Installing Serverless</h3>
<p>Once you have created an account it's time to set up the Serverless CLI (command line interface) on your system. This will allow you to run commands from your terminal.</p>
<p>Make sure you have npm installed by following this guide. Now it's time to install the serverless framework.</p>
<p>To do this run</p>
<pre><code><span class="hljs-built_in">npm</span> install -g serverless
</code></pre><p>By adding the -g this will install serverless globally so you can access the command anywhere not just in a certain directory. Now you need to login, this will redirect you to the Serverless login page. From your terminal type</p>
<pre><code>serverless <span class="hljs-keyword">login</span>
</code></pre><p>Now make sure you have an AWS account if you have you can skip this section and go straight to the 'First Project' section. If not then sign up for an AWS account. It's free and comes with 12 months of generous usage limits, then</p>
<h5 id="heading-create-aws-access-keys"><strong>Create AWS Access Keys</strong></h5>
<ol>
<li><p>Login to your AWS account and go to the Identity and Access Management (IAM) page</p>
</li>
<li><p>Click on <strong>Users</strong> and then <strong>Add user</strong>. Fill in the details and be sure to select the <strong>Programmatic access</strong> checkbox. Click <strong>Next</strong> to go through to the permissions page, click on <strong>Attach existing policies directly.</strong> Search for and select <strong>AdministratorAccess</strong> then click <strong>Next: Review</strong> and <strong>Create user.</strong></p>
</li>
<li><p>View and copy the <strong>API Key</strong> and <strong>Secret</strong> as we will need this in the next and final step</p>
</li>
</ol>
<p>The final step is to run and enter your <strong>API Key</strong>, <strong>Secret,</strong> and region as <strong>eu-west-2</strong> by entering into your terminal</p>
<pre><code><span class="hljs-attribute">aws</span> configure
</code></pre><h3 id="heading-first-project">First Project</h3>
<p>Now that you have installed and logged in to the Serverless framework we can now create our first project.</p>
<p>I have set up a template that we can use to get familiar with using the serverless commands.</p>
<p>You can take a look through the repository here feel free to fork/star the repo as we will be building on top of it in the upcoming articles.</p>
<p>To clone the repo to your machine run this command in your terminal</p>
<pre><code>git clone git@github.com:GoldenRatio3<span class="hljs-operator">/</span>Serverless<span class="hljs-number">-101</span>.git
</code></pre><p>Next, change into the directory so we can link to your AWS account</p>
<pre><code><span class="hljs-built_in">cd</span> Serverless-101
</code></pre><p>Run the serverless command to create an application and connect to AWS. Looks like the below image, you can name your application <strong>serverless-101</strong>.</p>
<pre><code>serverless
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1640195214227/uWCHMoQDUI.jpeg" alt="serverless.jpeg" /></p>
<p>Now open in your favorite IDE (I would recommend visual studio code)</p>
<p>You should see something like this</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1640195250333/LwzKvqnASg.jpeg" alt="vs.jpeg" /></p>
<p>We have 5 files</p>
<ul>
<li><p><strong>.gitignore</strong> file which allows us to ignore committing auto-generated files to git</p>
</li>
<li><p><strong>handler.js</strong> file this is the entry point to our application and where the logic lives</p>
</li>
<li><p><strong>LICENSE</strong> file stating the uses for this code</p>
</li>
<li><p><strong>README.md</strong> file that explains how to install, run etc.</p>
</li>
<li><p><strong>serverless.yml</strong> file which is the main config file for your serverless function</p>
</li>
</ul>
<h3 id="heading-lets-deploy">Let's Deploy</h3>
<p>We have set up the Serverless framework and cloned the repo to our machine.</p>
<p>The next step is to deploy to your cloud provider (we will be using AWS for this article)</p>
<p>To deploy we just run</p>
<pre><code><span class="hljs-attribute">serverless</span> deploy
</code></pre><p>This will build our packages and deploy them to our cloud provider</p>
<p>Once the command completes, fire up postman and hit the endpoint that's showing in the terminal. If all has been done correctly you should receive a response like the one below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1640195291994/zhFtw5PEA.jpeg" alt="stack.jpeg" /></p>
<p>under the 'endpoints' section is the endpoint you want to copy and paste</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1640195343827/RoL9tlV63.jpeg" alt="postman-1.jpeg" /></p>
<p>You should see something similar to the above</p>
<h3 id="heading-update">Update</h3>
<p>Now we have deployed our first serverless application, let's update the function's logic and see how easy it is to update and then redeploy.</p>
<p>First, we will update the message being returned to the client by opening up <strong>handler.js</strong> and updating the string on line 8 from:</p>
<pre><code><span class="hljs-attribute">message</span>: <span class="hljs-string">"Great work! You have now deployed your first lambda"</span>
</code></pre><p>to</p>
<pre><code><span class="hljs-attribute">message</span>: <span class="hljs-string">"Great work! You have now updated and redeployed your lambda"</span>
</code></pre><p>now we can save and run</p>
<pre><code><span class="hljs-attribute">serverless</span> deploy
</code></pre><p>this will repackage our new application and deploy it.</p>
<p>To test the update has been successful, fire up postman as before and hit the endpoint. You should now see a response similar to below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1640195391826/oNa_Khabz.jpeg" alt="postman-2.jpeg" /></p>
<p>Nice work!</p>
<h3 id="heading-remove">Remove</h3>
<p>We can also remove and clean up the application we have deployed by running</p>
<pre><code>serverless <span class="hljs-keyword">remove</span>
</code></pre><p>this will remove all objects from AWS including the S3 objects and the cloud formation stack, then at any time we can redeploy by running</p>
<pre><code><span class="hljs-attribute">serverless</span> deploy
</code></pre><h3 id="heading-thats-a-wrap">That's a wrap</h3>
<p>We have now created, setup and deployed our very first serverless application to AWS and confirmed the endpoint is up and available using postman.</p>
<p>If you want to be notified when the next articles are released for adding POST and DELETE endpoints, monitoring, running locally and debugging tips then you can subscribe to my mailing list over at my blog.</p>
<p>Thanks for reading this article, if you have any questions, feel free to reach out in the comments section below.</p>
]]></content:encoded></item><item><title><![CDATA[The Complete Beginners Guide to Serverless]]></title><description><![CDATA[What is Serverless?
Serverless computing is a cloud computing execution model, where your provider e.g. Amazon (AWS), Google Cloud, Microsoft (Azure) runs the server and you focus on the implementation.
It simplifies the process of deploying and mana...]]></description><link>https://blog.bradleywinter.dev/the-complete-beginners-guide-to-serverless</link><guid isPermaLink="true">https://blog.bradleywinter.dev/the-complete-beginners-guide-to-serverless</guid><category><![CDATA[serverless]]></category><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Bradley Winter]]></dc:creator><pubDate>Mon, 13 Dec 2021 13:10:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/QvU0LNnr26U/upload/v1640264942281/kaZmFxR7c.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-what-is-serverless">What is Serverless?</h3>
<p>Serverless computing is a cloud computing execution model, where your provider e.g. Amazon (AWS), Google Cloud, Microsoft (Azure) runs the server and you focus on the implementation.</p>
<p>It simplifies the process of deploying and managing code in production and abstracts away scaling, capacity planning and maintenance from the developer.</p>
<p>This article will take you through everything you need to know about the Serverless model, including comparisons against the current options and explain in detail when to use the model and when not to.</p>
<h3 id="heading-current-way-vs-serverless">Current way vs Serverless?</h3>
<p>There are many alternative models to the Serverless one, the most popular models are managing the infrastructure yourself, where you buy, maintain and upgrade your servers or deploying your application to a managed server also known as IaaS (infrastructure as a service)</p>
<h3 id="heading-so-why-serverless">So why Serverless?</h3>
<p>Why then has this new serverless model taken hold and becoming popular within the community.</p>
<p>All the current models put the large overhead of owning and managing a server on the developer/company. This increases the costs for the company and creates a limitation to scalability and flexibility for the developer.</p>
<p>In comes Serverless which is a managed, stateless and ephemeral service, that allows you the developer to focus on the most important part (the business logic) and leave the rest to your cloud provider.</p>
<p>We will delve into the pros and cons of this model and discuss examples of when to use and not to use the serverless execution model.</p>
<h3 id="heading-serverless-pros">Serverless pros</h3>
<p>There are many different perspectives we can view the serverless execution model from. The main three we will be viewing from is the developer, the business and the user.</p>
<h5 id="heading-pricing"><strong>Pricing</strong></h5>
<p>For the serverless model, the charge is execution based, meaning you are charged by the number of executions of a particular bit of code. This reduces the running costs as you will pay zero if that bit of code is never run. Further, the business will not need to hire a team to buy, maintain and upgrade the infrastructure which will reduce overhead.</p>
<h5 id="heading-environments"><strong>Environments</strong></h5>
<p>As developers, we don't want to code and test in production so we create replica environments to do this e.g. QA, Staging, Development environments. Setting many environments up is a resource-intensive task, by using the serverless model it makes setting up many versions of your code as simple as an extra configuration line.</p>
<h5 id="heading-scale"><strong>Scale</strong></h5>
<p>Serverless allows for automatic scaling based on certain parameters e.g. CPU usage, memory usage etc. This allows you to scale up and down to meet your performance requirements for your user base without having to acquire, set up and deploy your code to new servers.</p>
<h5 id="heading-invocation"><strong>Invocation</strong></h5>
<p>Serverless computing allows for different kinds of events to invoke your code e.g. a client hits one of your endpoints, uploads and image, tweets or makes a call. This allows for a lot of flexibility while keeping costs down as you don't need the task running 24/7, you only need it when a particular event happens e.g. when a user uploads an image, call your image resize code that resizes the image and uploads to your storage area.</p>
<h5 id="heading-deployability"><strong>Deployability</strong></h5>
<p>When developing there is a question around when to deploy my code to production. This is a spectrum but at either side, there are the fast deployable iterations which mean as soon as you have finished your development work and it has passed the tests and been reviewed it goes straight out to production. At the other end, there is the monthly or even bi-yearly releases where a massive bundle of changes are pushed into production, then the month following is spent debugging and fixing the issues.</p>
<p>The preferred state is to be able to deploy once the code has been tested and reviewed, as this allows for smaller deployable commits resulting in less risk and faster delivery of value to your users. This is exactly what the serverless model can do.</p>
<h5 id="heading-monitoring"><strong>Monitoring</strong></h5>
<p>No need to add custom code to your backend for monitoring purposes, cloud providers provide this right out of the box, for example, AWS pipe your lambda logs into AWS CloudWatch</p>
<h5 id="heading-programming-languages"><strong>Programming Languages</strong></h5>
<p>When you create your new function within the serverless model you can select what language you want that function to run in. There are many languages available to run your code on so you can choose any modern language e.g. Javascript, Python, Golang.</p>
<p>Further, each function can be a different language so you can choose the language that best fits the requirements.</p>
<h3 id="heading-serverless-cons">Serverless cons</h3>
<p>So there are quite a few positives to using the Serverless model yet, there are also a few drawbacks which we will discuss below.</p>
<h5 id="heading-networking"><strong>Networking</strong></h5>
<p>Now you have completed and deployed your code how do you access it? Once deployed you cannot access directly and will need to set up a wrapper, for example, an API Gateway to access them which on AWS is pretty straightforward</p>
<h5 id="heading-3rd-party-dependencies"><strong>3rd Party Dependencies</strong></h5>
<p>Have to bundle dependencies into one executable and can make the lambda heavy, which can hit your providers limits and leads to slower startup times so the current thinking is when you have a small number of dependencies use the serverless model, for larger projects with more dependencies use the current architecture. However, they are looking to add a new technique called <strong>layers</strong> which will reduce the drawback of this.</p>
<h5 id="heading-execution-time"><strong>Execution time</strong></h5>
<p>Serverless computing is meant for short-running tasks, which means most of the providers have an upper timeout limit around 300 seconds for processing an incoming request. Therefore if you have long-running tasks, you could not use the serverless model for them and would not want to as it would be expensive.</p>
<h5 id="heading-startup-time"><strong>Startup Time</strong></h5>
<p>Takes time to get function within the serverless model started, approx 100ms from a cold start, but, there are tactics to reduce this and increase performance for your application for example by periodically invoking your function to keep it 'warm'</p>
<h5 id="heading-vendor-lock-in"><strong>Vendor lock-in</strong></h5>
<p>Can end up being locked into a particular cloud provider but by using a framework e.g. <strong>the serverless framework</strong> and architecting your system for multi-cloud providers you will be able to reduce this and deploy on many clouds at once. Increasing reliability.</p>
<h3 id="heading-aws-serverless-architecture-example">AWS Serverless Architecture Example</h3>
<p>Let's go through a quick example of how you could architecture a serverless application on AWS.</p>
<ul>
<li><p>Client-side javascript application, allows us to use a simple, static web server.</p>
</li>
<li><p>For the web server, we will use Amazon S3 buckets, which provide a simple and reliable web server to server HTML, CSS, JS and Images.</p>
</li>
<li><p>For our backend business logic, we will use AWS Lambda Functions (FaaS)</p>
</li>
<li><p>To expose our backend functions we will wrap them with AWS API Gateway</p>
</li>
<li><p>To store our data we will use AWS DynamoDB which provides a managed NoSQL database</p>
</li>
<li><p>Finally, to authenticate our users, we will use AWS Cognito which is an identity service integrated with API Gateway and AWS Lambda, which can allow users to signup and log into your web and mobile applications.</p>
</li>
</ul>
<h3 id="heading-wrap-up">Wrap up</h3>
<p>As you can see the serverless model is one of many and can be useful in certain situations. It is not a one size fits all solution and is not for every use case.</p>
<p>If you want to try deploying your first Serverless application, you can follow along with this article approx 10 minute completion time.</p>
<p>If you have any other ideas for further pros and cons of the serverless model and what you are currently using them for, feel free to add a comment below.</p>
<p>Thanks for reading as always if you are interested in learning more about technical topics in Software engineering and technical interview best practices check out my website</p>
]]></content:encoded></item><item><title><![CDATA[The 6 Biggest Technical Interview Blunders]]></title><description><![CDATA[Not prepared your intro

Most interviewers start off asking you to introduce yourself, this is the first impression they will have of you so make sure you prepare a short 2-minute introduction.
An introduction should include
Where you are currently w...]]></description><link>https://blog.bradleywinter.dev/the-6-biggest-technical-interview-blunders</link><guid isPermaLink="true">https://blog.bradleywinter.dev/the-6-biggest-technical-interview-blunders</guid><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[interview]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[Bradley Winter]]></dc:creator><pubDate>Mon, 29 Nov 2021 13:12:23 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/5Q07sS54D0Q/upload/v1640265098431/NBm4VG8K1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<ol>
<li>Not prepared your intro</li>
</ol>
<p>Most interviewers start off asking you to introduce yourself, this is the first impression they will have of you so make sure you prepare a short 2-minute introduction.</p>
<p>An introduction should include</p>
<p>Where you are currently working and your job title e.g. “I’m currently a Software Engineer at Goldman Sachs, leading a team of 5 for the last two years.”</p>
<p>What you are currently working on and key highlights e.g. “I’m working on the initial architecture of our reporting service and have just finished building out a messaging system which has scaled with our rapid growth.”</p>
<p>What technologies you are using e.g. “I’m a full-stack developer, primary working with Java for the backend and Javascript frameworks e.g. React for the frontend.”</p>
<ol>
<li>Not Asking clarifying questions</li>
</ol>
<p>Listen intently and note any useful information in the question, then confirm the requirements from the interviewer and make sure you fully understand the problem, before coming up with a solution.</p>
<p>For example</p>
<p>If the question mentions sorted e.g. “sorted array” then it is highly likely that will be needed for the optimal solution</p>
<p>If the interviewer mentions inputs for a function make sure to clarify any boundary conditions e.g. interviewer mentions string input, you could ask “can null be passed as a parameter?” which will impact your solution</p>
<ol>
<li>Diving straight into a solution</li>
</ol>
<p>I have seen many candidates start coding not long after the question, only to realise they will have to rewrite their code because they can optimize.</p>
<p>Stop. Think. Take a couple of minutes to come up with a brute force solution (without coding) which will get you thinking about the problem and your interviewer may give you advice, then optimise.</p>
<ol>
<li>Not Listening to the Interviewer</li>
</ol>
<p>This is a simple one, but candidates can get focused on their code and not do this.</p>
<p>Listen to the interviewer, they have used this question multiple times and know it inside and out. If they propose an idea or say to look deeper into a certain section of code, there is always a reason.</p>
<p>Take a couple of minutes to think about their advice and how you can implement it in your code to optimize the solution.</p>
<ol>
<li>Not testing</li>
</ol>
<p>Once you have finished your implementation, you are not done. The interviewer is looking at how you would work in the real world and after writing some code, the next step is testing.</p>
<p>Now the interviewer does not expect you to test every single permutation but first walk through your code with your interviewer, talking about what would happen at each step (an example will help).</p>
<p>Pay special attention to</p>
<p>Non-standard code e.g. x = length — 2; or for (int i=10; i&gt;start; i--) make sure the values make sense when walking through your code</p>
<p>Arithmetic and null inputs/outputs e.g. x = (digit * 10) / 2 + 1 and ArrayIndexOutOfBounds Exceptions</p>
<p>Edge cases e.g. unexpected input convertStrToNum("test")</p>
<p>Once you find bugs, take a minute to understand why they have happened and how you would fix them. Do not patch up the code before thinking about the root cause, as you could be introducing more bugs or fixing a bug that should not have happened in the first place.</p>
<ol>
<li>Not saying Thank you</li>
</ol>
<p>Thank the interviewer for their time. It’s polite and it goes a long way.</p>
<p>Bonus: Giving up</p>
<p>Don’t. Technical Interview questions are designed to be tough, you are not expected to get the optimal solution straight away.</p>
<p>Take a few minutes and talk through the solution with your interviewer, although all interviewers are different, they will usually give you some advice to keep you on track.</p>
<p>Thanks for reading! If you found this article useful or are looking to prepare for technical interviews, subscribe to my mailing list on my blog for useful articles and advice at bradleywinter.dev</p>
]]></content:encoded></item></channel></rss>