<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Enoch Chejieh on Medium]]></title>
        <description><![CDATA[Stories by Enoch Chejieh on Medium]]></description>
        <link>https://medium.com/@enoch-chejieh?source=rss-330c3c6bfc74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VfzOfUD1Ax2yw0miYJeGTw.png</url>
            <title>Stories by Enoch Chejieh on Medium</title>
            <link>https://medium.com/@enoch-chejieh?source=rss-330c3c6bfc74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:31:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enoch-chejieh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[PYR: My Year in Review (2022)]]></title>
            <link>https://enoch-chejieh.medium.com/pyr-my-year-in-review-2022-864af7f6ed5c?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/864af7f6ed5c</guid>
            <category><![CDATA[year-in-review]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[career-advice]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Fri, 06 Jan 2023 08:35:51 GMT</pubDate>
            <atom:updated>2023-01-06T08:35:51.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WoaeqMm3mASlH2OtsD1kuw.jpeg" /></figure><p>I decided to write a <strong>Past Year Review</strong> (PYR). I got the idea from an <a href="https://medium.com/@chriscordry/ive-done-tim-ferriss-s-past-year-review-for-5-years-here-are-22-lessons-i-learned-cfd0fb0492a1">article</a> I read, which was inspired by Tim Ferriss. It’s about reflecting on the year you had and distilling lessons that you can learn from and serve as your to-do and not-to-do list in the years to come. The year came with its accomplishments and failures, which I would be happy to share some of.</p><h4>Lessons 🌝</h4><p>As I sit here and reflect on all of my failures, I can’t help but think about how they are just stepping stones to ultimate success. And let’s be real, nobody ever became a ‘somebody’ without experiencing a whole bunch of failures along the way.</p><p>But seriously, I believe that failures are simply opportunities to learn and grow. I discovered that multitasking just doesn’t work for me. I mean, how do people do it? Do they have like, two brains or something? 🦦 Anyway, I learned that focusing on one thing at a time just works better for me. As a result, I wasn’t able to write as much or fully dive into learning a framework called Substrate, which is a tool for building blockchains. But hey, at least now I know to stick to my one-thing-at-a-time strategy.</p><p>Overall, I’m not letting these failures get me down. Instead, I’m using them as motivation to keep pushing forward and working towards my goals.</p><h4>Travel</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YsxceezXxN51P4VdG4ttsQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XBfA3A39b6NJoAIwciVAzg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAIpNJ0T71KRc_aq6ARhiA.jpeg" /></figure><p>As the year was coming to a close, I decided to take a trip to the beautiful country of <strong>Benin Republic</strong> with a few of my friends. At first, I wasn’t sure if I wanted to go, but I’m so glad I did because it ended up being an incredible experience. From exploring the vibrant markets to soaking up the rich culture, every moment was filled with adventure. And if there’s one thing I’ve learned from this trip, it’s that I have a true passion for <strong>traveling and experiencing all that the world has to offer</strong>. I can’t wait to see where my wanderlust will take me next!</p><h4>Speaking</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QN3gsG4KOcJQJHu3UqpHg.png" /></figure><p>I am grateful to have had the opportunity to speak at my first tech event earlier this year. You know that saying “everything you want in life is on the other side of fear”, it’s true. And I’m happy to say that it was a great experience overall. I am definitely looking forward to speaking at more events in the years to come, and I hope to have the opportunity to speak internationally as well.</p><h4>Amazing People</h4><p>Okay, okay, this is about to get a little bit sappy. I’m grateful for the experiences I had this year, the good and the bad. I’m glad I met a lot of amazing people along the way who I would love to give credit to because they are awesome, but if I decided to write everyone’s name, this section will be quite long. So thank you, my family and friends, you guys rock!!!</p><h4>Books</h4><p>In terms of books, I read/listened to a few great ones this year. Some of them were:</p><ul><li>Principles by Ray Dalio.</li><li>The Art Of War.</li><li>Never Split the Difference: Negotiating As If Your Life Depended On It.</li><li>The Infinite Machine by Camila Russo.</li><li>Sam Walton: Made In America.</li></ul><h4>Quotes</h4><p>There are so many great quotes out there that have had a profound impact on my life. Here are just a few that come to mind:</p><ul><li>Ultimately it’s not what you get or even what you give, but who you become. — <strong>Mary Gates</strong></li><li>Twenty years from now you will be more disappointed by the things that you didn’t do than by the ones that you did do. — <strong>Mark Twain</strong></li><li>I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain. — <strong>Frank Herbert</strong></li></ul><p>Hold your horses kids! We’re not done yet. One last lesson from Uncle Enoch: beware of the paradox of choice. Pick something and go for it — don’t waste so much time thinking about whether it’s the “right” one. Just do it, and if it doesn’t work out, try again with something else. :).</p><p>I hope you enjoyed my short ramble. I know I sure did — I always have a blast talking about myself. Anyway, I’m really looking forward to the years to come and all the adventures that are in store. I have a feeling it’s going to be one big great adventure. So let’s get it!</p><p>Want to connect? I’m open to opportunities and you can find me on <a href="https://www.linkedin.com/in/enoch-chejieh/">LinkedIn</a> and <a href="https://github.com/ecj222">GitHub</a>, or simply shoot me an email, and I’ll respond.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=864af7f6ed5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enjoying the journey]]></title>
            <link>https://enoch-chejieh.medium.com/enjoying-the-journey-ffeecbc499f5?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffeecbc499f5</guid>
            <category><![CDATA[skills]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[fun]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Mon, 21 Nov 2022 20:32:46 GMT</pubDate>
            <atom:updated>2022-11-21T20:33:17.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Sunsetting" src="https://cdn-images-1.medium.com/max/1024/1*-b3pqBbLsRdL3ambgfIPKg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/sYPWWliPQuk"><strong>Lilith</strong></a></figcaption></figure><p>Writing has always been a form of expression, something to express one’s self, I got into writing at the beginning of 2021 from the advice given to me by a friend of mine, It was amazing. The moment I finished writing an article, I get a hit of dopamine like a drug. I first got started writing mainly technical articles which in my opinion are great and I recommend any Software engineer to do this. Honestly writing has been a great skill to have, from writing documentation, creating technical articles, or simply just composing a concise email.</p><p>Writing is one of those things you never knew you would like until you tried it, I think the most important thing you can learn from this article is to try multiple things till you find that one thing that sticks. If it helps, you can adopt this mindset to get started doing the hard things ;).</p><blockquote>It might be fun…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffeecbc499f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a blockchain from scratch in Rust]]></title>
            <link>https://coinsbench.com/how-to-build-a-blockchain-from-scratch-in-rust-9cedb59f8897?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cedb59f8897</guid>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[rust-programming-language]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Sun, 02 Jan 2022 20:57:42 GMT</pubDate>
            <atom:updated>2022-01-04T05:50:38.472Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFblvLyavwG-IxU8szuLEg.png" /></figure><p>2021 was a huge year for cryptocurrencies, NFT’s, and decentralized applications (DAPPs), and 2022 will be even bigger. Blockchain is the underlying technology behind all these technologies.</p><p>Blockchain technology has the potential to change nearly every aspect of our lives from the Finance industry, Travel &amp; mobility, Infrastructures, Healthcare, Public sector, Retail, Agriculture &amp; mining, Education, Communication, Entertainment, and more.</p><blockquote>Every smart person that I admire in the world has a reason. They understand that this is the driving force of the fourth industrial revolution: steam engine, electricity, then the microchip — blockchain and crypto is the fourth.</blockquote><blockquote>— Brock Pierce</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSK5pC4ZIM5AhIY63IDjXA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@theshubhamdhage">Shubham Dhage</a> from <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><h4>What is a blockchain?</h4><p>A blockchain is a decentralized ledger of transactions across a peer-to-peer network, you can also think of a blockchain like a decentralized database that is immutable. A blockchain can be broken down fundamentally into several components e.g Node, Transaction, Block, Chain, and The consensus protocol (proof of work, proof of stake, proof of history).</p><p>If you are anything like me, you learn by building. Now the reason I’m writing this article is to give you a basic overview of how blockchains work by building a blockchain with Rust.</p><p>Sounds good? Let’s get to it.</p><h3>Getting Started</h3><p>Let us start by creating a new Rust project:</p><pre>cargo +nightly new blockchain</pre><p>Change to the directory you just created:</p><pre>cd blockchain</pre><p>Let’s add the necessary packages we need to build a blockchain:</p><pre>[dependencies]</pre><pre>chrono = &quot;0.4&quot;</pre><pre>serde = { version = &quot;1.0.106&quot;, features = [&quot;derive&quot;] }</pre><pre>serde_json = &quot;1.0&quot;</pre><pre>sha2 = &quot;0.10.0&quot;</pre><p>Next, create folder called models, that’s where you will keep most of your blockchain logic. In that folder create two (2) files called blockchain.rs and block.rs.</p><p>Import the following packages in both of the files and save them:</p><p>Blockchain.rs</p><pre>use chrono::prelude::*;</pre><pre>// Internal module</pre><pre>use super::block::Block;</pre><p>Block.rs</p><pre>use super::blockchain::Blockchain;</pre><pre>use chrono::prelude::*;</pre><pre>use sha2::{Sha256, Digest};</pre><pre>use serde::{Deserialize, Serialize};</pre><p>If you noticed we imported use super::block::Block; in our blockchain.rs file, we are just importing the struct located in our block.rs file here, don’t worry I will explain that a bit later.</p><p>After we have imported the necessary packages let’s create a type in our blockchain.rs file called Blocks:</p><pre>type Blocks = Vec&lt;Block&gt;;</pre><p>Next, let’s create a Blockchain type in blockchain.rs and an empty implementation for our Blockchain type:</p><pre>// `Blockchain` A struct that represents the blockchain.</pre><pre>#[derive(Debug)]</pre><pre>pub struct Blockchain {<br>  // The first block to be added to the chain.</pre><pre>  pub genesis_block: Block,</pre><pre>  // The storage for blocks.</pre><pre>  pub chain: Blocks,</pre><pre>  // Minimum amount of work required to validate a block.</pre><pre>  pub difficulty: usize</pre><pre>}</pre><pre>impl Blockchain {}</pre><p>Next, let’s create a Block type in block.rs and an empty implementation for our Block type:</p><pre>// `Block`, A struct that represents a block in a Blockchain.</pre><pre>#[derive(Debug, Clone, Serialize, Deserialize)]</pre><pre>pub struct Block {</pre><pre>   // The index in which the current block is stored.</pre><pre>   pub index: u64,</pre><pre>   // The time the current block is created.</pre><pre>   pub timestamp: u64,<br>   <br>   // The block&#39;s proof of work.</pre><pre>   pub proof_of_work: u64,</pre><pre>   // The previous block hash.</pre><pre>   pub previous_hash: String,</pre><pre>   // The current block hash.</pre><pre>   pub hash: String</pre><pre>}</pre><pre>impl Block {}</pre><h3>Creating the genesis block:</h3><p>The genesis block is the first block created in a blockchain. Let’s create a function that creates a genesis block for our blockchain and returns a new instance of the Blockchain type.</p><p>Add the following code in our Blockchain implementation in blockchain.rs:</p><pre>impl Blockchain {<br>   pub fn new(difficulty: usize) -&gt; Self {</pre><pre>     // First block in the chain.</pre><pre>     let mut genesis_block = Block {</pre><pre>        index: 0,</pre><pre>        timestamp: Utc::now().timestamp_millis() as u64,</pre><pre>        proof_of_work: u64::default(),</pre><pre>        previous_hash: String::default(),</pre><pre>        hash: String::default()</pre><pre>     };</pre><pre>     // Create chain starting from the genesis chain.</pre><pre>     let mut chain = Vec::new();</pre><pre>     chain.push(genesis_block.clone());</pre><pre>     // Create a blockchain Instance.</pre><pre>     let blockchain = Blockchain {</pre><pre>        genesis_block,</pre><pre>        chain,</pre><pre>        difficulty</pre><pre>     };<br></pre><pre>     blockchain</pre><pre>   }</pre><pre>}</pre><p>In the code above, we did the following:</p><ul><li>Created our genesis_blockinstance.</li><li>Added the genesis_block we created to the chain in our Blockchain type.</li><li>Returned an instance of the Blockchain type.</li></ul><p>In the genesis_block instance we created, notice how we set our previous_hash key to an empty string value (String::default()) that’s because there would be no previous block since the genesis block is the first block in the blockchain.</p><p>Also notice we made the hash of our genesis_block to be an empty string (“”) that’s because we haven’t calculated the hash value for our genesis block yet.</p><h3>Generating the hash of a block</h3><p>A hash is generated with the help of cryptography and current information present in the block.</p><p>Let’s create a function in our block implementation in theblock.rs file we created called calculate_hash() :</p><pre>// Calculate block hash.</pre><pre>pub fn calculate_hash(&amp;self) -&gt; String {</pre><pre>  let mut block_data = self.clone();</pre><pre>  block_data.hash = String::default();</pre><pre>  let serialized_block_data = serde_json::to_string(&amp;block_data).unwrap();</pre><pre>  // Calculate and return SHA-256 hash value.</pre><pre>  let mut hasher = Sha256::new();</pre><pre>  hasher.update(serialized_block_data);<br></pre><pre>  let result = hasher.finalize();</pre><pre>  format!(&quot;{:x}&quot;, result)</pre><pre>}</pre><p>In the code above, we did the following:</p><ul><li>Converted the block’s data to JSON format.</li><li>Hashed the block’s data with the SHA256 algorithm.</li><li>Returned the hashing result in base16.</li></ul><h3>Creating a new block</h3><p>Great!, we have implemented functionalities for creating our genesis block and calculating the block hashes of our blocks.</p><p>Now let’s add the functionality for adding new blocks to the blockchain, in our blockchain.rs file add this function to the Blockchain type implementation:</p><pre>pub fn add_block(&amp;mut self, nonce: String) {</pre><pre>  let new_block = Block::new(</pre><pre>    self.chain.len() as u64,</pre><pre>    nonce,</pre><pre>    self.chain[&amp;self.chain.len() - 1].previous_hash.clone()</pre><pre>  );</pre><pre>  new_block.mine(self.clone());</pre><pre>  self.chain.push(new_block.clone());</pre><pre>  println!(&quot;New block added to chain -&gt; {:?}&quot;, new_block);</pre><pre>}</pre><p>Here we did the following:</p><ul><li>Created an add_block function that takes in an argument called &amp;mut self (instance of the Blockchain type).</li><li>Created our instance of the Block type.</li><li>Mined a block hash using the Block type’s mine function.</li><li>Added the new block to the chain of blocks.</li></ul><p>Next in our block.rs file add the following code in the Block type implementation:</p><pre>// Create a new block. The hash will be calculated and set automatically.</pre><pre>pub fn new (</pre><pre> index: u64,</pre><pre> previous_hash: String,</pre><pre>) -&gt; Self {</pre><pre>   // Current block to be created.</pre><pre>   let mut block = Block {</pre><pre>      index: 0,</pre><pre>      timestamp: Utc::now().timestamp_millis() as u64,</pre><pre>      proof_of_work: u64::default(),</pre><pre>      previous_hash: String::default(),</pre><pre>      hash: String::default(),</pre><pre>   };<br></pre><pre>   block</pre><pre>}</pre><p>Here we did the following:</p><ul><li>Created a function called new() that takes in three arguments index and previous_hash.</li><li>Created our instance of the Block type.</li><li>Generated a block hash for our block.</li><li>Returned an instance of the Block type.</li></ul><h3>Mining new block</h3><p>We have successfully implemented functionality for creating a new block.</p><p>Let’s implement functionality for mining new blocks. The process of mining new blocks involves generating a SHA256 hash that starts with a desired number of 0s which would be the mining difficulty miners have to solve to mine a new block.</p><p>Let’s create a function in our block.rs file inside our Block type implementation:</p><pre>// Mine block hash.</pre><pre>pub fn mine (&amp;mut self, blockchain: Blockchain) {</pre><pre>  loop {</pre><pre>    if !self.hash.starts_with(&amp;&quot;0&quot;.repeat(blockchain.difficulty)) {</pre><pre>      self.proof_of_work += 1;</pre><pre>      self.hash = self.generate_block_hash();</pre><pre>    } else {</pre><pre>       break</pre><pre>    }</pre><pre>  }</pre><pre>}</pre><p>Great job, we are done with implementing our blockchain, now let’s test it out.</p><p>Let’s create a file called mod.rs in our models folder and save the following code:</p><pre>pub mod block;</pre><pre>pub mod blockchain;</pre><p>All we are doing here is making the files we created earlier blockchain.rs and block.rs publicly accessible in our main.rs file.</p><p>Now let’s paste the following code in our main.rs file:</p><pre>mod models;</pre><pre>fn main() {<br>   let difficulty = 1;</pre><pre>   let mut blockchain = models::blockchain::Blockchain::new(difficulty);<br></pre><pre>   models::blockchain::Blockchain::add_block(&amp;mut blockchain);</pre><pre>}</pre><p>Now to initiate a transaction run cargo +nightly run in your terminal.</p><h3>Conclusion</h3><p>In this tutorial you’ve learned how to create a simple blockchain from scratch with Rust.</p><p>I hope you’ve enjoyed reading this article, you can get the full source code of this Rust blockchain <a href="https://github.com/ECJ222/Rust-blockchain">here</a></p><p>If you have any comments, please feel free to drop them below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cedb59f8897" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/how-to-build-a-blockchain-from-scratch-in-rust-9cedb59f8897">How to build a blockchain from scratch in Rust</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Stay Healthy as a Developer]]></title>
            <link>https://enoch-chejieh.medium.com/how-to-stay-healthy-as-a-developer-49bf8a126da8?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/49bf8a126da8</guid>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[health]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Fri, 27 Aug 2021 20:51:38 GMT</pubDate>
            <atom:updated>2021-08-28T05:28:32.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adK9mC6vjVX5Aucz1jJ9dg.jpeg" /><figcaption>Photo By<a href="https://www.pexels.com/@psco"> Pineapple Supply</a> Co from <a href="https://www.pexels.com/photo/white-macbook-near-pineapple-and-pumpkin-204686/">Pexels</a></figcaption></figure><p>Spending long hours sitting in front of a computer screen, coding all day, dealing with bugs and deadlines — As software developers, it’s easy to let things get a bit out of control in regards to health.</p><blockquote>When health is absent, wisdom cannot reveal itself, art cannot manifest, strength cannot fight, wealth becomes useless, and intelligence cannot be applied. — Herophilus</blockquote><p>If software developers would adopt more health practices they would be more productive and accomplish more tasks in less time, Let’s try to imagine a possible outcome here — a developer works super hard for a solid 20 hours but neglects his/her health, and over time the developer is not able to give 100% in whatever he/she is doing, Which would inevitably lead burnouts.</p><p>Here are some tips you can implement to help you stay or improve your health.</p><h4>Get Enough Sleep</h4><p>Sleep helps remove brain toxins that build up while you are awake. The more you deprive yourself of sleep the more these toxins build up, Which could harm your ability to think.</p><p>Generally, sleeping recharges your energy and helps in a lot of aspects, On average we need at least 6–8 hours of sleep, Which should be enough.</p><h4>Take a Breather</h4><p>Most times our minds work best when we take a break, This will let you think about a problem from a different angle and probably come with an answer at the end of the break, Personally the technique I use is called the<a href="https://en.wikipedia.org/wiki/Pomodoro_Technique#:~:text=The%20Pomodoro%20Technique%20is%20a,length%2C%20separated%20by%20short%20breaks."> Pomodoro technique</a> which I highly recommend.</p><h4>Sit Correctly</h4><p>Maintaining a good posture while coding in front of your computer is important — it helps to mitigate strain on your lower back and neck pain.</p><p>You can also try working on a standing desk, this way you can alternate between sitting and standing.</p><blockquote>Your posture now determines your portion later. — Bradley Cooper</blockquote><h4>Watch What you Eat</h4><p>Just like a car wouldn’t run without the right fuel, the same applies to our bodies, Make sure you find time to eat a properly balanced meal — preferably a big breakfast to give you enough energy for the day, a good lunch, and a light supper but when working odd hours you can adjust accordingly.</p><h4>Exercise</h4><p>The body needs movement, staying in front of your desk all day long is not really a good thing to do. It’s definitely a good idea to stretch at least once every hour or two, I have found that taking walks or jogging is a great way to refresh your mind especially when you’re trying to find a solution to a problem.</p><p>As software developers, Time is very precious — we can get back a lot of things but we can’t get back our time. To ease the burden of our daily duties at home in the aspect of cooking, cleaning, gardening, and other necessities, We can leverage home management services to assist us in doing so, <a href="https://ouredenlife.com/">Eden Life</a> is a good example.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49bf8a126da8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Optimize Your Productivity as a Software Developer]]></title>
            <link>https://enoch-chejieh.medium.com/how-to-optimize-your-productivity-as-a-software-developer-3399cdb870c9?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/3399cdb870c9</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Sat, 29 May 2021 00:58:07 GMT</pubDate>
            <atom:updated>2021-05-29T00:58:07.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lq60Kg-nqWFlZDDCcPtBig.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@nosoylasonia?utm_source=medium&amp;utm_medium=referral">Juan Gomez</a> on Unsplash</figcaption></figure><p>Are you always frustrated when you try to get some work done but then you frequently get distracted, whether it’s a phone call or a message from a friend or an email?</p><p>Here is a list of tips that I have used and found very helpful in optimizing my productivity and I hope it works for you too.</p><h4>1. Minimize distractions</h4><p>Software developers work on so many complex problems in their everyday activities that require a bunch of tools, coding platforms, online resources, and apps that require understanding.</p><p>They need to stay focused and pay attention to code and to solve complex problems, If they are interrupted, it will be hard to get back in the grove and it could take around 15–20 minutes to regain that focus.</p><p>When you’re working turn off all the notifications from your desktop, mobile phones, or other gadgets. It just hinders your focus and decreases your overall productivity. You can take the help of some apps or extensions to limit your time on certain sites or you can also block the websites.</p><p>Try to minimize the tabs or windows open in your browser, the more windows, and tabs you have open, the more distractions you’ll have, which could increase the chances of errors in your code.</p><h4>2. Time management</h4><p>Time management helps you prioritize your tasks so that you ensure you have enough time available to complete every project. Spend some time thinking about how you work best. Do you prefer taking short sprints or long stretches of time to complete a project? Work out what works for you and organize your time from there.</p><p>Personally, what I utilize for time management is the Pomodoro Technique, The technique is used to encourage people to work with the time they have rather than against it, The aim of the technique is to reduce the impact of interruptions in your workflow.</p><h4>3. Use scrum</h4><p>Scrum is an agile development framework that helps teams work together and focuses on making the most out of complex coding projects. It is extensively used in the IT industry and it’s based on sprints and constant planning, rather than having a single, long milestone.</p><p>It can be applied to any project that has complex requirements, aggressive deadlines, and a generous amount of uniqueness. Its benefits and ease of use explain why many organizations adopt it.</p><h4>4. Take full advantage of automation</h4><p>With the vast variety of tools available these days, leverage the power of automation. Automation is the future, It helps you to focus on the bigger tasks by taking care of the monotonous ones for instance if you need to push small code changes, frequently to a repository and test each code change, This task can be automated by using Continuous Integration and Continuous Development CI/CD for more information on this you can check out this <a href="https://medium.com/nerd-for-tech/a-beginners-guide-to-setting-up-ci-cd-with-github-actions-81554e7847d0">article</a>.</p><h4>5. Spend more time thinking than coding</h4><p>Don’t jump straight into writing code without first properly exploring what you are doing and how you can solve it. Always try to keep things simple, spend extra few minutes coming up with simpler solutions to the coding problems you are trying to solve, This helps you with other aspects of productivity like writing clearer code, as well as improving the quality and scalability of your code.</p><h4>Conclusion</h4><p>The reality is there is so much advice out there on how to increase productivity, Everyone wants to be productive and get as much done as possible. There is actually no secret to productivity you just need to put in the work, dedicate the needed time and space where you can focus on one specific thing at a time without distractions and that’s all you need to accomplish your goal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3399cdb870c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test-Driven Development in React with React Testing Library and Jest]]></title>
            <link>https://enoch-chejieh.medium.com/test-driven-development-in-react-with-react-testing-library-and-jest-8f85430441fb?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f85430441fb</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Sun, 21 Mar 2021 08:24:35 GMT</pubDate>
            <atom:updated>2021-03-22T01:36:04.929Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mmeb0rSNVSxMqFRGIfZGgw.png" /></figure><blockquote>Test-driven development is a way of managing fear during programming. Fear makes you tentative. Fear makes you want to communicate less. Fear makes you shy away from feedback. Fear makes you grumpy. — TDD By Example</blockquote><h3>What is Test-Driven Development (TDD)?</h3><p>Test-Driven Development (TDD) is a software development process in which test cases are developed to specify and validate what the code will do. In simple terms, test cases are created for each functionality and tested first and if a test fails then a new code is written in order to pass that particular test, making the code simple and bug-free.</p><h4>React Testing Library</h4><p>React testing library is a very light-weight testing library for testing React components, It provides light utility functions on top of react-dom and react-dom/test-utils, It also encourages good testing practices.</p><h4>Installation</h4><pre>npm install --save-dev @testing-library/react</pre><pre>or</pre><pre>yarn add --dev @testing-library/react</pre><h4>Jest</h4><p>Jest is a javascript testing framework created and maintained by Facebook. If you are building your React application with create-react-app Jest will work out of the box with zero configurations, Jest expects to find our test files with any of the following popular naming conventions:</p><ul><li>Files with .js suffix in __tests__ folders</li><li>Files with .test.js suffix</li><li>Files with .spec.js suffix.</li></ul><h4>Installation</h4><p>Let’s assume your application is created via create-react-app.</p><pre>npm install --save-dev react-test-renderer<br><br><br>npm install --save-dev @testing-library/react</pre><p>The testing command within your package.json should look something like this to run your tests.</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;react-scripts test&quot;<br>  }<br>}</pre><p>For an application that is not created with create-react-app you can add Jest by following the steps below.</p><ol><li>Add dependencies</li></ol><pre>npm install --save-dev jest babel-jest @babel/preset-env @babel/preset-react react-test-renderer</pre><p>2. Configure your babel by adding the following to your babel.config.js</p><pre>module.exports = {<br> presets: [&#39;@babel/preset-env&#39;, &#39;@babel/preset-react&#39;],<br>}</pre><p>3. Add the testing command in your package.json</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;jest&quot;<br>  }<br>}</pre><figure><img alt="The plan" src="https://cdn-images-1.medium.com/max/480/1*gg0eIEqXPkHUZZwRKYKSyQ.gif" /><figcaption>The plan.</figcaption></figure><p>We would be using this simple react application created with create-react-app below for demonstration purposes, also this application was built with styled-components, for more information on this you can check here <a href="https://styled-components.com/">https://styled-components.com</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9tlVYBIljjq8OJnL7l_UQ.png" /></figure><p>Let’s create a Grid component within the src folder in the components folder called grid.js.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3c3538c385a835f05e80b388d48010c/href">https://medium.com/media/b3c3538c385a835f05e80b388d48010c/href</a></iframe><p>We want to test if the text prop in the Grid component is rendering exactly as we expect it to, now let’s create a file called grid.test.js in the src folder this is where we would be performing our tests.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f4f0de9f72a98332354951aad5bb467/href">https://medium.com/media/3f4f0de9f72a98332354951aad5bb467/href</a></iframe><p>Let me explain what is going on here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*C3n818P9NUTcbRYb-ANkaw.gif" /><figcaption>It’s all part of the plan.</figcaption></figure><h4>‘render’</h4><p>This renders our react component and returns helpful queries that allow us to find certain elements in the view hierarchy.</p><h4>‘afterEach(cleanup)’</h4><p>This basically cleans up everything after each test to avoid memory leaks.</p><h4>‘describe’</h4><p>This command allows us to group related tests to produce cleaner output.</p><h4>‘test’</h4><p>This runs our test, if you don’t want to use test() you can use it() instead.</p><h4>‘getAllByText’</h4><p>This returns an array of all matching nodes for a query by text, in our case it’s ‘New text’ then throws an error if no elements were found.</p><pre>const elements = getAllByText(&#39;New text&#39;)</pre><h4>‘expect’</h4><p>We use this function for testing values along with a “matcher” in our case toBe().</p><h4>‘toBe’</h4><p>We use this matcher function to compare the value gotten from the expect function, then make an assertion about the value.</p><p>Notice when we run our test case the test we wrote passes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*h6clv9M7_rOKHTq02CKyKw.png" /></figure><p>Well done, now let’s try a snapshot test, I guess you are wondering what’s a snapshot test?</p><blockquote>Snapshot testing</blockquote><blockquote>Snapshot tests are very useful whenever you want to make sure your UI does not change unexpectedly, A typical snapshot test case renders a UI component, takes a snapshot, then compares it to a reference snapshot file stored alongside the test. The test will fail if the two snapshots do not match: either the change is unexpected, or the reference snapshot needs to be updated to the new version of the UI component.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4168f9ff183ad9d208d7539a1739da82/href">https://medium.com/media/4168f9ff183ad9d208d7539a1739da82/href</a></iframe><p>Notice when we run our snapshot test case, the test we wrote passes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*lKvImWeongjnKRHWczIaVg.png" /></figure><p>Notice after running our test a __snapshots__ folder is created inside our src folder, this is where all our snapshots will be stored and all snapshot test files have a .snap suffix.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc90fa9118c00ff7ffaadb9f79968d27/href">https://medium.com/media/bc90fa9118c00ff7ffaadb9f79968d27/href</a></iframe><p>Okay, now let’s change one or two arguments in our snapshot test.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b6c3ceda9e47fd91f72bb91ca98b22a/href">https://medium.com/media/5b6c3ceda9e47fd91f72bb91ca98b22a/href</a></iframe><p>Now let’s run our test again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*GTg6Ob7v1NOisjnn0q1VRw.png" /></figure><p>It detected our changes, which means it working as intended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*9BWS2GZNGazEsxOwy7X1rg.gif" /></figure><h4>Conclusion</h4><p>I believe implementing the test-driven approach when developing your applications is a good way to reduce bugs and increase code quality within your codebase, the bigger the codebase gets, the harder it gets to move further or to change the code but If you have automated tests, they become your safety net, allowing you to identify errors and their location within a short period of time, how it affects the system.</p><p>I hope you found something interesting in this article, please if you have any questions or comments please feel free to ask them in the comment section.</p><p>you can get the full example used in this article here:</p><p><a href="https://github.com/ECJ222/react-tdd-tutorial">ECJ222/react-tdd-tutorial</a></p><h4>References</h4><ul><li><a href="https://jestjs.io/">Jest</a></li><li><a href="https://blog.logrocket.com/comparing-react-testing-libraries/">Comparing React testing libraries - LogRocket Blog</a></li><li><a href="https://www.sitepoint.com/test-react-components-jest/">How to Test React Components Using Jest - SitePoint</a></li><li><a href="https://create-react-app.dev/docs/running-tests/">Running Tests | Create React App</a></li><li><a href="https://dl.acm.org/doi/book/10.5555/579193">Test Driven Development | Guide books</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f85430441fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide to Setting Up CI/CD With Github Actions]]></title>
            <link>https://enoch-chejieh.medium.com/a-beginners-guide-to-setting-up-ci-cd-with-github-actions-81554e7847d0?source=rss-330c3c6bfc74------2</link>
            <guid isPermaLink="false">https://medium.com/p/81554e7847d0</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[development-tools]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Enoch Chejieh]]></dc:creator>
            <pubDate>Sun, 21 Feb 2021 09:49:01 GMT</pubDate>
            <atom:updated>2021-02-27T02:37:36.655Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BZ_jv-xjX_FfJR5fQH_6UQ.png" /></figure><p>If you are reading this, you or your team probably need a way to run automatic tests, build, deliver and deploy projects faster, well worry no more this is where continuous integration and continuous delivery (CI/CD) with Github Actions comes in. But hold on what does CI/CD mean?</p><h3>Continuous Integration (CI)</h3><p>Continuous integration is the practice of automating the integration of code changes from multiple contributors into a single software project. It’s a primary DevOps best practice, allowing developers to frequently merge code changes into a central repository where builds and tests then run.</p><h3>Continuous Delivery (CD)</h3><p>Continuous Delivery is when your code is always ready to be released but isn’t pushed to production unless you make the decision to do so. It is a manual step. With Continuous Deployment, any updated working version of the app is automatically pushed to production.</p><h3>Continuous Deployment (CD)</h3><p>Continuous deployment is the process by which qualified changes in software code or architecture are deployed to production as soon as they are ready.</p><h3><strong>Examples of Tools to Use to Perform CI/CD</strong></h3><p>There are numerous tools to configure and perform CI/CD processes:</p><ul><li><a href="https://www.jenkins.io/">Jenkins</a></li><li><a href="https://circleci.com/">CircleCI</a></li><li><a href="https://www.jetbrains.com/teamcity/">TeamCity</a></li><li><a href="https://www.atlassian.com/software/bamboo">Bamboo</a></li><li><a href="https://about.gitlab.com/">Gitlab</a></li><li><a href="https://codeship.com/">CodeShip</a></li><li><a href="https://travis-ci.org/">Travis CI</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*bJju_H158UbrUFZ242aoDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*1g21TmVLmbxCSCuIyJVC_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*Mg24ZANCLWIIGeBPfMvI1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*5ymydieSCLt0lO9jdbB8VQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*YQkIHbSbn4ZTUtYHXcFeEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*7gQexNIhutDj_2NqkDVe7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*D6xQofqDmCFdhU2MAnnKaA.png" /></figure><p><a href="https://github.com/features/actions">Github Actions</a> is a tool that makes it easy to automate software workflows and handles CI/CD processes, <a href="https://github.blog/2018-10-17-action-demos/">introduced in October 2018</a>, launched in beta in August 2019, and finally distributed in November 2019, GitHub Actions is also paid, although it has a free version with some limitations.</p><h3>Example of Using Github Actions In a Project</h3><p>For this example, we would be using <a href="https://reactjs.org/docs/create-a-new-react-app.html">React Js (Create React App) starter project</a> for demonstration purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKPG5z31d38zvqQdyb8Mkg.png" /></figure><p>First, we need to enter our GitHub project and access the Actions tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNBfF0r7HnJNF-GrgQ6NCg.png" /></figure><p>We arrive at a screen that allows us to choose between a predefined workflow or an established workflow, In our case, we’ll be using an established workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*06QKpxsQW8gArPUWQsEfNQ.png" /></figure><p>Notice the workflow in the file called main.ymlwhich is in .github/workflows/ below, this is the default workflow that Github gives us when we establish our own workflow. We can have different files with different workflows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rD2bCj5ahW--4DbafMWHjg.png" /></figure><p>Now we’ll change the content of the file.</p><pre>name: Lint </pre><pre>on: push</pre><pre>jobs:  <br>  run-linters:  <br>    name: Run linters<br>    runs-on: ${{ matrix.os }}</pre><pre>    strategy:<br>      matrix:<br>        os: [ubuntu-latest]<br>        node: [13.x, 14.x, 15.x]</pre><pre>    steps:<br>      - name: Check out Git repository<br>        uses: actions/checkout@v2</pre><pre>      - name: Setup node env 🏗 <br>        uses: actions/setup-node@v2.1.2<br>        with:<br>          node-version: ${{ matrix.node }}</pre><pre>      - name: Install dependencies 👨🏻‍💻<br>        run: npm ci</pre><pre>      - name: Run linter 👀<br>        run: npm run lint</pre><h3>‘name’</h3><p>It’s a label for our workflow.</p><h3>‘on’</h3><p>Github executes workflows that are defined with the on key — in our case, any push event. We can also define a specific branch. For example, push events in the master branch:</p><pre>on:<br>  push:<br>    branches:<br>      - master</pre><h3>‘jobs’</h3><p>Each workflow is made up of one or more jobs. In our case, there’s only one.</p><h3>‘runs-on’</h3><p>This parameter contains the type of virtual machine in which the code will be executed. In this case, we’ll use ubuntu-latest(To see the different types of virtual machines available).</p><h3>‘strategy’ and ‘matrix’</h3><p>A strategy creates a matrix of environments in which to execute the work. Each matrix allows us to establish a set of different configurations of the virtual environment.</p><h3>‘steps’</h3><p>A step is a sequence of tasks. In the example we’re seeing, the first step is to check the repository that triggered the push event so the workflow can access it.</p><pre>- name: Check out Git repository<br>  uses: actions/checkout@v2</pre><p>In the second step, the workflow is set up with a version of node.js to execute the application.</p><pre>- name: Setup node env 🏗 <br>  uses: actions/setup-node@v2.1.2<br>  with:<br>    node-version: ${{ matrix.node }}</pre><p>In the third step, the workflow installs all our dependencies that are needed for our application with the npm ci command, for more information on the command I highly recommend you check the <a href="https://docs.npmjs.com/cli/v7/commands/npm-ci">documentation</a>.</p><pre>- name: Install dependencies 👨🏻‍💻<br>  run: npm ci</pre><p>Finally, we have arrived at the last step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*R0kW7-TidATIZqCOCTXDqA.gif" /></figure><p>In the last step, we use the <a href="https://eslint.org/">linter</a> tool which is a tool that analyzes our code to flag programming errors, bugs, stylistic errors, and overall helps to improve our code.</p><pre>- name: Run linter 👀<br>  run: npm run lint</pre><p>Whenever we push code to our repository this workflow will run, when we access the Actions tab of the repository again, we can see a list of the times the workflow has been executed. In this case, if no error has occurred, we obtain the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ez_IFVI0tAC7Z_PErl1m5Q.png" /></figure><p>That’s it we are done.</p><h3>Conclusion</h3><p><a href="https://github.com/features/actions">Github Actions</a> is one of the best ways to create and maintain a Continuous Integration/Continuous Delivery/Continuous Deployment (CI/CD) workflow, it&#39;s definitely a feature that is worth getting excited about. It facilitates easier development workflow by handling a number of steps.</p><p>you can get the full example used in this article here:</p><p><a href="https://github.com/ECJ222/reactjs-github-actions-tutorial">ECJ222/reactjs-github-actions-tutorial</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81554e7847d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>