<?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 Afa Madza on Medium]]></title>
        <description><![CDATA[Stories by Afa Madza on Medium]]></description>
        <link>https://medium.com/@The_Mad_Zaafa?source=rss-98b759c886e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7Yg7FswKP_05A5gw6rx6iA.jpeg</url>
            <title>Stories by Afa Madza on Medium</title>
            <link>https://medium.com/@The_Mad_Zaafa?source=rss-98b759c886e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 20:57:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@The_Mad_Zaafa/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[Internet of Things (IoT): Concepts, Concerns & Applications]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/internet-of-things-iot-concepts-concerns-applications-c0647473b461?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0647473b461</guid>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[internet]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 04:37:26 GMT</pubDate>
            <atom:updated>2018-06-26T04:42:51.821Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*YTGJHbN-sPKi0wXFGoJX3w.jpeg" /></figure><blockquote>“The most profound technologies are those that disappear. They weave themselves into the fabric of everyday life until they are indistinguishable from it.” -Mark Weiser</blockquote><p>If you’ve seen the movie Minority Report or any episode of the TV series Black Mirror, you definitely have some idea of what exactly the Internet of Things (IoT) is, and how impactful it can be to life. For those who are not familiar with the latter, Black Mirror is an award-winning Netflix Original. The show is a psychological introspective that shows what exactly life would be like if technology had advanced to such a degree that our lives were fully entrenched within the IoT. What if where you lived, or the type of job you could have were determined by your 5-star rating? What if how far you could progress in life was limited by a points system? Black Mirror provides a refreshing perspective and explores these questions and many more. One episode in particular, “Nosedive,” deals with a character called Lacie who lives in a version of America where every minuscule interaction with other people is ranked on a scale from 1 to 5 by the involved parties on an application that syncs with augmented-reality contact lenses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*_VCgQD4PdZG9mE1r" /></figure><p>As such, the minute you see someone, you can also see their ranking which forces interactions between people to become superficially cheery, as individuals try to get higher ratings. Black Mirror is so intriguing because the concepts presented seem almost other-worldly, but in actually aren’t too far off from becoming reality. The technological framework for a full IoT is already here, and Black Mirror gives us a glimpse at some of the possible ways our lives could be affected.</p><h3>What is IoT?</h3><p>The IoT is the network of physical devices, vehicles, home appliances, and other items embedded with electronics, software, sensors, actuators and connectivity which enables these things to connect and exchange data. The term “Thing” in “Internet of Things” is used quite broadly. For example, a thing within the IoT could be a person with a heart monitor implant, a pet with a biochip transponder, a vehicle that has built-in sensors to alert the driver when tire pressure is low — or any other natural or man-made object that an IP address can be assigned to, thus gaining the ability to transfer data over a network. As a result, it is becoming increasingly easy to create opportunities to directly integrate the physical world into computer-based systems which results in improvements, efficiency, economic benefits and reduced human exertion.</p><p>The definition of the IoT has evolved due to a convergence of multiple technologies such as wireless technology, machine learning, automation, micro-electromechanical systems, and the internet. This convergence has facilitated the bridging of the gap between operational technology and information technology, allowing unstructured machine-generated data to be analyzed for insights that will drive innovation. The concept of a network of smart devices has been around since 1982. A modified Coke machine at Carnegie Mellon University became the first internet-connected appliance. The Coke Machine was able to report its inventory and whether newly loaded drinks were cold. The contemporary vision that we have of the IoT today, is in large part due to the efforts of Mark Weiser’s paper, “The Computer of the 21st Century.” His paper talked about ubiquitous computing, and how eventually technology would become so intertwined with our lives to the point where we couldn’t even imagine how life would be otherwise. In his book “Emerging Technologies for Learning,” David Becta describes ubiquitous computing as “ a vision of computing power ‘invisibly’ embedded in the world around us and accessed through intelligent interfaces: ‘Its highest ideal is to make a computer so embedded, so fitting, so natural, that we use it without even thinking about it.’ This is about a shift to human-centered computing, where technology is no longer a barrier, but works for us, adapting to our needs and preferences and remaining in the background until required. This implies a change in our relationship with ICT [Information and Communications Technology] to a much more natural way of interacting and using the power of networked computing systems which will be connected not just to the internet or other computers, but to places, people, everyday objects and things in the world around us.”</p><h3>Practical Applications of IoT</h3><p>In his 1999 presentation to Procter &amp; Gamble, Kevin Ashton, the co-founder of the Auto-ID Center at the Massachusetts Institute of Technology, explained the potential of IoT: “Today computers — and, therefore, the internet — are almost wholly dependent on human beings for information. Nearly all of the roughly 50 petabytes (a petabyte is 1,024 terabytes) of data available on the internet were first captured and created by human beings by typing, pressing a record button, taking a digital picture or scanning a bar code. The problem is, people have limited time, attention and accuracy — all of which means they are not very good at capturing data about things in the real world. If we had computers that knew everything there was to know about things — using data they gathered without any help from us — we would be able to track and count everything and greatly reduce waste, loss and cost. We would know when things needed replacing, repairing or recalling and whether they were fresh or past their best.” Practical application of IoT technology can be seen in numerous industries, but I’ll focus on transportation and building management for this article.</p><h4>IoT Example: Autonomous Vehicles</h4><p>An autonomous vehicle, sometimes referred to as self-driving cars or driverless cars, is a vehicle that uses a combination of sensors, camera, radar and artificial intelligence (AI) to travel between destinations without a human operator. In order to qualify as being completely autonomous, a vehicle must be able to navigate without needing human intervention to a predetermined destination via roads that have not been adapted for its use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*nRNNSp9_Ewf763Cs.png" /></figure><p>AI technologies power self-driving car systems. Developers of autonomous vehicles use vast amounts of data from image recognition systems along with neural networks and machine learning. The intersection of these various fields results in being able to build systems that can drive autonomously. Neural networks identify patterns in the data, obtained through sensors and various other hardware, which is passed on to the machine learning algorithms. One prominent example is Google’s self-driving car which uses a mix of sensors and then combines all of the data generated by those systems in order to identify objects around the vehicle.</p><h4>IoT Example: Smart Homes</h4><p>Smart Home technology, also known as home automation is a classic example of the IoT in practice. Home automation provides home owners with comfort, security, convenience and improves energy efficiency by affording them the ability to control other smart devices, usually via a smart home app on their smartphone or a different networked device. Smart home systems and devices operate together and share consumer usage data among themselves in order to automate actions based on the owner’s preferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*hmD0-FYWJ8uqUP1q.jpg" /></figure><p>Today, almost every appliance associated with domestic life has a smart home option. A few examples:</p><ul><li>Smart TVs connect to the internet to access content through applications, such as on-demand video and music. Some smart TVs also include voice or gesture recognition.</li><li>Using smart locks and garage-door openers, users can grant or deny access to visitors. Smart locks can also detect when residents are near and unlock the doors for them.</li><li>Pet care can be automated with connected feeders. Houseplants and lawns can be watered by way of connected timers.</li></ul><h3>Concerns Associated with IoT</h3><h4>Invasion of Privacy &amp; Unlawful Surveillance</h4><p>As I mentioned earlier in the article, a thing is essentially any object that can be assigned an IP address. Unfortunately, as technology advances, so too does the potential for unethically using that technology increase. Briefly returning to our smart home example, and internet-connected door lock could possibly be used to monitor when a person enters or leaves their home. TVs with voice control capability could potentially be used as a listening device to eavesdrop on conversations. One potential defense against IoT attacks is to segment your network. This means creating two distinct networks in your house: one network houses mobile devices and personal computers while the other is reserved for IoT devices.</p><h4>Network Security</h4><p>One fundamental concern regarding IoT is the fact that the more devices you have, the more data you have to protect. A decade ago, most people just had to worry about protecting their personal computers. A few years later, we had to worry about protecting our smartphones as well. Now, there’s a plethora of “things” that we need to protect. The bottom line is that any device with built-in network connectivity is a potential security risk because hackers have more points within the network to exploit. Additionally, not only do we have to be concerned about where our data is stored, we also have to be wary of what data IoT devices transmit and where they ultimately end up.</p><h3>Conclusion</h3><p>Although IoT seems like an extremely attractive concept in theory, we need to consider ways to improve upon the technology in order to ensure the safety of data and privacy. A glaring hole concerning IoT is the fact that there is not a comprehensive means of managing all of an individual’s IoT devices. If on the other hand, we are able to fix those issues, it will certainly be interesting to witness how exactly people’s behavior would change. Hopefully we never get to experience the negative aspects of IoT portrayed in Black Mirror.</p><h3>Sources</h3><ul><li><a href="http://www.iotevolutionworld.com/iot/articles/428409-iot-brings-minority-report-future-now.htm">IoT Brings you Minority Report: The Future is Now</a></li><li><a href="https://sites.psu.edu/ist110pursel/2017/12/01/black-mirror-and-the-internet-of-things/">IST 110: Introduction to Information Sciences and Technology</a></li><li><a href="https://www.theatlantic.com/entertainment/archive/2016/10/black-mirror-nosedive-review-season-three-netflix/504668/">&#39;Black Mirror&#39; Is Back: &#39;Nosedive&#39; Is a Sharp Satire About Social Media</a></li><li><a href="https://www.networkworld.com/article/3166106/internet-of-things/4-critical-security-challenges-facing-iot.html">4 critical security challenges facing IoT</a></li><li><a href="https://internetofthingsagenda.techtarget.com/definition/smart-home-or-building">What is smart home or building? - Definition from WhatIs.com</a></li><li><a href="https://en.wikipedia.org/wiki/Internet_of_things">Internet of things - Wikipedia</a></li><li><a href="https://internetofthingsagenda.techtarget.com/definition/Internet-of-Things-IoT">What is IoT (Internet of Things) and How Does it Work?</a></li><li><a href="https://www.cio.com/article/2895398/internet/3-reasons-to-be-wary-of-the-internet-of-things.html?page=2">3 reasons to be wary of the Internet of Things</a></li><li><a href="https://searchenterpriseai.techtarget.com/definition/driverless-car">What are Self-Driving Cars and How Do They Work?</a></li></ul><p><a href="http://archive.teachfind.com/becta/research.becta.org.uk/upload-dir/downloads/page_documents/research/emerging_technologies07_chapter6.pdf">http://archive.teachfind.com/becta/research.becta.org.uk/upload-dir/downloads/page_documents/research/emerging_technologies07_chapter6.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0647473b461" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning: An Explanation for the Novice]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/machine-learning-an-explanation-for-the-novice-eb22d6515a32?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb22d6515a32</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Sun, 27 May 2018 02:44:07 GMT</pubDate>
            <atom:updated>2018-05-27T02:44:07.148Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*diAwIcxbca8EFJsFYsmK0A.jpeg" /></figure><p>Within the technology industry, there are numerous fields. The purpose of this article is to provide insight into one of those fields, namely machine learning. In this article, I will provide a high level explanation of machine learning so that even beginners who are not well versed in technical concepts relating to the field will gain some understanding of what machine learning is, and how crucial it is to various aspects of our lives. We’ll explore common machine learning methods and algorithmic approaches.</p><h3>Machine Learning</h3><p>Machine learning is an area of study within the field of Artificial Intelligence (AI). The primary objective of machine learning is to understand the structure of data and fit the data into models that are meaningful and that can be used by people. An oversimplification of machine learning is that it produces predictions. For example, “Given an instance with particular attributes, predict something about that instance.” The predictions could potentially be about the future (“predict what the price of a stock will be at a certain point in time”), but the could also be about qualities that are not immediately obvious to a computer, (“predict whether an image is a cat or a dog”). Although there is a lot of overlap between machine learning and other fields of computer science such as data science, it differs from traditional computational approaches. In traditional computing, algorithms are sets of well defined programming instructions that computers utilize to solve a problem. Machine learning algorithms on the other hand provides the capability of allowing computers to train on data inputs (a plethora of cat or dog images for instance) and use statistical analysis in order to generate values that fall within a specific range (whether the image was a cat or dog). As a result, machine learning facilitates computers building models from sample data in order to automate decision-making processes based on data inputs.</p><h3>Machine Learning Methods</h3><p>In machine learning, tasks are generally classified into three broad categories namely <em>supervised learning</em>, <em>unsupervised learning</em>, and <em>reinforcement learning</em>. These categories are based on how learning is accomplished or how feedback on the learning is given to the system developed. The supervised learning method trains algorithms based on example input data and output data that is labeled by humans, whereas in unsupervised learning, the data given to the algorithm is not labeled. Reinforcement learning refers to goal-oriented algorithms which learn how to attain a complex objective or maximize along a particular dimension over many steps.This is done so as to allow the algorithm to find structure within the data that it was provided with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*BQaqyvnW4jThHt0_." /></figure><h4>Supervised Learning</h4><p>In simple terms, in supervised learning, we already know the solution to a task or problem based on past or completed data. The idea is to find a model that can predict the answers when we don’t know them (either in future or incomplete data).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/0*nHI9O0cUxANtDqIR." /></figure><p>Supervised learning is accomplished through two general tasks:</p><ul><li><strong>Regression</strong>: the task of approximating a mapping function from input variables to a continuous output variable, such that the continuous output variable is a real value such as an integer or float.</li><li><strong>Classification</strong>: the task of approximating a mapping function from input data variables to discrete output variables, such that the output variable is a label, category or class. The mapping function predicts the class or category for a given observation.</li></ul><p>Although classification and regression predictive modeling problems are distinct. There is some overlap between the algorithms for them. For example, a classification algorithm may predict a continuous value, but the continuous value is in the form of a probability for a class model. Some algorithms may be used for both classification and regression with small modifications such as decision trees and artificial neural networks. <em>A common use case of supervised learning is to use historical data to predict statistically likely future events</em>.</p><h4>Unsupervised Learning</h4><p>In unsupervised learning, data is unlabeled, so the algorithm is left to find commonalities among its input data. Essentially, we want the algorithm to find unknown structures or trends. Although the data provided has no labels, we want the algorithm to organise the data into groups, clusters or classes. We can further divide supervised learning into:</p><ul><li><strong>Cluster Analysis</strong>: the task or grouping into sets based on similarity</li><li><strong>Density Estimation</strong>: the task of using statistical models to find an underlying probability distribution that gives rise to the observed variables.</li><li><strong>Dimensionality Reduction</strong>: the task of finding a smaller set of variables that captures the essential patterns of the observed variables. Reducing the size of data while still retaining core characteristics.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*vvhrKU8zY_loh3_x." /></figure><p>Without being given a correct answer, unsupervised learning methods can look at complex data that is expansive and seemingly unrelated in order to organize it in a meaningful way. For example, given untagged photos of dogs as input data, an algorithm would eventually be able to classify the dog photos together. <em>The goal of unsupervised learning is to discover hidden patterns within a dataset</em>.</p><h4>Reinforcement Learning</h4><p>In reinforcement learning, much like in unsupervised learning, the algorithm is not provided with answers. Instead, the algorithm is tasked with deciding how to perform a task it has been given. Since there is no training data, the algorithm must learn from experience. It collects training examples through trial and error as it attempts to complete the task with the goal of maximizing long-term reward. The easiest context to understand reinforcement learning is in games with a clear objective and a point system. Like a child that is incentivized by either positive or negative reinforcement, algorithms are penalized when they make the wrong decisions and are rewarded when they make the right ones. Reinforcement learning solves the difficult problem of correlating immediate actions with the delayed returns that they produce. Quite like humans, reinforcement learning algorithms often have to wait to see the fruit of their decisions. They operate in a delayed return environment where it can be difficult to understand which action leads to a certain outcome over the course of time and steps taken. Reinforcement learning algorithms can be expected to perform better in more ambiguous environments while choosing from an arbitrary number of possible actions rather than the limited options of a game. This <a href="https://medium.com/machine-learning-for-humans/reinforcement-learning-6eacf258b265">article</a> by Vishal Maini provides a good example of a game that could be used to train a reinforcement learning algorithm (read the section about the robotic mouse in a maze).</p><h3>Implementing Machine Learning</h3><p>Machine learning techniques use a train and test system known as cross-validation before using machine learning algorithms in real situations. Validation is defined as the process of deciding whether the numerical results that quantify the hypothesized relationships between variables are acceptable as descriptions of the input data. Cross-validation on the other hand is used to gain insight as to how well a model will generalise to other data sets and not just the data used to train it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*BNSHqBCyZe6SGcTU." /></figure><p>There is always a need to validate the stability of machine learning models so as to provide assurance that the model has interpreted the data correctly and is not high in bias or variance.</p><h3>Practical Applications</h3><p>Machine learning is all around us. There are several everyday examples of machine learning being used that we do not even realize. To name a few, the techniques are applied and used in: search engines, spam filtering, facial recognition, social network analysis, market segmentation, data analysis, fraud detection and risk analysis.</p><p>Sometimes a description is not enough. With these complex algorithms, it’s often more beneficial to see practical examples of how to use the techniques with actual data and real-life applications. Let’s take a look at some of the different ways to machine learning in finance.</p><p>Unsupervised learning techniques can be applied to analyse and understand financial data. For example, <a href="http://quantdare.com/analisis-de-componentes-principales/">PCA</a> can be used as an asset allocation tool, <a href="http://quantdare.com/k-means-algorithm/">k-means clustering</a> as a way of grouping returns in the equity market, or other <a href="http://quantdare.com/reproducing-the-sp500-by-clustering/">clustering techniques</a> to reproduce the S&amp;P 500 or even <a href="http://quantdare.com/stock-classification-with-isomap/">ISOMAPs</a> to help classify stocks into sectors.</p><p>Supervised learning techniques are extraordinarily well suited to financial problems. They can be used to make predictions and help make decisions in investment and risk strategies. For example, techniques like <a href="http://quantdare.com/vecinos-serie-temporal/">Nearest Neighbours</a>, <a href="http://quantdare.com/redes-neuronales-ii/">Neural Networks</a>, <a href="http://quantdare.com/clasificando-mercado-con-arboles-de-decision/">Decision trees</a> &amp; <a href="http://quantdare.com/random-forest-vs-simple-tree/">Random Forests</a>, and <a href="http://quantdare.com/naive_bayesian_classifier/">Naïve Bayes</a> have applications to detect the type of market movement in currency crosses and the stock market.</p><h3>Conclusion</h3><p>Although data and computational analysis may make us think that we are receiving objective information, this is not the case. Human bias plays a role in how data is collected, organized and ultimately in the algorithms that determine how machine learning will interact with that data.If, for example, people are providing images for “fish” as data to train an algorithm, and these people overwhelmingly select images of goldfish, a computer may not classify a shark as a fish. This would create a bias against sharks as fish, and sharks would not be counted as fish.As machine learning is increasingly leveraged in business, uncaught biases can perpetuate systemic issues that may prevent people from qualifying for loans, from being shown ads for high-paying job opportunities, or from receiving same-day delivery options. Because human bias can negatively impact others, it is extremely important to be aware of it, and to also work towards eliminating it as much as possible. Because machine learning is a field that is continuously being innovated, it is important to keep in mind that algorithms, methods, and approaches will continue to change.</p><h3>Sources</h3><ul><li><a href="https://machinelearningmastery.com/classification-versus-regression-in-machine-learning/">Difference Between Classification and Regression in Machine Learning - MachineLearningMastery.com</a></li><li><a href="https://deeplearning4j.org/deepreinforcementlearning">A Beginner&#39;s Guide to Deep Reinforcement Learning</a></li><li><a href="https://www.digitalocean.com/community/tutorials/an-introduction-to-machine-learning">An Introduction to Machine Learning | DigitalOcean</a></li><li><a href="https://quantdare.com/machine-learning-a-brief-breakdown/">Machine Learning: a brief breakdown ⋆ Quantdare</a></li><li><a href="https://medium.com/machine-learning-for-humans/reinforcement-learning-6eacf258b265">Machine Learning for Humans, Part 5: Reinforcement Learning</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb22d6515a32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Immutable vs Mutable Objects (Python)]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/immutable-vs-mutable-objects-python-c3ee2c7b408e?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3ee2c7b408e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Wed, 09 May 2018 07:37:27 GMT</pubDate>
            <atom:updated>2018-05-09T07:49:53.732Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*tSyZpiivGgnHOKHN.jpg" /></figure><p>In the Python programming language, everything is an object. Not all objects in Python handle change the same way. Before going on further to explain, I’ll need to define some important terms. First, a <strong>class</strong> in Python is essentially a blueprint created by a programmer for an object. It defines a set of attributes that will characterize any object that is instantiated from that specific class. An <strong>object</strong> on the other hand, is an instance of a class. This is the realized version of the class, where the class is manifested in the program. Specifically, the different types of objects I’ll be discussing include <strong>mutable</strong> and <strong>immutable</strong> objects.</p><h3>id() and type()</h3><p>In order to better understand mutability, it would be beneficial to talk about Python’s built-in id and type functions. The id function returns the identity of an object. This is guaranteed to be unique among simultaneously existing objects. It basically returns the object’s memory address. For instance:</p><pre>&gt;&gt;&gt; a = 7<br>&gt;&gt;&gt; id(a)<br>35143880 </pre><p>In this snippet of code, we assigned the variable a to the integer 7. Calling the id function with a as a parameter then returns the integer’s memory address on the next line. The type function on the other hand returns an objects type. For example:</p><pre>&gt;&gt;&gt; a = 7<br>&gt;&gt;&gt; type(a)<br>&lt;type &#39;int&#39;&gt;</pre><p>In this snippet of code, we simply call the type function with a as an argument. The objects type is displayed on the next line. Now that we have these two tools at our disposal, we can now start discussing mutable an immutable types.</p><h3>Mutable Objects</h3><p>In Python, some common mutable objects include lists, dicts, and sets. In simple terms, when an object is referred to as being mutable, it means that the object, or the contents of that object can be altered. A good way to think about which types are mutable and which are not is that <em>containers </em>and <em>user-defined </em>types are usually mutable while scalar types are almost always immutable. Notable exceptions for this logic includes a <em>tuple</em>, which is a container but is immutable, and a <em>frozenset.</em> A frozenset is an immutable version of a set. say for example that you had a list of things to do as follows:</p><pre>&gt;&gt;&gt; to_do = [&#39;laundry&#39;, &#39;read&#39;, &#39;taxes&#39;]</pre><p>After getting back from a long day of work, the last thing you want to do is your taxes, so you decide to take that off your list like so:</p><pre>&gt;&gt;&gt; to_do.pop(2)<br>&#39;taxes&#39;<br>&gt;&gt;&gt; print(to_do)<br>[&#39;laundry&#39;, &#39;read&#39;]</pre><p>Instead of doing your taxes, you’d rather relax with a cold beverage in hand, so lets make that happen.</p><pre>&gt;&gt;&gt; to_do.append(&#39;cold_one&#39;)<br>&gt;&gt;&gt; print(to_do)<br>[&#39;laundry&#39;, &#39;read&#39;, &#39;cold_one&#39;]</pre><p>We were able to easily manipulate our list because its mutable. If we had a list for two different days like so:</p><pre>&gt;&gt;&gt; to_do1 = [&#39;groceries&#39;, &#39;gym&#39;, &#39;cook&#39;]<br>&gt;&gt;&gt; to_do2 = [&#39;groceries&#39;, &#39;gym&#39;, &#39;cook&#39;]<br>&gt;&gt;&gt; id(to_do1), id(to_do2)<br>(140395611717000, 140395611716928)</pre><p>We could use the id function to check the memory address of each list. As we can see, the memory addresses are different, so although, the lists have the same value, they point to different places in memory. This is important to note because more likely than not, if the memory address is different while the value is the same, then the object is mutable.</p><h3>Immutable Objects</h3><p>Common immutable objects in Python include ints, floats, tuples, and strings. Unlike mutable objects, the immutable objects can’t be changed. Instead, they return a new object entirely if they are updated. We’ll use our tax example again, but this time they’ll be in a tuple and not a list.</p><pre>&gt;&gt;&gt; to_do = (&#39;laundry&#39;, &#39;read&#39;, &#39;taxes&#39;)</pre><p>Now that we have our tuple, we’ll try to use the pop attribute that we used before to remove taxes from the tuple.</p><pre>&gt;&gt;&gt; to_do.pop(2)<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>AttributeError: &#39;tuple&#39; object has no attribute &#39;pop&#39;</pre><p>Since a tuple is not a list, we got an error because the pop method is not available to tuples. Instead, lets try to assign an empty string to the index where taxes is:</p><pre>&gt;&gt;&gt; to_do[2] = &quot;&quot;<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>TypeError: &#39;tuple&#39; object does not support item assignment</pre><p>Again, we are met with an error. This error tells us that tuples don’t <em>support item assignment. </em>That’s Python’s way of politely saying, you can’t change this object. Seems like there’ll be no cold ones for us this time. Another example of an object we won’t be able to change is a string.</p><pre>my_string  = &quot;Avadakedavra&quot;</pre><p>For our string, we are using a well know magic spell. Let us attempt to change the letter k to q.</p><pre>&gt;&gt;&gt; my_string[5] = &#39;q&#39;<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>TypeError: &#39;str&#39; object does not support item assignment</pre><p>Once again, we get the error informing us that we can’t change the object. If we were to create another variable for the string, we would be able to us the id function to check both memory addresses like so:</p><pre>&gt;&gt;&gt; my_string  = &quot;Avadakedavra&quot;<br>&gt;&gt;&gt; my_spell = &quot;Avadakedavra&quot;<br>&gt;&gt;&gt; id(my_string), id(my_spell)<br>(140395550790560, 140395550790560)</pre><p>As we can see, although two different variable names have been assigned to the string, the id function still shows that they point to the same memory address. Unlike mutable objects, when the memory addresses are the same despite having different variable names, the object is immutable.</p><h3>So what?</h3><p>Although mutability might not seem like an important concept, it becomes crucial when trying to write efficient programs. For instance, to concatenate a string, one could do the following:</p><pre>my_string = &quot;&quot;<br>for word in words:<br>    my-string += str(data)</pre><p>Although this program would work, it is extremely inefficient. Since strings are immutable, concatenating two strings actually creates a third string which is a combination of the previous two. If you are iterating over a lot of text to build a large string, a lot of memory will be used to create and discard the objects as the program is running. A more efficient way to do the same thing would be as follows:</p><pre>&quot;&quot;.join(str(word) for word in words)</pre><p>This code takes advantage of the mutability of a list object to gather the words together and then allocates a single result string to put the combination of all the words in. This reduces the amount of memory used by the program.</p><h3><strong>Passing Immutable and Mutable Arguments to Functions</strong></h3><p>Although we now understand what exactly mutable and immutable objects are, we still need to examine how these objects behave when they are passed to functions. There are mainly two ways that objects get passed to functions. Passing by reference means that the called functions parameter will be the same as the caller’s passed argument. On the other hand, pass by value means the called function’s parameter will be a copy of the caller’s passed argument. First we’ll pass an immutable object to a function:</p><pre>&gt;&gt;&gt; def increment(n):<br>...   n += 1</pre><pre>&gt;&gt;&gt; a = 3<br>&gt;&gt;&gt; increment(a)<br>&gt;&gt;&gt; print(a)<br>3                         # <em>a</em> is still referring to the same object</pre><p>In this example, we get the result 3 because we are unable to modify the value that a is assigned to since its an integer, which is immutable. After a gets passed to the increment function, we create a new variable n within the function to hold the value after adding one to the previous value of a so that now, n = 4. When we call the print statement at the end, a is still referencing the value 3.</p><p>Now, we’ll pass a mutable object to a function and see how it behaves.</p><pre>&gt;&gt;&gt; def increment(n):<br>...   n.append([4])</pre><pre>&gt;&gt;&gt; l = [1, 2, 3]<br>&gt;&gt;&gt; increment(l)<br>&gt;&gt;&gt; print(l)<br>l = [1, 2, 3, 4]        # l changed</pre><p>In the above snippet of code, we assign the variable l to a list containing the integers 1,2 &amp; 3. We then pass l to the increment function as a parameter. The .append method simply adds the integer 4 to the end of the list. From previous examples, we’ve demonstrated that lists are mutable, so we are able to change their values in place. Although we have not created a new object, when we print l the list is updated because it is mutable.</p><p>The concept of mutability is one that has plagued many a fledgling programmer, so I hope I’ve been able to help a bit. happy coding my friends!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3ee2c7b408e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating and Using Dynamic Libraries ( C )]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/creating-and-using-dynamic-libraries-c-a9d344822ed0?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9d344822ed0</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 02:53:40 GMT</pubDate>
            <atom:updated>2018-04-17T02:53:40.018Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ft0_lSTlsCtZJ4H5.jpg" /><figcaption>Obligatory library related image.</figcaption></figure><p>In my article located below, I gave a detailed explanation of how to create and use static libraries. If you need a refresher, please check it out! In this article, I will focus on explaining how exactly to create and use dynamic libraries in the C programming language.</p><p><a href="https://medium.com/@The_Mad_Zaafa/creating-and-using-static-libraries-c-b52a6b8e1663">Creating and Using Static Libraries (C)</a></p><blockquote>“I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.” -Bill Gates</blockquote><p>In order to explain the significance of using dynamic libraries, I’ll need to define some terms. First of all, a <em>function</em> is a named section of a program that does a specific task. Functions can be used throughout the program to save time by employing aforementioned function to perform a task as opposed to rewriting that specific block of code when you want to do the task again later in the program. Although static libraries can be used by multiple programs, once the program has been compiled, it is no longer possible to change the different pieces of object code in an executable file because all the code is contained within a single file that was statically linked when the program was compiled.</p><p>This finally brings us to dynamic or shared libraries. Unlike static libraries, dynamic libraries consist of separate files containing separate pieces of object code. These files are dynamically linked together to form a single piece of object code. Furthermore, dynamic libraries contain extra information that the operating system will need to link the library to other programs.</p><p>The implication of this is that memory is conserved while using dynamic libraries since each application or program can access the dynamic library without needing an individual copy, as would be the case, if we were using static libraries. Although dynamic libraries afford the ability to alter source code without recompiling the entire program, static libraries’ execution speed at run-time is faster because the object code for the functions within the library are already in the executable file. As a result, multiple calls to functions are handled more efficiently than when using dynamic libraries.</p><h3>How to Create a Dynamic Library (Linux)</h3><p>To create a dynamic library in Linux, simply type the following command: gcc *.c -c -fPIC and hit return. This command essentially generates one object file .o for each source file .c . The -fPIC flag ensures that the code is position-independent. This means it wouldn’t matter where the computer loads the code into memory. Some operating systems and processors need to build libraries from position-independent code so that they can decide at runtime where they want to load it into memory. The -c options just ensures that each .o file isn’t linked yet.</p><p>Next, type in the following command: gcc *.o -shared -o liball.so (substitute your desired library name with all) and hit return. The wildcard * tells the compiler to compile all the .o files into a dynamic library which is specified by the -shared flag. The naming convention for dynamic libraries is such that each shared library name must start with lib and end with .so . Other than that though, let your imagination run free when considering names for your dynamic libraries.</p><p>Finally, we’ll need to export the path for libraries so that programs know where to look for them by executing the following command: export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH</p><h3>Using Dynamic Libraries (Linux)</h3><p>The point of creating a dynamic library is to use it with other programs. You can compile your code as follows:</p><pre>gcc -L test_code.c -lholberton -o test_code</pre><p>In the above command it is worth noting that your source code, test_code.cin this case, needs to be listed before the -l flag. The expression, -lcombined with holberton tells the compiler to look for a dynamic library called <em>libholberton.so, </em>while the -L flag tells the compiler to look in the current directory for the library file. This is why it is important to use the standard format for naming that I described earlier. For instance if test_code.c was the following:</p><pre>#include &quot;holberton.h&quot;</pre><pre>int main(void)<br>{<br>      _puts(&quot;Hello World!&quot;);<br>      return (0);<br>}</pre><p>Typing and executing gcc -L test_code.c -lholberton -o test_code would generate an executable file called test_code. In order to accomplish this, the compiler looks through the library that is specified with the -l flag for the _puts function object code. Executing test_code like so: ./test_code would give us the following output: Hello World!. Now that you know how to create and use dynamic libraries, go and conquer the world!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9d344822ed0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating and Using Static Libraries (C)]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/creating-and-using-static-libraries-c-b52a6b8e1663?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b52a6b8e1663</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[c-programming-language]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Mon, 12 Feb 2018 04:02:12 GMT</pubDate>
            <atom:updated>2018-02-12T04:02:12.964Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/667/0*ziyuAqqMCxUct36y.jpg" /><figcaption>Disclaimer: C static libraries do not actually look like this.</figcaption></figure><p>A statically-linked library, or static library for short, is essentially a file that contains several .o object files that can be used as a single entity during the linking phase of a program. If you are not familiar with how a program is compiled, please feel free to read my post on it <a href="https://medium.com/@The_Mad_Zaafa/dissecting-gcc-a091bf886eea">here</a>. Usually, the library is indexed so that the system is able to retrieve symbols such as functions and variables faster. During the linking phase, the linker will search the library for .o files that provide any of the missing symbols in the main program. As a result, linking a program with its object files ordered in a library is faster than if the object files were located elsewhere on the disk because the system has fewer files to look for. In this article, I’ll explain how to create and use a static library to facilitate writing code that you can manage efficiently.</p><h3>How to Create a Static Library</h3><p>The command to create a static library is ar, which means “archiver.” The ar command doesn’t just create static libraries (which are basically archive files). It can also list the names of object files in the library and modify .o files contained in the static library. If you’ve ever used a .zip or a .tar file, you know how easy it is to create a file that contains other files. That is exactly what a .a archive file is: a file containing other files. To create object files, simply type and execute gcc -c *.c. This command tells the compiler to generate object files for all the .c files in the current directory. In order to create a static library, we can use the following command:</p><pre>ar rc libholberton.a *.o</pre><p>In this command, the r flag ensures that older files will be updated by being replaced with new object files. The c flag means that the library will be created if it does not already exist. Finally, the *.o is a wildcard operation to include all files ending with .o in the static library. It is important to note the format for naming a .a file:</p><pre>lib&lt;your_lib_name&gt;.a</pre><p>At this point, you can store your archive in a library directory. For instance, some coders like to store archives in a standard directory once they are sure that it works. On Linux and Mac the usr/local/lib directory is a good choice because that is the directory set aside for the user’s custom libraries.</p><h3>Using Static Libraries</h3><p>The point of creating a static library is to use it with other programs. If your library is in a standard directory, then you can compile your code as follows:</p><pre>gcc test_code.c -lholberton -o test_code</pre><p>In the above command it is worth noting that your source code, test_code.c in this case, needs to be listed before the -l flag. The expression, -l combined with holberton tells the compiler to look for an archive called <em>libholberton.a. </em>This is why it is important to use the standard format for naming that I described earlier. For instance if test_code.c was the following:</p><pre>#include &quot;holberton.h&quot;</pre><pre>int main(void)<br>{<br>      _puts(&quot;Hello World!&quot;);<br>      return (0);<br>}</pre><p>Typing and executing gcc test_code.c -lholberton -o test_code would generate an executable file called test_code. In order to accomplish this, the compiler looks through the library that is specified with the -l flag for the _puts function object code. Executing test_code like so: ./test_code would give us the following output: Hello World!. Now that you know how to create and use static libraries, I hope you have fun coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b52a6b8e1663" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dissecting GCC]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/dissecting-gcc-a091bf886eea?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a091bf886eea</guid>
            <category><![CDATA[gnu-linux]]></category>
            <category><![CDATA[holberton-school]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Thu, 18 Jan 2018 03:41:42 GMT</pubDate>
            <atom:updated>2018-01-18T04:11:27.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/667/0*_Dro2W-lWlLHJf4Q.jpg" /></figure><p>The GNU Compiler Collection (GCC) is a compiler system developed by the GNU Project which supports a variety of programming languages. GCC is the standard compiler for most Unix-like operating systems and is also a key component of the GNU toolchain. In this article, I’ll explain what exactly happens at each step of the compilation process. In broad strokes, the sequence of events after a compilation command is given to GCC includes:</p><ul><li>Preprocessing</li><li>Compilation</li><li>Assembly</li><li>Linking</li></ul><h3>Hello World!</h3><p>As an example, we will examine each stage of compilation using the well-loved “Hello World” program main.c . The code for main.c is as follows:</p><pre>#include &lt;stdio.h&gt;</pre><pre>int main (void)<br>{<br>  printf (&quot;Hello, world!\n&quot;);<br>  return 0;<br>}</pre><p>It is important to note that GCC executes each sequence of commands automatically without advertising what exactly is going on behind the scenes. If however, you would like to see each individual step being executed, gcc -v main.c will run a verbose compilation that displays detailed information about the commands being executed. The first line of the program, #include&lt;stdio.h&gt;, is a header file that defines input/output routines used by our program. The next line of code, int main (void), is the “entry point” of our program. Following that is printf which prints the characters between the quotation marks to “standard output.” The \n character is not printed because gcc interprets it as a “newline.” Finally, the program returns an integer, 0, on the last line of code since we defined the main routine as returning an integer (int ).</p><h3>Preprocessor</h3><p>When we write a C program, the first stage of the compilation process is to expand macros and included header files via the preprocessor. To accomplish this, GCC executes the following command:</p><pre>$ cpp main.c &gt; main.i</pre><p>The resulting file, main.i , contains the source code with expanded macros. It is C programming convention to label preprocessed files with the &#39;.i&#39; extension.</p><h3>Compiler</h3><p>This stage is actually where the compilation of preprocessed source code to assembly language for a particular processor takes place. In the command line to convert the preprocessed C source code to assembly language, enter the following code and hit enter:</p><pre>$ gcc -Wall -S main.i</pre><p>Note that the running gcc with the -S option will not create an object file. The resulting file is main.s. To see the assembly language stored in the file, enter the following into the command line:</p><pre>$ cat main.s</pre><h3>Assembler</h3><p>As its name suggests, the assembler converts assembly language to machine code and generates an object file. When calls to external functions are made in the assembly source file, the assembler leaves the addresses of the external functions undefined so that the linker can fill them in during the next step of the process. To generate the object file with the assembler, enter and run this command:</p><pre>$ as main.s -o main.o</pre><p>The -o option above specifies that the output should be directed to the main.o file. The main.o file contains instructions in language that the machine can understand in order to run our program. As I mentioned earlier, any calls to external functions would be undefined at this point.</p><h3>Linker</h3><p>In this stage of the compilation process, the Linker proceeds to link object files to create an executable. Creating an executable usually necessitates calls to external functions from C run-time libraries and system. For instance the full command to link our program is:</p><pre>$ ld -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o <br> /usr/lib/crti.o /usr/lib/gcc-lib/i686/3.3.1/crtbegin.o <br> -L/usr/lib/gcc-lib/i686/3.3.1 main.o -lgcc -lgcc_eh<br> -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i686/3.3.1/crtend.o <br> /usr/lib/crtn.o</pre><p>Thankfully, we would never directly need to type that behemoth of a command because the linking process is discreetly handled by gcc when the following code is entered:</p><pre>$ gcc main.o</pre><p>This command links the object file main.o to the C standard library, after which an executable file called a.out is produced. To run the Hello World program, simply enter:</p><pre>$ ./a.out</pre><p>The output should look like this if done correctly:</p><pre>$ ./a.out<br>Hello, world!</pre><p>Now that we understand how much is involved at each stage of the compilation process, we can truly appreciate the simplicity of typing gcc main.c into a terminal and letting GCC do the heavy lifting.</p><p><em>Source: </em><a href="http://www.network-theory.co.uk/docs/gccintro/gccintro_87.html"><em>http://www.network-theory.co.uk/docs/gccintro/gccintro_87.html</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a091bf886eea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ls * .c Behind the Scenes]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/ls-c-behind-the-scenes-b61c12490b68?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b61c12490b68</guid>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Tue, 16 Jan 2018 07:52:02 GMT</pubDate>
            <atom:updated>2018-01-16T07:52:02.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j8qZMtjqmLMKUXxV.png" /></figure><p>In this article, I’ll be explaining what goes on behind the scenes when you type ls * .c and hit enter in a linux prompt. For those who like the bottom line up front, typing ls * .c essentially lists all files or directories in the current directory that end with .c. For those who don’t like spoilers and would rather like to read the steps involved, ignore the previous sentence and read on.</p><h3>What is ls ?</h3><p>According to the ls manual page (man page) ls is a command that is used in bash that’s supposed to “list directory contents.” When ls is used without any options, it just shows the contents of the directory that you are currently in. Additionally, if you list a directory after ls, it displays the contents of the directory that was passed as an argument.</p><h3>What the * ?</h3><p>The asterisk represents any number of characters. Usually in programming languages, the asterisk is used in combination with other commands to perform tasks on certain types of types specified in the arguments that the asterisk accepts. For example, if you specified cd*, the wildcard makes it possible for the system to search for objects that start with cd. Conversely, *cd would return all objects that end with cd.</p><h3>ls * .c &lt; return &gt;</h3><p>Now that we know what lsand *do, it becomes fairly apparent what the two commands combined would do. As I mentioned earlier, (for those who ignored the sentence in the intro, you can pay attention to it now) typing ls * .c lists all files or directories in the current directory that end with .c. It’s quite handy when you would rather not manually search for specific files or directories yourself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b61c12490b68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hard vs Soft Links: Synonyms and Cross-references]]></title>
            <link>https://medium.com/@The_Mad_Zaafa/hard-vs-soft-links-synonyms-and-cross-references-2105e8f976fe?source=rss-98b759c886e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2105e8f976fe</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Afa Madza]]></dc:creator>
            <pubDate>Tue, 16 Jan 2018 06:39:13 GMT</pubDate>
            <atom:updated>2018-01-16T06:58:02.746Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qfexuj-Aj9iTzMKp.JPG" /></figure><p>The difference between hard and soft links is something that has plagued Software Engineers at one point or another on the quest to becoming better programmers. In this article, I’ll attempt to explain the difference between the two types of links by using aspects of the dictionary as an analogy. In order to get to the fun stuff though, I’ll have to explain some technical terms first.</p><h3>Inodes Defined</h3><p>An Index node (inode) is essentially a data structure in a Unix-style file system that describes a filesystem object such as a file or directory. It is important to note that every file in the system has an inode. Inodes typically contain information about the file such as the file size, owner information, file permissions, file type…etc. Something else to note is that the inode does not contain the actual contents or name of the file.</p><h3>How to Create Hard and Soft Links</h3><p>A symbolic link, also commonly referred to as a soft link, is a special kind of link that points to another name on the file system. In order to create a soft link in Unix, at the prompt enter:</p><pre>ln -s source_file myfile</pre><p>Replace source_file with the name of the existing file for which you want to create the symbolic link. Next, replace myfile with the name of the symbolic link. If all goes smoothly, the ln command should create the symbolic link. On the other hand, hard links are created by entering the following into the prompt:</p><pre>ln source_file my_file</pre><h3><strong>Dictionary Antics</strong></h3><p>Have you ever looked up a word in a physical dictionary only to find that the dictionary directs you to search for the meaning of the word somewhere else? Well, that is essentially what soft links do. You go to them, and they point you somewhere else. If for instance, the cross-reference for a word you are searching for pointed to page 87 in the dictionary, you could then turn to page 87 to see the word. Symbolic links work in very much the same way. If on the other hand, page 87 was ripped out of the dictionary, that cross-reference would be useless. Exactly the same thing happens if the source_file is moved to a different location or deleted… myfile becomes a useless cross- reference.</p><p>Conversely, hard links are more like synonyms. A synonym essentially has the same meaning as a different word. If for instance you searched for the word joyful, you would quickly notice that joyful is a synonym for happy. A hard link then is just the creation of a word with the same meaning as happy on its own page in the dictionary. Therefore, if someone ripped out the page with happy on it, there would be no effect on happy’s synonyms. Once a hard link is made, myfile is linked directly to the inode, so deleting source_file would be inconsequential.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2105e8f976fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>