<?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[Cameron Pavey]]></title><description><![CDATA[I write about technology, programming, productivity, and more.

I'm a full-stack dev with an interest in everything related to web technology, and a keen focus ]]></description><link>https://blog.pavey.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 16:06:50 GMT</lastBuildDate><atom:link href="https://blog.pavey.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[So, you've angered our digital overlords.]]></title><description><![CDATA[These days, we are all too reliant on technology, I’ll be the first to admit. I don’t have a huge issue with it, because it makes my life much more convenient, enjoyable, and it usually works. Usually.

I am a heavy user of the Google ecosystem. From...]]></description><link>https://blog.pavey.dev/so-youve-angered-our-digital-overlords</link><guid isPermaLink="true">https://blog.pavey.dev/so-youve-angered-our-digital-overlords</guid><category><![CDATA[Security]]></category><category><![CDATA[privacy]]></category><category><![CDATA[data]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sun, 14 Feb 2021 12:18:02 GMT</pubDate><content:encoded><![CDATA[<p>These days, we are all too reliant on technology, I’ll be the first to admit. I don’t have a huge issue with it, because it makes my life much more convenient, enjoyable, and it usually works. Usually.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1613304839097/30BHiDmqM.jpeg" alt="dylan-carr-YFgRGXYmFTI-unsplash.jpg" /></p>
<p>I am a heavy user of the Google ecosystem. From Pixel phones and Chromebooks to Google Home and of course, Gmail — the search giant pervades every aspect of my life, and I’ve never really had an issue with that in the past.</p>
<p>People always mention how google is selling our data, etc, and when you see stuff like your google maps timeline, it sends a chill down your spine, but I’ve always thought “well, they’re probably being more productive with that data than I am” and that was that.</p>
<p>Well the other day, I stumbled across this tweet:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1613304860137/FpTBK3-BP.png" alt="Screen_Shot_2021-02-12_at_3.46.41_pm.png" /></p>
<p>This struck some fear into my heart for sure. I rely so heavily on the google ecosystem, I started to think about what would happen if I somehow lost access to my primary google account.</p>
<p>For a start, that would be my Gmail and google drive gone, where I keep record of countless important documents and conversations.</p>
<p>The next thing to worry me was the number of sites where I “Sign in with Google”. It’s a lot, 47 different services, according to my Google account settings.</p>
<p>And what happens when you can’t sign in to one of those sites? They send you a password reset maybe? To your disabled google account.</p>
<p>The gears started turning and the more I thought about it, the more terrifying it became.</p>
<p>I needed a backup plan. Literally.</p>
<h2 id="the-plan">The Plan</h2>
<h3 id="cloud-storage">Cloud Storage</h3>
<p>My foremost concern was safeguarding the plethora of important documents I store on my google drive. Probably not the smartest idea to store things like that on the cloud and hope for the best, but the convenience sure is nice.</p>
<p>After some brief searches, I decided the fastest solution I could get in place would be to set up a Synology NAS, and use the included Cloud Backup Package to slurp all the data from my various cloud storage providers. I’ve been meaning to set-up a backup system for my home computers for a while, so now was as good a time as any I guess, and the NAS could help with that too. I picked up a Synology DS118 Disk Station from Amazon, along with a 4TB Seagate Iron Wolf NAS Drive.</p>
<p>Set-up was easy enough, and by the end of the day, I had a full copy of all my google drive data sitting on the shelf in my bedroom, continuously checking for new changes. Neat.</p>
<p>Granted, I could have set up something DIY for a fair bit cheaper, but sometimes you just want a no-fuss solution, and are happy to pay for it. Besides, the DS118 is on the cheaper end of Synology’s offerings.</p>
<h3 id="email">Email</h3>
<p>The next thing on my digital-doomsday prepper list was email. I use my Gmail for everything, personal, business, pretty much every account I have online. This one was going to be a lot harder.</p>
<p>The main thing is that I need to preserve any emails and attachments I already have retro-actively and any new ones in the future. Call me a data hoarder, but you never know when you need an obscure attachment from a 5-year-old email. It’s happened.</p>
<p>Aside from backing up my existing and future emails, I wanted a relatively clean email address which I could use if something terrible happened and I could no longer rely on Google. To this end I signed up to Proton Mail, an email provider who prides themselves on privacy and security, and who — and this is very important — doesn’t also control every other aspect of my digital identity.</p>
<p>My plan for tackling email at this point is a two-pronged approach. The Synology NAS has a wide array of packages for hoovering various different data sources, and when there isn’t a package, you can just SSH in and do it yourself.</p>
<p>I found this good tutorial on setting up Gmvault on the NAS to snag copies of all my existing emails. This is only about 7GB for me, so nothing too drastic. This task can run on a schedule to make sure the backup is always up to date. Meanwhile, if we want to start populating our secondary email provider (Proton mail in my case) with emails going forward, we can also set up a filter to forward all incoming mail to our new address. This means from this point forward, all those messages will be safe and sound on the NAS, and in Proton Mail. Nice.</p>
<h3 id="identity">Identity</h3>
<p>This one is also pretty scary. Now, I haven’t had my Google account suspended before, but I imagine if the above tweet is anything to go by, a lot of stuff stops working. It stands to reason that your ability to “Sign in with google” could also be taken away. That’s a problem, I use that a lot.</p>
<p>According to the Oauth Authorisations in my google account, I have 47 apps which I sign into with google. If I lost access to all of these apps, it would not be a good day, especially notion.so, where I keep all of my online notes and thoughts organised (and where I drafted this article).</p>
<p>Most of these apps will allow you to add additional sign-in methods (like other social sign-ins) or — better yet — a password. I spent a good portion of my weekend going through, adding alternative sign-in methods to as many of these services as I could, and closing down any which I no longer needed or used.</p>
<p>Finding an alternative social login is difficult. I wouldn’t want to become beholden to any of the big tech companies, and the only options which you can consistently use pretty ubiquitously are Facebook and Google.</p>
<p>In the end, I’ll keep using google social login for the foreseeable future, but in the event that something should go wrong, at least I should still be able to sign in with my passwords.</p>
<p>For now, nothing else is of much concern. If everything was gone tomorrow, I don’t own enough paid apps or movies with google that I would be particularly devastated if I lost access to them.</p>
<p>De-googling is a fairly common practice among more privacy-centric tech folk. it’s never been a really big concern of mine thus far. I always thought that the convenience of the services outweighed the price you pay for them (your data and privacy). While researching information for this article, I got thinking about the common solutions people take to avoid the all-seeing-eye of the search giant, and I decided to install Firefox, set DuckDuckGo as my default search engine, and see what life is like away from the watchful guidance of our search engine overlord.</p>
<p>Turns out, it’s quite fine so far. I knew Firefox was no slouch, but DuckDuckGo has been nothing short of impressive when it comes to meaningful search results.</p>
<p>I think It is important to always plan for the worst, and hope for the best. Having contingencies in place is important so that if you lose a key piece of your online identity, you won’t be dead in the water.</p>
<p>There are still some bits I need to solve, like my google photos, and my google home stuff, but overall, with not very much work at all, I am now in a much better position, and feel more comfortable with the state of my digital identity.</p>
<p>I have no plans to stop using the google ecosystem as of now, but if push comes to shove, I will survive.</p>
]]></content:encoded></item><item><title><![CDATA[How I doubled my productivity while working from home]]></title><description><![CDATA[This year has been an interesting one, not least of all because many people around the world - especially in the tech sector - ended up working from home for an extended period of time. 
Working from home used to have something of a workplace stigma ...]]></description><link>https://blog.pavey.dev/how-i-doubled-my-productivity-while-working-from-home</link><guid isPermaLink="true">https://blog.pavey.dev/how-i-doubled-my-productivity-while-working-from-home</guid><category><![CDATA[Productivity]]></category><category><![CDATA[General Programming]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sat, 05 Dec 2020 23:25:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1607210650613/hvgeeuJGM.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This year has been an interesting one, not least of all because many people around the world - especially in the tech sector - ended up working from home for an extended period of time. </p>
<p>Working from home used to have something of a workplace stigma around it. Employers were seemingly sceptical of how you could be productive in such a distracting environment. Needless to say, it's been proven it can be done, but what I wasn't expecting is how it would be the catalyst for an actual <em>increase</em> in productivity. Let's take a look at some of the factors which contributed to this.</p>
<h2 id="track-your-productivity">Track your productivity</h2>
<p>The first step on any great transformative journey is to gather data. Gather data of where you started from, what you do each step of the way, and ultimately where you end up. With something as subjective as productivity, this is hard to do. For me, I've had good results using  <a target="_blank" href="https://www.rescuetime.com">RescueTime</a>, a tool which shows me a summary of where I spent my time on any given day.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1607207285187/aqiKB7RpL.png" alt="Screen Shot 2020-12-06 at 9.27.24 am.png" /></p>
<p>As they say, hindsight is 20/20. Having this kind of information available makes it easy to reflect and see where you wasted time, and where you can win some extra productivity. </p>
<p>(Whenever I see my stats, seeing how long I spend on Slack per day is a bit jarring at first, but then I remember that on average, office workers spend about 28% of their day on email.)</p>
<p>Tracking where your time is spent isn't a step you should skip. It's like training your body. If you are trying to lose 10kg but never set foot on the scales, how will you know if it is working?</p>
<p>If you are trying to boost your productivity, but have no way of measuring it, then good luck to you.</p>
<h2 id="avoid-multitasking">Avoid multitasking</h2>
<p>Humans are good at a lot of things, but generally not multi-tasking, or remembering lots of small things. This leads to a well-known problem called "context switching", where your productivity will effectively plummet when you try to switch between multiple tasks.</p>
<p>This happens for a few reasons, but essentially, the "context" that you create around a task consists of lots of small pieces of information which you need to keep in your head to complete the task. If at any point, someone or something interrupts your tasks, all of these small bits of context are at risk of being lost. Even if the distraction is only a minute long, the cost of switching between tasks will make the impact much greater than just 1 minute.</p>
<p>According to  <a target="_blank" href="https://insights.sei.cmu.edu/devops/2015/03/addressing-the-detrimental-effects-of-context-switching-with-devops.html">Todd Waits</a> </p>
<blockquote>
<p>[...] Switching between projects requires an operational overhead for the team member to figure out where he or she left off, what needs to be done, how that work fits in the project, etc. Once a team member is assigned five projects, his or her ability to contribute to any given project drops below 10 percent, with 80 percent effort being lost to switching between project contexts.</p>
</blockquote>
<p>The effects of context switching are well known and impossible to conquer. No matter how good you think you are when it comes to multi-tasking, chances are, you are giving yourself far too much credit. The only way to properly combat the effects of context switching is to remove it from the equation as much as possible.</p>
<p>Carl Newport's  <a target="_blank" href="https://www.amazon.com.au/Deep-Work-Focused-Success-Distracted/dp/0349411905/">excellent book "Deep work"</a> takes a deep dive into this topic and expands on systems which you can use to get the most out of the tasks that matter. If you're going to take anything away from this article, let it be this. </p>
<p>Don't multitask. It doesn't work.</p>
<h2 id="externalise-everything">Externalise everything</h2>
<p>This was the big one for me.</p>
<p>It's easy to say "Don't multitask" I know. In practice, it is a lot harder, because even if you don't plan to do it, all it takes is an errant Slack message and then Boom, context switched. (It's worth noting, RescueTime has an awesome Slack integration to mute notifications during focus time. Killer feature)</p>
<p>How, then, should we solve this? After listening to  <a target="_blank" href="https://alifeofproductivity.com/the-productivity-project/">Chris Bailey's "The Productivity Project"</a>, where he touches on the benefits of externalising your todo list, I became a little bit obsessed with lists. At first, it was exactly how Chris suggested it. If you have something you need to do, write it down, so you don't have to think about it anymore, essentially. </p>
<p>Eventually, this evolved into something of a rolling "work journal". I tried a few tools and ultimately settled on  <a target="_blank" href="https://www.notion.so">Notion</a> (but you could use anything really). </p>
<p>The idea is simple. We <em>know</em> we will be interrupted, and we <em>know</em> that when we are, it will tank our productivity because we will lose all the little bits of context in our head.</p>
<p>What if we could externalise that context though?</p>
<p>When working through complex issues with a lot of moving parts, any time there was a new noteworthy development, such as a discovery, problem, or solution, I would make a note of it. It doesn't need to be too detailed; it is just a note to your future self so that when you are inevitably distracted, your notes should contain all the information you need to pick up right where you left off.</p>
<p>This information could be your current challenges you are trying to solve, todo items of what you still need to complete, or even just small anecdotal quirks about the system you are working with, that you don't want to dedicated mental space to remember, but can't afford to forget.</p>
<p>It doesn't sound like it should work half as well as it does.</p>
<p>Employing this system, I've been able to largely mitigate a lot of the burden I've typically suffered when it comes to context switching. I don't have to worry about taking a lunch break and losing my place. I don't have to dread every incoming slack message, and I am confident that when we return to the office in force, I won't have to worry as much about that casual tap on the shoulder causing my delicate mental house of cards to come crashing down around me.</p>
<p>If this has given you some ideas to boost your productivity, or if you have some tricks of your own, I'd love to hear from you. Leave a comment below, or <strong> <a target="_blank" href="https://twitter.com/cpave3">follow me on Twitter</a> </strong> for more content like this.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Imperative vs Declarative Programming]]></title><description><![CDATA[You might have heard these terms being tossed around a bit, especially when it comes to things like React. React is declarative according to the documentation, but what does that really mean? Let's take a look at the difference between these two para...]]></description><link>https://blog.pavey.dev/understanding-imperative-vs-declarative-programming</link><guid isPermaLink="true">https://blog.pavey.dev/understanding-imperative-vs-declarative-programming</guid><category><![CDATA[General Programming]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[programming languages]]></category><category><![CDATA[learn coding]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sat, 14 Nov 2020 04:00:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1605326438322/C07zvw2FK.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You might have heard these terms being tossed around a bit, especially when it comes to things like React. React is <em>declarative</em> according to the documentation, but what does that really mean? Let's take a look at the difference between these two paradigms.</p>
<h2 id="what-is-imperative-programming">What is Imperative Programming?</h2>
<p>According to our good friend Wikipedia, we have the following definition:</p>
<blockquote>
<p>In computer science, imperative programming is a programming paradigm that uses statements that change a program's state.</p>
</blockquote>
<p>In essence, this means we are issuing instructions describing both what <em>and</em> how we want the computer to perform its task. Imperative programming makes use of relatively low-level function and API calls to have more absolute control over the implementation details of how something is done.</p>
<p>An example of some imperative code is the following JavaScript:</p>
<pre><code><span class="hljs-keyword">const</span> domNode = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'foo'</span>);
domNode.style.color = <span class="hljs-string">'red'</span>;
</code></pre><p>Here, we are telling the browser how to get a certain element, and how to change its color to red. What, and how.</p>
<h2 id="what-about-declarative-programming">What about Declarative Programming?</h2>
<p>By contrast, declarative programming is a higher-level concept. We tell the system <em>what</em> to do, but not strictly how to do it. The implementation details are abstracted away from us, but they are still there. Make no mistake, you can't tell a computer what to do without <em>something</em> telling it how to do it, somewhere down the chain.</p>
<p>A simple example of declarative programming is the following HTML:</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"foo"</span>&gt;</span>My Heading<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre><p>We are telling the browser what we want it to do, but the actual implementation of how it interprets that HTML and renders it to our screen is abstracted away, and out of our hands.</p>
<h2 id="react-is-declarative">React is Declarative</h2>
<p>So when people say React as declarative, what does this mean for us? If you think about it, it makes sense. React shares a lot of similarities with HTML, and the way things used to be done. We can build entire, complex applications without ever having to do direct DOM manipulation for the most part. Sure, there are still some edge-cases where directly touching the DOM and using refs is the best approach, but those cases are few and far between.</p>
<p>Most of the time when writing code for React, you will be composing your applications by nesting components within each other. Some of these components will contain business logic, but even then, chances are you will seldom write imperative code.</p>
<p>Consider the follow React code:</p>
<pre><code><span class="hljs-keyword">const</span> foo = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">style</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">color:</span> '<span class="hljs-attr">red</span>' }}&gt;</span>My Heading<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span></span>;
}
</code></pre><p>Here, we are telling react to make this component and give it red text, but the actual imperative calls under the hood to make this happen are not our concern. We tell React what to do, and it figures out <em>how</em>.</p>
<h2 id="other-examples-of-declarative-coding">Other examples of Declarative Coding</h2>
<p>Domain-Specific Languages (DSLs) are very often Declarative in nature. This is because the point of a DSL is to provide an interface where the available instructions make sense in the context of the domain. Consider SQL, a DSL for interacting with and querying databases. We could have some SQL like:</p>
<pre><code><span class="hljs-keyword">SELECT</span> * <span class="hljs-keyword">FROM</span> <span class="hljs-string">`users`</span> <span class="hljs-keyword">WHERE</span> <span class="hljs-string">`users.date_of_birth`</span> <span class="hljs-keyword">IS</span> <span class="hljs-literal">NULL</span>;
</code></pre><p>Here we are telling the database "get me all the users with a null "date of birth" field", and because the DSL is so finely tuned, it almost reads like plain English (although the same cannot be said for some more advanced queries).</p>
<p>The important thing here is that we told the database <em>what</em> to do, and the engineers who implemented the DSL on the backend have done the hard work of figuring out <em>how</em> to do it.</p>
<p>Depending on the situation there is always going to be a need for both declarative <em>and</em> imperative coding. Don't make the mistake of thinking you need to pick one and stick to it. Understanding the differences between these two paradigms, and how they come together is the first step in knowing when and where to use each.</p>
]]></content:encoded></item><item><title><![CDATA[You'll never be a 10x Developer]]></title><description><![CDATA[You've seen the job listings, you've heard the recruiters. 
"Innovative tech company looking for 10x developer to take the lead on a greenfield project."
But what is a 10x Developer? How is it possible for one person to do the work of 10? Are they ju...]]></description><link>https://blog.pavey.dev/youll-never-be-a-10x-developer</link><guid isPermaLink="true">https://blog.pavey.dev/youll-never-be-a-10x-developer</guid><category><![CDATA[General Programming]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[project management]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sat, 31 Oct 2020 01:40:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1604108428714/c4qW6YuJ8.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You've seen the job listings, you've heard the recruiters. </p>
<p>"Innovative tech company looking for 10x developer to take the lead on a greenfield project."</p>
<p>But what is a 10x Developer? How is it possible for one person to do the work of 10? Are they just that good? Are the other 10 people just lazy?</p>
<p>Although some people would certainly argue otherwise, there is no such thing as a 10x Developer. It's just another buzzword used by recruiters and companies to hype people up. Suggesting that one person can perform the work of 10 others is a strange thing to get excited about. </p>
<p>It certainly isn't something that should be desired.</p>
<p>Doing 10x the work of the "average developer" would have a few problems with it if it were even possible.</p>
<ol>
<li>The burnout would be extraordinary. If you are pushing that hard, you won't be able to sustain it for very long.</li>
<li>The single point of failure becomes much more dramatic. If your 10x Dev is sick and takes the day off, there goes most of your team's productivity.</li>
<li>You wouldn't be fairly compensated. Sure, if you really were delivering that much extra value, you might be compensated above average, but the chances of being remunerated 10x are almost non-existent.</li>
</ol>
<h2 id="what-can-we-do-instead">What can we do instead?</h2>
<p>As they say, don't put all your eggs in one basket. The real force multiplier in this industry is not single heroes who carry teams to victory. It is the teams themselves, and the potential they unleash through effective communication, collaboration, and prioritisation.</p>
<p>There is no real way to measurably determine how many "developer multiples" a given software engineer embodies, so don't even bother. Productivity will ebb and flow as the various factors and situations surrounding the team changes.</p>
<p>What is known, however, is that effective teams raise each other up, and deliver value greater than the sum of their parts. </p>
<p>An actual force multiplier that you can count on.</p>
<p>Let's take a look at each of these key factors:</p>
<h3 id="communication">Communication</h3>
<p>Effective teams have stellar communication. This is especially vital during the extended work from home stint a lot of us have had around the world. Being in the office helps with communication, but the connectivity we enjoy in this modern world makes it entirely possible over the internet as well.</p>
<p>Communication matters because without it, things get lost in the details. Poor communication leads to mismanaged expectations, poorly understood requirements, and general frustration.</p>
<h3 id="collaboration">Collaboration</h3>
<p>As we've established, you can't do it all by yourself, or you shouldn't, anyway. As part of a team, you must work together to deliver the best outcomes possible for your company and your customers. This means you need to deliver high-quality solutions, do doing that requires collaboration.</p>
<p>One person cannot know the best way to do everything, and no matter how good you are, you will make mistakes. Collaboration involves spending time doing pair programming, code reviews, demos, showcases, planning, and meetings. </p>
<p>These might seem like a waste of time.</p>
<p>You might think your time would be better spent writing code and fixing bugs.</p>
<p>This isn't the case. Although writing code and delivering results is important, you'll find it very difficult, almost impossible to do at scale without proper collaboration.</p>
<h3 id="prioritisation">Prioritisation</h3>
<p>The key to strong productivity in the eyes of your company is proper prioritisation. Most companies are in business to serve specific customers, and customers generally want certain things more than others.</p>
<p>Product Management and dealing with customer requirements is a whole art of its own, but at the intersection with Engineering, work is divided into tickets and sent over to be developed. </p>
<p>When it comes to software, the golden rule is that there is always more work to do than there is time to do it. The work is never "done", software projects end when their continuation is no longer in the interest of the company, not because all the work was finished. There's always more to do.</p>
<p>This means we need to be careful when selecting what we work on because with the effectively infinite workload, and finite capacity, it becomes a balancing act.</p>
<p>Focus on the most urgent work that is required to delight the target customer. If it isn't required as part of your "Minimum Lovable Product" for any given release, re-assess if it needs to be done.</p>
<p>There is no secret sauce to being a lone wolf heroic developer. The real magic happens when teams unite. It takes some time for new teams to gel, once they have become properly integrated, they are a force to be reckoned with. Whether you have a new or existing team, keep these points in mind and do what you can to improve cohesion.</p>
<p>There is no challenge a cohesive team cannot tackle.</p>
]]></content:encoded></item><item><title><![CDATA[Are you a Developer, or a Software Engineer?]]></title><description><![CDATA[Job titles can be a contentious point. To some, they matter a great deal, and to others, they don't matter at all. Things get extra interesting when you start throwing around the word "Engineer" though. What does it mean to be an Engineer? What does ...]]></description><link>https://blog.pavey.dev/are-you-a-developer-or-a-software-engineer</link><guid isPermaLink="true">https://blog.pavey.dev/are-you-a-developer-or-a-software-engineer</guid><category><![CDATA[Software Engineering]]></category><category><![CDATA[General Programming]]></category><category><![CDATA[learning]]></category><category><![CDATA[technology]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Fri, 23 Oct 2020 09:18:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1603442020971/SU3wVpfw6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Job titles can be a contentious point. To some, they matter a great deal, and to others, they don't matter at all. Things get extra interesting when you start throwing around the word "Engineer" though. What does it mean to be an Engineer? What does it mean to be an Engineer of Software? What is Software? Does it include websites?</p>
<p>There are a lot of people who don't consider web development to be true software development. There are even more who consider neither of these things to be Engineering, but that is not the case.</p>
<p>The following excerpt comes from  <a target="_blank" href="https://www.engineersaustralia.org.au/For-Students-And-Educators/Engineering-Careers/What-Is-Engineering">Engineers Australia</a></p>
<blockquote>
<p>Software Engineering is about creating high-quality software in a systematic, controlled, and efficient manner. It is an approach to designing software to maximise quality and reliability by treating it as a formal engineering process. </p>
</blockquote>
<p>In other words, Software Engineering means approaching software design and development with engineering processes. Taking this approach helps the Engineer to ensure higher quality and reliability.</p>
<p>As with everything, there are varying degrees of skill and care with which you can approach the art of Software Development. It is possible to build a system without applying any quality gates, without doing proper design, and without having proper processes in place. If you're lucky, maybe some of the systems will even work when you're done. "Maybe" isn't good enough for businesses, though. "Maybe" has no place in enterprise software or any software at scale.</p>
<p>If you are a professional developer, you have a responsibility to your employers and your clients to deliver robust, quality software. That kind of software is made by applying engineering practices.</p>
<p>Ensure that you and your team are writing clean code. The code should be simple to understand by reading it for the most part. It should be well-documented enough that the more complex parts are still understandable. Your code should be well tested, and your tests should run in CI on every commit. Systems should be planned out and documented well before any code is even written. Plans and designs are easier and cheaper to change than code. </p>
<p>Use the planning phase to identify design flaws, and improve where you can. Coworkers should review your plans and designs the same as they do with your code. </p>
<p>Your team needs to communicate well, and often. Nobody expects one person to have all the answers. If you are unsure of how to solve a problem or approach a situation, don't be afraid to ask for help. Two heads are better than one, and effective communication and teamwork lead to well-engineered systems.</p>
<p>At the end of the day, it's not what you make, or what language you use that determines whether you are a Software Engineer. What matters is how you solve the problems you are presented with, and how you deliver value to your stakeholders.</p>
]]></content:encoded></item><item><title><![CDATA[Get Developer Super Powers with Vim]]></title><description><![CDATA[Get Developer Super Powers with Vim
You've probably heard of Vim if you've been working with code for a while. Vim is a command-line text editor available for a lot of operating systems. Initially released in 1991, Vim is one of the most popular text...]]></description><link>https://blog.pavey.dev/get-developer-super-powers-with-vim</link><guid isPermaLink="true">https://blog.pavey.dev/get-developer-super-powers-with-vim</guid><category><![CDATA[General Programming]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[learn coding]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sun, 18 Oct 2020 07:58:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1603007849448/K2APq81bM.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Get Developer Super Powers with Vim
You've probably heard of Vim if you've been working with code for a while. Vim is a command-line text editor available for a lot of operating systems. Initially released in 1991, Vim is one of the most popular text editors in the computing community.</p>
<p>So why should you care about this old text editor? You should care because it is pretty much ubiquitous, and is worth learning unless your heart already belongs to an alternative like emacs or even nano (if you really want to).
Vim is scary at first. It does so much, and its shortcuts are not likely ones that you have used before. Even quitting out of the software is notoriously tricky for newcomers. Once you have learnt the basics though, they will be the gift that keeps on giving, and I'll tell you why.</p>
<h2 id="ubiquity">Ubiquity</h2>
<p>Vim is everywhere, even when it isn't. For instance, pretty much any Linux or Mac operating system you touch will have Vim installed and ready to go. With the advent of "Windows Subsystem for Linux" on Windows 10, Vim is now readily available on Windows as well (and could be downloaded anyway before this).
Most code editors also have Vim emulation plugins available, so even if you don't want to use Vim directly, you can still get all of the benefits it brings from the comfort of the code editor or IDE you know and love.</p>
<h2 id="portability">Portability</h2>
<p>With Vim, you learn the shortcuts and commands once and take them with you everywhere. As mentioned above, any code editor you use will have Vim bindings, and many coding websites like Codewars also support Vim mode. What this means is that all of your devices, editors, and environments can share the same keybindings easily. You don't have to manage the mental burden of memorising different shortcuts for different setups.</p>
<h2 id="productivity">Productivity</h2>
<p>The real secret sauce that makes learning Vim worthwhile is the productivity benefits it offers. A key principle of Vim is to deliver maximum productivity and functionality from the keyboard, without needing to move your hand to the mouse, and without needing to leave the home row so much on the keyboard. This is the main factor that leads to some of the weird shortcuts and keybindings, like :w to save instead of the more commonly used +s.</p>
<p>The main factor which drove me to become familiar with Vim was the portability so that I would be more productive while working in remote ssh environments. Once I started incorporating it into my daily workflow through the JetBrains IdeaVim plugin, and the corresponding VS Code plugin, I realised that the shortcuts and keybindings themselves were actually a huge time saver even when not working with remote systems. I quickly found myself using v and hjkl to select chunks of text instead of lifting my hand to use the mouse. I often use vim to save, search, replace, copy, paste, and delete text, even though VS Code and PHP Storm have all these features natively. The reason is simple. It's just faster and more natural to do it all in Vim.</p>
<p>Learning Vim is daunting at first, but give it some time, it will almost certainly be an investment which pays itself off in spades and serves you well for years to come.</p>
]]></content:encoded></item><item><title><![CDATA[How to easily send and receive data with an iframe]]></title><description><![CDATA[Iframes get a bad wrap for everything from security problems, to usability and SEO issues. Despite this, they are one of the tools at our disposal, and knowing how to use them effectively could open the door to new solutions to old problems. Being ab...]]></description><link>https://blog.pavey.dev/how-to-easily-send-and-receive-data-with-an-iframe</link><guid isPermaLink="true">https://blog.pavey.dev/how-to-easily-send-and-receive-data-with-an-iframe</guid><category><![CDATA[General Programming]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[learn coding]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sat, 17 Oct 2020 04:19:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1602908349414/69FkIlfBz.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Iframes get a bad wrap for everything from security problems, to usability and SEO issues. Despite this, they are one of the tools at our disposal, and knowing how to use them effectively could open the door to new solutions to old problems. Being able to send data between the iframe and the parent page is a useful trick for delivering more integrated solutions, rather than the traditional boring "page-in-a-page" way iframes get used.</p>
<p>The method examined here isn't just for iframes though, it will work in any case where you have access to another page's <code>window</code> object (so popups, and embedded web-browsers can join in on the fun too). Iframes are easy to play with though, so we will use them for this example.</p>
<p>Establishing 2-way communication between a child page and its parent can be done a few ways, but generally, the recommended approach is to use <code>window.postMessage</code>, if the technologies you are using support it (sorry IE users).</p>
<p>So let's create a basic page to act as our parent.</p>
<pre><code><span class="hljs-comment">&lt;!-- index.html --&gt;</span>
<span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Parent Page<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Container<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">textarea</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"output"</span> <span class="hljs-attr">cols</span>=<span class="hljs-string">"30"</span> <span class="hljs-attr">rows</span>=<span class="hljs-string">"10"</span> <span class="hljs-attr">disabled</span>&gt;</span>awaiting data...<span class="hljs-tag">&lt;/<span class="hljs-name">textarea</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"field"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"type something fun here"</span> /&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"send"</span>&gt;</span>Send<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">iframe</span>
        <span class="hljs-attr">height</span>=<span class="hljs-string">"500px"</span>
        <span class="hljs-attr">id</span>=<span class="hljs-string">"inner"</span>
        <span class="hljs-attr">src</span>=<span class="hljs-string">""</span>
        <span class="hljs-attr">frameborder</span>=<span class="hljs-string">"0"</span>
      &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">iframe</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre><p>Here we have a very basic page. I will use a disabled textarea for showing data from incoming messages from the embedded page, and an input and button for sending messages to said page. Aside from that, we have the guest of honor, the <code>iframe</code> itself, currently with no source for it, because we need to make a page to embed first. Let's do that.</p>
<h2 id="the-embedded-page">The Embedded Page</h2>
<p>This is the page which will be running inside the iframe or popup. Structurally we will make something very similar to the parent page.</p>
<pre><code><span class="hljs-comment">&lt;!-- inner.html --&gt;</span>
<span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Embedded Page<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Embedded<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">textarea</span> <span class="hljs-attr">cols</span>=<span class="hljs-string">"30"</span> <span class="hljs-attr">rows</span>=<span class="hljs-string">"10"</span> <span class="hljs-attr">disabled</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"output"</span>&gt;</span>awaiting data...<span class="hljs-tag">&lt;/<span class="hljs-name">textarea</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"field"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"send"</span>&gt;</span>Send<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre><p>Now we need to load this page into the iframe. The easiest way to do this is with something like the npm package <code>serve</code>. If you have <code>npm</code> installed, navigate to the directory where these files are located, and run <code>npx serve</code>.</p>
<p>You should get some output indicating which port the assets are being served on. In my case, they are being served on port 5000. When I visit http://localhost:5000 I will be served the parent page, index.html, and if I visit http://localhost:5000/inner.html, I will get the page I want to embed.</p>
<p>This means I can use that URL as the source for my iframe, so I will set that as the value of my <code>src</code> attribute now.</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">iframe</span>
    <span class="hljs-attr">height</span>=<span class="hljs-string">"500px"</span>
    <span class="hljs-attr">id</span>=<span class="hljs-string">"inner"</span>
    <span class="hljs-attr">src</span>=<span class="hljs-string">"http://localhost:5000/inner.html"</span>
    <span class="hljs-attr">frameborder</span>=<span class="hljs-string">"1"</span>
&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">iframe</span>&gt;</span>
</code></pre><p>With that out of the way, if we visit the index.html page we should now see the iframe containing our other page below it. The next step is to write some JavaScript to facilitate communication between the two pages.</p>
<h2 id="the-javascript">The JavaScript</h2>
<p>Firstly, we need to write some code on the index page which will wait for the iframe to load, and the get the reference to its <code>window</code> object so that we can call the <code>window.postMessage</code> function on it.</p>
<p>We will also need to add an event listener to send a message when we click our send button, and an event listener to display any messages we receive from the embedded page.</p>
<p>In index.html, create a <code>&lt;script&gt;</code> tag before the end of your <code>&lt;/body&gt;</code> tag which contains something like the following snippet.</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
      <span class="hljs-comment">// assign variables with references to the DOM nodes we will be interacting with</span>
      <span class="hljs-keyword">const</span> output = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"output"</span>);
      <span class="hljs-keyword">const</span> iframe = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"inner"</span>);
      <span class="hljs-keyword">const</span> button = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"send"</span>);
      <span class="hljs-keyword">const</span> field = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"field"</span>);
      <span class="hljs-comment">// we will assign this value once the iframe is ready</span>
      <span class="hljs-keyword">let</span> iWindow = <span class="hljs-literal">null</span>;

      <span class="hljs-comment">// This event listener will run when we click the send button</span>
      button.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
        <span class="hljs-comment">// don't do anything if the iframe isn't ready yet</span>
        <span class="hljs-keyword">if</span> (iWindow === <span class="hljs-literal">null</span>) {
          <span class="hljs-keyword">return</span>;
        }

        <span class="hljs-comment">// otherwise, get the value of our text input</span>
        <span class="hljs-keyword">const</span> text = field.value;

        <span class="hljs-comment">// and send it to the embedded page</span>
        iWindow.postMessage(text);
      });

      <span class="hljs-comment">// This event listener will run when the embedded page sends us a message</span>
      <span class="hljs-built_in">window</span>.addEventListener(<span class="hljs-string">"message"</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
        <span class="hljs-comment">// extract the data from the message event</span>
        <span class="hljs-keyword">const</span> { data } = event;

        <span class="hljs-comment">// display it in our textarea as formatted JSON</span>
        output.value = <span class="hljs-built_in">JSON</span>.stringify(data, <span class="hljs-literal">null</span>, <span class="hljs-number">2</span>);
      });

      <span class="hljs-comment">// Once the iframe is done loading, assign its window object to the variable we prepared earlier</span>
      iframe.addEventListener(<span class="hljs-string">"load"</span>, <span class="hljs-function">() =&gt;</span> {
        iWindow = iframe.contentWindow;
      });
    </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre><p>That JavaScript alone won't do much though, we need to add the corresponding code in the embedded page, so add another script tag in inner.html containing the following</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
      <span class="hljs-comment">// set up references to DOM nodes</span>
      <span class="hljs-keyword">const</span> output = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"output"</span>);
      <span class="hljs-keyword">const</span> button = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"send"</span>);
      <span class="hljs-keyword">const</span> field = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"field"</span>);

      <span class="hljs-comment">// create a variable for the parent window. We will assign it once we get the first message.</span>
      <span class="hljs-keyword">let</span> parent = <span class="hljs-literal">null</span>;

      <span class="hljs-comment">// add an event listener to send messages when the button is clicked</span>
      button.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">() =&gt;</span> {
        <span class="hljs-comment">// don't do anything if there is no parent reference yet</span>
        <span class="hljs-keyword">if</span> (parent === <span class="hljs-literal">null</span>) {
          <span class="hljs-keyword">return</span>;
        }

        <span class="hljs-comment">// otherwise get the field text, and send it to the parent</span>
        <span class="hljs-keyword">const</span> text = field.value;
        parent.postMessage(text);
      });

      <span class="hljs-comment">// add an event listener to run when a message is received</span>
      <span class="hljs-built_in">window</span>.addEventListener(<span class="hljs-string">"message"</span>, <span class="hljs-function">(<span class="hljs-params">{ data, source }</span>) =&gt;</span> {
        <span class="hljs-comment">// if we don't have a reference to the parent window yet, set it now</span>
        <span class="hljs-keyword">if</span> (parent === <span class="hljs-literal">null</span>) {
          parent = source;
        }

        <span class="hljs-comment">// now we can do whatever we want with the message data.</span>
        <span class="hljs-comment">// in this case, displaying it, and then sending it back</span>
        <span class="hljs-comment">// wrapped in an object</span>
        output.textContent = <span class="hljs-built_in">JSON</span>.stringify(data);
        <span class="hljs-keyword">const</span> response = {
          <span class="hljs-attr">success</span>: <span class="hljs-literal">true</span>,
          <span class="hljs-attr">request</span>: { data },
        };
        parent.postMessage(response);
      });
    </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre><p>Save all your files, refresh your browser, and give it a try. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1602907827955/BzUFgQwKR.gif" alt="iframe-demo.gif" /></p>
<p>Using this method of sending messages opens up a whole new level of interactivity when it comes to popups, iframes, and embedded browsers, paving the way for some pretty cool interactions if you play your cards right.</p>
<p>Pastebin links to source:</p>
<ul>
<li>index.html - https://pastebin.com/A0HFp6c5</li>
<li>inner.html - https://pastebin.com/ba6TNXK5</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[4 principles to help you learn more effectively]]></title><description><![CDATA[There are countless skills you could spend time mastering. Learning how to learn should make the top of your list though. If you are able to refine your ability to learn, the other skills will be a cinch. 
Gone are the days when the only way to get a...]]></description><link>https://blog.pavey.dev/4-principles-to-help-you-learn-more-effectively</link><guid isPermaLink="true">https://blog.pavey.dev/4-principles-to-help-you-learn-more-effectively</guid><category><![CDATA[Self Improvement ]]></category><category><![CDATA[General Programming]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Tue, 13 Oct 2020 10:59:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1602586771443/YxeW9vMbd.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There are countless skills you could spend time mastering. Learning how to learn should make the top of your list though. If you are able to refine your ability to learn, the other skills will be a cinch. </p>
<p>Gone are the days when the only way to get a quality education was via formal education institutes. Self-learning is bigger than ever, and it doesn't look to be going anywhere. This is thanks to the ubiquity of information provided by the internet. The vast wealth of quality information available online is mind-boggling. Having an effective method for gathering and synthesizing this information is crucial.</p>
<p>The following principles will help you to become a better student, and master the art of learning.</p>
<h2 id="have-a-goal">Have a goal</h2>
<p>Don't set some nebulous goal like "Learn to code" or "Learn about Finance". These are too vague and have no defined success criteria. The most important thing about sustainable learning is setting a goal, and keeping it in sight.</p>
<p>Define what success would look like for you, and work backwards from there. You can always adjust this as you go, it isn't set in stone. Instead of "Learn to code", be more specific. "Learn enough JavaScript to make my personal website". Instead of "Learn about Finance", how about "Learn enough about personal finance to understand and put in place an effective monthly budget".</p>
<p>Try to keep the scope of any single goal small so that it remains achievable. Don't decide to "Learn Nuclear Physics" and then give up after a week when you realise what a massive undertaking that is.</p>
<h2 id="know-how-you-will-use-this-information">Know how you will use this information</h2>
<p>Human brains are a funny thing. They are capable of storing vast amounts of information, but only when the circumstances are right.</p>
<p>Synapses are the physical representation of memory in your brain. They form and strengthen through use and repetition. To keep information and store it for long-term use, you need to build synapses. This process is easier when the information you are trying to store is relatable. If you are learning something new, with no frame of reference for how it will help you in the long run, or how it relates to what you already know, forming new synapses and linking this information into your existing memories will be harder.</p>
<p>To combat this, having a plan for how you will use this new information, and where it fits into your knowledge and skill set is important. If we take a look at the earlier example of "Learn enough JavaScript to make my personal website", we can see the context for this information right there in the goal. You want to make a website. You know what a website is and how they work from a high level,  but now you want to dig in and learn the inner workings. Having this frame of reference will allow you to construct a more robust mental model, and keep the information far easier than if you dive into the deep end and have no way to build the information upon what you already know.</p>
<h2 id="take-initiative">Take Initiative</h2>
<p>As with anything worth doing, the key to success is consistency. Nobody can learn for you or force you to learn. Your learning and development is your own responsibility. You may be fortunate enough to have resources made available to you to assist you in your endeavour. Some companies offer workplace L&amp;D programmes. If yours doesn't, don't fret. There are enough free and affordable resources available that it is a non-issue. One thing which you might be lacking is time. </p>
<p>A lot of us lead busy lives, and finding a chunk of time to dedicate to learning can be tricky. For some people, waking up at 4 am is an option. Maybe negotiating with your boss to dedicate some time to learning is a possibility. Whatever your situation, there is a way you can make it work. If you resolve to better yourself, you will find the way that works for you.</p>
<h2 id="everything-in-moderation">Everything in moderation</h2>
<p>Too much of anything is bad for you. This is true for physical exercise, and mental exercise too. Make sure that you balance your learning efforts with adequate rest and recovery time. We know synapses are important for forming and retaining memories and skills. Sleeping is an important part of the Synapse creation and maintenance process. When we sleep, our minds and bodies undergo important routines to make sure everything is in working order. Our brains clear out built-up waste products and strengthen new and existing synapses. Without sleep, your learning capacity plummets. Do not take time out of your sleep cycle to focus on learning, find the time somewhere else if you can.</p>
<p>This barely scratches the surface of the wonderful world of self-learning, but hopefully, it is enough to inspire you to take the leap, and actively work towards cultivating knowledge of your own accord.</p>
]]></content:encoded></item><item><title><![CDATA[Boost your coding productivity with these 5 simple tactics]]></title><description><![CDATA[As a developer, your productivity is not gauged by how much code you churn out, but by how much value you deliver. Gone are the days where lines of code are a worthwhile performance metric. If you want to master your craft and hone your productivity,...]]></description><link>https://blog.pavey.dev/boost-your-coding-productivity-with-these-5-simple-tactics</link><guid isPermaLink="true">https://blog.pavey.dev/boost-your-coding-productivity-with-these-5-simple-tactics</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Tue, 04 Aug 2020 14:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1597578012568/cMEYPqbKC.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As a developer, your productivity is not gauged by how much code you churn out, but by how much value you deliver. Gone are the days where lines of code are a worthwhile performance metric. If you want to master your craft and hone your productivity, you will need to embrace the age-old adage — “Work smarter, not harder”.</p>
<p>These are 5 methods and principles you can employ today to start seeing immediate returns in your productivity.</p>
<h2 id="be-deliberate-in-what-you-want-to-achieve">Be deliberate in what you want to achieve</h2>
<p>There is no way to know how productive you are if you have nothing to measure against. One of the biggest boosts to productivity you can get without having to do much at all is to set deliberate goals for what you want to do today and this week.</p>
<p>At the start of each week, take a moment to think about 3 things you want to have ticked off by the end of Friday. These should be high-level items, and your daily objectives will help you meet these goals.</p>
<p>At the start of each day, consider what you have accomplished so far this week, and what you would need to do today to stay on track. Write down 3 objectives somewhere (I prefer a physical medium, but apps like Sunsama work great for this too). As you go through the day, when you finish a goal, tick off the item.</p>
<p>It can take a bit of calibration to get a good feel for how big these tasks should be. I found myself writing down far too much at first. I was lucky if I was able to finish the first item on the list. After about a week of tweaking, I’ve reached a scope that works well for me. This technique is invaluable when it comes to projecting how much work I will get done in a week, and making it happen.</p>
<h2 id="don-t-write-perfect-code">Don’t write perfect code</h2>
<p>Not straight away, at least. Many developers have fallen prey to the temptation to write perfect code in a single go. It rarely happens. Think of writing code the same way you would draw a picture. Start with a rough outline of what you want, and iteratively add details until you end up with something great.</p>
<p>Leonardo da Vinci didn’t paint the Mona Lisa by perfecting her head before moving on to her neck, he worked through countless iterative refinements over the whole image.</p>
<p>A good principle to help remember this is the “3 E’s of code”</p>
<ul>
<li>Effective — Write the code solve the problem</li>
<li>Efficient — Improve the code to make it more optimised</li>
<li>Elegant — Refine the code to make it beautiful (don’t skip this step. Efficient code isn’t worth much if no one can read it)</li>
</ul>
<p>In that order. Don’t start the next step until the previous one is complete.</p>
<p>This methodology ties in well with the next point.</p>
<h2 id="use-tdd-wherever-you-can">Use TDD wherever you can</h2>
<p>Test-Driven Development is great. It is basically a free productivity boost. Writing your tests as you go and refactoring code once it passes fits in perfect lock-step with the 3 E’s mentioned above. Don’t write your tests after you are finished with the code. If you do this, one of two things are likely to happen:</p>
<ol>
<li>You will be told to skip the tests and move on</li>
<li>If you do write the tests, you will base them on the output of the code, and if you have bugs, so will the tests</li>
</ol>
<p>Writing tests as specifications — distilled business requirements — ensures that your code is working as you write it and that the testing cannot be skipped. This results in higher quality work, fewer bugs, and less cause to come back and rework things later. If that isn’t a productivity gain, I don’t know what is.</p>
<h2 id="work-in-batches">Work in batches</h2>
<p>A fact of life for most jobs is that you will often receive small tasks which people ask you to do. Being a developer is no different, and depending on your role you might get a couple of these a week, or dozens of them per day!</p>
<p>The key thing here is that many of these tasks are not urgent at all, and can be delayed without any adverse impact. If you delay enough similar tasks, you will be able to group them all together and action them all at once. This approach of doing the work in batches has various benefits. On the one hand, you are reducing the amount of context-switching you do, so you will naturally get productivity gains there. You will also be able to consolidate the setup and teardown overhead associated with small tasks. In most cases, the setup work required to do one task is the same as the work required to do 10 similar tasks. consolidating this overhead can save you a lot of time which could be better spent elsewhere.</p>
<h2 id="be-relentless">Be Relentless</h2>
<p>Perhaps the most important thing when it comes to getting stuff done. Sometimes you have to just power through. Using the other tactics described above will put you in a position to identify the work which needs to be done, and give you tools to do it efficiently, but at the end of the day, you just have to do it. I set myself a hard requirement of AT LEAST checking off the first item on my 3 item list every day. On good days I can get two or three high-level items checked off, but if you check off one meaningful objective each day — as long as you have set yourself valuable targets — you will be smashing out work and ticking boxes like nobody’s business.</p>
]]></content:encoded></item><item><title><![CDATA[Why Code Consistency is Important]]></title><description><![CDATA[When it comes to your codebase, one of the most significant indicators of overall quality is consistency. Consistency of patterns, style, naming, libraries — every part of your system needs to be considered, and carefully designed with consistency in...]]></description><link>https://blog.pavey.dev/why-code-consistency-is-important</link><guid isPermaLink="true">https://blog.pavey.dev/why-code-consistency-is-important</guid><category><![CDATA[Software Engineering]]></category><category><![CDATA[clean code]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Thu, 16 Jul 2020 12:18:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1597580355908/Awvd0GKam.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When it comes to your codebase, one of the most significant indicators of overall quality is consistency. Consistency of patterns, style, naming, libraries — every part of your system needs to be considered, and carefully designed with consistency in mind.</p>
<h1 id="why-is-consistency-important-">Why is consistency important?</h1>
<p>Consistency is crucial when it comes to code quality because consistency leads to predictability. A solution with a high degree of quality will be predictable in the way it functions. You will be able to look at code, and without any domain knowledge, you should have a pretty good idea what’s going on. To quote Robert C. Martin — author of the excellent “Clean Code” — “You know you are working on clean code when each routine turns out to be pretty much what you expected”.</p>
<p>Many aspects inform the predictability of the code. One of the most commonly focused aspects — with good reason — is tests and testability. Tests can be considered the ultimate manifestation of predictability. They describe the behaviour of the code to the reader in a reliable way. It provides predictability in the extreme, which is why tests are so valued.</p>
<p>Consistency has a similar effect. When your code has standard naming conventions, consistent indenting and spacing, and standardised architecture and interface, It is easier to work with and can be developed faster, and with greater confidence.</p>
<h1 id="how-can-consistency-be-improved-">How can consistency be improved?</h1>
<p>There are several vital factors which you can focus on when it comes to improving code quality through consistency.</p>
<h2 id="spacing-and-indenting">Spacing and Indenting</h2>
<p>This one might seem reasonably benign — especially in languages like PHP and JavaScript where the spacing and indenting don’t have any functional impact — but do not underestimate the benefits of well-formatted code. When code is formatted consistently, the readers get the advantage of being able to read and understand the code with greater ease. This benefit is the same one you get when you read a well-structured webpage or article. The visual flow of information — while not affecting the content directly — changes the way the data is perceived and ingested. Consider this first example:</p>
<img src="https://miro.medium.com/max/2720/1*qDyheqbqqAstUXgKBbuC4A.png" />

<p>JavaScript without whitespace and indenting</p>
<p>A simple example, but already we can see that with the formatting stripped away, it is hard to read at a glance. Let’s see what happens when we add some spaces.</p>
<img src="https://miro.medium.com/max/2720/1*y55siMy8T7e6hgYdIH2kOw.png" />

<p>Just like syntax highlighting, spacing and indenting can convey meaning. It can tell the viewer about how the code they are looking at will behave, but only if you let it. This aspect of code style is very subjective, so work with your team to find a spacing and indenting style which everyone is happy with, and strictly enforce it with tools like eslint, or whatever linting tool supports your language of choice.</p>
<h2 id="variable-naming-and-casing">Variable Naming and Casing</h2>
<p>There are many different ways to name variables. From the hard to understand single-letter variables, through semantically named variables, there is a lot to consider.</p>
<p>The most important thing here is once again consistency. Work with your team to identify a standard which everyone is happy to follow. Don’t let this be a single person’s decision. It doesn’t matter how good your standards and style guides are if everyone hates following them.</p>
<p>Choose a casing style and stick to it. Don’t go around mixing snake_case and camelCase. It will be confusing and hard to follow in the long run. If most of your code has snake_case variables, and then just one variable is declared in camelCase, you might spend an undue amount of time trying to understand why this variable is unique, when at the end of the day there is no reason aside from inconsistency.</p>
<h2 id="architecture">Architecture</h2>
<p>Consistent architecture is a vital part of building quality into your solution. As mentioned above, the key benefit of being consistent is having things work pretty much how you would expect. It makes systems safe to depend on, and it makes it easier to make educated guesses about how the system works. Being able to make these educated guesses about how parts of the project will come together is crucial.</p>
<p>If you look at one part of the system and come to understand it, you might assume that other analogous parts of the system would follow the same rules. If you delve into these other systems only to discover that they are inconsistent, that is no good at all.</p>
<p>Consistent architecture is the sort of thing that needs to be planned. If you try to free-style it, you will likely end up with an inconsistent amalgamation of different patterns which don’t necessarily blend. To avoid this unfortunate state, you should have a pretty good idea what sort of application architecture you are going to go with before you start writing code. In this instance, it also doesn’t hurt to record architectural decisions using something like the aptly named <a href="https://github.com/joelparkerhenderson/architecture_decision_record">Architectural Decision Records (ADR)</a>. This acts as a sort of documentation for the architecture and can help explain to others further down the line why particular decisions were made, what alternatives were considered, and other useful fragments of information like this.</p>
<p>Consistency leads to predictability, reliability, and ultimately quality. If you care about quality code, consistency in everything you do should be your first port of call.</p>
]]></content:encoded></item><item><title><![CDATA[Principles for more effective Code Reviews]]></title><description><![CDATA[For many software companies, code reviews are an essential part of the project lifecycle. Code reviews allow us to have multiple sets of eyes over a piece of code before testing and deployment. Quite often, the reviewers will raise feedback to the au...]]></description><link>https://blog.pavey.dev/principles-for-more-effective-code-reviews</link><guid isPermaLink="true">https://blog.pavey.dev/principles-for-more-effective-code-reviews</guid><category><![CDATA[project management]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[code review]]></category><category><![CDATA[Collaboration]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Fri, 03 Jul 2020 12:15:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1597580263652/e-na-LDWQ.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>For many software companies, code reviews are an essential part of the project lifecycle. Code reviews allow us to have multiple sets of eyes over a piece of code before testing and deployment. Quite often, the reviewers will raise feedback to the author, noting areas of the newly added or changed code which could be improved, or potentially even flagging issues before the code is ever run.</p>
<p>Effective code reviews require striking a careful balance between technology and communication. Proper consideration needs to be given to the code, and any quality or functionality issues. Identifying issues is all well and good, but if you cannot deliver the feedback effectively and respectfully, it might do more harm than good to your team cohesion. The point of a code review is not to show that you are smarter than the other person, or to point out everything they did wrong. At its core, a code review is a collaborative process, and a quality filter to ensure that your team’s outputs are as good as they can be. After all, no one produces perfect work, no matter how much experience they have.</p>
<p>How, then, can we structure our code reviews to ensure that people are respected, and feedback is heard? The following is a set of soft principles which I have found to be effective when giving and receiving code review feedback. These aren’t silver bullets, and your mileage may vary.</p>
<h1 id="us-against-the-problem">Us against the problem</h1>
<p>A principle which is more often applied to relationship advice, using this to frame all of your feedback is very effective. Your feedback should not target the author personally; it should target the issue in the code itself. Rather than writing “<strong>You</strong> did this wrong”, flip it around and focus on the problem itself. Of course, even if you do flip it around, it isn’t constructive to say “This is wrong”, which leads us to our next point.</p>
<h1 id="offer-a-solution-not-just-a-problem">Offer a solution, not just a problem</h1>
<p>“This is wrong” is pretty much the epitome of unhelpful. Of course, in some cases, it might be something simple like a typo, but sometimes you will encounter implementation issues where the approach in question will not work. In these cases, it is important to offer a potential solution to the problem. After all, if the author knew the “correct” way of doing it, chances are if it is a deeper issue than a typo, they probably wouldn’t have included the issue in the first place. For this reason, rather than “This is wrong”, it is preferable to take the time to provide extra detail around why you believe it is an issue, and how it could potentially be solved. A potential piece of feedback following this principle might look something like “This will not work because of {reason}. Instead, consider {alternative}”.</p>
<h1 id="keep-pull-requests-short">Keep pull requests short</h1>
<p>Ask any people-manager, giving good feedback is time-consuming. One issue which you have likely noticed if you’ve been involved with a variety of code reviews is that long pull requests don’t tend to get the same level of care and thought as their short counterparts. This isn’t always the case of course, but it is hard to argue against the fact that it is easier to give in-depth feedback on a small diff of say 60 lines than it would be to review one of 600 lines.</p>
<p>Naturally, all 600 of those lines are going to need to be reviewed at some point. By following good ticket and branch management processes, and decomposing work to small enough chunks, you can significantly reduce the cognitive burden of any given code review, which will result in more focus, and high-quality feedback.</p>
<h1 id="not-only-criticism">Not only criticism</h1>
<p>At its core, code reviews are essential feedback sessions. Because of this, you should avoid only ever giving critical feedback. Critical feedback is so vital to personal growth because it highlights what we can improve and do better, but it is only one side of the equation. To be an effective giver of feedback, you also need to offer praise when people do good things, which they should continue doing. To this end, when you see something particularly noteworthy in a code review, it can be a great idea to flag it as being well done.</p>
<p>Do note that the other principles still apply here. Do not praise the author directly. Telling someone “you’re great” is not good praise, because being great is not something which someone can do more of explicitly. Instead, focus on what they did and why it is noteworthy. Flagging someone’s approach to solving a particular problem and saying “I like this solution because {reason}, good work” is vastly more helpful, because it focuses on what the author has done, rather than who or what they are. Keep your praise — and your criticism — centred on the output, and the situation. Don’t make it personal in either case.</p>
<h1 id="don-t-be-a-dictator">Don’t be a dictator</h1>
<p>Developers are opinionated. They like doing things their way, and a lot of the time they don’t like the alternatives (look at vim and emacs). These opinions can become an issue when it comes time for code reviews if there aren’t some established boundaries around how feedback should be applied. I follow the idea that bugs and functionality issues are blocking issues, and I won’t approve a code review while these issues persist. On the other hand, if I raise feedback and it is something opinionated or subjective, It is reasonable for the recipient to reject the feedback in a lot of cases (unless it goes against your code standards or negatively affects code quality).</p>
<p>To effectively apply this point, the language you use in your comments will be pivotal. If someone has done something which you subjectively thing could be better, don’t tell them to change it, instead, prompt them to see if they would consider making a change. They might be open to the idea, and didn’t know the solution you do, so try phrasing your comments like “consider doing it this way instead, because {reason}”, rather than “change this because {reason}”.</p>
<p>If you don’t have code standards around this particular issue, and it isn’t technically wrong, they don’t have to change it, but you can still raise it if you think there is room for improvement.</p>
<h1 id="everyone-has-a-say">Everyone has a say</h1>
<p>As mentioned at the start, these are my personal preferences, and you might like some of them, you might hate them. This one is pretty important, in any case. Code reviews are a team process. It doesn’t matter how great and well designed your processes are if the people who have to follow them hate doing so. Creating the code review process and setting the parameters of what is acceptable and what isn’t should be a collaborative process. Everyone affected should have a say, and the process should be open to review and revision regularly. Designing the code review process as a team will ensure that you end up with a process which everyone understands, and is happy to follow.</p>
<p>These are just a few principles which I have found to be very useful in code reviews. Generally, if everyone approaches code reviews with mutual respect, and a desire to make the code as good as it can be, the benefits you will get from the whole process will be greater than if everyone tries to push their code-style agendas. Do you have any excellent code review tips I haven’t covered? Please leave them in the comments below!</p>
]]></content:encoded></item><item><title><![CDATA[Measuring for Performance in Software Delivery]]></title><description><![CDATA[When it comes to the delivery of software projects, the adoption of the scientific method is becoming more and more prevalent. This means that we are ever increasingly trying to base our decisions on data, and to do that, we need to collect data. Lot...]]></description><link>https://blog.pavey.dev/measuring-for-performance-in-software-delivery</link><guid isPermaLink="true">https://blog.pavey.dev/measuring-for-performance-in-software-delivery</guid><category><![CDATA[software development]]></category><category><![CDATA[project management]]></category><category><![CDATA[performance]]></category><category><![CDATA[agile development]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sat, 27 Jun 2020 12:01:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1597579301174/xyPnA9tIU.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When it comes to the delivery of software projects, the adoption of the scientific method is becoming more and more prevalent. This means that we are ever increasingly trying to base our decisions on data, and to do that, we need to collect data. Lots of it. We generally do this by tracking metrics produced as byproducts of the work we perform, and almost inevitably, some of these metrics are used to measure our performance.</p>
<p>According to Goodhart’s law, “When a measure becomes a target, it ceases to be a good measure”. One fantastic example of this would be using a team’s velocity — something which is traditionally measured — as a target. Following Goodhart’s law, velocity is very likely to rapidly become meaningless, as teams provide artificially bloated estimates so that their velocity is perceived as being higher than it would be with more “honest” estimates. If you are measuring something which can be manipulated, and treating it as a target, it will invariantly be manipulated.</p>
<p>Another example of a potentially lousy target metric is Utilisation. Of course, you don’t want your team to be under-utilised, but Utilisation above a certain point has a negative effect. Queue Theory tells us that as Utilisation approaches 100%, Lead Time approaches infinity, and this holds for software teams as well. If your planned work consumes 100% of your team’s capacity, what happens when unplanned work pops up? When your ultimate goal is to get software out, an arbitrarily long lead time is not ideal.</p>
<p>What, then, are we to measure? And what are we to use as targets? The following are a set of metrics which through research conducted by Forsgren et al. (2018) have proven to be reliable indicators of high performing teams, without falling prey to Goodhart’s law.</p>
<ul>
<li>Lead Time: The amount of time it takes to get a piece of work from the backlog, into production.</li>
<li>Deployment Frequency: How often your team releases new code into a production environment.</li>
<li>Time to restore: In the event of an outage, the amount of time it takes for all systems to restore to working order.</li>
<li>Change fail rate: The frequency with which changes pushed to production result in a fault.</li>
</ul>
<p>Another essential step in moving towards a more data-driven culture for your team is to make these metrics clearly visible for all to see. Put your metrics up on the wall, post them in slack on a schedule, do whatever you have to do to get the data into the spotlight. Constantly visibility of data informs decisions. If your data is trending in the wrong direction, this is an indicator that something needs to change.</p>
<p>There is a strong correlation between teams which were determined to be “high performers” and teams who adopted Lean management practices. Forsgren notes “At the heart of Lean management is giving employees the necessary time and resources to improve their own work. This means creating a work environment that supports experimentation, failure, and learning, and allows employees to make decisions that affect their jobs.”</p>
<p>It is worth noting that the targets described above are made more attainable by Agile and Lean approaches, such as reducing batch sizes. Reduced batch sizes offer multiple benefits, including shortened cycle times, more frequent feedback, decreased risk (and ease of reverting if something does go wrong).</p>
<p>When it comes to software, what do you measure? What have you had success with, and what have you moved away from? Leave your thoughts in the comments.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Types; Static vs Dynamic, & Strong vs Weak.]]></title><description><![CDATA[Generally speaking, when talking about programming languages, most — if not all — languages can be classified by where they fall in a quadrant, with one axis containing Static and Dynamic typing, and the other containing Strong and Weak typing. But w...]]></description><link>https://blog.pavey.dev/understanding-types-static-vs-dynamic-strong-vs-weak</link><guid isPermaLink="true">https://blog.pavey.dev/understanding-types-static-vs-dynamic-strong-vs-weak</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Python]]></category><category><![CDATA[PHP]]></category><category><![CDATA[TypeScript]]></category><dc:creator><![CDATA[Cameron Pavey]]></dc:creator><pubDate>Sat, 23 Feb 2019 13:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1597581340167/q9NNUHrze.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Generally speaking, when talking about programming languages, most — if not all — languages can be classified by where they fall in a quadrant, with one axis containing Static and Dynamic typing, and the other containing Strong and Weak typing. But what do these terms mean?</p>
<h2 id="static-typing">Static Typing</h2>
<p>Essentially, static typing means that variable types are checked at “compile-time”, or before the code is executed.</p>
<p>Let’s look at an example in TypeScript:</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">foo</span>(<span class="hljs-params">a: number</span>) </span>{
    <span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span>(a) === <span class="hljs-string">'number'</span>) {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'number'</span>;
    } <span class="hljs-keyword">else</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'not number'</span>;
    }
}foo(<span class="hljs-number">1</span>);
foo(<span class="hljs-string">'1'</span>); <span class="hljs-comment">// this will throw a compiler error, because it is not a number</span>
</code></pre><p>Attempting to pass a string into the function <code>foo</code> after explicitly stating it accepts numbers, would cause it to throw an error such as</p>
<pre><code>Argument <span class="hljs-keyword">of</span> <span class="hljs-keyword">type</span> <span class="hljs-string">'"1"'</span> <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> assignable <span class="hljs-keyword">to</span> parameter <span class="hljs-keyword">of</span> <span class="hljs-keyword">type</span> <span class="hljs-string">'number'</span>.
</code></pre><h2 id="dynamic-typing">Dynamic Typing</h2>
<p>On the other hand, dynamic typing means that the variables’ types are checked on the fly, as the code is executed. Consider the following PHP code.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">foo</span>(<span class="hljs-params">$a</span>) </span>{
    <span class="hljs-keyword">if</span> (gettype($a) === <span class="hljs-string">'integer'</span>) {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'integer'</span>;
    } <span class="hljs-keyword">else</span> {
        <span class="hljs-comment">// This will never be evaluated</span>
        <span class="hljs-keyword">return</span> <span class="hljs-string">'not integer'</span>;
    }
}

<span class="hljs-keyword">echo</span> foo(<span class="hljs-number">1</span>); <span class="hljs-comment">// integer</span>
</code></pre><p>Depending on what value is passed into the function <code>foo</code>, the variable <code>$a</code> could technically be any type, and it is only known which one when the code is executed.</p>
<p>On the other axis of our Types quadrant, we have Strong and Weak typing. This is a bit more confusing because there is no universal consensus on what these terms mean, even though they get thrown around a lot. That being said, let’s try to understand them.</p>
<h2 id="strongly-typed">Strongly Typed</h2>
<p>A lot of — but not all — developers agree that the essence of a strongly typed language is the fact that it converts a variable or value’s type to suit the current situation automatically. This means the <code>"123"</code> is always treated as a string and is never used as a number without manual conversion or intervention. Consider the following Python code:</p>
<pre><code><span class="hljs-attr">z</span> = x + y<span class="hljs-comment">; // This will fail</span>
</code></pre><p>This fails and returns the following error:</p>
<pre><code>Traceback (most recent <span class="hljs-keyword">call</span> last):
  File "main.py", <span class="hljs-type">line</span> <span class="hljs-number">3</span>, <span class="hljs-keyword">in</span> &lt;module&gt;
    z = x + y;
TypeError: unsupported operand <span class="hljs-keyword">type</span>(s) <span class="hljs-keyword">for</span> +: <span class="hljs-string">'int'</span> <span class="hljs-keyword">and</span> <span class="hljs-string">'str'</span>
</code></pre><p>This is because the two variables which we tried to add together and assign to <code>z</code> were different types, and as the error says, adding an int and a string is not supported.</p>
<h2 id="weakly-typed">Weakly Typed</h2>
<p>A weakly typed language is — as you might expect — the opposite of what is described above. The interpreter or compiler attempts to make the best of what it is given by using variables in ways that might seem confusing at first, but make sense once we understand what they are doing.</p>
<p>This means that in some situations — for example — an integer might be treated as if it were a string to suit the context of the situation.</p>
<p>To demonstrate, let’s try the above example again in a weakly typed language, like JavaScript:</p>
<pre><code><span class="hljs-keyword">const</span> z = x + y; <span class="hljs-comment">// 12</span>
</code></pre><p>Note that this returned 12, instead of 3. This is because rather than performing a math operation as we requested, it treated both values as strings, and concatenated them together, resulting in the string “12”.</p>
<hr />
<h2 id="wrapping-up">Wrapping up</h2>
<p>Hopefully, this sheds some light on the minutia of language typing systems for those who do not already know. This is just a fundamental summary, and there is, of course, a lot more to it, but this should hopefully be a good starting point in understanding the finer details of your favourite programming languages.</p>
]]></content:encoded></item></channel></rss>