<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kobby Owen</title>
    <description>The latest articles on DEV Community by Kobby Owen (@kobbyowen).</description>
    <link>https://dev.to/kobbyowen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F321644%2Fed968753-168d-45b3-a52a-9c6760eb7016.jpeg</url>
      <title>DEV Community: Kobby Owen</title>
      <link>https://dev.to/kobbyowen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kobbyowen"/>
    <language>en</language>
    <item>
      <title>Stop Mocking Manually — Generate a Full Fake API in Seconds</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Fri, 27 Mar 2026 14:14:27 +0000</pubDate>
      <link>https://dev.to/kobbyowen/stop-mocking-manually-generate-a-full-fake-api-in-seconds-17m0</link>
      <guid>https://dev.to/kobbyowen/stop-mocking-manually-generate-a-full-fake-api-in-seconds-17m0</guid>
      <description>&lt;p&gt;If you’ve ever built a frontend and thought:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I just need a quick API… why am I writing a whole backend?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I hit that problem one too many times.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;data-server&lt;/strong&gt; — a tool that lets you spin up a &lt;strong&gt;fully working fake REST API in seconds&lt;/strong&gt; from a JSON or CSV file.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbulbsq7fmbrgmgajse71.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbulbsq7fmbrgmgajse71.gif" alt="Giff image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ What it actually does
&lt;/h2&gt;

&lt;p&gt;Give it a file like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"todos"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Write docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"done"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ship feature"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"done"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mock-data-server ./todos.json &lt;span class="nt"&gt;--port&lt;/span&gt; 2400
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And instantly you get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET    /todos
GET    /todos/1
POST   /todos
PUT    /todos/1
PATCH  /todos/1
DELETE /todos/1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No FastAPI. No Express. No setup.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤯 Why this is useful
&lt;/h2&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing a backend just for testing&lt;/li&gt;
&lt;li&gt;Maintaining mock endpoints manually&lt;/li&gt;
&lt;li&gt;Fighting with fake data tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;p&gt;✅ Spin up a real API in seconds&lt;br&gt;
✅ Test full CRUD flows&lt;br&gt;
✅ Persist changes back to your file&lt;br&gt;
✅ Simulate real backend behavior&lt;/p&gt;


&lt;h2&gt;
  
  
  🔥 Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;📦 Auto-generates REST routes from your data&lt;/li&gt;
&lt;li&gt;✏️ Full CRUD support&lt;/li&gt;
&lt;li&gt;💾 Writes changes back to JSON/CSV&lt;/li&gt;
&lt;li&gt;🔍 Filtering, sorting, pagination&lt;/li&gt;
&lt;li&gt;⏱ Optional request delay (simulate latency)&lt;/li&gt;
&lt;li&gt;🌍 CORS enabled by default&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="s2"&gt;"http://127.0.0.1:2400/todos?done=false&amp;amp;sort_by=title&amp;amp;order=asc&amp;amp;page=0&amp;amp;size=5"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 Getting started
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv
&lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate
pip &lt;span class="nb"&gt;install &lt;/span&gt;mock_data_server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mock-data-server data.json &lt;span class="nt"&gt;--port&lt;/span&gt; 2400
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🎯 The goal
&lt;/h2&gt;

&lt;p&gt;Make it &lt;strong&gt;stupidly easy&lt;/strong&gt; to go from:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I need an API”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“My API is running”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in under 3 seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔗 Check it out
&lt;/h2&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/kobbyowen/data-server" rel="noopener noreferrer"&gt;https://github.com/kobbyowen/data-server&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🙌 Feedback welcome
&lt;/h2&gt;

&lt;p&gt;Still early — I’d love feedback:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What would make this more useful?&lt;/li&gt;
&lt;li&gt;What features would you want next?&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you’ve ever wasted time mocking APIs… this is for you.&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>development</category>
      <category>backend</category>
    </item>
    <item>
      <title>JSON2OBJ</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Mon, 22 Nov 2021 23:45:15 +0000</pubDate>
      <link>https://dev.to/kobbyowen/json2obj-3llm</link>
      <guid>https://dev.to/kobbyowen/json2obj-3llm</guid>
      <description>&lt;h2&gt;
  
  
  json2obj
&lt;/h2&gt;

&lt;p&gt;Allows you to transform JSON data into an object whose members can be queried using the member access operator. Unlike &lt;code&gt;json.dumps&lt;/code&gt; in the standard library that returns a dictionary object, this library returns a JSONObjectMapper object. The attributes of these objects are defined by the contents of the JSON data provided to it&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;It can be installed using pip &lt;br&gt;
&lt;code&gt;pip install json2obj&lt;/code&gt;&lt;br&gt;
Source code available at &lt;br&gt;
&lt;a href="https://github.com/trumpowen/json2obj"&gt;https://github.com/trumpowen/json2obj&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;json2obj&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;JSONObjectMapper&lt;/span&gt; 

&lt;span class="n"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JSONObjectMapper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"""{ "name" : "trumpowen" , "age" : 125 }"""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"trumpowen"&lt;/span&gt; &lt;span class="c1"&gt;# true
&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;125&lt;/span&gt; &lt;span class="c1"&gt;# true 
# replaces and overwrites 
&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; 
&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Wilkins"&lt;/span&gt; 
&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Owen"&lt;/span&gt; 
&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;other_names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"Trump"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# add new attribute. If this is not desired, you can initialize the object with readonly set to True. This will prevent the addition of new attributes and changing the values of existing attributes 
&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1900&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="n"&gt;json_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# returns a string representation 
&lt;/span&gt;&lt;span class="n"&gt;json_as_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_dict&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# returns a dictionary representation 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Documentation
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;help(obj)&lt;/code&gt; , where obj is an instance of JSONObjectMapper&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>json</category>
      <category>oop</category>
    </item>
    <item>
      <title>JavaScript In Depth - isFinite &amp; IsNaN Functions</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Mon, 01 Nov 2021 08:36:30 +0000</pubDate>
      <link>https://dev.to/kobbyowen/javascript-in-depth-isfinite-isnan-functions-cp6</link>
      <guid>https://dev.to/kobbyowen/javascript-in-depth-isfinite-isnan-functions-cp6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Javascript is not a language for the unwary - Kobby Owen &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just before you stop reading, I know what you are thinking! "Who would read an article about these simple functions ?. These are basic functions every beginner of Javascript can quickly master, and easily learn to use. There is no need for an article about this!". While this is true, their behavior may be somewhat surprising, especially when dealing with non-number arguments. Learning more about their implementation will give you an in-depth knowledge of JavaScript and its core implementation. &lt;/p&gt;

&lt;p&gt;If you can answer the following questions, then you may stop reading this article. If not, I suggest you keep reading, since you will learn a lot from studying these functions and their implementation.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why is &lt;code&gt;isNaN(new Date())&lt;/code&gt; false and &lt;code&gt;isNaN(Date())&lt;/code&gt; true &lt;/li&gt;
&lt;li&gt;Why is &lt;code&gt;isFinite(null)&lt;/code&gt; true and &lt;code&gt;isFinite(undefined)&lt;/code&gt; false &lt;/li&gt;
&lt;li&gt;Why is &lt;code&gt;isFinite(" ")&lt;/code&gt; true and &lt;code&gt;isFinite("a")&lt;/code&gt; false &lt;/li&gt;
&lt;li&gt;Why is &lt;code&gt;isNaN("Infinity")&lt;/code&gt; true and &lt;code&gt;isNaN("infinity")&lt;/code&gt; false &lt;/li&gt;
&lt;li&gt;Under what conditions do &lt;code&gt;isNaN&lt;/code&gt; and &lt;code&gt;isFinite&lt;/code&gt; throw a TypeError &lt;/li&gt;
&lt;li&gt;What is the value of &lt;code&gt;isNaN(" 23 ")&lt;/code&gt;, &lt;code&gt;isNaN(23)&lt;/code&gt;, &lt;code&gt;isNaN(" 23." )&lt;/code&gt;, &lt;code&gt;isNaN("12 .")&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;isFinite&lt;/code&gt; function determines if the passed argument is finite value. It checks if its argument is not &lt;code&gt;NaN&lt;/code&gt;, or negative infinity or positive positive infinity. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;isNaN&lt;/code&gt; on the other hand determines whether the argument passed is a &lt;code&gt;NaN&lt;/code&gt; or not. This function is necessary because of the nature of &lt;code&gt;NaN&lt;/code&gt;. &lt;code&gt;NaN&lt;/code&gt; is the only floating point value that does not compare to itself. This behavior is so true that, ECMAScript documentation suggests that one of the reliable ways to check for &lt;code&gt;NaN&lt;/code&gt; is the expression&lt;code&gt;(x === x)&lt;/code&gt;, which returns false only if &lt;code&gt;x&lt;/code&gt; is a &lt;code&gt;NaN&lt;/code&gt;. &lt;br&gt;
Mostly, to determine if a number is okay to be used in arithmetic operation without few surprises, you should find yourself using &lt;code&gt;isFinite&lt;/code&gt; more than &lt;code&gt;isNaN&lt;/code&gt;, since &lt;code&gt;isFinite&lt;/code&gt; checks for &lt;code&gt;NaN&lt;/code&gt; values and goes on to check for infinite values. In cases where infinite values are legitimately allowed to participate in operations, &lt;code&gt;isNaN&lt;/code&gt; will be the best function to use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Implementation Details
&lt;/h2&gt;

&lt;p&gt;The first thing &lt;code&gt;isNaN&lt;/code&gt; and &lt;code&gt;isFinite&lt;/code&gt; function does is to try to convert its argument to a Number. This conversion is done using an ECMAScript internal function which is not exposed to the developer. It is this internal function that forms the core of these two functions, and is therefore worth studying. For the purpose of the article, lets call this function &lt;code&gt;ToNumber&lt;/code&gt; function. This function is used a lot in ECMAScript behind the scenes. Understanding how it works, will give you a lot of understanding about the results of most operations in JavaScript. In an attempt to explain this internal function, we will use many helper functions and explain other internal methods used in ECMAScript that helps the &lt;code&gt;ToNumber&lt;/code&gt; function to perform its conversion. I will use to top down approach to explain the implementation of this function.&lt;/p&gt;
&lt;h3&gt;
  
  
  ToNumber Internal Function
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ToNumber&lt;/code&gt; function takes a single argument, which is the argument to convert. To convert the argument, it takes the following step.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the argument is undefined, it returns &lt;code&gt;NaN&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If the argument is null , it returns &lt;code&gt;0&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;If the argument is a number, it returns it &lt;/li&gt;
&lt;li&gt;If the argument is a BigInt , throw a &lt;code&gt;TypeError&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;If the argument is a Symbol, throw a &lt;code&gt;TypeError&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;If the argument is a String, call another internal method(&lt;code&gt;StringToNumber&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;If the argument is an Object, call another internal method(&lt;code&gt;ToPrimitive&lt;/code&gt;) and pass its result through &lt;code&gt;ToNumber&lt;/code&gt; function again.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;NB. Step 7 involves 2 steps, it calls a helper function to convert the object to a primitive value, preferably a number, and call the &lt;code&gt;ToNumber&lt;/code&gt; function recursively on its return value. The astute reader may reason at this point that this can cause an infinite recursion. That is not the case, because ECMAScript makes sure the return of &lt;code&gt;ToPrimitive&lt;/code&gt; is not another object.&lt;/p&gt;

&lt;p&gt;Now lets look at the two helper functions used by &lt;code&gt;ToNumber&lt;/code&gt; to aid the conversion of its argument. &lt;/p&gt;
&lt;h3&gt;
  
  
  StringToNumber Internal Function
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;StringToNumber&lt;/code&gt; function simply parses its string argument and converts it to a number. One important thing to note about this function is the kind of input the parser accepts. The parser allows for optional white-space before and after the main string decimal characters. Any invalid character present in the argument, no matter where it is, will cause the parser to return &lt;code&gt;NaN&lt;/code&gt;, and consequently the function too. Invalid characters include any character that is not part of the set [+ - E e .].  These valid non decimal characters are however allowed to appear only once. Making it appear twice will cause the function to return &lt;code&gt;NaN&lt;/code&gt;. The function however recognizes the "Infinity" and returns the mathematical representation of it. An optional + or - is allowed before the decimal characters. They should however be the first non white-space character, if it exists in the sequence except it is being used before an E or e. An empty string, or a string full of white-space will cause the function to return the number 0. The following examples demonstrates the use of the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="cm"&gt;/** implementation code **/&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; 23&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 23&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; 23 &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 23&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;+23.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 23.5 &lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;+ 23.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// NaN ( space after the plus sign)&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;-23.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// -23.5 &lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;23.2.3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;23ab&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//NaN&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Infinity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Infinity &lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;-Infinity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// -Infinity&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;+Infinity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Infinity &lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ab&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//NaN&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NaN&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="cm"&gt;/**NaN ( not because the phrase NaN can be parsed , but because the characters N a N cannot be represented as a number) **/&lt;/span&gt;

&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;23E-14&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//23E-14&lt;/span&gt;
&lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;23E -14&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//NaN ( space after E. )&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ToPrimitive Internal Function
&lt;/h3&gt;

&lt;p&gt;The last function to examine before we can proceed is &lt;code&gt;ToPrimitive&lt;/code&gt; method. This method takes an input and converts it to a primitive type, basically a number or a string. The function also takes an optional argument called hint. The &lt;code&gt;hint&lt;/code&gt; argument can either be [default, number or string]. When the function is called, it first checks if the input is an object. If it is and it defines a &lt;code&gt;Symbol.toPrimitive&lt;/code&gt; method, it is called on the object  while passing "number" as a hint to the function. If the method returns an object ( null not included ), a &lt;code&gt;TypeError&lt;/code&gt; is thrown, otherwise its value is returned. If the object does not define its &lt;code&gt;Symbol.ToPrimitive&lt;/code&gt;, it looks for two methods on the object, ie &lt;code&gt;toString&lt;/code&gt; and &lt;code&gt;valueOf&lt;/code&gt;. If the hint is a number, &lt;code&gt;valueOf&lt;/code&gt; is called first, else &lt;code&gt;toString&lt;/code&gt; is called first, and the other is called next. When the function to be called first is resolved, it is checked if it exists on the object or any of its bases, if it exists, and its return value when called is not an object, it returns it results. The second function, which is based on the value passed to the hint argument is called next. Its value is returned if is is not an object. If both methods returns an object, a &lt;code&gt;TypeError&lt;/code&gt; is thrown by the function. &lt;/p&gt;

&lt;p&gt;If you did not understand these functions, here are their implementation in JavaScript( note JavaScript). In a real ECMAScript implementation, these functions are probably implemented in C/C++.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="c1"&gt;// return 0 for empty string after stripping space characters&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;OrdinaryToPrimitive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;methodNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;methodNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;toString&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;toValueOf&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; 
        &lt;span class="nx"&gt;methodNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;valueOf&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;toString&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;methodNames&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;function&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]()&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ToPrimitive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;Symbol&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toPrimitive&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;default&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;Symbol&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toPrimitive&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; 
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;OrdinaryToPrimitive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; 



&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;undefined&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; 
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; 
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;argument&lt;/span&gt; 
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bigint&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;symbol&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt; 
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; 
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;StringToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;argument&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; 
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;primitive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ToPrimitive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;ToNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;primitive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are a few things to note here. &lt;code&gt;ToPrimitive&lt;/code&gt; delegates to another method called &lt;code&gt;OrdinaryToPrimitive&lt;/code&gt; if the input provided does not defined &lt;code&gt;Symbol.toPrimitive&lt;/code&gt; method.&lt;/p&gt;

&lt;h2&gt;
  
  
  isNaN and isFinite
&lt;/h2&gt;

&lt;p&gt;Now that we understand these internal functions. Let us go back to our functions. &lt;br&gt;
&lt;code&gt;isNaN&lt;/code&gt; first converts its argument to a number using the &lt;code&gt;ToNumber&lt;/code&gt; method and checks for &lt;code&gt;NaN&lt;/code&gt;. If the result of that conversion is a &lt;code&gt;NaN&lt;/code&gt;, true is return otherwise false is returned.&lt;br&gt;
&lt;code&gt;isFinite&lt;/code&gt; also first converts its argument to a number using the same &lt;code&gt;ToNumber&lt;/code&gt; method. If then proceeds to check if the result of that conversion is not a &lt;code&gt;NaN&lt;/code&gt; or &lt;code&gt;-Infinity&lt;/code&gt; or &lt;code&gt;Infinity&lt;/code&gt;. &lt;br&gt;
There is nothing interesting about these functions apart from the internal method that it calls to convert its argument before checking it. &lt;code&gt;ToNumber&lt;/code&gt; internal methods are used by a lot of JavaScript functions including &lt;code&gt;parseInt&lt;/code&gt; to convert its &lt;code&gt;radix&lt;/code&gt; argument., All functions defined on the global Math object calls the function on its arguments before it starts processing the result, it is used by &lt;code&gt;Date.UTC&lt;/code&gt; to convert it parameters into acceptable values and almost all the setter methods on the Date object ( example &lt;code&gt;setHours&lt;/code&gt;, &lt;code&gt;setMonth&lt;/code&gt;, &lt;code&gt;setYear&lt;/code&gt;) and almost all methods and functions that operates with numbers. Understanding how this internal method works will save you from opening your jaws wide while you stare at the screen trying to understand the return values of some functions. Try to take a moment to go through this internal method one more time. Now let us answer the five questions at the beginning of the article, which you should be able to answer if you paid enough attention to it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 1
&lt;/h3&gt;

&lt;p&gt;Why is &lt;code&gt;isNaN(new Date())&lt;/code&gt; false and &lt;code&gt;isNaN(Date())&lt;/code&gt; true &lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;The result of &lt;code&gt;new Date()&lt;/code&gt; is an object. When that object is passed to &lt;code&gt;isNaN&lt;/code&gt; as an argument, &lt;code&gt;ToPrimitive&lt;/code&gt; is called to convert it to a primitive value, preferably a number. This ends up calling &lt;code&gt;valueOf&lt;/code&gt; method on the object and returning its results, which is a number. This number is then checked for &lt;code&gt;NaN&lt;/code&gt; , which is ultimately false. The result of &lt;code&gt;Date()&lt;/code&gt; on the other hand is a string that represents the current time. This string is passed to &lt;code&gt;StringToNumber&lt;/code&gt; internal method by &lt;code&gt;ToNumber&lt;/code&gt;. The result is a string that cannot be parsed into a number, thus returning &lt;code&gt;NaN&lt;/code&gt;. &lt;code&gt;isNaN&lt;/code&gt; proceeds to check the result of this conversion and finds that its &lt;code&gt;NaN&lt;/code&gt; and ultimately return true  &lt;/p&gt;

&lt;h3&gt;
  
  
  Question 2
&lt;/h3&gt;

&lt;p&gt;Why is &lt;code&gt;isFinite(null)&lt;/code&gt; true and &lt;code&gt;isFinite(undefined)&lt;/code&gt; false&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ToNumber&lt;/code&gt; converts null to 0 and undefined to &lt;code&gt;NaN&lt;/code&gt;, thus the return values of &lt;code&gt;isFinite&lt;/code&gt; when called with these two values&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 3
&lt;/h3&gt;

&lt;p&gt;Why is &lt;code&gt;isFinite(" ")&lt;/code&gt; true and &lt;code&gt;isFinite("a")&lt;/code&gt; false&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;Both arguments are strings, so &lt;code&gt;ToNumber&lt;/code&gt; calls &lt;code&gt;StringToNumber&lt;/code&gt; internal method on them. Empty strings after trimming white spaces causes the method to return 0. Thus the first &lt;code&gt;isFinite&lt;/code&gt; call is the result of checking if 0 is a finite number, which it is. "a" on the other hand returns &lt;code&gt;NaN&lt;/code&gt; when converted. &lt;/p&gt;

&lt;h3&gt;
  
  
  Question 4
&lt;/h3&gt;

&lt;p&gt;Why is &lt;code&gt;isNaN("Infinity")&lt;/code&gt; true and &lt;code&gt;isNaN("infinity")&lt;/code&gt; false&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;StringToNumber&lt;/code&gt; recognizes the string "Infinity" , "-Infinity", "-Infinity". It rightly returns Infinity and the result is checked whether its &lt;code&gt;NaN&lt;/code&gt;, which ends up being false. &lt;code&gt;Infinity&lt;/code&gt; is not &lt;code&gt;NaN&lt;/code&gt;. &lt;br&gt;
"infinity" on the other hand is not recognized, neither can it be parsed as a number. It returns &lt;code&gt;NaN&lt;/code&gt; as a result of the conversion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Question 5.
&lt;/h3&gt;

&lt;p&gt;Under what conditions do &lt;code&gt;isNaN&lt;/code&gt; and &lt;code&gt;isFinite&lt;/code&gt; throw a &lt;code&gt;TypeError&lt;/code&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;If their argument in either a &lt;code&gt;BigInt&lt;/code&gt;, Symbol or they defined &lt;code&gt;toString&lt;/code&gt; and &lt;code&gt;valueOf&lt;/code&gt; which both returns an object instead of a primitive value like a string or a number &lt;/p&gt;

&lt;h3&gt;
  
  
  Question 6.
&lt;/h3&gt;

&lt;p&gt;What is the value of &lt;code&gt;isNaN(" 23 ")&lt;/code&gt;, &lt;code&gt;isNaN(23)&lt;/code&gt;, &lt;code&gt;isNaN(" 23." )&lt;/code&gt;, &lt;code&gt;isNaN("12 .")&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;isNaN(" 23 ")&lt;/code&gt; is false&lt;br&gt;
&lt;code&gt;isNaN("23.")&lt;/code&gt; is false &lt;br&gt;
&lt;code&gt;isNaN("12 .")&lt;/code&gt; is true &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
    </item>
    <item>
      <title>Check This Out</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Fri, 30 Apr 2021 15:46:21 +0000</pubDate>
      <link>https://dev.to/kobbyowen/check-this-out-2ce8</link>
      <guid>https://dev.to/kobbyowen/check-this-out-2ce8</guid>
      <description>&lt;p&gt;Basic Flask Project For Beginners&lt;br&gt;
&lt;a href="https://github.com/trumpowen/color-app-backend"&gt;https://github.com/trumpowen/color-app-backend&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>backend</category>
    </item>
    <item>
      <title>Designing With Exceptions and Errors ( Part I ) - The Need For Exception Handling Mechanisms</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Wed, 31 Mar 2021 08:55:07 +0000</pubDate>
      <link>https://dev.to/kobbyowen/designing-with-exceptions-and-errors-part-i-the-need-for-exception-handling-mechanisms-49n6</link>
      <guid>https://dev.to/kobbyowen/designing-with-exceptions-and-errors-part-i-the-need-for-exception-handling-mechanisms-49n6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Errors should never pass silently. Unless explicitly silenced - Zen Of Python &lt;/p&gt;

&lt;p&gt;Return victorious from war, or do not return at all - Samurai Principle        &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Webster dictionary defines exception as &lt;code&gt;a case to which a rule does not apply&lt;/code&gt;   and an error is &lt;code&gt;an act or condition of ignorant or imprudent deviation from a code of behavior.&lt;/code&gt; These two definitions have been given to show how the terms are similar. The difference between the two terms in real life, is the severity of the problem. Exceptions are considered less fatal, but they all amount to one thing, an rule or an expectation has been violated. For this article , exceptions will be used to indicate any deviation of some sort. Readers should however bear in mind that, not all exceptions are errors. Some exceptions are used to control the flow of execution of a program. A prime example is python's &lt;a href="https://docs.python.org/3/library/exceptions.html#StopIteration"&gt;StopIteration&lt;/a&gt; exception. &lt;/p&gt;

&lt;p&gt;Exceptions are provided to help get information from where a violation is detected to where it can be  handled. A routine, method or a function that cannot cope with a problem &lt;em&gt;throws an exception&lt;/em&gt;, hoping that its direct or indirect caller can handle the problem. A caller that can handle a problem, indicates its ability to do so by &lt;em&gt;catching the exception&lt;/em&gt;. Anytime we write a piece of code, we make a promise that the code will work given specific conditions, in a specific way. Exceptions are a way for the code to say, "Okay , these conditions under which I can work successfully were not provided, so I can not finish my work". These conditions can be : the database server should be running, the host device must have a working internet connection, an integer provided should be in a specific range or a key must exist in a dictionary. Consider the following piece of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="c1"&gt;#A function to divide two integers. 
#The dividend must be in range 2, 127. 
#The divisor must not be greater than half the dividend.
#The return value of the function will always be a positive integer greater than zero .
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;special_divide&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;dividend&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;divisor&lt;/span&gt; &lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;dividend&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Dividend must be in range 2 - 127"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;divisor&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;dividend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Divisor must not be greater than half of the dividend"&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dividend&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;divisor&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I choose python because of readability, conciseness and practicality. The code here is promising to return an integer greater than 1 but less than 128. In order to not break that promise, its saying "I will only work under these conditions: The dividend must be in a specific range, the divisor must not be greater than half the dividend. In a case where these conditions are violated, I will fail to perform my task, therefore I will throw an exception to indicate my failure to do so." These two conditions are the &lt;em&gt;pre-conditions&lt;/em&gt; of the function. It is not enough to state these preconditions in comments. The code must be designed to enforce these preconditions. This illustrates the practice of not allowing errors to pass silently and returning only when successful. Raising an exception draws attention to the situation and provides enough information for the code that called this function to understand what happened. One thing to notice is that, &lt;a href="https://docs.python.org/3/library/exceptions.html#ValueError"&gt;ValueError&lt;/a&gt; is not the only exception that can be raised. If the user provides a 0 value to the divisor, a &lt;a href="https://docs.python.org/3/library/exceptions.html#ZeroDivisionError"&gt;ZeroDivisionError&lt;/a&gt; is raised. If the user provides non integer value, a &lt;a href="https://docs.python.org/3/library/exceptions.html#TypeError"&gt;TypeError&lt;/a&gt; is raised by the function int(). If a floating point value is provided, the function says, "Okay I can handle this error by converting the floating point to an integer, so I will do just that. ( This should be documented by the programmer to make the caller aware)". In the case where all these conditions are satisfied, the function returns its promised value. Before exception handling approach, let us consider the alternatives available to a function detecting a problem that cannot be handled locally, so that an error must be reported to a caller.&lt;/p&gt;

&lt;p&gt;The first approach was to &lt;strong&gt;return an error code&lt;/strong&gt;. In this approach, a function that fails to perform its task returns an error code as an indication of error. Popular values includes negative values, zero, null values, false. This approach was not always feasible. Consider the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_next_integer_from_input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;read_integer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="c1"&gt;# read next integer from input stream 
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;read_integer&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a function like this, every integer is a possible return value. There can be no integer value representing an input failure. The least we can do is to make the function return a pair of values, one indicating the return value and the other indicating whether an error occurred or not. Even where this approach is feasible, the programmer must check the result of every code. This quickly doubles the size of the code, and makes room for even more errors. Programmers, however tend to forget to check the return value of every single function they call. This causes errors to pass easily and silently. What about functions that by language definition, are not allowed to return a value ? An example is a &lt;em&gt;constructor&lt;/em&gt;. This approach also forces the programmer to make every function return a value, even for functions that by design should not return, or void functions, in technical terms. &lt;/p&gt;

&lt;p&gt;Another approach was to &lt;strong&gt;leave the program in an error state&lt;/strong&gt;. In most cases, this is done by setting a global variable to a certain value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;error_occurred&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;global_error_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; 
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; 
        &lt;span class="n"&gt;global_error_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The programmer, after every function call, then checks if this variable show an indication of error. An prime example is C errno variable. Most C standard library functions set this variable to a number other than 0 to indicate an error. This quickly suffers from the deficiencies of the first approach. The programmer may fail to notice that the program has been put in an error state. Programmers may also forget to set the global variable in their functions to report errors. The use of global variables may also cause a lot of problems in the presence of concurrency, without extra work. &lt;/p&gt;

&lt;p&gt;Another approach was to &lt;strong&gt;terminate the program&lt;/strong&gt;. This was a very drastic step.  For most programs, we can and must do better than that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;error_occurred&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At least we can produce a decent message for the user before exiting the program. In particular, a library that does not know about the purpose and general strategy of the program in which it is being used cannot just terminate the program. That would be very bad for the program. Such a library that unconditionally terminates cannot be used in a program that cannot afford to crash.&lt;/p&gt;

&lt;p&gt;The last approach was to &lt;strong&gt;call an error handler&lt;/strong&gt;. This must be some other approach in disguise because the problem immediately becomes ‘‘What does the error-handling function do?’’&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;error_occurred&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_handler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unless the error-handling function can completely resolve the problem, the error-handling function must in turn either terminate the&lt;br&gt;
program, return with some indication that an error had occurred or set an error state. But wait a minute,  if the error-handling function can handle the problem without bothering the ultimate caller, why do we consider it an error ?&lt;/p&gt;

&lt;p&gt;Traditionally, a combination of these approach were used to report and handle errors. Sadly, modern programmers who do not understand the use of exceptions, use these approaches in their code. The result is seen in subtle bugs, errors that cannot be detected during development until later, and many undiscovered errors that are passing silently. Debugging the program also becomes stressful. These approaches can therefore not be used to detect all errors. This has caused the need for exceptions support in languages. &lt;/p&gt;

&lt;p&gt;In my next article, I will discuss the history of exceptions, the technical details of exception mechanism, that is,  how languages implement it,  practising offensive programming , and how to avoid "try-catch code hell".&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>design</category>
      <category>coding</category>
    </item>
    <item>
      <title>A List Of C and C++ Books For Beginners, Intermediates, Advanced and Expert Programmers.</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Thu, 23 Jan 2020 00:36:11 +0000</pubDate>
      <link>https://dev.to/kobbyowen/a-list-of-c-and-c-books-for-beginners-intermediates-advanced-and-expert-programmers-13mi</link>
      <guid>https://dev.to/kobbyowen/a-list-of-c-and-c-books-for-beginners-intermediates-advanced-and-expert-programmers-13mi</guid>
      <description>&lt;p&gt;Get your curated list of C and C++ books to get you going....&lt;br&gt;
&lt;a href="https://github.com/trumpowen/books"&gt;All C and Books You Need&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>cpp</category>
    </item>
    <item>
      <title>MegaMimes : A C Mime Type Library</title>
      <dc:creator>Kobby Owen</dc:creator>
      <pubDate>Tue, 21 Jan 2020 21:37:07 +0000</pubDate>
      <link>https://dev.to/kobbyowen/megamimes-a-c-mime-type-library-4lna</link>
      <guid>https://dev.to/kobbyowen/megamimes-a-c-mime-type-library-4lna</guid>
      <description>&lt;p&gt;Determining the Mime Type of a file In C has not been easy.  Developers need an external table , which usually comes as an external file, which contains just a few mime types of various file extensions, Well I don't blame the developers, THERE IS NO ALGORITHM TO CHECK THE MIME TYPE OF A FILE. What if the FILE was deleted ? . That will be very awful for the program. Most people who do not want to use external files normally resort to using web services. This can unbearably slow, because of network problems. Now these problems of determining the MIME TYPE of a file from your C Code can be solved by &lt;a href="https://github.com/trumpowen/MegaMimes"&gt;MegaMimes&lt;/a&gt;. &lt;br&gt;
&lt;a href="https://github.com/trumpowen/MegaMimes"&gt;MegaMimes&lt;/a&gt; is a C Library that is used to determine the MIME Type of a file, with just a few code. The MIME Type table comes embedded in the library and as a result, no need for external files, web services and any other technique.  The library works on all major Operating Systems ( Windows, Linux,, Mac OS X ) . The library can be extended by adding your own mime types, if they do not exist in the table. MegaMimes has no dependencies, which makes it very easy to install!!!!&lt;br&gt;
Do not fail to check it out. &lt;br&gt;
If the library proves helpful to you, do not forget to give it a STAR. If you have any contributions, you can open a pull request and an issue. Thank You&lt;/p&gt;

</description>
      <category>c</category>
      <category>cpp</category>
    </item>
  </channel>
</rss>
