<?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: Matthew Clark</title>
    <description>The latest articles on DEV Community by Matthew Clark (@mattclark1025).</description>
    <link>https://dev.to/mattclark1025</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%2F455797%2F864c02fe-23dc-4700-9982-794c2d49b41b.jpg</url>
      <title>DEV Community: Matthew Clark</title>
      <link>https://dev.to/mattclark1025</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mattclark1025"/>
    <language>en</language>
    <item>
      <title>Why Node.js For Web Development in 2020?</title>
      <dc:creator>Matthew Clark</dc:creator>
      <pubDate>Tue, 08 Sep 2020 03:18:12 +0000</pubDate>
      <link>https://dev.to/mattclark1025/why-node-js-for-web-development-in-2020-2ebc</link>
      <guid>https://dev.to/mattclark1025/why-node-js-for-web-development-in-2020-2ebc</guid>
      <description>&lt;p&gt;With the rapidly growing software development industry and technology stacks, choosing the right way for web app development has become one of the complicated tasks. There are many technologies and programming languages that come and go over the years, but JavaScript is the one standalone technology that has not only maintained its position but also influence software development companies for building high-end applications.&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%2Fi%2Fzurbxnpl0aptu7zknvob.png" 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%2Fi%2Fzurbxnpl0aptu7zknvob.png" alt="Alt Text" width="700" height="457"&gt;&lt;/a&gt;Image Source: &lt;a href="https://www.statista.com/statistics/793628/worldwide-developer-survey-most-used-languages/" rel="noopener noreferrer"&gt;https://www.statista.com/statistics/793628/worldwide-developer-survey-most-used-languages/&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;According to the Survey, 67.7% of developers are still preferring JavaScript for web app development.&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;However, now Node.Js has not just become an altercation of JavaScript but also majorly based on it. According to the survey reports, 51.4% of respondents used Node.Js leaving aside some of the most powerful frameworks, libraries, and other software development tools.&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%2Fi%2Fi4m232momwudpn27aqb6.png" 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%2Fi%2Fi4m232momwudpn27aqb6.png" alt="Alt Text" width="700" height="431"&gt;&lt;/a&gt;Image Source: &lt;a href="https://www.statista.com/statistics/793840/worldwide-developer-survey-most-used-frameworks/" rel="noopener noreferrer"&gt;https://www.statista.com/statistics/793840/worldwide-developer-survey-most-used-frameworks/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition, Jeff Harrel, the Director of Engineering at PayPal says &lt;em&gt;“Node.Js powers our web applications and has allowed our teams to move much faster in bringing their designs to life”&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;But, what key features making Node.Js 2020 ready? Is choosing Node.js over other technologies a winning choice for startups or enterprises…Let’s learn…&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;If you are one of those new techs who are not much aware of Node.js, then it’s better to get started with the overview of the Node.Js!&lt;/p&gt;

&lt;h1&gt;
  
  
  Basic Overview of Node.Js
&lt;/h1&gt;

&lt;p&gt;Node.Js is originally launched by Ryal Dahl, as a set of libraries that used to run on top of the V8 engine and allowing to run JavaScript code on the server. If putting it in simple words, then Node.js is neither a library nor a framework. In fact, &lt;em&gt;Node.Js is a cross-platform, open-source JavaScript runtime that actually works on the server-side. It simply means that you can execute JavaScript codes on your computer machine by using that runtime instead of running it in the browser.&lt;/em&gt; Sounds interesting, right! That’s how Node.js gonna work and empowering developers.&lt;/p&gt;

&lt;p&gt;In addition, it won’t be wrong calling Node.js a strong yet feature-rich framework, as it provides a unique combination of libraries, helpers, and various tools that make the entire web app development process far simpler and easier to operate. Moreover, it provides a strong base to build your web apps and safeguard your online presence.&lt;/p&gt;

&lt;h1&gt;
  
  
  What Exactly Makes Node.Js a Powerful Technology?
&lt;/h1&gt;

&lt;p&gt;Elements of Node.js are V8, libuv, Http-parser, C-ares, OpenSSL, and zlib. While Node.js has been relishing developer’s attention since its launch and exceptionally used for the real-time applications. Node.Js is undoubtedly packed with the unique set of features that have helped it become a top choice for developers when it comes to web app development.&lt;br&gt;
However, still many of you wondering what exactly sets Node.Js apart from other libraries and frameworks. The simple answer to this question is its Core Elements.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;For better understanding let’s split Node.Js into two parts: V8 and Libuv. On the one hand, V8 is composed of 70% C++ and 30% of JavaScript, on the other hand, Libuv is completely written in C.&lt;/em&gt;
&lt;/h4&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%2Fi%2Fk79lzjzzmoeerb9o5s4v.png" 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%2Fi%2Fk79lzjzzmoeerb9o5s4v.png" alt="Alt Text" width="700" height="393"&gt;&lt;/a&gt;Image Source: &lt;a href="https://dev.to/khaosdoctor/node-js-under-the-hood-1-getting-to-know-our-tools-1465"&gt;https://dev.to/khaosdoctor/node-js-under-the-hood-1-getting-to-know-our-tools-1465&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Let’s understand it in a simple language:
&lt;/h1&gt;

&lt;p&gt;If you ever get a chance to take a closer look at the Node.js code, you will find the two main folders “Lib and SRC”. The “Lib” folder is the one that contains all the JavaScript functions and modules that required into the project where the “SRC” folder contains all the C++ implementations.&lt;/p&gt;

&lt;h3&gt;
  
  
  For example:
&lt;/h3&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%2Fi%2Fjzhsadqqi3bu957da4iv.png" 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%2Fi%2Fjzhsadqqi3bu957da4iv.png" alt="Alt Text" width="611" height="544"&gt;&lt;/a&gt;Image Source: &lt;a href="https://dev.to/khaosdoctor/node-js-under-the-hood-1-getting-to-know-our-tools-1465"&gt;https://dev.to/khaosdoctor/node-js-under-the-hood-1-getting-to-know-our-tools-1465&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now, you must have a fair idea about what exactly is Node.js and it’s core elements that made it stronger over others. However, the central question remains the same, that what are the top features that make Node.Js development trends for 2020.&lt;/p&gt;

&lt;h1&gt;
  
  
  Key Features of Node.js Making It Ready for 2020
&lt;/h1&gt;

&lt;p&gt;Making an investment in the web app development is a crucial decision, so before proceeding for the top web development company, you should what makes Node.js best over others.&lt;/p&gt;

&lt;p&gt;So when it comes to choosing the Node.js for developing web apps, undoubtedly 51% developers love using it becuase of its speed and multi-user proficiency. Secondly, since it is majorly based on JavaScript, therefore, making a real-time application becomes easier with Node.js. All-in-all, Node.Js is a combination of library, framework, and other development tools that simplifies the job of full-stack web developer and ensure effortless development.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Let’s Understand the Key Features of Node.Js in detail to make a better choice for web app development:&lt;/em&gt;
&lt;/h4&gt;

&lt;h2&gt;
  
  
  1. High Performance and Event-Based Model
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;It’s Not a Myth!&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;As the businesses are growing rapidly, they are looking for frameworks that can easily adaptable and scalable as the user base grow. and Node.js has the power to host any size of the audience seamlessly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;V8 Engine:&lt;/strong&gt; Node.js is built on Google Chrome’s V8 engine and written in C++, which not only makes it super fast but also helps in creating web applications that can handle multiple parallel connections with greater performance. In addition, both V8 and Node are often updated with the performance boosters, security patches, and support to add the touch of modern Javascript features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single-Threaded Architecture:&lt;/strong&gt; The event-driven, single-threaded architecture of Node.js, make it capable of processing multiple simultaneous requests without any delay. Most of the popular platforms create an additional thread for each new request, which takes a long time to process and blocking a thread for making other requests. On the other hand, Nodejs manage requests with a single thread by making use of event loop and callbacks for I/O operations and delegating tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event-Based Model:&lt;/strong&gt; Whether it’s about non-blocking responses, single-threaded nature, or usage of a common language for both client/server-side, Node.Js is a popular choice for various solutions that required frequent updates in data, for example, chats, video conferences and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Conclusion: Many leading companies like PayPal have switched their technologies to develop Node.js application and noticed 35% decrease in response time as compare to migrating it from Java.&lt;/em&gt;&lt;/strong&gt;&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%2Fi%2Far8dcxuj72wjr0xm3xzt.png" 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%2Fi%2Far8dcxuj72wjr0xm3xzt.png" alt="Alt Text" width="500" height="613"&gt;&lt;/a&gt;Image Source: &lt;a href="https://medium.com/paypal-engineering/node-js-at-paypal-4e2d1d08ce4f" rel="noopener noreferrer"&gt;https://medium.com/paypal-engineering/node-js-at-paypal-4e2d1d08ce4f&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Node.Js Supports Microservices
&lt;/h2&gt;

&lt;p&gt;With the increasing demand for applications, microservices have become one of the major needs for businesses struggling with web app performance.&lt;/p&gt;

&lt;p&gt;Every project started out small or with the basic MVP, but sooner or later it starts growing and demand the new features. As your user base grow and your app expanded with new features, you may end up with a huge project and your web development company will keep struggles to cope with. On one side you probably need to add new features and on the other hand, you need to provide the top-notch performance to the users. Well, this one of the most common problems among enterprise applications. But the simple answer to this problem is to look for a Microservice pattern.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;It means “a microservice is a single self-contained unit which, together with many others, makes up a large application. By splitting your app into small units every part of it is independently deployable and scalable, can be written by different teams and in different programming languages, and can be tested individually”.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Well described by an open-source developer — Max Stoiber&lt;/em&gt;
&lt;/h4&gt;

&lt;h3&gt;
  
  
  For example:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;When Walmart shifted to microservices architecture with Node.Js, they get immediate benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Seamlessly handling over 500 million pages views with zero downtime&lt;/li&gt;
&lt;li&gt;98% of mobile conversion growth instantly&lt;/li&gt;
&lt;/ul&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%2Fi%2Fm7ve7drl543no362sfvr.png" 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%2Fi%2Fm7ve7drl543no362sfvr.png" alt="Alt Text" width="700" height="357"&gt;&lt;/a&gt;Image Source: &lt;a href="https://blog.risingstack.com/how-enterprises-benefit-from-microservices-architectures/" rel="noopener noreferrer"&gt;https://blog.risingstack.com/how-enterprises-benefit-from-microservices-architectures/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Easy Maintenance With Serverless Web Development
&lt;/h2&gt;

&lt;p&gt;Going serverless with the Node.js can help you save a great cost and time as most of the web applications run on high-maintenance servers.&lt;/p&gt;

&lt;p&gt;Since nowadays software development companies have a dedicated team of engineers to help manage and maintain servers, why to make it complicated for you when Node.js serverless and hardware-free solutions are here to save you.&lt;/p&gt;

&lt;p&gt;This will not only help in reducing time and cost but also enhanced the efficiency and productivity of the developers as well as software development companies using this framework.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Some benefits of using serverless applications&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Serverless applications are like a piece of code that usually functions closely like the AWS Lambda. It means, it is executed based on the kind of event triggered. Moreover, it ensures a faster deployment cycle run via a single command.&lt;/p&gt;

&lt;h3&gt;
  
  
  Take a look of an example:
&lt;/h3&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%2Fi%2F0cwr58qp9stkfsti4qq0.png" 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%2Fi%2F0cwr58qp9stkfsti4qq0.png" alt="Alt Text" width="700" height="185"&gt;&lt;/a&gt;Image Source: &lt;a href="https://blog.logrocket.com/going-serverless-with-your-node-js-apps/" rel="noopener noreferrer"&gt;https://blog.logrocket.com/going-serverless-with-your-node-js-apps/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Rich Ecosystem For Enterprise- NPM
&lt;/h2&gt;

&lt;p&gt;In simple words, NMP is a default package manager of Node.js which allows programmers to install, update, and access open-source JavaScript tools for modern web applications. With over 836,000 libraries available in NPM and over 10,000 new ones being published every week, Node.js ecosystem becomes quite rich and providing a vast variety of free accessible tools in a few clicks to developers.&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%2Fi%2F6gwumltwd0kw3c2y17zr.png" 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%2Fi%2F6gwumltwd0kw3c2y17zr.png" alt="Alt Text" width="541" height="367"&gt;&lt;/a&gt;Image Source:&lt;a href="https://blog.npmjs.org/post/180868064080/this-year-in-javascript-2018-in-review-and-npms#:%7E:text=With%20over%20836%2C000%20libraries%20currently,entirely%20apples%2Dto%2Dapples" rel="noopener noreferrer"&gt;https://blog.npmjs.org/post/180868064080/this-year-in-javascript-2018-in-review-and-npms#:~:text=With%20over%20836%2C000%20libraries%20currently,entirely%20apples%2Dto%2Dapples&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;According to the survey, 7% of users are using NPM to build front-end web applications whereas 77% of enterprises are building Node.js applications. One prime reason behind this is, NPM has released the “Enterprise version” of package manager that ensures high-end privacy and security of the web application.&lt;/p&gt;

&lt;p&gt;Moreover, you can choose to hire web developer to leverage the NPM package managers and avoid writing the common features right from the scratch and eliminate the risk of adding new layers of complexity to the development process.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Developing Cross-Platform Apps With Node.Js
&lt;/h2&gt;

&lt;p&gt;Platforms like Electron and NW.js have introduced a new way of writing cross-platform applications with Node.js like technologies. It means, now you can develop desktop apps with Node.js by simply using some code lines from your web app to create desktop versions for mainly macOS, Windows, and Linux. The best part about this, the same team working on a web app can deliver the desktop app without having the expert knowledge of programming languages like Objective-C, C#, or other required for building native apps.&lt;/p&gt;

&lt;p&gt;Also, the majority of the Node.js tools are cross-platform, so developer’s don’t require a specific machine to write, debug, and build a Windows, macOS, or Linux apps.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Highly modern enterprises are already knowing that developing your web app with Node.js is probably an optimum way to improve app performance, increasing coding efficiency, and bringing overall happiness to their development team.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;To end this post, it is worth mentioning that that Ruby on Rail is the biggest titan of the development industry but still, a huge part of web development solutions revolves around JavaScripts frameworks. For front-end — Vue.js, React and Angular.Js are ruling but Node.js is the biggest choice for back-end development.&lt;/p&gt;

&lt;p&gt;So with the above-given futuristic features, I see strong reasons for choosing Node.js for building web application that delivers smooth and excellent user experience. And for enterprises, still find themselves stuck anywhere in between the features, can choose to get a partner with the right team of developers, who are capable of making the most of this modern web app development framework and make your app future-ready.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>webdev</category>
      <category>startup</category>
    </item>
    <item>
      <title>3 Characteristics of Fast Growing Programming Languages</title>
      <dc:creator>Matthew Clark</dc:creator>
      <pubDate>Wed, 02 Sep 2020 19:56:29 +0000</pubDate>
      <link>https://dev.to/mattclark1025/3-characteristics-of-fast-growing-programming-languages-3m47</link>
      <guid>https://dev.to/mattclark1025/3-characteristics-of-fast-growing-programming-languages-3m47</guid>
      <description>&lt;p&gt;The justifications for creating a new programming language vary. If you’re a computer scientist like Mary Hawes or Grace Hopper, your concern is economics: the cost of programming generally, and for porting applications to new hardware platforms specifically. If you’re Dennis Ritchie or Ken Thompson, your issue is that the prior letter of the alphabet is too slow. Or if you’re Rasmus Lerdorf, you want something simpler to maintain your homepage so you write a surprisingly cromulent language that still powers wide swaths of the public internet.&lt;/p&gt;

&lt;p&gt;The intent, in turn, informs the execution. COBOL is human readable, C is fast and PHP is, or at least was, simple.&lt;/p&gt;

&lt;p&gt;None of which guarantees anything. As engineers need to be reminded regularly, not only doesn’t the best technology win in every case, it doesn’t win in most cases. The quality of the technical implementation is but one among many factors in the adoption – or lackthereof – of a given piece of technology.&lt;/p&gt;

&lt;p&gt;A new programming language, therefore, can be designed with the best of intentions, it can be backed by well resourced organizations, it can be exceptionally well engineered and yet it can still see minimal interest and adoption. This is more true today, in fact, than it’s ever been because the rise in developer importance has led to widespread language fragmentation which has in turn created enormous competition for programming language attention, visibility and traction.&lt;/p&gt;

&lt;p&gt;While there is no way to predict success for a particular programming language, however, there are three characteristics that languages that have outperformed their counterparts on the RedMonk language rankings over the past eight years have had in common. If you’re advocating for a current language or considering whether to write a new one, then, these patterns are worth considering.&lt;/p&gt;

&lt;h2&gt;
  
  
  Assimilation:
&lt;/h2&gt;

&lt;p&gt;The majority of programming languages are stand alone pieces of software. The syntax is unique, or at least relatively so. Each has its own compiler and associated tooling, its own community and so on. Several of the fastest movers on our rankings in recent years, however, are languages able to seamlessly intermingle with large existing language communities.&lt;br&gt;
TypeScript is perhaps the best example of this. A superset of JavaScript that offers optional type safety, TypeScript can present unique and differentiated features to developers – while operating side by side with what is by our measure the most popular language in the world. This makes the adoption of TypeScript within a given enterprise far less controversial than an incompatible language would be.&lt;/p&gt;

&lt;p&gt;In similar fashion, Kotlin’s major boost came from its approval as a first class citizen on the Android platform. But its vault from the distant back half of our rankings to a Top 20 language was not fueled by its usage on the mobile platform alone. Instead, Kotlin’s ability to intermingle with what up until recently we ranked as the second most popular programming language in the world has allowed it to flow into enterprise settings like water. Consider that several vendors tried to capitalize on the popularity of Swift – an enormously popular language thanks to its role as the basis for iOS applications – and push it into the enterprise. These efforts, by and large, have failed. Webinars about how to use Kotlin with Springboot or otherwise mainstream enterprise frameworks, however, abound.&lt;/p&gt;

&lt;p&gt;Speaking of Kotlin, it’s worth mentioning that that transaction goes both ways, in that while Kotlin – along with Clojure, Groovy, Scala et al – compete with Java the language, all of them leverage Java the platform. So while Kotlin’s competing with Java in one dimension, it is being absorbed by it in another.&lt;/p&gt;

&lt;p&gt;Embrace and extend has been a technology trope for years for a reason, and the reason is that it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security:
&lt;/h2&gt;

&lt;p&gt;Like insurance, security is generally viewed as a necessary evil. Something that has to be done, but that is merely unsexy work in a best case scenario and more likely to be both tedious and miserable. As enterprises have shifted more and more of their business to digitally based models, however, the importance of security from an application development perspective skyrockets.&lt;/p&gt;

&lt;p&gt;Its importance notwithstanding, security is never going to be something that a majority of developers get excited about and want to spend cycles on. If a language is able to build in some security, however, if only to protect developers from some particular subset of vulnerabilities, that is an increasingly attractive feature – particularly if it doesn’t require too many compromises.&lt;/p&gt;

&lt;p&gt;TypeScript in particular, as mentioned, has benefitted from this approach, being able to present itself to developer and executive alike as JavaScript, but with some security baked in. Even Kotlin with its Null Safety feature has benefitted from the growing emphasis on secure development in some cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Versatility:
&lt;/h2&gt;

&lt;p&gt;Lastly, one of the things developers prize, and to a lesser extent the enterprises they work for, is versatility. There are many instances of successful specialized languages, of course – R being perhaps the most obvious. Languages that have the ability to traverse a wide range of use cases, however, offer enormous value to developer and employer alike.&lt;/p&gt;

&lt;p&gt;Perhaps the best example of this is Java. Originally created to provide software for cable set top boxes, the language went on to storm the world as an industry standard for enterprise applications. For years industry observers and analysts would write reports about how “Java Was Dead.” This “dead” language would later go on to serve as the foundation for everything from Android’s application ecosystem to the majority of Big Data software infrastructure. With so much competition from more recent languages that were developed in reaction to the perceived shortcomings of Java and other long time stalwarts, one of the more common questions about our language rankings has been concerning Java’s ability to sustain its performance even amidst all the predictions of its imminent demise. There are many answers to that question, inertia among them, but the language’s versatility is perhaps the most accurate. It keeps finding new workloads to run, and in so doing has kept itself relevant.&lt;/p&gt;

&lt;p&gt;Python, the new number two language on our rankings, has never had the profile that Java’s had, but the breadth of use cases has not only sustained its performance but grown its usage even as one time competitors like Ruby have fallen off. From VB-style local apps to cross-platform developer scripting requirements to data science, the combination of Python’s accessibility and variety of potential entrypoints have ensured that Python is at least as relevant today as it was a decade ago.&lt;/p&gt;

&lt;p&gt;And while it would be incorrect to solely attribute JavaScript’s popularity to its versatility, the language’s ability to traverse from the front end of an application to the back, beginning with the introduction of Node.js in 2009, opened up entirely new vistas for the language. It would be enormously popular even absent that back end presence, but that has been a selling point both for developers looking to learn the language and enterprises considering adopting it for better than ten years now.&lt;/p&gt;

&lt;p&gt;To be clear, if you look across the Top 20 languages that we’ve ranked, both now and in years past, you will find many languages that don’t fit one of the above patterns. But given how difficult language growth is to achieve today, and the fact that the fastest growing languages we’ve tracked with the exception of Swift exhibit one of these tendencies, they’re certainly worth considering when trying to move the needle around a particular language.&lt;/p&gt;

&lt;p&gt;Particularly if, like TypeScript, you can incorporate more than one at the same time.&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
    <item>
      <title>Ignore Console.log() From Now On!</title>
      <dc:creator>Matthew Clark</dc:creator>
      <pubDate>Tue, 01 Sep 2020 23:16:30 +0000</pubDate>
      <link>https://dev.to/mattclark1025/ignore-console-log-from-now-on-34cn</link>
      <guid>https://dev.to/mattclark1025/ignore-console-log-from-now-on-34cn</guid>
      <description>&lt;p&gt;Adding &lt;em&gt;console.log()&lt;/em&gt; to our code is probably one of the most common practice among developers. However, I have spent a lot of time in my life to persuade beginners (and sometimes proficient coders) to stop using it for debugging JavaScript. Here’s why.&lt;/p&gt;

&lt;p&gt;First, I must admit that I’m still doing &lt;em&gt;console.log()&lt;/em&gt; statements in my code — old habits die hard. I’m not alone: Around 75% of Node.js developers report using it (in 2016, &lt;a href="https://www.clarkio.com/2017/04/25/debugging-in-nodejs/" rel="noopener noreferrer"&gt;https://www.clarkio.com/2017/04/25/debugging-in-nodejs/&lt;/a&gt;) for finding errors in their applications.&lt;/p&gt;

&lt;p&gt;In a couple of situations it is either the simplest thing to do because you know exactly what and where to log information, or it’s the only thing to do because you are in constrained production/embedded environments with no other tool. However, this not an excuse to make the exception lead your daily practice. Indeed, as a general rule, &lt;em&gt;console.log()&lt;/em&gt; is painful and prone to errors — as you will see hereafter. There are much more sophisticated solutions available.&lt;/p&gt;

&lt;h1&gt;
  
  
  Missing Contextual Information
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;console.log()&lt;/em&gt; forces you to consciously select which information to be logged prior to debugging. And what you display in the first place isn’t sufficient or even completely irrelevant because you usually don’t yet have any idea of what’s going on.&lt;/p&gt;

&lt;p&gt;Every time you launch your app, you go a step further — whether it be realizing you’re still not logging the right information at the right time or wasting hours changing your statements again and again to display new information and hide irrelevant info.&lt;/p&gt;

&lt;h3&gt;
  
  
  Counterattack with a debug tool:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Display/watch any JS variable inline while debugging (function arguments, local variables, global variables, etc.)&lt;/li&gt;
&lt;li&gt;Explore the call stack to get the complete context in which your problem appear&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Too Much Information
&lt;/h3&gt;

&lt;p&gt;Algorithms are usually designed to automate a large number of small tasks — loops and recursion being fundamental building blocks for this. Along with &lt;em&gt;console.log()&lt;/em&gt;, it results in a large number of lines displayed in front of you, so you may have a hard time coming to find the right information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Counterattack with a debug tool:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create conditional breakpoints[&lt;a href="https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints#conditional-loc" rel="noopener noreferrer"&gt;https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints#conditional-loc&lt;/a&gt;] to pause the execution when a specific condition is met so you can take time to analyse what’s going on&lt;/li&gt;
&lt;li&gt;Watch custom JS expressions&lt;a href="//variables,%20conditions,%20etc."&gt;https://developers.google.com/web/tools/chrome-devtools/javascript/reference#watch&lt;/a&gt; so you don’t waste time deriving the same expression at each step of a loop&lt;/li&gt;
&lt;li&gt;Create a debug log classification[&lt;a href="https://blog.risingstack.com/node-js-logging-tutorial/" rel="noopener noreferrer"&gt;https://blog.risingstack.com/node-js-logging-tutorial/&lt;/a&gt;] in addition to your standard application log in order to activate debug messages on-demand for the domain of interest (e.g., file, service, class, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Untrustworthy Information
&lt;/h3&gt;

&lt;p&gt;You cannot always trust information reported by &lt;em&gt;console.log()&lt;/em&gt; because there is simply no standardized behavior about it. You don’t really know what happens under the hood.&lt;/p&gt;

&lt;p&gt;Most of the time, calling &lt;em&gt;console.log()&lt;/em&gt; when the console is not yet active only results in a reference to the object being queued[&lt;a href="https://stackoverflow.com/questions/23392111/console-log-async-or-sync" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/23392111/console-log-async-or-sync&lt;/a&gt;], not the output the console will contain.&lt;/p&gt;

&lt;p&gt;As a workaround, you’ll need to either clone the information or serialize snapshots of it. The rendering happens asynchronously&lt;a href="https://dev.tobeing%20throttled%20to%20rate-limit%20updates"&gt;https://stackoverflow.com/questions/23392111/console-log-async-or-sync&lt;/a&gt; alongside future interactions with the logged objects (e.g., expanding object properties in the browser console).&lt;/p&gt;

&lt;h3&gt;
  
  
  Counterattack with a debug tool:
&lt;/h3&gt;

&lt;p&gt;Asynchronous stack traces&lt;a href="https://dev.tonow%20the%20default%20in%20Chrome"&gt;http://mrbool.com/how-to-debug-asynchronous-javascript-with-chrome-devtools/33573&lt;/a&gt; allow you to inspect function calls beyond the current event loop, just like a context-aware travel in time to the originators of your asynchronous callbacks&lt;/p&gt;

&lt;h1&gt;
  
  
  Altered Code Behavior
&lt;/h1&gt;

&lt;p&gt;The standard way to debug asynchronous code is to console log &lt;em&gt;1&lt;/em&gt;, &lt;em&gt;2&lt;/em&gt;, &lt;em&gt;3&lt;/em&gt;, &lt;em&gt;4&lt;/em&gt;, etc. (i.e., all executed steps before the output you’re expecting until you get the right order).&lt;/p&gt;

&lt;p&gt;As a consequence, you modify the code and thus the way it runs, which can lead to really hard-to-track, unsteady behaviors. After you finish debugging, you also have to remember to delete all the stray console logs in your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Counterattack with a debug tool:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;When it comes time to really understanding the flow of an application, going step by step[&lt;a href="https://developers.google.com/web/tools/chrome-devtools/javascript/reference#stepping" rel="noopener noreferrer"&gt;https://developers.google.com/web/tools/chrome-devtools/javascript/reference#stepping&lt;/a&gt;] is mandatory&lt;/li&gt;
&lt;li&gt;When it comes time to really understand the timing of asynchronous callbacks, breakpoints[&lt;a href="https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints" rel="noopener noreferrer"&gt;https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints&lt;/a&gt;] are your best friends (select the type that best suits your problem)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  The Debugging Toolkit for JavaScript
&lt;/h1&gt;

&lt;p&gt;To help you debug a full stack JS application, you actually really need a few tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome DevTools[&lt;a href="https://developers.google.com/web/tools/chrome-devtools/" rel="noopener noreferrer"&gt;https://developers.google.com/web/tools/chrome-devtools/&lt;/a&gt;] now supports Node.js debugging[&lt;a href="https://medium.com/the-node-js-collection/debugging-node-js-with-google-chrome-4965b5f910f4" rel="noopener noreferrer"&gt;https://medium.com/the-node-js-collection/debugging-node-js-with-google-chrome-4965b5f910f4&lt;/a&gt;] in addition to JS code running in a local or remote browser&lt;a href="//e.g.,%20on%20a%20mobile%20device"&gt;https://developers.google.com/web/tools/chrome-devtools/remote-debugging/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Node.js debug[&lt;a href="https://github.com/visionmedia/debug" rel="noopener noreferrer"&gt;https://github.com/visionmedia/debug&lt;/a&gt;] module&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you believe you can’t use the debugger when running your tests, consider reading this article[&lt;a href="https://peterlyons.com/js-debug/" rel="noopener noreferrer"&gt;https://peterlyons.com/js-debug/&lt;/a&gt;] and other similar resources you might easily find on the internet.&lt;/p&gt;

&lt;p&gt;There is probably no one-size-fits-all solution anyway, so if I have not convinced you and you don’t still want to use the debugger as your main debug tool, I would suggest you read this article[&lt;a href="https://medium.com/@shanebdavis/debuggers-are-broken-become-a-console-log-samurai-f352accd9ef6" rel="noopener noreferrer"&gt;https://medium.com/@shanebdavis/debuggers-are-broken-become-a-console-log-samurai-f352accd9ef6&lt;/a&gt;] to make your logging smarter. One can also mention third-party modules like winston[&lt;a href="https://github.com/winstonjs/winston" rel="noopener noreferrer"&gt;https://github.com/winstonjs/winston&lt;/a&gt;] or loglevel[&lt;a href="https://github.com/pimterry/loglevel" rel="noopener noreferrer"&gt;https://github.com/pimterry/loglevel&lt;/a&gt;] for JavaScript as fairly good customisable loggers, but on my side I prefer to use them for production-grade logs only (e.g., information, warnings, errors, etc.). Others modules like debug[&lt;a href="https://github.com/visionmedia/debug" rel="noopener noreferrer"&gt;https://github.com/visionmedia/debug&lt;/a&gt;] are more appropriate for debug/trace logs.&lt;/p&gt;

&lt;p&gt;Thank you for your watching!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>debugging</category>
      <category>chrome</category>
    </item>
    <item>
      <title>JS Coding Patterns that give you away as a Junior Developer</title>
      <dc:creator>Matthew Clark</dc:creator>
      <pubDate>Mon, 31 Aug 2020 23:23:25 +0000</pubDate>
      <link>https://dev.to/mattclark1025/js-coding-patterns-that-give-you-away-as-a-junior-developer-4h61</link>
      <guid>https://dev.to/mattclark1025/js-coding-patterns-that-give-you-away-as-a-junior-developer-4h61</guid>
      <description>&lt;p&gt;Computer programming is somewhere between an art and a science. Your code must match the syntax that the computer expects and understands, but the style and flow of your program are ultimately up to you.&lt;/p&gt;

&lt;p&gt;Most programming problems can be solved in many different ways and judging one as better than another can be tricky. Sometimes, things come down to personal preference, and other times one approach is just better than another. This could be for performance, conciseness, or readability.&lt;/p&gt;

&lt;p&gt;This post explores two patterns that are more likely to be used by junior developers than senior ones. The examples below are written in JavaScript, but the general principles extend to other programming languages as well.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Overuse of “if” and “else” Statements
&lt;/h1&gt;

&lt;p&gt;Let’s say we are writing a class used to represent Simpsons characters. The constructor of the class accepts a first name, last name, and occupation for that character.&lt;br&gt;
The code below creates the class and instantiates an example character, &lt;em&gt;edna&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Character {
  constructor (firstName, lastName, occupation) {
    this.firstName = firstName
    this.lastName = lastName
    this.occupation = occupation
  }
}
const edna = new Character(
  'Edna',
  'Krabappel',
  'Elementary School Teacher'
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s say that we want to add a getter property to our class that returns a boolean, describing whether the character is a member of the Simpson family or not.&lt;br&gt;
Edna Krabappel is not a member of the Simpson family, but Lisa Simpson would be. Here is one way that this might be achieved, but it isn’t very good.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Character {
  constructor (firstName, lastName, occupation) {
    this.firstName = firstName
    this.lastName = lastName
    this.occupation = occupation
  }

  get isSimpson () {
    if (this.lastName === 'Simpson') {
      return true
    } else {
      return false
    }
  }
}
const edna = new Character(
  'Edna',
  'Krabappel',
  'Elementary School Teacher'
)
console.log(edna.isSimpson) // Logs false, as expected
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code works as expected, but is unnecessarily verbose.&lt;br&gt;
For starters, the &lt;em&gt;else&lt;/em&gt; block isn’t needed. If the condition is found to be &lt;em&gt;true&lt;/em&gt;, then the function will return a value and terminate — the &lt;em&gt;else&lt;/em&gt; alternative will never be reached.&lt;/p&gt;

&lt;p&gt;This fact allows us to simplify the method to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get isSimpson () {
  if (this.lastName === 'Simpson') {
    return true
  }
  return false
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generally speaking, it’s stylistically preferable to avoid else blocks because it reduces code nesting. Although this isn’t always possible, it often is.&lt;/p&gt;

&lt;p&gt;But even with that improvement, the method is still a bit silly. Since the getter intends to return a boolean as the output, an if statement isn’t needed at all.&lt;/p&gt;

&lt;p&gt;This code does the same job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get isSimpson () {
  return this.lastName === 'Simpson'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s much nicer. Comparison operators are often combined with if statements, but they don’t have to be. Sometimes, it’s better to just return a boolean directly.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Using Functional Programming in a Nonfunctional Way
&lt;/h1&gt;

&lt;p&gt;JavaScript arrays can be manipulated either procedurally or functionally.&lt;/p&gt;

&lt;p&gt;A functional approach is often preferable because it avoids mutation and unnecessary variables, but a procedural approach can be appropriate in certain situations as well.&lt;/p&gt;

&lt;p&gt;While your choice of paradigm may be a matter of taste, misuse of functional programming techniques can identify you as a beginner. To illustrate, here’s an example.&lt;/p&gt;

&lt;p&gt;Let’s say that we have an array of &lt;em&gt;Character&lt;/em&gt; objects available, and want to use this data to create an array of names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// An example input array could look like this:
const characters = [
  new Character(
    'Edna',
    'Krabappel',
    'Elementary School Teacher'
  ),
  new Character(
    'Lisa',
    'Simpson',
    'Student'
  ),
  new Character(
    'Moe',
    'Szyslak',
    'Bartender'
  ),  
]
// In that case the output we are looking for would look like this:
[
  'Edna Krabappel',
  'Lisa Simpson',
  'Moe Szyslak'
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first step is going to be adding a getter to our &lt;em&gt;Character&lt;/em&gt; class that returns the full name of the character:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get fullName () {
  return `${this.firstName} ${this.lastName}`
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that available, we can move on to getting an array of full names. Here is one solution that works, but leaves room for improvement:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const names = []
characters.forEach(character =&amp;gt; {
  names.push(character.fullName)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This implements &lt;em&gt;forEach&lt;/em&gt; and provides a callback function, but it might as well have been implemented procedurally.&lt;br&gt;
Instead of returning a value, each iteration of the loop mutates the external &lt;em&gt;names&lt;/em&gt; variable. A &lt;em&gt;for&lt;/em&gt; loop could easily achieve the same thing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const names = []
for (let character of characters) {
  names.push(character.fullName)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;forEach&lt;/em&gt; just isn’t the right choice for this. To ensure that the callback function remains “pure”, we should use another array method — let’s try &lt;em&gt;reduce&lt;/em&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 names = characters.reduce((names, character) =&amp;gt; {
  return names.concat(character.fullName)
}, [])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This attempt avoids the problems associated with &lt;em&gt;forEach&lt;/em&gt; but still isn’t great.&lt;/p&gt;

&lt;p&gt;The problem lies with the verb “reduce”. As well as preventing externally declared variables and mutation, one important benefit of functional programming is readability.&lt;/p&gt;

&lt;p&gt;A functional method like “filter” or “reduce” can make for more expressive and readable code when used correctly.&lt;/p&gt;

&lt;p&gt;For example, when a programmer sees that an array is being “filtered” they can assume that a set of items are being inputted, and only a subset of those items will be outputted. The items that were not outputted were “filtered out”.&lt;/p&gt;

&lt;p&gt;Likewise, when a programmer sees an array being “reduced” they can assume that the function will take the input set and “reduce it” to a more compact output. You might “reduce” a list of test scores to a single average.&lt;/p&gt;

&lt;p&gt;This gives readers of your code a helpful hint of what it does. If the array was being operated on procedurally, then readers would need to dig into the code at a lower level to understand what is happening.&lt;/p&gt;

&lt;p&gt;Getting back to the example, this solution is not ideal because the verb “reduce” does not accurately describe what is happening. Since the goal is to return one output item for each input item, “map” is a much better choice. It’s also much more concise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const names = characters.map(character =&amp;gt; character.fullName)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;Writing code that works is good but we should also strive to write code that is succinct, performant, and readable to others.&lt;/p&gt;

&lt;p&gt;Eliminating redundant &lt;em&gt;if&lt;/em&gt; and &lt;em&gt;else&lt;/em&gt; conditions and selecting array methods appropriately are a good step towards this goal.&lt;/p&gt;

&lt;p&gt;Seemingly small details such as these are one way that experienced programmers can be distinguished from less experienced ones.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>functional</category>
      <category>coding</category>
      <category>programming</category>
    </item>
    <item>
      <title>Converting an iterable to an array in JavaScript?</title>
      <dc:creator>Matthew Clark</dc:creator>
      <pubDate>Sun, 30 Aug 2020 20:44:36 +0000</pubDate>
      <link>https://dev.to/mattclark1025/converting-an-iterable-to-an-array-in-javascript-e8k</link>
      <guid>https://dev.to/mattclark1025/converting-an-iterable-to-an-array-in-javascript-e8k</guid>
      <description>&lt;p&gt;JavaScript ES6 introduced, among many other things, the spread operator (...)[&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax&lt;/a&gt;], which allows an iterable to be expanded in places where zero or more arguments or elements are expected.&lt;/p&gt;

&lt;p&gt;We can use the spread operator to convert iterables or, as they are sometimes referred to, array-likes. Let's take a look at some examples:&lt;/p&gt;

&lt;h4&gt;
  
  
  String
&lt;/h4&gt;

&lt;p&gt;When the spread operator is applied to a string, the result is an array of strings each one representing a character of the original string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const name = 'Zelda';
const letters = [...name]; // 'Z', 'e', 'l', 'd', 'a'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Set
&lt;/h4&gt;

&lt;p&gt;A Set is a collection of unique values. When the spread operator is applied to it, the result is an array of the stored values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const data = [1, 2, 3, 1, 2, 4]
const values = new Set(data);
const uniqueValues = [...values]; // [1, 2, 3, 4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the above example is the basis for the uniqueElements snippet[&lt;a href="https://www.30secondsofcode.org/js/s/unique-elements" rel="noopener noreferrer"&gt;https://www.30secondsofcode.org/js/s/unique-elements&lt;/a&gt;].&lt;/p&gt;

&lt;h4&gt;
  
  
  NodeList
&lt;/h4&gt;

&lt;p&gt;A NodeList is a collection of nodes, returned by methods such as document.childNodes() or document.querySelectorAll(). While it implements some methods that help manipulate it as an array (e.g. NodeList.prototype.forEach()), it's oftentimes desirable to convert it to an array. When the spread operator is applied to it, the result is an array of the contained nodes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const nodes = document.childNodes;
const nodeArray = [...nodes]; // [ &amp;lt;!DOCTYPE html&amp;gt;, html ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the above example is the basis for the nodeListToArray snippet[&lt;a href="https://www.30secondsofcode.org/blog/s/js/s/node-list-to-array" rel="noopener noreferrer"&gt;https://www.30secondsofcode.org/blog/s/js/s/node-list-to-array&lt;/a&gt;].&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>object</category>
      <category>array</category>
      <category>string</category>
    </item>
    <item>
      <title>Introducing React-Three-Fiber</title>
      <dc:creator>Matthew Clark</dc:creator>
      <pubDate>Thu, 27 Aug 2020 23:54:21 +0000</pubDate>
      <link>https://dev.to/mattclark1025/introducing-react-three-fiber-9p9</link>
      <guid>https://dev.to/mattclark1025/introducing-react-three-fiber-9p9</guid>
      <description>&lt;h1&gt;
  
  
  What’s React-Three-Fiber?
&lt;/h1&gt;

&lt;p&gt;React-Three-Fiber or R3F is a powerful React renderer for three.js scenes, both for the web and with React Native.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why should I use it?
&lt;/h1&gt;

&lt;p&gt;To help you increase the speed of creation of your scenes. With R3F you’ll spend less time doing boring stuff and more time defining custom components, R3F will do all of these for you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating the canvas&lt;/li&gt;
&lt;li&gt;Binding events&lt;/li&gt;
&lt;li&gt;Creating Three.js objects&lt;/li&gt;
&lt;li&gt;Starting the render loop&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Component-based scene
&lt;/h3&gt;

&lt;p&gt;3JS allows us to write three.js objects in a declarative way. That means we can build up our scene creating re-usable React components, leveraging props, states, and hooks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built-in helper
&lt;/h3&gt;

&lt;p&gt;It comes with some useful functions like raycaster and on each mesh it gives you access to all the useful pointer events like onClick, onPointerOver, onPointerOut, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hooks
&lt;/h3&gt;

&lt;p&gt;It comes with lots hooks, such as useFrame or useThree, from which we can get useful objects like renderer, scene, camera, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dependency-free
&lt;/h3&gt;

&lt;p&gt;Since it’s “just” a renderer it doesn’t rely on the three.js version, so you’re free to choose your preferred version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Re-render only when needed
&lt;/h3&gt;

&lt;p&gt;It works like any React component, updating itself on a dependency change (state, store, etc).&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation
&lt;/h1&gt;

&lt;p&gt;To install it with npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   npm install three react-three-fiber
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install it with Yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   yarn add three react-three-fiber
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You only need to add three (three-js) and this great module, no other dependencies and it’s only 33kB!&lt;/p&gt;

&lt;h1&gt;
  
  
  How Do I Use It?
&lt;/h1&gt;

&lt;p&gt;Simply use the Canvas component to create a three-js canvas — this will take the whole height and width of its container.&lt;/p&gt;

&lt;p&gt;Then, within the Canvas node, you’ll be able to add all your dynamic components — like your nested hierarchy of react components as well as custom ones. In this case, we created a Box component with some custom behaviors.&lt;/p&gt;

&lt;p&gt;We used useRef to access the mesh of the cube. After it’s initialized by three-js, inside, canvas is able to keep a connection to it, altering scale or changing direction when hovered over with mouse or touch. If you scroll down and take a look at the Canvas you will see other official components from three-js, such as ambientLight and pointLight.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   &amp;lt;Canvas&amp;gt;
    &amp;lt;ambientLight /&amp;gt;
    &amp;lt;pointLight position={[10, 10, 10]} /&amp;gt;
    &amp;lt;Box position={[-1.2, 0, 0]} /&amp;gt;
    &amp;lt;Box position={[1.2, 0, 0]} /&amp;gt;
   &amp;lt;/Canvas&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To sum up, you will need to use just these functions/hooks from Fiber if you want to start using this great library to add more 3D:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   import { Canvas, useFrame } from 'react-three-fiber'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you enjoy your experience with this library I suggest you to start looking at a more grounded introduction to the three-js and WebGL world here: &lt;a href="https://threejsfundamentals.org/" rel="noopener noreferrer"&gt;https://threejsfundamentals.org/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If then you feel you’d like to explore more of the capabilities of fiber, you can read more in the official documentation.&lt;/p&gt;

&lt;h1&gt;
  
  
  What’s Your Opinion of This Library?
&lt;/h1&gt;

&lt;p&gt;There are other high-level libraries, like A-FRAME, that build similar experiences and pages with a 3D element on the web.&lt;/p&gt;

&lt;p&gt;But the real power of R3F is being able to access the low-level API of three-js, helping you become more familiar with this incredible WebGL library. It also helps you keep a clearly defined hierarchy of components, to be reused all over.&lt;/p&gt;

&lt;h1&gt;
  
  
  CodeSandbox React-Three-Fiber Playground
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/react-three-fiber-poc-udkii/" rel="noopener noreferrer"&gt;https://codesandbox.io/s/react-three-fiber-poc-udkii/&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  If you want to learn more about Hooks
&lt;/h1&gt;

&lt;p&gt;I have personally read “Learn React Hooks” when I started using hooks and it helped me understand them to use tools such as useFrame or Canvas hook: &lt;a href="https://amzn.to/2Y8hoX9" rel="noopener noreferrer"&gt;https://amzn.to/2Y8hoX9&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>3d</category>
      <category>threejs</category>
    </item>
  </channel>
</rss>
