<?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 Wilson Wang on Medium]]></title>
        <description><![CDATA[Stories by Wilson Wang on Medium]]></description>
        <link>https://medium.com/@wilson8507?source=rss-daaff8cfa908------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CW7lFtHALtAhgF40lWT4jQ@2x.jpeg</url>
            <title>Stories by Wilson Wang on Medium</title>
            <link>https://medium.com/@wilson8507?source=rss-daaff8cfa908------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:54:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wilson8507/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[The Law of Leaky Abstraction]]></title>
            <link>https://medium.com/@wilson8507/the-law-of-leaky-abstraction-f6ec1ad145c8?source=rss-daaff8cfa908------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6ec1ad145c8</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Wilson Wang]]></dc:creator>
            <pubDate>Mon, 04 Jun 2018 09:36:33 GMT</pubDate>
            <atom:updated>2018-06-06T19:32:57.694Z</atom:updated>
            <content:encoded><![CDATA[<p>The importance of the abstractions and their defects.</p><h4>What Is Abstraction?</h4><p>In my opinion, abstraction is a concept that programmers usually used when developing. Exaggeratedly to say, everything in software comes from the abstraction, such as the data type in programming language, the design patterns, and the software architecture……etc.</p><blockquote><em>Abstraction</em>: a simplification of something much more complicated that is going on under the covers</blockquote><blockquote>— Joel Spolsky, creator of the Stack Overflow</blockquote><p>To clarify the concept of abstraction, we could consider the situations below:</p><ul><li>We are all knowing that the truth everything in the computer is working behind the combination of 1s and 0s. However, there doesn’t exist the concepts such as the number, true/false, or character in a computer’s logic circuit. How do we develop the data types in the programming language? We need to define the rules that how to represent these concepts in a computer. Take integer for an example, We define a number of bits to represent an integer. Here is the abstraction! In fact, when declaring an integer in programming, we don’t need to know how the integer is implemented in the computer. The creator of the programming language abstract the 1s and 0s in the computer so that the user of this programming language could use the integer without knowing the knowledge how a number is implemented in a computer.</li></ul><p>Another situation is talking about how to implement a concept of the person in a program.</p><ul><li>In the real world, a person has many properties such as hair colors, skin colors, height, weight, gender…etc. When we want to implement a person in program, at the same time we are abstracting. We could create a class called <em>Person</em> with lots of properties and lots of methods that a <em>person</em> class could execute. When a user wants to create an instance of the <em>person, </em>he doesn’t need to know the details about how a person is implemented, and he could call this person’s method to execute lots of things that a person can do. In fact, the <em>person</em> class abstract the details of the real world person.</li></ul><p>With the existence of abstraction, it seems like programming is a wonderful world, and we can always take anything that we don’t know its details, and use these things to produce lots of expanded functions.</p><p>However, it is wrong! The abstraction is usually leaky! We will produce extensive problems.</p><h4>What Is Leaky Abstraction?</h4><blockquote>The Law of Leaky Abstraction:</blockquote><blockquote><strong>All non-trivial abstractions, to some degree, are leaky.</strong></blockquote><blockquote>— Joel Spolsky, creator of the Stack Overflow</blockquote><p>The leaky abstraction is talking about the defects of the abstraction. The abstraction mentioned above seems to be perfect and won’t produce any problem. However, there always exists a missing to some degree in the abstraction.</p><p>Take the integer implementation situation as examples:</p><ul><li>Suppose you are a newbie at C language and you are curious about what is the result of assigning a large number (eg. 21474836470) to an integer variable. It turns out to be an unexpected error. However, you will have no idea why this error happened and how to solve it until you know some details of implementing an integer in the C language. This is caused by leaky abstraction. When we are trying to abstract something, we couldn’t abstract everything about it, there always exists some missing so that it will cause some unexpected errors. The real numbers are unbounded, so we can’t use limited bits to represent all of them, however, we are still able to represent a subset of them.</li></ul><p>So, with the existence of abstraction, we can develop the programs in a highly effective way, however, we will also have some extended problems if someday the abstraction interface is broken. Because of the leaky abstraction, the programmers usually handle the errors, and always write the testing codes.</p><h4>Conclusion</h4><p>The abstraction is still important in developing the programs (or the software) although always exists leaky abstraction. All we need to do is knowing how to use the things that have been abstract, and then dive into the details about the implementation, that is abstraction will improve our attention on the most important thing about developing just we avoid tapping in to “the leaky abstraction trap”.</p><blockquote>the abstractions save us time working, but they don’t save us time learning.</blockquote><blockquote>— Joel Spolsky, creator of the Stack Overflow</blockquote><p>Further Reading:</p><p><a href="https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/">The Law of Leaky Abstractions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6ec1ad145c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>