<?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 Sanura Hettiarachchi on Medium]]></title>
        <description><![CDATA[Stories by Sanura Hettiarachchi on Medium]]></description>
        <link>https://medium.com/@sanurahettiarachchi?source=rss-733076e6cf85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*oqlgYHyqz7Shu5xZ</url>
            <title>Stories by Sanura Hettiarachchi on Medium</title>
            <link>https://medium.com/@sanurahettiarachchi?source=rss-733076e6cf85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:37:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanurahettiarachchi/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[5 Major Blind Spots for Software Developers]]></title>
            <link>https://sanurahettiarachchi.medium.com/5-major-blind-spots-for-software-developers-acadf2c79576?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/acadf2c79576</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 00:06:34 GMT</pubDate>
            <atom:updated>2025-03-14T00:06:34.184Z</atom:updated>
            <content:encoded><![CDATA[<p>There are some caveats that software engineers fail to see in the large perspective of a profit focused business. This unawareness can lead to waste of resources, lack of efficiency and missed business opportunities. It is crucial to rectify these oversights to achieve the universal harmony between business goals and the technical execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WiDE1sjTcIucxnnNqxHCvg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@rocinante_11?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Mick Haupt</a> on <a href="https://unsplash.com/photos/green-and-gray-robot-toy-zjoipZO73Mc?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><h3><strong>1. Code is just a means to an end</strong></h3><p>We all love our code. We want it to be as perfect as possible. But always keep in mind that writing code is never the true goal of a business. The real objectives are most of the time to generate profits, solve real world problems, create value for customers and maximize wealth in all aspects. Often times the business decisions would force us to deprioritize tech debt and code health. As hard as it may be, when that happens try to keep an open mind. Know where to draw the line and when to yield.</p><h3><strong>2. Return on Investment</strong></h3><p>When developers immerse on the indispensable task of trying to find the best technical solutions and optimize every bit of code and process they can think of, it might be difficult to notice how much effort such endeavours would cost. Often there is a tendency to over-engineer solutions without any hindsight to how much value it would generate for a company. Coders should try to be mindful of the business value and the impact of the initiatives, even if this falls outside the scope of their typical job role.</p><h3><strong>3. Perfection vs Time to Market</strong></h3><p>Building a flawless product with a smooth user experience and no bugs is every developers sweetest dream. This approach normally takes a long period of time to achieve that superior quality. Meanwhile another business would release a basic version of a product and make continuous improvements on it. Timing is a crucial aspect for the success of a business to gain a market. As devs we should be conscious about it. Make sure to prioritize the list problems, check off the “must-wins” and save the “nice-to-haves” and always keep delivering.</p><h3><strong>4. Technical Debt</strong></h3><p>How many TO-DO comments have we seen in code? Some of these can be left as a hasty hack that were made years ago and no one ever gave them a second glance. These alterations could be quick and easy to implement for the moment. But in the long haul it will reduce the maintainability and efficiency of the overall codebase and some would even be arduous to replace after going live to the production environment. The few hours that were saved initially will appear to be minute in comparison to the time taken for refactoring.</p><h3><strong>5. User Experience</strong></h3><p>Most companies can have dedicated designers who are responsible for delivering the user experience. But as developers who do the final implementation of these designs, we know what the code is capable of. It is inconsiderate to just implement a given design as it is without any afterthought. Always suggest improvements on design and offer insights where possible. This will for sure, ultimately result in higher customer satisfaction and provide a boost to the business.</p><h3><strong>Conclusion</strong></h3><p>Above are only a few of the overlooked areas I considered as important in the software development life cycle. There can be many similar aspect you have noticed in your day to day work too.</p><p>Awareness in these elements will result in improved alignment of business and technical aspects, better customer satisfaction, higher efficiency, enhanced time-to-market, reduced tech debt and many more benefits.</p><p>Being sentient about such issues would make a better software engineer and above all a truly valued member of a team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acadf2c79576" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Data Analytics :  Capstone Project]]></title>
            <link>https://sanurahettiarachchi.medium.com/google-data-analytics-capstone-project-da88b18e20ed?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/da88b18e20ed</guid>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Mon, 06 Nov 2023 11:19:42 GMT</pubDate>
            <atom:updated>2023-11-06T11:20:46.636Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google Data Analytics : Capstone Project</h3><h3>Case Study : How does a bike-share navigate speedy success?</h3><p>After completing the <a href="https://www.coursera.org/professional-certificates/google-data-analytics">data analytics certification offered by Google</a> on Cousera I was given the opportunity to complete an case study. Here I will take on the role of a junior data analyst in a company called Cyclistic. I will follow each step of the data analytics process <strong>ask, prepare, process, analyze, share, and act</strong>. Before we dive into the case study, let me provide you with the business context and the problem we are trying to solve using data driven decision making.</p><h3>Context</h3><p>Cyclistic is a bike-share company founded in 2016 based in Chicago. Since then, the program has grown to a fleet of 5,824 bicycles that are geotracked and locked into a network of 692 stations across Chicago. The director of marketing defines the success of the company based on the annual number of memberships. So far, to achieve this Cyclistic offered <em>single-ride passes, full-day passes</em> for casual riders and <em>annual memberships</em> for Cyclistic members. Financial analysts have concurred that the annual memberships are more profitable to the company than the casual riders.</p><p>Without further ado, lets dive in to the case study. Below is my report that will be presented.</p><h3>Business Task</h3><p>The business task at hand is to identify how to motivate casual riders to purchase Cyclistic annual memberships which will increase profits for the company leading to business success.</p><p>In order to achieve this objective we have to identify the differences between Cyclistic annual members and the casual riders, figure out what motivates casual riders to purchase the annual membership and investigate how to use digital media in the Cyclist marketing strategy.</p><p>The full report including the recommendation will be provided to Lily Moreno, the director of marketing and the Cyclistic Executive team so that a final decision can be made after reviewing.</p><h3>Data sources</h3><p>The analysis will be done on the data source made available <a href="https://divvy-tripdata.s3.amazonaws.com/index.html">here</a> which was provided by Motivate International Inc. under this <a href="https://divvybikes.com/data-license-agreement">license</a>. The data from the latest quarter available (Q3), from July 2023 to Spt 2023 will be used for the analysis.</p><p><strong><em>File names:</em></strong><em> 202307-divvy-tripdata.zip, 202308-divvy-tripdata.zip, 202309-divvy-tripdata.zip</em></p><h3>Data cleaning and manipulation</h3><p>For data cleaning and manipulation I used R studio.</p><p>1. Extracted zip files to csv files and imported to R studio.</p><pre>trip_data_7 &lt;- read.csv(“code/cyclistic/202307-divvy-tripdata.csv”)<br>trip_data_8 &lt;- read.csv(“code/cyclistic/202308-divvy-tripdata.csv”)<br>trip_data_9 &lt;- read.csv(“code/cyclistic/202309-divvy-tripdata.csv”)<br><br>trip_data &lt;- rbind(trip_data_7, trip_data_8, trip_data_9)</pre><p>2. Cleaned empty rows and columns</p><pre>install.packages(“dplyr”)<br>install.packages(“janitor”)<br>install.packages(“lubridate”)<br>library(dplyr)<br>library(janitor)<br>library(lubridate)<br>library(tidyr)</pre><pre>trip_data &lt;- trip_data %&gt;% <br> remove_empty(“rows”) %&gt;% <br> remove_empty(“cols”)</pre><p>3. Converted data type from char to date for started_at and ended_at</p><pre>str(trip_data)<br>trip_data$started_at &lt;- ymd_hms(trip_data$started_at)<br>trip_data$ended_at &lt;- ymd_hms(trip_data$ended_at)</pre><p>4. Removed rows with incomplete data that had NA values</p><pre>summary(trip_data)<br>trip_data &lt;- trip_data %&gt;% drop_na()</pre><p>5. Removed columns that has a negative trip duration</p><pre>trip_data &lt;- trip_data %&gt;%<br> mutate(trip_duration = difftime(ended_at, started_at, units = &quot;mins&quot;))<br><br>trip_data[trip_data$trip_duration &lt; 0,]<br>trip_data &lt;- trip_data[trip_data$trip_duration &gt;= 0,]</pre><h3>Analysis Summary</h3><p>Below are the key insights that can be derived from the data set for<br><strong>casual and annual riders:</strong></p><ul><li>Average usage</li><li>Preferred ride types</li><li>Trip duration based on the day of the week</li><li>Number of rides per day</li></ul><p>In order to make these insight blow calculations and formatting were made:</p><ol><li>Merge data to a single frame</li></ol><pre>trip_data &lt;- rbind(trip_data_7, trip_data_8, trip_data_9)</pre><p>2. Created a calculated column with trip duration using started_at and ended_at fields</p><pre>trip_data &lt;- trip_data %&gt;%<br> mutate(trip_duration = difftime(ended_at, started_at, units = “mins”))</pre><p>3. Created new calculated column day of the week based on started_at</p><pre>trip_data[trip_data$trip_duration &lt; 0,]<br>trip_data &lt;- trip_data[trip_data$trip_duration &gt;= 0,]</pre><p>4. Exported the frame to a new CSV for further analysis</p><pre>write.csv(trip_data, “code/cyclistic/trip_data.csv”, row.names = FALSE)</pre><h3>Visualizations and Key Findings</h3><p>The CSV file that was exported is imported to Tableau to create below graphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1maa1Z8-7nJlV2xV_R_zJg.png" /><figcaption>Average usage of casual and annual members</figcaption></figure><p><strong>Observation:</strong> From this pie chart we can see that on an average basis 59% of the trips are made by the member users and only 41% is by the casual users.<br><strong>Insight: </strong>Majority of the Cyclistic riders who use the bikes frequently has purchased the annual membership. Still, 41% is a significant usage for the casual riders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YHXWNxBhULo-X1S1d3wBKA.png" /><figcaption>Average usage of casual and annual members on <strong>Weekends</strong></figcaption></figure><p><strong>Observation:</strong> Even though annual members use bikes frequently, this changes significantly during weekends. More casual riders are active during weekends.<br><strong>Insight: </strong>It can be assumed that most of these casual riders use bikes during weekends for recreational purposes and not for office work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8jbTu_uT3v94SAD5R4KAA.png" /><figcaption>Ride types used by casual and annual users</figcaption></figure><p><strong>Observation:</strong> The preference on classic and electric bikes are almost the same. But the deviation here is the low usage of docked bike which is only preferred by causal riders.<br><strong>Insight: </strong>May be Cyclistic owns only a very few docked bikes. Casual riders like to use docked bikes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pG_WkTaU-R9TC0PFDfbIIA.png" /><figcaption>Trip duration on each day of the week</figcaption></figure><p><strong>Observation:</strong> This confirms the theory that casual riders are more active during weekends.<br><strong>Insight: </strong>Not only the trip count which we demonstrated in the pie chart earlier, but the trip duration in this chart is also very high for casual riders in the weekends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4ehNRW3oiJf9HU4u28joQ.png" /><figcaption>Number of trips over the months</figcaption></figure><p><strong>Observation:</strong> Casual riders use bikes more than annual riders on some of the days<br><strong>Insight: </strong>During weekends casual riders use Cyclistic more. But this graph also shows that the bikes are used frequently by casual riders on the holidays such as 4th of July.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F3xYnXo4LuFOkNilvPLulw.png" /><figcaption>start locations</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RjaswkHcjN7yYvFjAJewQ.png" /><figcaption>end locations</figcaption></figure><p><strong>Observation:</strong> There is no remarkable difference in the ride locations between casual and annual riders.<br><strong>Insight: </strong>The customers (both casual and annual members) are taking more trips near the beach area of Chicago. This could be due to reacreational activities and the city center.</p><h3>Recommendations</h3><p>After analysing the data for the past quarter, the data analyist team would like to recommend the following actions to be taken in Cyclistic marketing strategy in order to motivate casual riders to obtain annual membership.</p><ol><li>Provide special offers and and bonuses for the annual membership during holidays and weekends.</li><li>If only a few docked bikes are available, increase the number of docked bikes and give discounts to annual members to use docked bikes.</li><li>All members ride more in the beach area. We can provide discounts or similar incentives to any new anual members who travel within those areas.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da88b18e20ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SEO : A guide to search engine optimization]]></title>
            <link>https://medium.com/swlh/seo-a-guide-to-search-engine-optimization-7391c069cb40?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/7391c069cb40</guid>
            <category><![CDATA[seo-tips]]></category>
            <category><![CDATA[seo-services]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[seo-training]]></category>
            <category><![CDATA[seo-agency]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Fri, 25 Nov 2022 19:29:45 GMT</pubDate>
            <atom:updated>2022-11-25T19:42:36.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>SEO : A guide to search engine optimisation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_2RwEuGrKzXhWXiaO2oQcg.png" /></figure><p>Ever wonder how all these search engines are finding best results for your search terms? Do you need your web page to appear at the top of the search results? That’s where search engine optimisation, widely known as SEO comes in handy. SEO is the way that allows your web page to appear at the top unpaid results or what we call organic results of a search engine. For an example if you have a blog about “software engineering” it might not appear in the first few hits on google search engine under those keywords. We must optimise our page properly so the search engines would notice us. SEO allows you to reach more of your targeted audience who are looking for search terms that are relevant to your very own webpage. This article will provide you a quick guide to get started. Now I will talk about each of below topics that might help you in your SEO journey.</p><ol><li>Competitor Analysis</li><li>Search Engine Indexing</li><li>Search Engine Cache</li><li>Sitemap</li><li>Robots.txt</li><li>Web page owner</li><li>Source Code</li><li>Backlink analysis</li><li>Social media analysis</li><li>Customer profiling</li><li>Keyword weight allocation</li><li>How google reads a website</li><li>Naming web pages</li><li>Naming titles</li><li>Creating optimised meta tags</li><li>SEO targeted landing pages</li><li>Optimise images for SEO</li><li>Creating links</li><li>Redirect www to non-www</li><li>Tools in SEO process</li></ol><p>Well, that’s a long list. Let’s get into each point briefly and see how it helps us to achieve our goal.</p><h3>Competitor Analysis</h3><p>Who are competitors? Simply put, competitors are the people who offer similar products or services to that you have. It’s important to do a competitor analysis to stay ahead of your competition and be in the lead while learning from them. This is a tip not only for SEO but also for business growth as well. You have to know about your rivals online presence. You must check for their backlinks and the social media activity like in Facebook, Twitter, Instagram, YouTube and other online communities related to the business. There are ways to do this in google.</p><p>On this practical tour let us embark the journey of a new flouriest from the island nation of Sri Lanka. I want my new web page to be at the top whenever someone is searching for florists in Sri Lanka, where I come from.</p><h3>Search Engine Indexing</h3><p>The main factor that shows us which opponents outrank me is the key words. For instance, if you type some keywords to find your webpage and all the results that come before your page can be considered as your competitors. You have to choose your keywords wisely. I will use the keyword “florist Sri Lanka”.</p><p>First, I will get the paid results, or the so-called advertisements. We can’t do much about them unless I want to pay my way to the top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xt9aZCzLtbzEIq71-h2LSA.png" /></figure><p>After ignoring those, what we can check is the organic results or the non-paid hits. Better to watch out for the pioneers, correct? So, the first result I get is <a href="https://shirohanaflowers.com/">https://shirohanaflowers.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IT7pfI6yQzTB4JwZbPMFZA.png" /></figure><p>Then I’m going to run a search again with “site: https://shirohanaflowers.com/” to see how many pages are on my competitor’s page. If it says a 15 or 20 pages if you can get 25 pages on your site it will give you an advantage over competitor. However here it says 80.500 results which is quite a high number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UT--BASSXffI8vmj2r0YaQ.png" /></figure><h3>Search Engine Cache</h3><p>The second thing we can check is the search cache. It is the Google’s version of internet stored in cache. To check when google last visit my competitor I should check the cached page.</p><p>Click the three dots next to the search results, and you will get a popup like in the screen below. Or you can simply type “cache:https://shirohanaflowers.com/” on chrome and it will take you to the cached page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Md63jxSFzNHIRTXxHJNWGw.png" /></figure><p>Amazing, it says these guys have been indexed by google for 10 years. Let’s move ahead and click cache to check the cache.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTNLcxtmgcB6JfCRP2S2uQ.png" /></figure><p>Here you can see the details of Google cache on this page. It was cached on 21 Nov 2022 17:28:04 GMT, when I’m writing this it’s 23rd of Nov. As you can see, it is not that long ago.</p><p>This snapshot of this page is stored in a backup each time the Googlebot crawls your page in case the current page is not available for some reason.<br> In addition cache shows what a web page looked like the last time Google visited it. The site will be indexed each time that it was crawled.</p><p>To get our site indexed more frequently than our competitor we need more relevant content and more authority. We can check this frequency using our Google Cache like we did earlier.</p><p>The last cached date can be used as a measurement of relevance in the content on our web page. Which denotes that google finds our page important enough to keep it updated daily. It wants the page to be available to clients even if the servers go down because it’s beneficial to the viewers.</p><p>Googlebot will also crawl a web page if the content if updated more often on a regular basis. If the quality is high and we update our page in a higher frequency posting new content, it will increase the rank. But it’s important to remember that Quality of content matters over the Quantity of it. Nobody will want to read bad content. Also remember, how the google algorithm works is never exposed to public. So, our ideas on getting attention of it is never perfect.</p><h3>Sitemap</h3><p>A Sitemap is an XML (or other formats Text, RSS, mRSS, Atom 1.0) file that lists the URLs for a site. It allows webmasters to include additional information content in you page,</p><blockquote>when it was last updated?<br>how often it changes?<br>how important it is in relation to other URLs in the site?</blockquote><p>· a video entry can specify video running time, rating, and age-appropriateness rating<br>· an image entry can specify location of the images included in a page<br>· an article entry can specify article title and publication date</p><p>This allows search engines to crawl the site more intelligently. I’m checking <a href="https://shirohanaflowers.com/sitemap.xml">https://shirohanaflowers.com/sitemap.xml</a> and I see they have one. But sometimes people have xml file in other names. To search this, go and search “inurl:www.lassanaflora.com filetype:xml”. If they don’t have a site map that means they are missing some important element from their web page. If you do SEO on your page it will be easy to overrun them.</p><h3>Robots.txt</h3><p>robots.txt is a text file that is created to instruct robots (typically search engine bots) how to crawl and index pages on their website. It will tell which URLS are available on our site. Let’s check if they disallow any pages. Which means they try to hide it. Copy that URL and see what they are hiding behind. I’m checking “https://shirohanaflowers.com/robots.txt” now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*CYf5lCLlaxZXFVeN01h0dA.png" /></figure><p>We can see that they have “Disallow: /*?” Which is used to block access to all URLs that include a question mark. More specifically, any URL that begins with your domain name, followed by any string, followed by a question mark, followed by any string. So, this doesn’t give away much.</p><p>This is the best way to ensure that users and search engines are directed to the correct page. The HTTP 301 status code means that a page has permanently moved to a new location. For an example “https://shirohanaflowers.com/” and “https://www.shirohanaflowers.com/” are two different domains. If they both direct to the same page the competitor has taken time to do this redirection. Which we can see that they have done.</p><h3>Web Page Owner</h3><p>It’s important to know what kind of people are working behind the competitor’s page.</p><blockquote>Who owns the webpage?<br>Who manages the web page?<br>Is this a work of a professional?<br>Expiration date on their domain?<br>Dedicated or shared IP?</blockquote><p>There are few web services to get information on an domain.<br> <a href="https://who.is/whois/shirohanaflowers.com">https://who.is/whois/shirohanaflowers.com</a><br> <a href="https://lookup.icann.org/">https://lookup.icann.org/</a></p><p>But if the domain privacy is turned on it will not show the name of the owner but you can still see created, updated and expiry date of a domain.</p><h3>Source code</h3><p>We can use developer tools in browser to check for the source code of a web page. Search for things out of place. Empty blocks and things out of ordinary. It will give you a clear idea of who you are dealing with. <a href="https://shirohanaflowers.com/">https://shirohanaflowers.com</a> has a minimalized source code. Paste it in an editor to read properly. If your competitor is disorganized code, seeing your website at the top of the results is a walk in the park.</p><h3>Backlink analysis</h3><p>A website can have links to other websites using an anchor. When I mention shirohanaflowers this is a backlink for that domain. We can find examples of website backlinks all over the internet in blog posts as well. We can check how many people refer to our competitor’s website. These backlinks play an important role in SEO. The more people linked to you the better points you will get.<br> <br> There are different tools that you can use for a backlink analysis. Both web and desktop applications. Also, free, and paid services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ejaMgLg_0czWiPpoT2Bekg.png" /></figure><p>I see that shirohanaflowers.com have 36k backlinks. Check out the anchor texts they have. Diversifying anchor links is a good habit for SEO because it can tell us which keywords the competitor is excelled in.</p><p>You can also search using google. For an example <strong><em>“-inurl: </em></strong><a href="https://www./"><strong><em>https://www.</em></strong></a><strong><em> shirohanaflowers.com” </em></strong>will give you where shirohanaflowers.com is mentioned outside their site. Explore and find out a bit more about the competitor.</p><h3>Social Media Analysis</h3><p>Social media is a common place for communities where likeminded people come and discuss their subjects of interest. You should go join in the conversations or be aware of what kinds of social media marketing strategies they are using. There are many tools to do this. One popular example is <a href="https://emplifi.io/">https://emplifi.io/</a> previously known as Social Bakers. But you can gather most of the data you need for free without paying anyone. Use google to search. Take a peek at the Facebook, Twitter, Instagram, YouTube and Tumblr accounts of your rivals. See what they are doing good. See what they are doing wrong. See what makes their stakeholders happy or unhappy.</p><h3>Customer Profiling</h3><p>Customer profiling is a marketing strategy that uses data to create a picture of the perfect customer who will interact with your product or service. First step of customer profiling is to sit back and visualize who your potential customers are. You should research on the customer base you are targeting. Find answers to questions like,</p><blockquote>How old are they?<br>Where do they live?<br>What are their interests?<br>Any targeted religious or ethnic groups?<br>Will women be more interested in this than men?<br>What are the social events they might like to participate in?</blockquote><p>List out the customer analysis to make sure you know your target market before you start. Google AdWords display planner is a good tool to use for customer profiling. Check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*pcAOuoAOWg80ZrXzonZn2Q.png" /></figure><h3>Keyword weight allocation</h3><p>The landing page or the index page is made from HTML elements. It is important to use those elements when targeting keywords. A web page has an URL to the domain or the specific page. Then there is the html document. It contains a title and meta tags which might only be visible to the search engines. All the design elements of the a page are inside the body. It may contain headings, paragraphs, images, hyperlinks, etc.</p><p>The most weight for keywords are placed within the URL itself. It’s very important when selecting the domain names and the page names for SEO. The weight for a keyword search reduces as you move on from headings to the footer of a webpage. The most important elements for SEO can be specified as the URL, title, meta tags and the headings. There are some advance ways of using google search to search a webpage (E.g. inurl: intitle: intext: inanchor:). We should consider these when building our landing page.</p><h3>How does Google read a website?</h3><p>Google is a company. Before listing out the organic results they will first show the paid customers. Your site will be included in the organic results. A typical web page these days contain headings, paragraphs, images, hyperlinks, etc. You have to organize this in a proper manner. Imagine google as a librarian. Its database is the library. When you search, it’s like asking the librarian for books on a certain topic. Your web page is a book. URL is the name of your book. Page titles are the chapters of the book. Sitemap is the page numbers of a book. Headings are like chapter headings. Meta description is like a summary on that chapter.</p><p>When google comes to fetch a website in the URL, it first the robots.txt file. A robots.txt file is a file at the root of your site that indicates those parts of your site you don’t want accessed by search engine crawlers. You can also specify if you have a sitemap. Knowing you have a site map google will next go and check your sitemap.xml, it will check if you have any new sites since you last visited. It will make the crawling much efficient. Then it will request the URL. Let’s say it’s a HTML document. It will start crawling from the top of the page. When this crawling happens it attaches a timestamp to the crawl process so that it doesn’t crawl it every day, or to try and guess when it should crawl it again. Google does this for every web document it indexes. It will read through the URL, title, meta description (will be shown in google search snippet), canonical links (tell google that this is the original page but similar content to this exists on other web page), images/videos and other info attached to them, text. Google will do this continuously to every landing page you have.</p><h3>Naming your web pages</h3><p>Now that we know Google takes the URL as one of the strongest indicators to what your webpage is about. Knowing that we should use our keywords to name the files and folders. Since I was targeting “florists Sri Lanka” in my example I can get keywords like “flower”, “shop”, “online”, “local”. I can name my landing pages using that. E.g.: <em>flower-shop.html</em></p><p>Here since we know that google search the URL including that file name, the question is,</p><p>why don’t we try to put in some more keywords to get more hits. E.g.: <em>sri-lanka-flower-shop-onlline.html</em>.</p><p>The problem here is while it might get you more traffic it could cause some problems. If a user searches using a terms like “local flower shop”, “flower shop wedding” there is a chance we won’t get the top priority from google. This is good if you are using many pages and files. Because you have potential to create more pages and target keywords. In this age single page apps are very popular. When you use a short filename you can precisely target the keywords you are concerned with.</p><p>If you have a medium size website that have pages under many categories make sure you create folders to organize them and use keywords in naming for SEO. For an example in my flower shop I will have a page to list flowers. And I will have a page for different events and gifts. I can have a folder for each category. I can even sub categorize the folders. For an example gifts for men and gifts for women. It will make more sense for google and yourself to make folders to categorize them. Know that this is one of the most important features in google page categorization.</p><p>E.g.:</p><p><em>/flower-shop.html<br> /flowers/roses.html<br> /events/weddings.html<br> /gifts/for-men/chocolate-box.html<br> /gifts/for-women/flower-necklace.html</em></p><h3>Naming your titles</h3><p>Naming your web page titles for google ranking is an important task. Here are some tips for making a good title for a page.</p><p>· Keep it short and sweet at max of 50 characters targeting your keywords.</p><p>· Don’t try to repeat the keywords. It will be of no use.</p><p>· Better divide the title to two portions. First part to give priority to your keywords. Second part to explain the intent of the page.</p><p>&lt;title&gt;Sri Lanka Florists Online — About Us&lt;/title&gt;</p><p>Your title will appear as the result title on the google search hits. Make sure you name the title wisely to attract that valuable click.</p><h3>Creating optimised meta tags</h3><p>Here are some tips for adding meta tags to your page.</p><p>There is description meta tag. This meta tag is used by google to show description about your page on google results snippet.</p><p>· Keep it within 150-character space.</p><p>· Mention your key words at the beginning</p><p>· It’s better to have unique descriptions for each landing page</p><p>And then there is the keywords meta tag. This metatag is not used for google ranking purposes. But you can still use it never the less. Here is a list of meta tags google recognize.<br> <a href="https://developers.google.com/search/docs/crawling-indexing/special-tags?visit_id=638049975639640153-3053771669&amp;rd=1">https://developers.google.com/search/docs/crawling-indexing/special-tags?visit_id=638049975639640153-3053771669&amp;rd=1</a></p><p>E.g.:</p><p>&lt;meta name=”description” content=”Florists, Online Flower Shop Sri Lanka will provide you with a wide variety of flowers, decorations and gift items for you to choose from.”&gt;</p><p>&lt;meta name=”keywords” content=”florists, flower shop, online flowers, flower shop online, buy flowers online, Sri Lanka Flowers, Flower shop Sri Lanka”&gt;</p><h3>SEO targeted landing pages</h3><p>What we have on our landing pages are very important. I will explain how certain elements make a good landing page. Higher the web element is, the more valuable it is for us to target google rankings.</p><p>Heading “h1”one is a very important web element. But if you have meaningless heading just based on keywords is not very good. Make sure it is sensible and it’s not directly targeted for SEO but meets the words necessary for google rankings. Heading two three and beyond is important too because google looks at them too. Internal linking is good for SEO but make sure your customers don’t get distracted clicking them and not reading what you have to offer. Better way to do this is using a navigation menu. Use synonyms to target the keywords because people might try them.</p><p>E.g.: flower / bloom/ blossom/ floweret/ floret Emphasise your keywords or anything if it creates better communication.</p><h3>Optimise images for SEO</h3><p>Optimising a webpage for google search is done as a webpage in whole. That’s why image names are also playing a role here. It’s not only the image name that we should be concerned about. You can add image name, title, alt and some meta data to optimize your image. Meta data like author title, image description, rating, keywords and copyright can be added as metadata. Also needless to mention target different keywords that’s important to the business.</p><h3>Creating links</h3><p>I have explained what backlinks are on competitor analysis. In-links are also important if we send user to other pages that refer to our page in return. We can create backlinks on out page too. But having 100 of backlinks are not necessary or a backlink will not count as an up vote. Create sensible backlinks, don’t try to think about SEO because Google is smart enough to recognize the difference. Keep users best interest in mind not search optimization. Read google guidelines to understand this better. Always try to create useful content. Remember 80% SEO is on page content, not backlinks. Check where your competitor is getting backlinks from, as discussed in competitor analysis. Rest assured, you will benefit from backlinks and it is not against google guidelines.</p><h3>Redirect www to non-www</h3><p>In your hosting account there must be a redirection option. Create a 301 permanent redirection. This will create “.htaccess” file which will contain info necessary for this redirection. You can create this file yourself adding the code below.</p><p><em>RewriteEngine on<br> RewriteCond %{HTTP_HOST} ^yourwebsite\.co.uk$ [NC]<br> RewriteRule ^(.*)$ </em><a href="http://www.yourwebsite.de/$1"><em>http://www.yourwebsite.de/$1</em></a><em> [R=301,L]</em></p><h3>Tools in SEO process</h3><p>There are many free and commercial tools available to help you with SEO. May be you should try a few of them and see what suits you the best. There are freeware and paid applications. But in my opinion you can get all you need even from non-commercial providers without paying a dime. Below are some tools you can use to begin with. There can be better or commercial tools that you can use.</p><ol><li>Competitor analysis — Screamingfrog</li><li>Find broken links — Link Checker</li><li>Check your website — google web master tools</li><li>Keyword planning — Google keyword planner</li><li>Display planning — Google display planner</li><li>Check backlinks — Site explorer</li></ol><h3>Conclusion</h3><p>This article became longer than expected and there is so much more that we can learn on SEO. But I really hope this will give an idea to a beginner and will help to get someone started. I hope your web page will be at top of the search results at some point. SEO is a continuous process; you must update and make changes to stay at top, which we are all trying to do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7391c069cb40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/seo-a-guide-to-search-engine-optimization-7391c069cb40">SEO : A guide to search engine optimization</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code Review : How to be a better reviewer]]></title>
            <link>https://medium.com/swlh/code-review-how-to-be-a-better-reviewer-9dd8cb71ce36?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dd8cb71ce36</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Sun, 20 Nov 2022 08:58:50 GMT</pubDate>
            <atom:updated>2022-11-20T08:58:50.346Z</atom:updated>
            <content:encoded><![CDATA[<h3>Code Review : How to be a better reviewer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASsLIQiTCetZ9Gg53TlPqQ.png" /></figure><p>I find that code reviews are an amazing tool of improving the way I code, and I have noticed that it helps my whole team to improve gradually. Of course, that is in addition to the usual benefits of quality, consistency, maintainability of code that it provides. Throughout the software industry code review has become an integral part of software engineering. Ultimately the goal of a code review is to make sure that the overall code health of your codebase improves overtime. In this article I plan to discuss on what to look for in a code review. Then I would discuss some good practices that we can follow in code reviews.</p><p>So, What should we look for in a code review?<br>Below are some points that we will discuss in detail afterwards.</p><ul><li>The change is designed well with the overall system</li><li>Any parallel programming is done safely</li><li>Users will benefit from this change (all stakeholders including devs)</li><li>UI/UX changes are implemented correctly</li><li>The code is only as complex as it needs to be</li><li>Solve current problems not things that we might need in far future</li><li>Developer has provided unit tests</li><li>Test cases are relevant and well-designed</li><li>Proper conventions and naming are followed</li><li>Clear and useful comments</li><li>Appropriate documentation</li><li>Adopted the style guide</li></ul><h3>Design</h3><p>This would be the first and most important thing for a code review. As a reviewer you need to understand the system design.</p><p>· Make sure you understand the intended fix or feature<br>· Change belongs in this codebase, package or module<br>· If the code depends on other changes, decide if this is the correct time to approve the changes<br>· Overall functionality should not break with this change<br>· Instead of a traditional final stage code review (gateway review), doing an early design feedback process might also help</p><h3>Functionality</h3><p>Functionality checks are achieved using QA and testing. But as code reviewers we also have a responsibility on this regard.</p><p>· Be vigilant about edge cases that might not be covered by logic.<br>· If this change has a user facing impact such as a UI change, review code along with some testing or demo videos if possible.<br>· Keep a lookout for race conditions, deadlocks and any performance issues.<br>· Identify bottlenecks or caveats in the code and suggest improvements where possible</p><h3>Complexity</h3><p>Is there a part of code that every developer in your organisation fears to touch or change? There’s a good chance it’s some over engineered code left by a very experienced software engineer. A change should not be overly complexed.</p><p>· Make sure any developer can understand the logic by going through the code<br>· Check in any line, method or component if the logic could be simplified<br>· Is the code trying to introduce generic functionality making it unnecessarily complex?<br>· Is the code trying to solve a future problem introducing compexity and provides no current benefit?</p><h3>Tests</h3><p>Reviewing the tests is another crucial part of a code review. Sometimes more than half of the code you review could be related to tests.</p><p>· Request for good unit tests or integration/component tests that covers possible scenarios<br>· Tests should be included in the same change list you are reviewing<br>· Maintain a reasonable code coverage on tests<br>· Rules like complexity would also apply for tests even though it’s not part of you main binaries<br>· Tests should be well designed and relevant</p><h3>Naming</h3><p>This might sound like a trivial category, but it is an important one.</p><p>· Change list is using meaningful variable, method, class names<br>· A good name should communicate purpose within the limit of being so long that it’s hard to read<br>· If a functionality or purpose of the code changed, the naming of corresponding parts of code was also updated.</p><h3>Comments</h3><p>Comments are not part of the core logic and it’s not mandatory. But it is important you review the comments too.</p><p>· Is the comment expressed clearly and in good English (or other language)<br>· Is this comment necessary, no need to state the obvious<br>· Simple comments should not be used as documentation<br>· Explain <strong><em>WHY</em></strong> some code is here not <strong><em>WHAT</em></strong> it’s doing</p><h3>Styles</h3><p>Most of the organisations nowadays use coding style configurations that can be directly imported to IDEs. Also there are style guides that the developers should follow.</p><p>· the author has used standard styling on the code<br>· there are no issues like whitespaces, unused imports, etc<br>· the change list is not adding style changes to whole file while really changing only a few lines</p><h3>Documentation</h3><p>In a code review we should ensure documentation is maintained and stays up to date with changes. The documentation tools may differ from project to project but the core principles stays the same for a review.</p><p>· Proper documentation should be provided as needed when it changes how the code would build, test or interact with other users of the system<br>· When removing code verify that deprecated documentation is also removed</p><h3>Context</h3><p>The change request will only show you the lines of code that were changed. Sometimes it would be helpful to check the whole code or the full file to make sense out of it.</p><p>· Instead of checking isolated changes try to figure out how it affects the overall system as needed<br>· A change should not be approved if it deteriorates the overall system</p><p>Now that we discussed what to look for in a code review, we should also follow good practices you can adopt in your code review process.</p><ul><li>Understand why the code review is needed</li><li>Take ownership as the reviewer</li><li>See the good as well as the bad</li><li>Improvement over perfection</li><li>Make comments</li><li>Resolve any disagreements with author</li><li>Check through the change list</li><li>Give some of your effort towards a better review</li></ul><h3>Understand the purpose</h3><p>Never consider a code review as an exam or a test that we need to pass. A reviewer doesn’t need to be an experienced developer than the author. But it’s important the reviewer understands the context and the change.</p><p>· Think of it as another layer of safety<br>· It’s there to serve you and your team to be better, it’s a win-win for everyone<br>· Don’t think of it as an additional task, it’s part of your software development life cycle<br>· Reading code has a different perspective from writing code</p><h3>Notice the Good</h3><p>Code review often focus on the mistakes. But it should offer encouragement and positive feedback as well.</p><p>· If you see something nice let the author know, leave a comment<br>· It would motivate your peers to keep doing the good that they do</p><h3>Never seek perfection</h3><p>A change list is never perfect. What a reviewer should seek is continuous improvement rather than perfection.</p><p>· A change should not be delayed for days or weeks because it is not perfect<br>· if the change overall improves the understandability, maintainability and readability of your code it can be approved</p><h3>Leave comments</h3><p>The reviewer should always feel free to leave a comment for the author. Never just reject a change or mark it as work needed.</p><p>· Leave comments for improvements, fixes and for nice things<br>· If the comment is opinionated, noncritical or educational, you can prefix the comment (E.g.: “not important:”, “suggestion:”, “to consider:”) so that the author does not have to resolve it immediately.</p><h3>Resolve conflicts</h3><p>There can be conflicts upon a review, based on different opinions of the author and the reviewer.</p><p>· Sometimes it’s hard to have a conversation over the comments on a change request. Try to have a call with the author to come to a consensus and record the agreed value as a comment after the meeting.<br>· If it does not work the last resort should be to have a broader conversation with other team members to confer and conclude.<br>· But you should never let a change hang there for weeks or months just because there was no agreement. Resolve the conflicts fast as possible.</p><h3>Navigating a change list</h3><p>A change could be spread across multiple files, and you will have to navigate through it efficiently.</p><p>· Take a broad view of the change. Does the change make sense?<br>· Examine the main parts of the change set. Look at the most important part of the change first.<br>· Look at the rest of the changes in an appropriate sequence.</p><h3>Put Some Effort</h3><p>A code review should be carried out as soon as possible after the review request is made.</p><p>· A change should never be left on the queue for review for more than one business day.<br>· If you are busy with coding or another prioritised task you can let the team know, so that someone else can pick it up for review<br>· A slow review can result in team velocity decrease, developer protests over code reviews, more pressure on developers to submit changes fast for review and ultimately poor code health<br>· As a participant of the code review it’s your responsibility to make the process seamless as possible</p><p>I hope these pointers will help you to become better reviewers to help our teams and peers with our maximum capacity. Next, I plan to write an article for the code authors on how to make the process of code review better and more beneficial. Until then, happy reviewing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dd8cb71ce36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/code-review-how-to-be-a-better-reviewer-9dd8cb71ce36">Code Review : How to be a better reviewer</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Token Based Authentication]]></title>
            <link>https://sanurahettiarachchi.medium.com/token-based-authentication-ecf1f45f1805?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf1f45f1805</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[json-web-token]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[jwt]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Sun, 20 Jun 2021 04:56:22 GMT</pubDate>
            <atom:updated>2021-11-23T09:29:56.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEQrLE9lj3CSnbYNU7mcWw.png" /></figure><h3>The need of authentication</h3><p>HTTP is a stateless protocol. Which means that the previous state is not remembered when you make a new request. No credentials or authorisations are remembered between requests by default. This works without effort for static web pages, you simply need to send a GET request with the URL. But when a request is made on dynamic content, in most cases it would be user dependent and the server will need to verify who is sending the request. Sending all the credentials and proof to verify a user in each request becomes a hazel and it’s an unnecessary overhead. As a solution session id was used in web applications and is still widely used.</p><h3>Session Based Authentication</h3><p>A session is a state maintained between the client and the server so that the server could verify which client is sending the requests. Session is stored in server side and will be verified against each client request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*79x5CIr-ndkuq5CNGvJSog.png" /><figcaption>Session Based Authentication Flow</figcaption></figure><ol><li>Client sends a request with user credentials for authentication.</li><li>Web application verifies the credentials and creates a new session id in session table</li><li>The session id is returned to the client in response and will be stored as a cookie</li><li>Subsequent requests are sent with previously obtained session id</li><li>Server verifies the session id against the session table</li></ol><p>How this session token is sent may vary depending on the implementation. The most common way is to send it in a cookie so the subsequent requests from the browser will automatically have the cookie in header.</p><p>This is probably the most popular way of authentication. But modern application structure is different and pose challenges.</p><h3>Problems in Session Based Authentication</h3><p>Session authentication expects a single server monolithic application by design. But modern web applications are hosted in multiple servers using a multitude of varying micro services. Session data in one server might not be available in another server.</p><p>The simple solution is to keep a shared <strong>session cache</strong>. (E.g.: Redis). A cache could provide faster access as a separate service where multiple other services can make requests to resolve the session.</p><p>Another approach would be to use <strong>sticky sessions</strong> where a load balancer will remember the corresponding server for each session and directs the request to corresponding sever. But considering the amount of requests and the load on the server this is not a scalable solution.</p><p>Also another drawback is in cookie-based implementation itself. Cookies are a common concept to web browsers but not directly supported in most mobile based applications. There are similar alternative implementations which can be used in these scenarios with some extra effort.</p><p><em>But is there a better approach for authentication?</em></p><h3>Token Based Authentication</h3><p>Token based authentication addresses some of the complications that I mentioned before. Check below diagram,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmGdn3wj99_r-UY3T2NAFw.png" /><figcaption>Token based authentication flow</figcaption></figure><ol><li>Client sends a request with user credentials for authentication.</li><li>Server creates a token, encoded and signed with its own secret key</li><li>Server sends the token back to the client</li><li>Subsequent request made with the obtained token in the header</li><li>Server decodes and verifies the token and resolve user details using the token data</li></ol><p>JWT has become a popular way of token authentication in web applications. Let’s dive into JWT authentication concept.</p><h3>JWT Structure</h3><p>The industrial standard for JWT is outlined in <a href="https://datatracker.ietf.org/doc/html/rfc7519">RFC7519</a> and it defines how a claim is structured.<br>The JWT token is basically an encoded text string. Each segment is visually separated by a dot. There are 3 parts in a standard JWT. (2 dots)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a8m0aK_g8Hx-krHomva-MA.png" /><figcaption>sample JWT</figcaption></figure><p>Above screenshot taken from <a href="https://jwt.io/">https://jwt.io/</a> shows the breakdown on segments. Left side shows the JWT and right side shows the decoded segment data.</p><p><strong>Segment1: Header<br></strong>Header information and the algorithm used in JWT is stored here</p><p><strong>Segment2: Payload<br></strong>This is the data segment. It can include username or any other client info you access regularly in your app. It also contains issued at time which can be used to expire a token. But never include sensitive data like passwords in here.</p><p><strong>Segment3: Signature<br></strong>This segment is used for verification. It contains encoded header and encoded payload segments and a secret key. All of this will be again encoded in the algorithm mentioned in header segment. It is important to make sure that the secret-key is securely stored in server. It should not be exposed to the public under any circumstances. It’s a private key, known only by the server.</p><h3>How JWT works?</h3><p>On the first request you will need to send the credentials to the server. It will validate the credentials and generate the JWT and send back to the client. The token will include the details I mentioned above.</p><p>When a subsequent request is made, the server will take the encoded header and data segment and decode it with the secret key. This will be then validated against the signature segment of the token. If it is matching the server will respond with a successful response or it should request to authenticate again.</p><p>A JWT instance is expected to be short lived (around 1 hour) and can be deleted once expired. Also simply removing the token from client side will usually ensure the access removal.</p><h3>What happens if you tamper with JWT data?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25KQRJ4iVYj6CUHzlJ883A.png" /></figure><p>If someone tampers with the data in the token, the verification signature in will not going to match. It has the encoded header, data and secret key segments. The generated key will be unique for a token. If you change data signature is not going to match. Assuming that the secret is secure within server it will be hard to manipulate data in the token.</p><h3>What if someone else steals the JWT?</h3><p>Yes, this is possible. The server won’t be able to identify a pirated token from the original. The client needs to be very careful of how they communicate with JWT. This is where terminologies like <strong>OAuth</strong> comes in handy for authentication and authorisation. It comes along with security that’s much needed in data transmission.</p><p>There are ways to blacklist a token that was identified as pirated. But to access that blacklist a single auth service will be needed and you will have to hit it multiple times. This goes against the whole principle of using JWT authentication. Of course, the blacklist can be distributed to different servers, but the access should be implemented in an event-oriented manner using web-hooks or event queues.</p><p><em>Hope you got a basic understanding on JWT by reading this. I will soon write about how OAuth is used and provide a JWT based implementation. Thanks!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf1f45f1805" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Read a Barcode]]></title>
            <link>https://sanurahettiarachchi.medium.com/read-a-barcode-107e28672d87?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/107e28672d87</guid>
            <category><![CDATA[barcode-reader]]></category>
            <category><![CDATA[barcode]]></category>
            <category><![CDATA[barcode-scanner]]></category>
            <category><![CDATA[gs1]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Sat, 12 Dec 2020 07:55:37 GMT</pubDate>
            <atom:updated>2020-12-12T07:55:37.013Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I had to implement a POS system for a small retail shop. I needed to understand barcodes to work on this project. You must have noticed when you purchase an item from a supermarket, at the cashier they scan the barcode on the product, and it displays all the product information.</p><p>All this is possible thanks to the GS1 organisation who maintains and develop standards for the barcodes worldwide, which also means that little strip of black and white bars is not completely free now. If you scan a barcode on USA or from the other side of the world in Sri Lanka you will still be able to read the product info using a barcode.</p><p>There are 95 equal width bars (black and white) in a normal barcode. When multiple bars nearby gets the same colour you will see different widths but keep in mind that all bars are in equal width.</p><p>The first 3 bars and middle 3 bars and end 3 bars are used to create segments in a barcode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*nqCQ1Cz7cCRtantiai0kaA.jpeg" /><figcaption>Left side and Right side</figcaption></figure><p>The rest of the 84 bars are divided into 12 segments with 7 bars in each segment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdN665MwWvUwioIweAMCWw.png" /><figcaption>12 segments with 7 bars in each</figcaption></figure><p>Number of white strips in each segment denotes a different number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*YjT6tWQwzfB0u9wx_gk_ew.gif" /><figcaption>different numbers</figcaption></figure><p>Right and Left side on barcode will contain same numbers like a mirror image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adLmZLteClNLhMNQRtId1g.png" /><figcaption>Same number on both sides</figcaption></figure><p>Segments in the left side of the barcode will have even number of white strips while right side has an odd number of white strips for the same number. When you read the barcode upside down if there is an odd number of white strips reader will know you are holding it upside down and read it accordingly.</p><p>Awesome, I know. But,</p><h3>What are the numbers under the barcode?</h3><p>First part of a barcode is used to identify the company that makes the product. <a href="https://en.wikipedia.org/wiki/List_of_GS1_country_codes">First 3 digits</a> are used to identify the country of that company. After that comes the company code, but the number of digits might vary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPqZHJsyqQQkcqA91t5-zg.png" /><figcaption>First part of numbers for company</figcaption></figure><p>The digits on the right-hand side could be used as product codes. (except the last check digit). When we have a large company code the number of digits available to use for product codes will be less.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NW-vZyqPGcxcNTLqaU07YQ.png" /><figcaption>product code</figcaption></figure><p>Each company can use different product codes, but they will be sent to a central database for reference.</p><p>The last digit at the end is called check digit. It is used to check if the reader has read the barcode correctly. For example take below code,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dn224iPKqzsNuJbPguKGdA.png" /></figure><p>Take sum of all numbers in barcode except the check digit<br>6 + 2 + 2 + 2 + 1+ 0 + 3 + 0 + 7 + 4 + 6 = 33</p><p>Take sum of numbers in odd positions<br>6 + 2 + 1 + 3 + 7 + 6 = 25</p><p>Double that amount<br>2 * 25 = 50</p><p>Add that to the sum of numbers from first step<br>50 + 33 = 83</p><p>Take last digit from that sum and subtract from 10<br>10 - 3 = <strong>7</strong></p><p>Here you should get the value of check digit. Then the reader will know that it read the barcode correctly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=107e28672d87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Clean Coding Practices]]></title>
            <link>https://medium.com/swlh/10-clean-coding-practices-e37ac283184d?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/e37ac283184d</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[information-technology]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Sun, 18 Oct 2020 06:13:31 GMT</pubDate>
            <atom:updated>2021-01-14T16:05:54.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_H_UpQahH0juwQpXWXnpQ.jpeg" /></figure><p>Throughout my venture as a software engineer, I have seen people code in various ways. Sometimes it’s easier to read and understand while others took a considerable time to go through. When we code, we write it for others to read later on, not for ourselves. Even if a person is working on an individual project it’s crucial that your code is readable to another developer. I will discuss about some practices I realised that will help us code clean and better, no matter what programming language you use.</p><ol><li>Avoid poor naming</li><li>Follow correct naming conventions</li><li>Create proper method signatures</li><li>Keep function parameter count to a minimum</li><li>Declare variables at the place of use</li><li>Avoid using confusing magic numbers</li><li>Minimise extensive nested conditions</li><li>Don’t implement super long functions</li><li>Avoid code duplication</li><li>Make necessary comments</li></ol><p>Below I will explain each point in detail with examples when needed.</p><h3>1. Avoid poor naming</h3><p><strong>Short variable names</strong></p><pre><em>private String an;</em></pre><p>This is a short variable name. It looks like an abbreviation. What does “<em>an</em>” stand for? You will have to go through the code to see the place where a value is assigned to “<em>an</em>” to figure out that it stands for the administrator’s name. “<em>adminName</em>” would have been a better option, don’t you think?</p><p><strong>Long Variable Names</strong></p><pre><em>Person[] peopleFromIndiaWhoCanSpeakFrench;</em></pre><p>This is a long variable name. You can shorten such names without losing the meaning. For example, “<em>indiansSpeakingFrench</em>”. Keep in mind when someone shorten the variable name, it should still be meaningful to others who read that code.</p><p><strong>Bad Notations</strong></p><pre><em>int iSize;<br>String sName;</em></pre><p>There are bad notations which are not applicable for modern programming concepts. For instance, Hungarian notation where a prefix letter is used to denote the data type will cause more confusion nowadays than a clarification. Integer variable “iSize” should simply be “size”.</p><p>In short, the variables should be,<br>· Not too short, Not too long<br>· Meaningful<br>· Reveal Intention<br>· Chosen from the problem domain</p><h3>2. Follow correct naming conventions</h3><p>There are different naming conventions in different programming languages. Few I have seen are,<br>· camelCase<br>· PascalCase<br>· snake_case<br>· kebab-case</p><p>It’s important that you follow the correct naming convention to avoid being a chaotic coder. A developer coming from a C# background would name a method in PascalCase while a Java developer would name it in camelCase. Always refer to good coding examples online if you are new to that language, also the documentations might help to find-out the best practices.</p><h3>3. Create proper method signatures</h3><pre><em>Laptop getPerson(String ownerId){<br>    //do something<br>}</em></pre><p>Here you would call <em>getPerson</em> method with an <em>ownerId </em>to fetch a person, but instead it would return you a <em>Laptop</em>. While that function might serve its’ purpose, it’s a terrible name which should be modified to a meaningful name so anyone who’s using it won’t be misguided. “<em>getLaptopByOwnerId</em>” would be a more purposeful name.</p><pre>void parse(int myNumber) {}<br>void getName() {}</pre><p>Usually a method like “<em>parse</em>” is expected to return data after some conversion. But here the method doesn’t return anything. That would be surprising and hard to understand. Either add a return type or simply change that unsuitable method name. Same goes for the “<em>getName</em>” function with an empty return.<br>Also the signature parameters should be more meaningful instead of using an ambiguous name like “<em>myNumber</em>”</p><h3>4. Keep method parameter count to a minimum</h3><pre>void myMethod(int param1, String param2, float param3, int param4, String param5) {}</pre><p>The best practice is to keep your method to 3 or less parameters. While it can become hard sometimes, when you look closely there are situations where you can split the method to different functions. Also if those parameters are actually related to same entity as attributes you would be able to create a new class and pass that object to you function. This would ultimately improve reusability and readability in your code.</p><h3>5. Declare variable at the place of use</h3><pre>void myMethod(Person person) {<br>    String a,b,c;</pre><pre>    //after 25 lines...<br>    a = person.getName();<br>}</pre><p>Where should the variables be declared? Some procedural programming languages such as “C” which I learnt as an undergraduate needed to declare all the variables at the top. These types of code are hard to be read. I prefer it when variables are declared at the place where they are actually being used. That way you won’t have to scroll back and forth to understand your code.</p><h3>6. Avoid using confusing magic numbers</h3><pre>Document getDocument(int state){<br>    if(state == 1){ <br>        return new ActiveDocument();<br>    } else if (state == 2){ //2 = Cancel<br>        return new CanceledDocument();<br>    }<br>}</pre><p>I find it confusing to understand a code like above. state == 1? What is meant by number 1? I have seen some developers use a comment to explain what this magic number denotes.</p><pre>} else if (state == 2){ //2 = Cancel</pre><p>But this is not a good practice. Declare a constant to explain its’ meaning. Also you can create an enumeration if the value is being used at multiple places.</p><pre>private static final int ACTIVE = 1;<br>private static final int CANCEL = 2;</pre><p>or</p><pre>public enum State {</pre><pre>    ACTIVE(1),<br>    CANCEL(2);</pre><pre>    private int value;</pre><pre>    public int getValue() {<br>        return value;<br>    }<br>}</pre><h3>7. Minimise extensive nested conditions</h3><pre>if(a = true){<br>    if(b = true){<br>        state = &quot;Active&quot;;<br>    } else {<br>      state = &quot;Cancel&quot;;<br>    } <br>} else if(c = true){<br>    if(b = true){<br>        state = &quot;Active&quot;;<br>    } else {<br>      state = &quot;Cancel&quot;;<br>    } <br>} else {<br>    state = &quot;Cancel&quot;;<br>}</pre><p>Multiple nested conditions make it hard to read your code. Always try to simplify them. Above code can be simplified as below,</p><pre>If(b = true &amp;&amp; (a = true || c = true)) {<br>    state = &quot;Active&quot;;<br>} else {<br>    state = &quot;Cancel&quot;;<br>}</pre><p>Also using ternary operators is a good practice,</p><pre>state = (b = true &amp;&amp; (a = true || c = true)) ? &quot;Active&quot; : &quot;Cancel&quot;;</pre><p>Keep in mind not to go overboard with combining conditions or ternary operators.</p><p>Example:</p><pre>If(a = true &amp;&amp; b = true || (c = true || a = true) &amp;&amp; d != a &amp;&amp; c != d &amp;&amp; (d = true || c = true) ){<br>}</pre><p>or multiple nested ternary operators,</p><pre>state = (b = true &amp;&amp; (a = true || c = true)) ? (c = true || a = true) &amp;&amp; d ? &quot;Active&quot; : &quot;Modify&quot; : &quot;Cancel&quot;;</pre><p>Instead of making it clear, a statement like this would make it more complicated and hard to perceive. At time it might be better to break down a condition based on context to make it more understandable.</p><pre>If(isValidFreightPayment(a,b,c) &amp;&amp;  (c || d)){<br>}</pre><pre>function isValidFreightPayment(boolean a, boolean b, boolean c){<br>    return a = true &amp;&amp; (b = true || (c = true || a = true);<br>}</pre><h3>8. Don’t implement super long methods</h3><p>Try to avoid creating long functions. Just because you can read it and understand that doesn’t mean it’s a good practice. Most of the time it’s hard to understand, to change and reuse. Also it’s imported to manage cohesion in your code. (related things should be together unrelated things should not be together). A method should be short (preferably around 10 lines). It should only do one thing and serve a single purpose.</p><p>Example:</p><pre>BigDecimal getAccountBalanceFromPersonId(String pid){<br>    //fetch person from id<br>    //get account from person account number<br>    //get account balance<br>}</pre><p>This function is doing multiple things, it should be broken down to serve a single purpose. Each functionality could be defined in separate methods.</p><h3>9. Avoid code duplication</h3><p>Another crucial factor is duplication in your code. Do you find yourself copy pasting the same code to different places with small changes (may be only variable names or some values?), stop and think about creating a common function to be called. Always stick to the DRY principle, <em>Don’t Repeat Yourself!</em></p><h3>10. Make necessary comments</h3><p>It’s a common understanding that comments on codes are good. I don’t find this to be very useful unless in specific situations. It’s better to keep your code clean and understandable than making comments everywhere. I follow below guideline when commenting on my code:</p><p>Do not use your comments to do below,</p><p><strong>Never state the obvious<br></strong>If it’s obvious in code what you do your comment will be just a useless distraction.</p><pre>//A map to store employee id and the employee object<br>Map&lt;int, Employee&gt; empIdToEmployeeMap;</pre><p><strong>Never manage version history using comments<br></strong>Managing version history changes through comments is not going to be useful in the long run. This can easily be achieved through a versioning system like git.</p><pre>//v1.12<br>function String getName(){}</pre><p><strong>Clarify through the code not comments<br></strong>instead of “<em>pf”</em> use a more clarifying name “<em>payfrequency”.</em></p><pre>int pf; //payfrequency</pre><p><strong>Dead code</strong><br>Never leave commented out useless code. Remove them completely. If needed use version management to restore them but don’t comment and leave out dead code.</p><pre>/*function getName(){<br>//do something<br>}*/</pre><p>Don’t write comments to explain the code, try to change your code to be more understandable.<br>Use your comments to explain whys and hows. Also you might have business reasons that might not be expressed through code that has to be mentioned as a comment.</p><p><strong><em>In conclusion</em></strong>, I always try to follow clean coding practices when I code. Your code is your pride. I always value code reviews and feedback from the peers so I can improve myself and my coding pattern. Always remember you code for others not for yourself, that is the first step of clean coding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e37ac283184d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/10-clean-coding-practices-e37ac283184d">10 Clean Coding Practices</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Reasons why Agile might not work for you]]></title>
            <link>https://sanurahettiarachchi.medium.com/5-reasons-why-agile-might-not-work-for-you-8843e8a6fe86?source=rss-733076e6cf85------2</link>
            <guid isPermaLink="false">https://medium.com/p/8843e8a6fe86</guid>
            <category><![CDATA[agile-development]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[agile-coaching]]></category>
            <dc:creator><![CDATA[Sanura Hettiarachchi]]></dc:creator>
            <pubDate>Tue, 08 Sep 2020 04:16:04 GMT</pubDate>
            <atom:updated>2020-09-08T04:16:04.467Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of us are familiar with agile. We have worked in agile development environments. Some organisations are using different versions of agile. But there are situations when agile won’t work for you. And why should you try out a model that wasn’t created for you? It would be like trying on super tight jeans. You might wear it somehow, but it’s bound to rip off at some point. This article would help you to identify if agile development will fit you.</p><h3>1. Business model won’t suit agile</h3><p>Agile is meant to adapt for changing requirements. If your organisation already has a predefined process and has a clear-cut requirement with a solution you won’t even need agile.</p><p>Some companies create an FSD (Functional Specification Document) before project kick-off and get signed by the customer. So, the requirement is clear, and you know how implementation is done. If there are any changes they will come as a change request and will be amended to the FSD. The change requests are expected to be limited.</p><p>These types of businesses work well without agile. And there is no reason to implement it. Keep doing what you do.</p><h3>2. Organisational Hierarchy is too traditional</h3><p>Agile expects you to have a flat hierarchy in the reporting structure. Any employee should be able to approach a senior manager quickly and must be able to express his thoughts without hesitation. You won’t benefit from agile in a bureaucratic traditional management structure.</p><p>This could depend on the industrial culture or the country you live in. Whatever the reason is, agile won’t suit you. And maybe you should transform your reporting structure, because such management structures hold back progress and keep genius ideas hidden in the trash. Not good for a company in the long run.</p><h3>3. Team members rejecting agile</h3><p>Even though you are interested in Agile some of your team members might not be enthusiastic about it. If you are going to implement agile find a team that is interested about it as much as you are. This situation gets more complex if management is reluctant to move towards agile. Each member on team should be aware of agile values and make it a part of their routine. If you don’t believe in it, it won’t work well for you.</p><h3>4. Customers rejecting agile</h3><p>Your clientele might be used to a more traditional business structure. They might not like to have a close relationship with you. For agile the client should be more openminded and be ready to communicate effectively. If your relationship with the customer is extremely rigid this might now work for you. Both the internal team and the business should share the agile mindset and must be willing to work collaboratively.</p><h3>5. Perfectionists and heavy planning</h3><p>Agile supports documentation and tracking requirements extensively. But if you expect everything to be perfect without any hills and slopes agile won’t work for you. You might want to do heavy planning and try to make sure everything is perfect. This is not agile. These heavy processes might fall under waterfall model rather than agile development.</p><p>I recently participated in a workshop on Agile development conducted by a professional. If you are not sure about agile, there are coaches who can train your team to adapt agile methodology and show the values of it. There are various models of agile. Find out what fits you best.</p><p>Do it right! Do it well!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8843e8a6fe86" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>