<?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: Web Dev Ken</title>
    <description>The latest articles on DEV Community by Web Dev Ken (@webdevken).</description>
    <link>https://dev.to/webdevken</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%2F678664%2Fa83b97dd-93e3-4930-8019-01e9578c53a0.gif</url>
      <title>DEV Community: Web Dev Ken</title>
      <link>https://dev.to/webdevken</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/webdevken"/>
    <language>en</language>
    <item>
      <title>A Motivational Post About Creating Good Web Frontends</title>
      <dc:creator>Web Dev Ken</dc:creator>
      <pubDate>Mon, 09 Aug 2021 09:08:08 +0000</pubDate>
      <link>https://dev.to/webdevken/a-motivational-post-about-creating-good-web-frontends-35i8</link>
      <guid>https://dev.to/webdevken/a-motivational-post-about-creating-good-web-frontends-35i8</guid>
      <description>&lt;p&gt;Often the frontend is called the place where the user experience takes place. The counter part of the frontend is, you guessed it, the backend. The backend handles the data that is produced or prepared for the frontend. A frontend can be a web application, a dekstop application, a smartphone app, a smart watch app or even a ticket wending machine. In short, every user interface that has some what a backend behind it, is called a frontend. Nowadays most popular frontends are the ones created for the web, let's call them web frontends, because they are run in the web browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web Browsers
&lt;/h2&gt;

&lt;p&gt;In the early days web browsers have been used to deliver information only. You could open a web page for a restaurant, get some information about the menu, opening hours or location, close it and done. Today, we deliver in addition to that a completely new and different experience. We want the users to stay on our page. A web browser is a great platform for creating more value for the user. Just imagine the amount of devices that have web browsers pre installed: Notebooks, smartphones, tablets, yet even game consoles have web browsers installed. It's crazy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Thing That Makes It So Great
&lt;/h2&gt;

&lt;p&gt;Web browsers are the portal to the internet for everybody and thus to that experience. We as frontend developers take a great role in creating and enhancing that experience. We can create something that is immediately available for billions of devices. We are the ones that are actively participating in producing that experience. We are at the front door.&lt;/p&gt;

&lt;p&gt;A bad frontend would make the users unconfortable using your solution and they would probably not like to come back. Imagine a good frontend to be a store or a restaurant where the user actually wants to visit often. A good frontend makes the user happy, leaves a positive experience and ensures the user comes back again.&lt;/p&gt;

&lt;p&gt;So my dear friend, create something awesome where the user wants to come back and stay at your place. It will not be an easy journey, but it will sure be worth it at the end!&lt;/p&gt;

</description>
      <category>ux</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Undefined vs. Null</title>
      <dc:creator>Web Dev Ken</dc:creator>
      <pubDate>Fri, 06 Aug 2021 09:22:04 +0000</pubDate>
      <link>https://dev.to/webdevken/undefined-vs-null-1phb</link>
      <guid>https://dev.to/webdevken/undefined-vs-null-1phb</guid>
      <description>&lt;p&gt;While developing some awesome applictions you might have come across types or values like &lt;code&gt;null&lt;/code&gt; and &lt;code&gt;undefined&lt;/code&gt;. The documentation for these types and values can be sometimes pretty confusing. So I am going to try to explain it for you in a practical way, so you can use them wherever you need while also understanding what they do. I will also try to give you examples where you can or have to use them.&lt;/p&gt;

&lt;p&gt;Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Null and Undefined: Empty Values
&lt;/h2&gt;

&lt;p&gt;Null and undefined are values that belong to the type of empty values. Empty value means the absence of a real value like boolean, number or string.&lt;/p&gt;

&lt;p&gt;The main difference between those two are, that in the life cycle of a JavaScript application you would never receive &lt;code&gt;null&lt;/code&gt;, unless someone has explicitly put it there. On the other hand, &lt;code&gt;undefined&lt;/code&gt; is something that can be produced by JavaScript itself.&lt;/p&gt;

&lt;p&gt;Let's consider a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const me = {
  name:   "Web Dev Ken",
  age:    "Old enough",
};

console.log(me.email);
// undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, I have an object with &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;age&lt;/code&gt;. If I try to access the property &lt;code&gt;email&lt;/code&gt;, I receive undefined because that property doest not exist.&lt;/p&gt;

&lt;p&gt;Let's see an example where &lt;code&gt;null&lt;/code&gt; comes into the party.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getObjectProperty(property) {
  const value = me[property];

  if (value) {
    return value;
  } else {
    return null;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above I have a simple function that receives an object key as an argument and tries to access that property from the object &lt;code&gt;me&lt;/code&gt;. In the if-statement I check if the value is available and return it accordingly. If the value does not exist, I explicitly return &lt;code&gt;null&lt;/code&gt;. Here we can see that there is no way that JavaScript somehow returns &lt;code&gt;null&lt;/code&gt; by itself. It's something I have put there to fullful a purpose.&lt;/p&gt;

&lt;p&gt;Let's consider a more advanced example with TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type MeType = {
  name:   string;
  age:    string;
  email:  string | null;
};

type OtherMeType = {
  name:   string;
  age:    string;
  email?: string;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above I introduce you two very similar types. &lt;code&gt;MeType&lt;/code&gt; has &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;age&lt;/code&gt; and &lt;code&gt;email&lt;/code&gt; and &lt;code&gt;OtherMeType&lt;/code&gt; has the same properties. The difference is with the property &lt;code&gt;email&lt;/code&gt;, that  explicitly can be &lt;code&gt;null&lt;/code&gt; with &lt;code&gt;MeType&lt;/code&gt; but that is optional with &lt;code&gt;OtherMyType&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const meType: MeType = {
  name:   "Web Dev Ken",
  age:    "Old Enough",
  email:  null
};

const otherMeType: OtherMeType = {
  name:   "Web Dev Ken",
  age:    "Old Enough"
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code example above I create to objects, one of type &lt;code&gt;MeType&lt;/code&gt; and the other of type &lt;code&gt;OtherMeType&lt;/code&gt;. In the case of &lt;code&gt;MeType&lt;/code&gt; I necessarily have to set the property &lt;code&gt;email&lt;/code&gt; where in the case of &lt;code&gt;OtherMeType&lt;/code&gt; I don't. Once we log the property &lt;code&gt;email&lt;/code&gt;, we will see what this leads to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(meType.email);
// null

console.log(otherMeType.email);
// undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above you can see the result of logging the property &lt;code&gt;email&lt;/code&gt; from both types as a practical example. With &lt;code&gt;meType.email&lt;/code&gt; we gave our object a possibility to be either a &lt;code&gt;string&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt;. While on &lt;code&gt;otherMeType.email&lt;/code&gt; we actually don't know if there is a value or if it results to &lt;code&gt;undefined&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As you can see in the examples above, &lt;code&gt;null&lt;/code&gt; is something we as developers can introduce and that is not produced by the JavaScrpt mechanism itself. This can be very powerful especially in TypeScript, if you want strict type safety and not deal with &lt;code&gt;undefined&lt;/code&gt;, you can create your types by explicitly setting &lt;code&gt;null&lt;/code&gt; where you have an absence of a value. Afterwards you can strictly check for &lt;code&gt;null&lt;/code&gt; in your code like &lt;code&gt;me.email === null&lt;/code&gt; and create robust and predictable code.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Why JavaScript Numbers Are Not Precise</title>
      <dc:creator>Web Dev Ken</dc:creator>
      <pubDate>Mon, 02 Aug 2021 16:09:39 +0000</pubDate>
      <link>https://dev.to/webdevken/why-javascript-numbers-are-not-precise-59c</link>
      <guid>https://dev.to/webdevken/why-javascript-numbers-are-not-precise-59c</guid>
      <description>&lt;p&gt;You might have already heard not to do mathematical calculations with JavaScript. Atleast if you need precise results.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;But there are whole numbers, decimals and floating point numbers in JavaScript. Why can I not calculate my mathemtical formulas with it?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At first glance, it might look like JavaScript displays large numbers correctly. Mostly it does, but then mostly it doesn't. Why is that? There is actually a pretty concrete reason from the perspective of a computer, but we will get to that in a moment. Let's first look at some examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const divide = 15 / 3;

console.log(divide);
// 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As in the example above, &lt;code&gt;15&lt;/code&gt; gets divided by &lt;code&gt;3&lt;/code&gt; that results in &lt;code&gt;5&lt;/code&gt;, if we log the result to the console. Everything fine so far. Let's do a more complex calculation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const divide = 15 / 0.1;
console.log(divide);
// 150
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the calculation above, we divide &lt;code&gt;15&lt;/code&gt; by &lt;code&gt;0.1&lt;/code&gt; which results in &lt;code&gt;150&lt;/code&gt;. Still no issues, right? Let's make the divisor smaller and observe what happens.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const divide = 15 / 0.01;
console.log(divide);
// 1_500
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All OK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const divide = 15 / 0.001;
console.log(divide);
// 15_000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Still OK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const divide = 15 / 0.0001;
console.log(divide);
// 150_000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hah! No issues, give me more!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: I am using thousands step notation like "1_000" for better showing the growth. The console.log actually doesn't display numbers that way. Writing numbes that way however is absolutely valid in JavaScript.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Until now everything seems to work as expected. The next line will change your expectation drastically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const divide = 15 / 0.00001;
console.log(divide);
// 1_499_999.9999999998
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What happened? We expected &lt;code&gt;15&lt;/code&gt; divided by &lt;code&gt;0.00001&lt;/code&gt; to equal &lt;code&gt;1_500_000&lt;/code&gt; but actually received &lt;code&gt;1_499_999.9999999998&lt;/code&gt;. What's going on? Let's explain that.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Explanation
&lt;/h3&gt;

&lt;p&gt;Not only JavaScript, but also other programming languages have sometimes issues in displaying large floating point numbers. Consider the number &lt;code&gt;PI&lt;/code&gt;, which is something like &lt;code&gt;3.141592653589793...&lt;/code&gt; and so on. Pretty much every programming language has problems displaying the full number &lt;code&gt;PI&lt;/code&gt;, but why?&lt;/p&gt;

&lt;p&gt;The reason is pretty simple: Memory space. Holding a large floating point number actually needs a lot of memory space to display it as accurately as possible. Most programming languages have therefore agreed on a strategy to solve this problem. They either round the value at the last comma place, once it reaches the end of space, to fit back again (also called approximation). Or they use a special type like &lt;code&gt;BigDecimal&lt;/code&gt; in Java or &lt;code&gt;BigInteger&lt;/code&gt; in C#, to reserve more memory space than the normal number type like &lt;code&gt;int&lt;/code&gt; or &lt;code&gt;double&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When it comes to JavaScript, it runs in an environment where it has certain limitations and design choices baked into it. One design choice why it results in even less accurate numbers is, that whole numbers, negative numbers and floating point numbers all have to fit in 64 bit memory space. You can imagine that shortenings had to be made to actually fit all these numbers into a limited space of 64 bits.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://eloquentjavascript.net/01_values.html#h_flOCH3CuFg"&gt;Values, Types, and Operators&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How should I display large numbers in my application?
&lt;/h3&gt;

&lt;p&gt;The answer is easy, you don't - if possible. Because eventually you might run into inaccuracy very quickly. If you have an application with a backend that uses a programming language that can handle larger numbers, you could use JavaScript to only show these numbers as strings. Or you could use JavaScript NPM packages like &lt;code&gt;decimal.js&lt;/code&gt; or &lt;code&gt;bignumber.js&lt;/code&gt;, that can handle large numbers a little better. At the end you have to acknowledge that JavaScript has these limitations.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Why I Decided To Stay A Frontend Engineer And Stopped Searching Full-Stack Jobs</title>
      <dc:creator>Web Dev Ken</dc:creator>
      <pubDate>Mon, 02 Aug 2021 14:55:00 +0000</pubDate>
      <link>https://dev.to/webdevken/why-i-decided-to-stay-a-frontend-engineer-and-stopped-searching-full-stack-jobs-590c</link>
      <guid>https://dev.to/webdevken/why-i-decided-to-stay-a-frontend-engineer-and-stopped-searching-full-stack-jobs-590c</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;My goal writing this post is to emphasize you to deepen your knowledge in the field you are currently in, instead of trying to move to new fields too quickly. If you are a frontend engineer yourself and think what you do are basics, read my story!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My software engineering career has pretty much started in January 2018. Coming from a mechanical engineering profession, it was hard for me to easily get a job in software engineering. At the time, I successfully landed a trainee job at a small company that had a frontend solution for their clients that was built with Angular. At work, I was confrontend with Angular, UI Architectures and Client-Server Architecture. Learning Angular was pretty fun, because the framework itself developed very quickly and there were tons of things to learn and apply to the application I was maintaining.&lt;/p&gt;

&lt;p&gt;After two years as trainee with a solid knowledge with Angular, I decided to move on and get a job as a software engineer at a company that deals with multiple projects, so I can learn from different environments. Luckily, I could land a job at an agency that helps customers expand their digitalization strategy by creating React frontends for their needs. Meanwhile I finished my study and received my bachelors diploma in computer science. After one and a half year at this company, occasionally looking at my local job market, I noticed a trend in full-stack developers being eagerly employed by mid to large companies. There were double more full-stack jobs than frontend jobs. As a fresh baked software engineer, I wanted to get future proof by gaining knowledge as a full-stack engineer, so I can always easily find a job once I need a switch again. But I had pretty much no knowledge about creating full-stack applications. From university I learnt all the basics like relational databases, service architectures, MVC and even .NET and C# basics, but I had no practical hands-on in years. So I decided to deepen my knowledge in C#/.NET in my spare time by creating leisure projects and learning online.&lt;/p&gt;

&lt;p&gt;Mid 2021 I started applying for various job descriptions that were looking for a .NET full-stack engineer. In total I had three job application interviews that, almost predictable, all rejected me. Here are the reasons why:&lt;/p&gt;

&lt;h3&gt;
  
  
  Interviewer number one
&lt;/h3&gt;

&lt;p&gt;The first one wanted me to create a small solution for visualizing IIS logs that were saved as text files. So I created a solution where the files get parsed, written into SQL database, read from with Entity Framework, mapped to a data transfer object with a mapper, sent to the client through an API endpoint via JSON and nicely displayed in the browser. I thought, that's what full-stack developers do. I handed in my solution in time and was invited to the company to present and discuss my solution. After presenting my solution, the responsible guy started to ask me questions. These were questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does LINQ do internally?&lt;/li&gt;
&lt;li&gt;What does line number so and so do (on an automatically generated .cs file)?&lt;/li&gt;
&lt;li&gt;What are the differences of objet and value types?&lt;/li&gt;
&lt;li&gt;What can be potential caveats of your application when you need to handle millions of lines of logs?&lt;/li&gt;
&lt;li&gt;What are memory leaks?&lt;/li&gt;
&lt;li&gt;What is garbage collection?&lt;/li&gt;
&lt;li&gt;What is encoding UTF-8?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The moral of the story was, that he asked me lot's of questions about backend development which I could barely answer. There were pretty much no questions about frontend engineering. So my impression was, that these guys were actually looking for a backend engineer that knows a bit HTML/CSS and not a full-stack engineer. After getting rejected, I moved to the second interview.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interviewer number two
&lt;/h3&gt;

&lt;p&gt;The second interviewer didn't require me to create a small application, but during the interview they wanted me to create a UML class diagram of a problem description within 15 minutes. So I tried my best to create an agnostic diagram and try to solve the problem. They asked me questions about my solution which were related to creating a relational database out of it. Overall, they further asked me questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does the keyword virtual do in C#?&lt;/li&gt;
&lt;li&gt;What are the differences between abstract classes, interfaces and class inheritance in C#?&lt;/li&gt;
&lt;li&gt;Does an abstract method has to be overriden or not?&lt;/li&gt;
&lt;li&gt;What is the difference between SQL and No-SQL?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They mainly asked me conceptual questions like class modelling, relational databases and so on. Again, there were little questions about frontend engineering and UI architectures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interviewer number three
&lt;/h3&gt;

&lt;p&gt;The third interviewer had pretty much only technical questions about .NET and SQL Server. These were questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can you inherit from multiple classes in C#?&lt;/li&gt;
&lt;li&gt;What are SQL Server functions and procedures?&lt;/li&gt;
&lt;li&gt;What is a left, right and inner join?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this interviewer, there were equal amounts of questions for frontend and backend. I pretty much could answer the frontend questions perfectly, but the backend questions almost none of it.&lt;/p&gt;

&lt;h3&gt;
  
  
  My conclusion
&lt;/h3&gt;

&lt;p&gt;After getting rejected from all three, I was extremely frustrated and felt like that I was stuck creating frontends forever. At the beginning, I had great interest in also doing backend development, but I highly overestimated my skills and didn't really know what a backend engineer needs to know. After calmly thinking and re-considering the feedbacks I received, I thought about the constellation of these interviews. As can be seen, they didn't want to know that much about my frontend engineering skills, just as if they were looking for a classic backend engineer only, who has some frontend skills. I could have been miserable in creating frontends and still land a job as a full-stack engineer, if I could answer their backend questions well. For me this meant that in the industry in my area, or at least the companies I had an interview with, still didn't recognize frontend engineering as an own discipline with an enormous complexity, that even has it's own bachelor programs nowadays. Becoming an expert in backend and frontend at the same time with a certain amount of deepness was no option for me. So I had to set my focus and move on.&lt;/p&gt;

&lt;p&gt;After all this, I recognized what I really wanted. I wanted to become a very skilled frontend engineer. Being a good frontend engineer requires a lot more than just creating fancy HTML with some JavaScript and CSS. I noticed that there is actually still a lot of things to learn creating frontends and that I actually just had started my journey. Yes, I didn't even know all the parts of JavaScript yet. Why should I switch disciplines before becoming an expert at what I do right now? From now on, I will dig much deeper, try to learn everything about the web and become a great frontend engineer.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>dotnet</category>
      <category>angular</category>
      <category>react</category>
    </item>
  </channel>
</rss>
