<?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 Uzair Shamim on Medium]]></title>
        <description><![CDATA[Stories by Uzair Shamim on Medium]]></description>
        <link>https://medium.com/@pureooze?source=rss-c3ee0a84d2ef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1IfYasuHHSycfhh7JxLVCg.png</url>
            <title>Stories by Uzair Shamim on Medium</title>
            <link>https://medium.com/@pureooze?source=rss-c3ee0a84d2ef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:08:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pureooze/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[Memory Bank: Labels In HTML]]></title>
            <link>https://medium.com/information-and-technology/memory-bank-labels-in-html-7a71a428537d?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a71a428537d</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[a11y]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Sun, 12 Oct 2025 01:39:34 GMT</pubDate>
            <atom:updated>2025-10-12T17:40:40.548Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmAeDPoFKH16c7l_-yC4eQ.jpeg" /></figure><p>What is the right way to label something in HTML?</p><p>This came up in something I was working on recently. I always forget the best practices for labeling so I wanted to write this blog post to help me remember… and as a quick reference when I inevitably forget 😉.</p><h3>Default Accessible Names</h3><p>Some elements provide a default accessible name that can be used by screen readers to provide a label for a given element. For example in a button the value between the open and close tags is the default accessible name.</p><pre>&lt;button&gt;this is a close button&lt;/button&gt;</pre><p>Sometimes the default accessible name is inaccurate and a separate label needs to be provided to give users accurate context. In these situations labels can help.</p><p>Imagine if the button in the code above needed to have X as its text. This is not very informative to screen reader users and we need a better way to indicate what this button does. There are also many elements that do not have default accessible names, so we may need to provide labels for them as well.</p><p>Full post here: <a href="https://pureooze.com/blog/posts/2025-10-07-memory-bank-labels-in-html/">https://pureooze.com/blog/posts/2025-10-07-memory-bank-labels-in-html/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a71a428537d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/memory-bank-labels-in-html-7a71a428537d">Memory Bank: Labels In HTML</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some Thoughts On Blogging]]></title>
            <link>https://medium.com/information-and-technology/some-thoughts-on-blogging-abf0191a40b1?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/abf0191a40b1</guid>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Tue, 02 Oct 2018 16:42:16 GMT</pubDate>
            <atom:updated>2018-10-05T02:11:17.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5BMp0D3cFCU49Mfe93siw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/SKcTKYNRvHY?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Camille Orgel</a> on <a href="https://unsplash.com/search/photos/keyboard?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In the spring of 2014 I was a college student in an IT program applying to coop job postings and needed something to differentiate myself from the other applicants. I decided that I would start a blog where I document random things I found interesting. Sound really broad? That’s because I didn’t really have any particular focus in mind and wanted to experiment with different topics. I think in the long run this was a good decision as it let me see what I was comfortable with, what worked and what didn&#39;t. This is the kind of thing you can learn best from experience but I will go more into detail about this later. For now, lets get back to my life story.</p><h4>blog --init 💥</h4><p>The first post came in April of 2014 titled <a href="https://ushamim.wordpress.com/2014/04/05/programming-paradigms/">Programming Paradigms</a>. And yes I used WordPress back then. The post was short — 25 words — with a link to a YouTube series by Dr. Jerry Cain. If a picture is a thousand words I guess this video is 31.05 million (17.25min * 30fps * 1000words)? Does it work like that? 😅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ha5n1X5zCu501AJIf5gEuQ.png" /><figcaption>My first blog post: <a href="https://ushamim.wordpress.com/2014/04/05/programming-paradigms/">https://ushamim.wordpress.com/2014/04/05/programming-paradigms/</a></figcaption></figure><h4>Projects</h4><p>After a few months I started working on a C++/Qt project called TLE. I used my blog to post screenshots and mockups (helpfully drawn by a close friend) whenever I got something interesting working. I’m confident to say that no one read it, but it was still nice just being able to get my thoughts onto “paper”. It helped me think about what I was doing and how I would explain it to someone who had never worked on the project before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ei_iH9Rm5h6fv6up7PLSsQ.png" /><figcaption>An early mockup of TLE</figcaption></figure><h4>Getting Traction</h4><p>As this was all going on, I started participating in the openSUSE community. I would post on the forums, the mailing lists and even in the IRC channel. I began to notice there were common questions about new releases and the direction of the project. So what did I do? I wrote blog posts explaining it for people who didn&#39;t have the time to watch the conference videos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rV4-CWf61AFx0toNEAgy8g.png" /><figcaption>Snippet from my post: <a href="https://ushamim.wordpress.com/2014/06/29/opensuse-the-way-forward/">https://ushamim.wordpress.com/2014/06/29/opensuse-the-way-forward/</a></figcaption></figure><p>At this point the frequency of my posts got slower, partly due to the posts getting longer and partly due to being busy with school. To keep my blog alive I started blogging about things I was doing in school. This is how I started blogging about technical content (how to’s, beginners guides, etc.). The very first post like this was about configuring a DNS server in CentOS 6.6:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WG2HzCdt5_3ZVxqlkrm4qA.png" /><figcaption>Snippet from <a href="https://ushamim.wordpress.com/2015/01/25/configuring-a-dns-server-on-centos-6-6/">https://ushamim.wordpress.com/2015/01/25/configuring-a-dns-server-on-centos-6-6/</a></figcaption></figure><p>When I started posting these I began to notice that the traffic to my blog was increasing significantly. This gave me the confidence to try and write some bigger guides.</p><h4>Moving To Medium</h4><p>I discovered the existence of Medium around July 2016. I was really intrigued by the website since it looked really nice compared to my blog and seemed to be very popular with writers. After a bit of debating I decided to switch to Medium. A major reason I switched was in hopes that I would get better exposure. I wrote a reflection about using Medium that you can read <a href="https://medium.com/information-and-technology/my-experience-with-medium-7ff48858234e">here</a>.</p><h4>The Comprehensive Guide To AppArmor</h4><p>In July 2016 I also released a guide to AppArmor called <em>The Comprehensive Guide To AppArmor</em>. The desire to create the post came from wanting to understand how AppArmor worked but having difficulty finding documentation that explained everything. So I decided to work with the developers of AppArmor to write a guide which explains all the basics you need to know to use AppArmor. The guide can be found <a href="https://medium.com/information-and-technology/so-what-is-apparmor-64d7ae211ed">here</a>. This is one of the most unique posts I have ever written as it went through several revisions and I had constant feedback from the actual developers of AppArmor — something I don&#39;t usually get from tools I write about.</p><h4>Becoming A Dev</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KEV8bFmo65toZZj7.JPG" /><figcaption>McMaster University Campus from <a href="https://en.wikipedia.org/wiki/File:Pan-IMGP0137-IMGP0142-mod-and-crop.JPG">Wikipedia</a></figcaption></figure><p>In 2016 I graduated from my college and felt that I would still like to learn more about computers. So I decided to sign up for a transfer program that lets college students transfer into year 3 at McMaster university. At the end of my first year (April 2017) at McMaster we were allowed to apply to internship jobs and thinking it was good to get some work experience I applied. I ended up getting a position as a Software Developer Intern at Ontario Teachers’ Pension Plan (OTPP).</p><p>During my time at OTPP I worked with both JavaScript and Java. At the same time I was working on personal projects in my free time. At the start I started trying to re-implement a project I had created in school — a podcast feed. For our school project we had implemented it using Qt but the code was a mess and we had no tests. I decided to build the app again but this time using JavaFX — because it would help me get better at Java for work — and to test it, something I learned the importance of at work. While developing this application I learned a lot about testing philosophies and how to test JavaFX. Noticing that there was almost no documentation for TestFX — a library used to test JavaFX applications — I wrote some (you can find <a href="https://medium.com/information-and-technology/test-driven-development-in-javafx-with-testfx-66a84cd561e0">here</a>).</p><p>This post turned out to be quite popular as there seems to be demand for testing JavaFX but a lack of documentation.</p><h4>Saka</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kAfZG-SGOkFJH4RZ.png" /><figcaption>Screenshot of <a href="https://github.com/lusakasa/saka">Saka</a></figcaption></figure><p>Spring of 2018 and I ended up becoming the maintainer of a browser extension called Saka. As I took over for the previous maintainer I was forced to learn a lot of the tools used in JavaScript projects. Things like Webpack, Karma, Babel and so on. As I began to understand the project I realized that there were no tests to validate the behavior of the application. This caused me worry — I didn’t have confidence in myself to modify code without breaking other parts of the app. So I decided to learn how browser extensions were tested and realizing it was not documented well I wrote a blog post titled <em>Unit Testing Browser Extension</em> that you can read <a href="https://medium.com/information-and-technology/unit-testing-browser-extensions-bdd4e60a4f3d">here</a>.</p><p>Saka represents a pretty important milestone in my journey as a dev. For the first time I was maintaining a project I had full control of that other people actually used! It was very exciting but also a bit nerve wrecking — I didn’t want to break it and lose users as a result. Looking back, it was a great idea to take over Saka since I have learned so much about JavaScript while maintaining it and it has inspired a lot of content on this blog.</p><h3>Reflection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7K2k1iFQyyduDmAhc1AzRQ.png" /><figcaption>Stats from September 2016</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9AeNIerp5lUMPrUe-vclXg.png" /><figcaption>Stats from September 2018</figcaption></figure><p>As my life has changed so has my blog. In a way it is a reflection of where I am with my life, what my focuses are and what goals I have for the future. It has changed quite a bit from what it started out as but I think it has only gotten better. It took me a long time to become confident enough to write my own content but it has been important in helping me learn new things and helping others do the same.</p><p><strong><em>If you liked this post be sure to </em></strong><a href="https://medium.com/@pureooze"><strong><em>follow this blog</em></strong></a><strong><em>, </em></strong><a href="https://twitter.com/pureooze"><strong><em>follow me on twitter</em></strong></a><strong><em> and </em></strong><a href="https://dev.to/pureooze"><strong><em>my blog on dev.to</em></strong></a><strong><em>.</em></strong></p><p><strong><em>P.S. Looking to contribute to an open source project? Come contribute to Saka, we could use the help! You can find the project here: </em></strong><a href="https://github.com/lusakasa/saka">https://github.com/lusakasa/saka</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abf0191a40b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/some-thoughts-on-blogging-abf0191a40b1">Some Thoughts On Blogging</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple List Render Optimization For React ]]></title>
            <link>https://medium.com/information-and-technology/a-simple-list-render-optimization-for-react-ef0a133e9c86?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef0a133e9c86</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[rendering]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 17:19:40 GMT</pubDate>
            <atom:updated>2018-10-30T05:54:08.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dEhau3bhqfzKgpKIxFmwwg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/NhepANBDBKo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">George Brynzan</a> on <a href="https://unsplash.com/search/photos/speed?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Yesterday I was watching a talk by <a href="https://twitter.com/benmvp">Ben Ilegbodu</a> at React Alicante called <em>Help! My React App is Slowwwww!</em> in which Ben discussed some optimizations developers can make to help improve performance of React applications. He goes over many of the potential bottlenecks that may arise such as unnecessary DOM updates, reconciliation and unnecessary object creation. It’s a really interesting talk and I encourage you to watch it (link below) but what I found most interesting was his first point about unnecessary DOM updates.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLBzJFcZsPBQ%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLBzJFcZsPBQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FLBzJFcZsPBQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/71303f86fa8d7c4f242a340f97b311c6/href">https://medium.com/media/71303f86fa8d7c4f242a340f97b311c6/href</a></iframe><p>When trying to optimize performance of web apps, we can look for actions that are bottlenecks and try to minimize the amount of times the application performs these actions. It turns out updating the DOM is a very time consuming operation. It is in fact so time consuming that React has a process called reconciliation that exists to try and avoid unnecessary updates.</p><p>Unfortunately as Ben shows in his talk — and as I will show in this post — there are still situations where reconciliation will not be able to help us. However we don’t need to lose hope because there are some simple tweaks we can make to address the issue.</p><h4>The 🔑 to Lists</h4><p>This is a really handy trick you can use to optimize the rendering of list items in React. Suppose you have a page that displays a list of items and is defined as follows:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fr4y5lj0qxn&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fr4y5lj0qxn&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fr4y5lj0qxn%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ef0c1b88851132a65a4815df0502a6b/href">https://medium.com/media/5ef0c1b88851132a65a4815df0502a6b/href</a></iframe><p>When the button is clicked, it will add an item to the list. This will then trigger an update to the DOM to display our new item along with all the old items. If we look at the DOM inspector while clicking the button we see the following (orange indicates the node is updating):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2F0sm8i&amp;url=https%3A%2F%2Fstreamable.com%2F0sm8i&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2F0sm8i.jpg%3Ftoken%3DHCxjVgWPN4C3c52ln7ATiA%26expires%3D1537553007&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="640" height="412" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b88358cbadaf0415558289fed975618/href">https://medium.com/media/5b88358cbadaf0415558289fed975618/href</a></iframe><p>See how all the list items are updated? If we think about this for a moment this doesn’t actually seem like an ideal update. Why can’t we just insert the new node without having to update all the other nodes? The reason for this has to do with how we are using the map function in the List component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79091135dc779557051ecb33e4c81d70/href">https://medium.com/media/79091135dc779557051ecb33e4c81d70/href</a></iframe><p>See how we are setting the key for each list item as the index? The problem here is that React uses the key to determine if the item has actually changed. Unfortunately since the insertion we are doing happens at the start of the list, the indexes of all items in the list are increased by one. This causes React to think there has been a change to all the nodes and so it updates them all.</p><p>To work around this we need to modify the map function to use the unique id of each item instead of the index in the array:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c22eb9c4a3fa62b239e48ee6b6d1eb7/href">https://medium.com/media/9c22eb9c4a3fa62b239e48ee6b6d1eb7/href</a></iframe><p>And now when we click the button we see that the new nodes are being added without updating the old ones:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2F8akmp&amp;url=https%3A%2F%2Fstreamable.com%2F8akmp&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2F8akmp.jpg%3Ftoken%3DxD3wFlYYWrVgPV0P45m1jg%26expires%3D1537554176&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="616" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/59016912d195ff3783020d083994eefe/href">https://medium.com/media/59016912d195ff3783020d083994eefe/href</a></iframe><p>So what’s the lesson?</p><blockquote><strong>Always use a unique key when creating lists in React (and the index is not considered unique)!</strong></blockquote><h4>The Exception ✋</h4><p>There can be situations where you do not have a truly unique id in your arrays. The ideal solution is to find some unique key which may be derived by combining some values in the object together. However in certain cases — like an array of strings — this cannot be possible or guaranteed. In these cases you must rely on the index to be the key.</p><p>So there you have it, a simple trick to optimize list rendering in React! 🎉🏎</p><p><strong><em>If you liked this post be sure to </em></strong><a href="https://medium.com/@pureooze"><strong><em>follow this blog</em></strong></a><strong><em>, </em></strong><a href="https://twitter.com/pureooze"><strong><em>follow me on twitter</em></strong></a><strong><em> and </em></strong><a href="https://dev.to/pureooze"><strong><em>my blog on dev.to</em></strong></a><strong><em>.</em></strong></p><p><strong><em>P.S. Looking to contribute to an open source project? Come contribute to Saka, we could use the help! You can find the project here: </em></strong><a href="https://github.com/lusakasa/saka">https://github.com/lusakasa/saka</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef0a133e9c86" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/a-simple-list-render-optimization-for-react-ef0a133e9c86">A Simple List Render Optimization For React 🏎</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integration Testing Browser Extensions with Jest]]></title>
            <link>https://medium.com/information-and-technology/integration-testing-browser-extensions-with-jest-676b4e9940ca?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/676b4e9940ca</guid>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[jest]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Fri, 17 Aug 2018 03:32:24 GMT</pubDate>
            <atom:updated>2024-05-02T02:50:24.951Z</atom:updated>
            <content:encoded><![CDATA[<h3>This post has been migrated to my new blog that you can find here:</h3><p><a href="https://pureooze.com/blog/posts/2018-08-16-integration-testing-browser-extensions-with-jest/">https://pureooze.com/blog/posts/2018-08-16-integration-testing-browser-extensions-with-jest/</a></p><p>Previously I wrote about how <a href="https://github.com/lusakasa/saka">I became the maintainer of Saka</a>, an open source browser extension that allows users to search through and load open tabs, browsing history and bookmarks. <a href="https://medium.com/information-and-technology/unit-testing-browser-extensions-bdd4e60a4f3d">I talked about how I came up with a solution for unit testing the extension</a> to give me confidence with code changes. I also mentioned that there were issues with integration testing that I ran into which made it difficult to test components that relied on browser APIs.</p><p>Today I am happy to report that I have found a way to perform integration testing on extensions and want to share it with you in this post. But before we go down that particular rabbit hole lets first discuss integration testing and why it is useful for validating software.</p><h4>The Testing Trophy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*tjlg6kLxt1YGyq5nOUeAnA.jpeg" /><figcaption><a href="https://twitter.com/kentcdodds/status/960723172591992832">https://twitter.com/kentcdodds/status/960723172591992832</a></figcaption></figure><p><a href="https://blog.kentcdodds.com/write-tests-not-too-many-mostly-integration-5e8c7fff591c">Kent C. Dodds has written about something he calls the ‘Testing Trophy’</a>. If you have heard of <a href="https://martinfowler.com/articles/practical-test-pyramid.html">the testing pyramid</a> before this is a similar concept — it’s a visualization of how you should prioritize the different types of testing in applications. The title of Kent’s post says it all:</p><blockquote><strong>Write tests. Not too many. Mostly integration.</strong></blockquote><p>Why does he say this? Kent notes the problem with unit tests is that they only prove individual units work as expected— they do not prove that the units can work together as a whole. Integration testing on the other hand proves that all the components in our project can actually work together as expected.</p><h3>To read the rest of this post it can be found on my new blog here:</h3><p><a href="https://pureooze.com/blog/posts/2018-08-16-integration-testing-browser-extensions-with-jest/">https://pureooze.com/blog/posts/2018-08-16-integration-testing-browser-extensions-with-jest/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=676b4e9940ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/integration-testing-browser-extensions-with-jest-676b4e9940ca">Integration Testing Browser Extensions with Jest</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit Testing Browser Extensions]]></title>
            <link>https://medium.com/information-and-technology/unit-testing-browser-extensions-bdd4e60a4f3d?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdd4e60a4f3d</guid>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Mon, 21 May 2018 17:40:47 GMT</pubDate>
            <atom:updated>2024-05-02T02:47:24.554Z</atom:updated>
            <content:encoded><![CDATA[<h3>This post has been migrated to my new blog that you can find here:</h3><p><a href="https://pureooze.com/blog/posts/2018-05-21-unit-testing-browser-extensions/">https://pureooze.com/blog/posts/2018-05-21-unit-testing-browser-extensions/</a></p><p>In April I became the maintainer of <a href="https://github.com/lusakasa/saka">Saka,</a> a browser extension that allows users to search through their tabs, bookmarks and history. The original goal of Saka was to provide an elegant tab search but this soon evolved to include recently closed tabs, bookmarks and history when the original maintainer <a href="https://github.com/eejdoowad">eejdoowad</a> recognized that users search for tabs the same way they search bookmarks and history. This was an important insight and it has helped make Saka a valuable productivity tool.</p><p>When I became the maintainer I was surprised at the absence of tests in the project. There were several components with complicated logic but no tests to be found anywhere. One of the most important things I have learned as a developer is that tests are the easiest ways to write reliable, easy to refactor code. Was the old maintainer just lazy? Did he simply not care about the quality of his code? No. The opposite in fact, he cared a lot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*fVpsL7y2i-A1UkATOYfEsQ.gif" /><figcaption><a href="https://github.com/lusakasa/saka">Saka, a browser extension for searching tabs, recently closed, bookmarks and history.</a></figcaption></figure><p>The issue is that the lack of documentation on the topic means that almost no one is able to test their extension. Having no confidence in my ability to make changes without breaking the code, this was a big problem. But as fate would have it after trying a dozen different approaches I ended up finding a solution.</p><h4>Why We Test</h4><p>As developers we want to be sure that the code we write today is not going to become a burden to maintain later in the lifetime of the application. One way we avoid creating these burdens is by writing tests. The great thing about tests is that outside of just verifying the behavior of functions, tests allow us to provide documentation for future developers. For example by creating unit tests we declare the valid inputs and outputs for a given function. This makes it easier to refactor code because we can have confidence that our code is working correctly when all our tests pass.</p><h4>The Testing Approach</h4><p>This post will focus on setting up the environment and writing some basic unit tests. I have a separate post at<a href="https://medium.com/information-and-technology/integration-testing-browser-extensions-with-jest-676b4e9940ca"> this link</a> which you can use to perform integration testing.</p><h3>To read the rest of this post it can be found on my new blog here:</h3><p><a href="https://pureooze.com/blog/posts/2018-05-21-unit-testing-browser-extensions/">https://pureooze.com/blog/posts/2018-05-21-unit-testing-browser-extensions/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdd4e60a4f3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/unit-testing-browser-extensions-bdd4e60a4f3d">Unit Testing Browser Extensions</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ECMAScript 2018: Asynchronous Iteration]]></title>
            <link>https://medium.com/information-and-technology/ecmascript-2018-asynchronous-iteration-ec0b6a3a294a?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec0b6a3a294a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[iteration]]></category>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[ecmascript]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Tue, 06 Mar 2018 05:04:55 GMT</pubDate>
            <atom:updated>2018-03-06T05:14:17.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IRnW4n7Eh57nTpSr.jpg" /></figure><p>It’s 2018 and it’s time for an update to the JavaScript standard. In January this year the TC39 committee released <a href="https://github.com/tc39/proposals/blob/master/finished-proposals.md">the latest changes</a> to the ECMAScript standard, appropriately called ECMAScript 2018. One of the changes coming in this update is the introduction of Asynchronous Iteration and the for-await-of loop to iterate over asynchronous functions like generators and promises.</p><h3>Synchronous Iteration</h3><p><a href="http://exploringjs.com/es6/ch_iteration.html">21. Iterables and iterators</a></p><p>The form of iteration JS programmers are used to using is called Synchronous Iteration. It is used to iterate over things like an array or a function that has completes execution and returns a result.</p><p>It is possible for you to implement your own custom iterators for objects you create. The link above has an in depth explanation of how these iterators work and the different ways they can be used. I will summarize their usage like so:</p><ul><li>Synchronous iteration requires the target object to be <em>iterable</em></li><li>An object is <em>iterable</em> if it defines [Symbol.iterator]()</li><li>[Symbol.iterator]() must return an <em>iterator</em></li><li>An <em>iterator</em> is an object that must at least define a function <em>next()</em></li><li>The function <em>next() </em>must return an object in the form {value: $value, done: false} when iterating over values</li><li>The <em>iterator </em>is considered finished when the<em> next() </em>function returns {done: true}</li></ul><p>Here is an example implementation of a custom iterable:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fj7cm13jj%2F5%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2Fj7cm13jj%2F5%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1c757679e68f5247936b9a120b56d1e/href">https://medium.com/media/f1c757679e68f5247936b9a120b56d1e/href</a></iframe><p>The problem with these synchronous iterators is that they can not be used to iterate over asynchronous operations, like calling a generator function (since generator functions call yield, they do not “finish” executing). To solve this problem the TC39 committee has added asynchronous iteration to the ECMAScript 2018 release.</p><h3>Asynchronous Iteration</h3><p><a href="http://2ality.com/2016/10/asynchronous-iteration.html">ES2018: asynchronous iteration</a></p><p>The new form of iteration, to use when iterating over asynchronous iterators is called asynchronous iteration. It is similar to its synchronous counterpart but instead of defining [Symbol.iterator]() the iterable must instead define [Symbol.asyncIterator](). The creation of asynchronous iterators is as follows:</p><ul><li>Asynchronous iteration requires the target object to be <em>iterable</em></li><li>An object is <em>iterable</em> if it defines [Symbol.asyncIterator]()</li><li>[Symbol.asyncIterator]() must return an <em>AsyncIterator</em></li><li>An <em>AsyncIterator </em>is an object that must at least define a function <em>next()</em></li><li>The function <em>next() </em>must return a promise that resolves with an <em>IteratorResult</em></li><li>The <em>IteratorResult </em>is an object with a form {value: $value, done: false}</li><li>When the iterator is finished it must return {done: true}</li></ul><p>However unlike the synchronous iterators, the asynchronous iterators cannot be used in a standard for-of loop. Instead they must use the new for-await-of loop. I have created an implementation of the synchronous iterator example above using asynchronous iterators below. Notice how the next() function in the iterable return a Promise instead of an object like in the first example. Also worth noting is that we have to use an asynchronous function to await for the result of the asynchronous iteration before we can update the page.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2F1o8w0xj7%2F32%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2F1o8w0xj7%2F32%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf1351b6e6517f5652a9699def0b8cd9/href">https://medium.com/media/bf1351b6e6517f5652a9699def0b8cd9/href</a></iframe><p>While the example is clearly more involved than the first, hopefully you can see that the asynchronous iterators now give developers the power to iterate over Promises and generator functions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec0b6a3a294a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/ecmascript-2018-asynchronous-iteration-ec0b6a3a294a">ECMAScript 2018: Asynchronous Iteration</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction To Rendering In React]]></title>
            <link>https://medium.com/information-and-technology/an-introduction-to-react-rendering-9c24a96b838b?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c24a96b838b</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jsx]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Sat, 30 Dec 2017 04:58:25 GMT</pubDate>
            <atom:updated>2017-12-31T03:15:05.918Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*SnFQ-3TVpHF5jMb6.png" /></figure><p>In this post I want to talk about how React renders components, and how it tries to improve performance by using its reconciliation algorithm to only update the parts of the DOM that need updating. This is not meant to be an introduction to React, but I will quickly go over some of the relevant foundation concepts in the next section.</p><h3>What Is React?</h3><p>React is an open source JavaScript library created by Facebook to address some of the needs they had when dealing with the development of the Facebook website. React has played an important role in the evolution of JavaScript Frameworks because it is responsible for popularizing the Component Based Architecture (CBA) paradigm. An important distinction between React and frameworks like Angular is that React is only a library. For example, React does not provide its own routing or HTTP libraries. To perform these type of tasks in React developers have to rely on other libraries like <a href="https://redux.js.org/">Redux</a> and the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">Fetch API</a>.</p><p>Since React is simply a library, it can be used in existing projects very easily:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/07fba8776f7be9af294ae618ea072f18/href">https://medium.com/media/07fba8776f7be9af294ae618ea072f18/href</a></iframe><p>While it is nice to be able to use React with pure JavaScript things can get hairy when writing a very large app. For this reason you may find it easier to use JSX, an alternative way of writing React code. JSX essentially allows you to combine HTML and JavaScript syntax together to make it easier to mange the code. The same example above can be written using JSX (more on it below):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8d8d1ecac6d0a7ea21e609f260c3a33/href">https://medium.com/media/a8d8d1ecac6d0a7ea21e609f260c3a33/href</a></iframe><h4>Component Based Architecture (CBA)</h4><p>In this article I am not going to go into detail about CBA (there are a ton of great articles already available about that) but I will just explain some of the motivation as to why Reacts approach is useful for developers. When writing code using a framework like AngularJS, you have to use Controllers and Views to create your application. Controllers house the logic (JS) for your application while the Views house the UI elements (HTML). This separation of logic from UI allows for one to be changed without significantly impacting the other. For example if you need to change the logic in a function, this can be done without having to rewrite any of the UI. One of the problems with this approach however, is that it makes it difficult to modify a specific part of the UI without also having to modify other parts of the interface and logic.</p><p>What makes CBA different is that in CBA the logic and UI are kept together, causing the two to be coupled to each other. The goal of CBA is to encapsulate portions of an interface into self contained units called components. The use of encapsulation allows a component to be changed without the developer having to modify any other component. Another major benefit of components is that they are reusable, which is key to writing good code in React.</p><h4>JSX</h4><p>JSX works as a syntax extension for JavaScript that combines templating languages with JavaScript. While JSX is optional to use in React, it is much more elegant than using pure JavaScript so I prefer using it when building React applications. Just like XML, JSX elements can have names, attributes and children. Values enclosed in curly braces are interpreted as JavaScript expressions which you can use to substitute a hard coded value with a variable or evaluation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d175b35f67922d5e638b1c7daa25d0bd/href">https://medium.com/media/d175b35f67922d5e638b1c7daa25d0bd/href</a></iframe><p>When React renders JSX (more on this later) it will convert the JSX elements into JavaScript and then use them to create the DOM. An interesting property of JSX is that <a href="https://reactjs.org/docs/introducing-jsx.html#jsx-prevents-injection-attacks">it prevents injection attacks</a> by converting everything into a string before rendering it. This ensures that a malicious user cannot execute XSS attacks using your application.</p><h4>Unidirectional Data Flow</h4><p>Another fundamental concept in React is the <a href="https://reactjs.org/docs/state-and-lifecycle.html#the-data-flows-down">Unidirectional Data Flow</a> which is how React propagates updates to components. Actions in the UI lead to the state of components being updated which in turn will cause the view to update to reflect these new changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*0aKDfNFWcBPZhBFabUIRCg.png" /></figure><p>Parent components can pass variables to their child components using props to provide them with the necessary context in which to render. Note that the arrows are not bidirectional, this is because components cannot update their parents, they can only receive updates from them.</p><h3>The Initial Render</h3><p>All React applications start at a root DOM node that marks the portion of the DOM that will be managed by React. You add child components to this node using React to get your application to look and behave the way you desire.</p><h4>JSX</h4><p>When React is called to render the component tree it will first need the JSX in your code to be converted into pure JavaScript. This can be achieved by making use of Babel. You may already be familiar with the Babel project for its transpiling capabilities, but it is also be used to convert the JSX you write into pure JavaScript. To see this in action you can check out <a href="https://babeljs.io/repl/#?babili=false&amp;browsers=&amp;build=&amp;builtIns=false&amp;code_lz=FAYwNghgzlAECiAPCBbADmAprTiAumAdgCZwBKmEIeAdAMID26DhResA3sLLAE5HFMvABQBKLjx788AV16Fh3SQEgAPMQCWANwB8HPAAsNUGml4M0JvBrxYAvqoD0m3Up6ild4F9Aso7TCwUNlgAXlh1bR1VJFQMbGtbTFCAIgNAsAYUxx0AFUx_DUIAcycXHQBuX0J_WBAWPAgioTDYYgYQGWDCWmLMPHggtgAhAE8ASWJFHgBycwY8GeBRKooqPAARAHkAWRp-EiFhQMxuvAAaOoam1l4V4CA&amp;debug=false&amp;circleciRepo=&amp;evaluate=false&amp;lineWrap=true&amp;presets=react&amp;prettier=true&amp;targets=&amp;version=6.26.0">this live demo</a> on the Babel website. On the left is the JSX and on the right is the resulting JavaScript.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9607612f902113ff93785aa7ace762ef/href">https://medium.com/media/9607612f902113ff93785aa7ace762ef/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80e19638b6fef509437d693246a93154/href">https://medium.com/media/80e19638b6fef509437d693246a93154/href</a></iframe><h4>Lifecycle Methods</h4><p>React comes with some lifecycle methods that you can use to update and control the application state. You can find out more about how and when to use them by reading <a href="https://medium.com/@baphemot/understanding-reactjs-component-life-cycle-823a640b3e8d">this great article by Bartosz Szczeciński</a>.</p><p>By default, React will re-render all child components of any component that itself has to re-render. This behavior may not always be ideal, for example when re-rendering the component requires performing costly calculations. The shouldComponentUpdate lifecycle method can be used to address this concern. By default it will always return true but you can add logic so that it only returns true under specific conditions. Note that this lifecycle method does not apply to when a component has its internal state changed using setState() which will still cause a re-render even if the shouldComponentUpdate method always returns false.</p><h3>Updating Components</h3><p>Once React has completed the initial render for your application it waits for one of two events before triggering an update for a component. Either the internal state of the component changes, or the props being passed into the component change.</p><p>Internal state of a component can be changed by calling the <a href="https://reactjs.org/docs/react-component.html#setstate"><em>setState()</em></a> function. The important thing to remember about setState() is that it is not executed immediately, as React may delay the state update.</p><blockquote>Think of setState() as a <em>request</em> rather than an immediate command to update the component. For better perceived performance, React may delay it, and then update several components in a single pass. React does not guarantee that the state changes are applied immediately.</blockquote><blockquote>— React Docs</blockquote><p>Props, unlike state, cannot be modified by the component they are being passed into. Components must instead rely on their parent to provide updates to the props. These updates can occur under two situations, either the parent will update the props due to some internal state change or the child will call a function passed down by the parent that updates some state in the parent which in turn will update the props of the component causing it to re-render. Below is an example of how a child component would call a function passed down by its parent, note that it assumes component C did not need to be re-rendered (this is not always the case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*nFZgXzV5n4gMiOcMi1L3iA.png" /><figcaption>Example of child component (B) calling a function in its parent component (A). Green signifies the components that re-render.</figcaption></figure><h4>Reconciliation</h4><p>When React has to perform updates to a component it attempts to improve performance by only updating what needs to be updated. The way React accomplishes this is by using its ‘diffing’ or reconciliation algorithm. According to the React docs, there are two assumptions that React makes when it comes to reconciliation:</p><ul><li>Two elements of different types will always produce different trees</li><li>Developers can hint which child elements are stable across different renders using a key prop</li></ul><p>The reconciliation algorithm behaves differently depending on what type of root element it has to re-render.</p><h4>Elements Of Different Types</h4><p>If the new element is a different type of element than the old element (ex. changing from &lt;span&gt; to &lt;h1&gt;) then React has to perform a full rebuild of the tree. This means that it will destroy the old tree and build a new one from scratch. Note that since the old tree is destroyed, any state associated with it will also be gone. When the old nodes are destroyed, the componentWillUnmount lifecycle method will be invoked. As the new tree is created, the new nodes will call the componentWillMount and componentDidMount lifecycle methods.</p><h4>Elements Of The Same Type</h4><p>If the new element is the same type as the old element then React will keep the same DOM node and instead only updates the attributes that have changed. When the props are changed to match the new element, the componentWillReceiveProps and the componentWillUpdate lifecycle methods are called. For example if you update the style for an element, React knows to only update the specific properties of the CSS that changed. Note that since the node is not destroyed any state associated with the old node is still available. Once React has updated the node, it will recurse on its children.</p><h4>Recursing On Children</h4><p>When the reconciliation algorithm recurses on the children of a node, React iterates over a list of both the old and new children. There is a good explanation of <a href="https://reactjs.org/docs/reconciliation.html#recursing-on-children">how this works</a> in the React docs. As mentioned in the docs, there may be performance issues if the new child is not appended to the list as React will not know what did and did not change. To avoid this issue you can use the key prop to give the element a unique ID so React can determine what actually changed.</p><h3>Conclusion</h3><p>Hopefully that was a useful explanation of how React does rendering of components and why its important to be aware of how you can improve its performance by following certain coding practices. If you have any questions or feedback, please leave a message in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c24a96b838b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/an-introduction-to-react-rendering-9c24a96b838b">An Introduction To Rendering In React</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test Driven Development In JavaFX With TestFX]]></title>
            <link>https://medium.com/information-and-technology/test-driven-development-in-javafx-with-testfx-66a84cd561e0?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/66a84cd561e0</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[javafx]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Mon, 07 Aug 2017 03:54:38 GMT</pubDate>
            <atom:updated>2024-05-02T02:45:18.108Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>This post has been migrated to my new blog that you can find here:</h3><p><a href="https://pureooze.com/blog/posts/2017-08-06-test-driven-development-in-javafx-with-testfx/">https://pureooze.com/blog/posts/2017-08-06-test-driven-development-in-javafx-with-testfx/</a></p><p><strong>A dive into how to test JavaFX applications using TestFX.</strong></p><p><strong>If you just want to read about how to use TestFX skip to the “Setting Up Our Application” section.</strong></p><p>I recently started working at a company that has a very heavy reliance on Java applications. As a primarily Python, Javascript and C++ developer, I had not used Java for a few years so given the obvious fact that I would have to get comfortable with using Java on a day to day basis, I decided to work on a small project in Java to get my feet wet.</p><h4>The Application</h4><p>While thinking about possible project ideas for this Java application I browsed through <a href="https://github.com/pureooze?tab">my Github repos</a> and saw an all too familiar project, a podcast feed aggregator/player that I had worked on with some friends. The application was written using Qt 5.8 and was capable of fetching RSS feeds for any audio podcast on iTunes, stream episodes and render the HTML contents associated to an individual episode. The links shown below in the right hand side widget would also open in the default system browser when clicked on by a user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZzOnv9RzZcvm6Lv4y3LOQ.png" /><figcaption>Screenshot of the original PodcastFeed application. On the left is the podcast list, the middle is the episode list (contents change based on selected podcast) and the right is the description rendering for each individual episode.</figcaption></figure><p>While the application looks pretty simple (and it is) the fun of developing this came from working with two friends to learn Qt while also developing the application quickly and in a small amount of time. The reason I considered rewriting this application in Java was because the code we originally wrote had several flaws (keep in mind we developed it in a very short amount of time):</p><ul><li>We wrote <strong>zero</strong> tests for the application (Yikes!!)</li><li>Classes were an after thought, they were not part of the initial design</li><li>Due to the above the functions were very tightly coupled</li><li>Tight Coupling made it very difficult to modify core processes of the application (like XML parsing) without breaking other features</li></ul><h4>The Approach — TDD</h4><p>Given the flaws mentioned above it became clear to me that I would need to take a different approach to this new application if I wanted any hope of being able to maintain it for any reasonable amount of time. For help with how to approach this application design I turned to a book I had been reading recently: <em>Growing Object-Oriented Software, Guided by Tests by Steve Freeman and Nat Pryce</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*t3i3vFXWo-6xiD4jLkFO8g.jpeg" /><figcaption>Tests are a core part of development, and this book is a great source of knowledge about how to create good tests.</figcaption></figure><p>This book is a fantastic read if you want to learn about what makes Test Driven Development a powerful tool for use in Object Oriented development. The authors provide a lot of deep insight on <em>why</em> tests are important, <em>what</em> kind of tests should be used when and <em>how</em> one writes expressive, easy to understand tests. I will spare the details on TDD but you can google it or read the book above to learn more about it.</p><p>The authors of the book continuously stress the importance of using End to End tests because of their ability to test the full development, integration and deployment processes in an organization. I myself do not have automated build systems such as Atlassian’s Bamboo system so my automation capabilities are limited, but I can make use of Unit tests to test individual functions and UI Tests to try and get as much End to End coverage (between the local application and the podcast data on the Internet) as possible.</p><h3>To read the rest of this post it can be found on my new blog here:</h3><p><a href="https://pureooze.com/blog/posts/2017-08-06-test-driven-development-in-javafx-with-testfx/">https://pureooze.com/blog/posts/2017-08-06-test-driven-development-in-javafx-with-testfx/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66a84cd561e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/test-driven-development-in-javafx-with-testfx-66a84cd561e0">Test Driven Development In JavaFX With TestFX</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Experience With Medium]]></title>
            <link>https://medium.com/information-and-technology/my-experience-with-medium-7ff48858234e?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ff48858234e</guid>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Thu, 29 Sep 2016 04:30:41 GMT</pubDate>
            <atom:updated>2016-09-29T04:30:41.068Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>It’s been about 3 months now since I switched over to Medium from Wordpress. Now that I have had a chance to experience it a bit I think I can provide a comparison between Medium and Wordpress.</p><h3>Pros</h3><ul><li>Simple, easy to use interface, almost never have to drill down menus looking for options</li><li>Super easy to use editor, its basically blank and you only see what you write until you want to insert something, save or publish your post</li><li>“Reads” statistics, this lets you see how many people that visit a specific post actually bother to scroll down or read it. It’s a useful way to determine if you are doing a good job of capturing the readers interest</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eHkR_13GaN9SvNdC0gA0xw.png" /><figcaption>Views column shows direct views in black and indirect (ex. RSS) views in gray</figcaption></figure><ul><li>Medium doesn’t do the stupid “” replacement with html character codes that Wordpress performs in code tags. This was one of the reasons I decided to leave Wordpress, the ability to disable the “feature” required paying</li><li>Publications allow you to easily setup a system where members can submit posts that are displayed on a shared page</li><li>Draft comments can be left by members of your publication and those you share the draft link with, allowing you to get feedback on stories before making them public</li><li>Comments can leave tags on your article, allowing readers to easily reference sections that they are addressing</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*HkXIvJXJco-9vj0QziVpIQ.png" /><figcaption>Notes that readers can leave behind for the author/publication</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*K0QXbhXa1GfqLX83umj20Q.png" /><figcaption>Notes are also visible in the comments, you can click on them to jump to the referenced portion of the post</figcaption></figure><ul><li>Great embedding support, I found it very easy to embed and format things into posts. Pictures, Twitter, Videos, its all pretty nice and easy</li><li>Lack of plugins, strangely a good thing. One of the biggest detractors of Wordpress is the <strong>terrible</strong> nature of plugin developers (and users) to never address security issues. It’s extremely common for Wordpress sites to get breached due to insecure/not updated plugins</li></ul><h3>Cons</h3><ul><li>Lack of syntax highlighting is super annoying on Medium. I have not looked for alternatives to the default code boxes but they are not that useful. Wordpress provided some great features in its code tags.</li><li>Cannot really mess around with the blog theme, while the default looks fine it leaves something to be desired. I actually really liked the theme from my Wordpress blog as it was simple to navigate and just showed you the content you wanted to see.</li><li>Medium definitely does not give you as much control of the blog as Wordpress did, however this wasn&#39;t as big as a con as it may seem. Most of the time I never used any of the fancy admin features Wordpress provided (mainly because you need to pay to use them)</li><li>Does not seem to have as much help available online as Wordpress does, makes it tricky at times when I want to do something fancy and cannot determine if Medium actually supports the feature</li><li>Medium does not allow you to leave notes for readers which can be frustrating when you don’t want to sidetrack the main content of the blog post</li></ul><p>Overall I think I am happy with using Medium over Wordpress. It feels more slick to me and the editor is really easy to use. While some of the issues above do leave me wanting for the functionality I had in Wordpress, I think that Medium provides an overall better experience for writing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ff48858234e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/my-experience-with-medium-7ff48858234e">My Experience With Medium</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is PAM?]]></title>
            <link>https://medium.com/information-and-technology/wtf-is-pam-99a16c80ac57?source=rss-c3ee0a84d2ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/99a16c80ac57</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[pams]]></category>
            <category><![CDATA[information-technology]]></category>
            <dc:creator><![CDATA[Uzair Shamim]]></dc:creator>
            <pubDate>Mon, 08 Aug 2016 01:26:16 GMT</pubDate>
            <atom:updated>2024-05-02T02:43:47.475Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>This post has been migrated to my new blog that you can find here:</h3><p><a href="https://pureooze.com/blog/posts/2016-08-07-what-is-pam/">https://pureooze.com/blog/posts/2016-08-07-what-is-pam/</a></p><p>The last post I did was the start of the <a href="https://medium.com/information-and-technology/so-what-is-apparmor-64d7ae211ed">Comprehensive Guide To AppArmor</a> which took a look at the basics an administrator or developer needs to know to start creating and deploying AppArmor profiles for a program. In the post I also left a question for the reader regarding AppArmor being used to replace the traditional DAC permissions (but never should!) and how you could use it to remove access to a file from a specific user (rather than a program). However this requires usage of the pam_apparmor module for PAM and due to this, before going into depth with using pam_apparmor, you should make sure you have a grasp of the basics of PAM and its configuration files.</p><h3>Seriously What Is PAM?</h3><p>PAM stands for Pluggable Authentication Modules and is used to perform various types of tasks involving authenticaction, authorization and some modification (for example password change). It allows the system administrator to separate the details of authentication tasks from the applications themselves. This allows the policy to not only be generic, it means that the programs <strong>do not need to be modified</strong> in order to update the policy! An example of PAM usage is controlling login attempts to a shell/GUI interface so that only successful authentication and authorized events are allowed. You could also use PAM to control who can use the <strong><em>su</em></strong> binary to switch identities or control who can use the <strong><em>passwd</em></strong> utility to change passwords.</p><h4>Overview</h4><p>When a developer wishes to interact with PAM to let it handle events, they must include <strong>libpam</strong> which allows communication via the API provided by the library. When PAM sees a new event that it must process, it will look at the relevant configuration files found in <strong>/etc/pam.d </strong>and determine which modules must be used at certain stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*ltCYgE0BcsaNw16b.png" /><figcaption>Source: <a href="http://www.tuxradar.com/content/how-pam-works">http://www.tuxradar.com/content/how-pam-works</a></figcaption></figure><p>PAM is capable of using context to determine what it needs to do, for example the <strong>pam_unix.so</strong> module has capabilities for the auth and account stack. In the auth stack it checks a username and password combo while in the account stack it will check a users aging and expiration info. This versatility is one of the reasons PAM has been so popular in the UNIX world, it allows for solutions that can be combined to create a generic library to deal with certain type of request.</p><h4>How Do I Tell A Program Supports PAM?</h4><p>This is usually pretty easy, you can use ldd to check if libpam is in use:</p><pre>comp:/home # ldd /usr/sbin/sshd | grep pam<br>   libpam.so.0 =&gt; /lib64/libpam.so.0 (0x02209ddace0105400)</pre><pre>comp:/home # ldd /bin/su | grep pam<br>   libpam.so.0 =&gt; /lib64/libpam.so.0 (0x02999ddace0105400)<br>   libpam_misc.so.0 =&gt; /lib64/libpam_misc.so.0 (0x12211ddace1105400)</pre><h3>To read the rest of this post it can be found on my new blog here:</h3><p><a href="https://pureooze.com/blog/posts/2016-08-07-what-is-pam/">https://pureooze.com/blog/posts/2016-08-07-what-is-pam/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99a16c80ac57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/information-and-technology/wtf-is-pam-99a16c80ac57">What is PAM?</a> was originally published in <a href="https://medium.com/information-and-technology">Information &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>