<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya Prakash on Medium]]></title>
        <description><![CDATA[Stories by Aditya Prakash on Medium]]></description>
        <link>https://medium.com/@prakashadityaap?source=rss-a20eff069f3b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ygUUbVFxyP_tl75qrIWDow.png</url>
            <title>Stories by Aditya Prakash on Medium</title>
            <link>https://medium.com/@prakashadityaap?source=rss-a20eff069f3b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:30:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prakashadityaap/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beginner’s Guide to Database Management Systems: Architecture]]></title>
            <link>https://interviewnoodle.com/beginners-guide-to-database-management-systems-architecture-3648d17c4a19?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3648d17c4a19</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[dbms]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Mon, 08 Nov 2021 12:58:55 GMT</pubDate>
            <atom:updated>2024-01-24T09:26:02.932Z</atom:updated>
            <content:encoded><![CDATA[<p>In continuation to my <a href="https://prakashadityaap.medium.com/beginners-guide-to-database-management-systems-db91d6356d4">previous article</a> on this topic, today I will be sharing my learnings on Database design and architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ElAeRjOyWx3DUD-k" /><figcaption>Photo by <a href="https://unsplash.com/@sunder_2k25?utm_source=medium&amp;utm_medium=referral">Sunder Muthukumaran</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Simply put, database architecture is a representation of database design, which can be centralized or decentralized. Having an architecture in place allows dividing the database system into individual components that can be modified, changed, replaced, and altered independently of each other. A modular design like this also allows for modular development, which in turn, reduces the code-time for a DBMS.</p><h3>Types of DBMS architecture:</h3><p>Database Management Systems can be divided into three main categories:</p><ol><li>1-Tier Architecture</li><li>2-Tier Architecture</li><li>3-Tier Architecture</li></ol><h4>1-Tier Architecture</h4><p>This is the simplest type of DBMS in which the client, server, and database all reside on the same machine. This type of architecture is not common in production environments and is mostly used in personal/school computers for practicing DBMS commands and concepts.</p><h4>2-Tier Architecture</h4><p>In this type, the presentation layer runs on a client, which is operated by a user, and the data is stored on another machine called the server. Whenever a user wants to access some information, a request is sent to the client, which returns a response. This architecture provides security to the DBMS as the data is not exposed to the end-user directly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*wPXfol0VfA6_kLPyjyRRHg.png" /><figcaption>Image Credits: JavaTPoint</figcaption></figure><p>An advantage of this type is that the implementation, maintenance and understanding are easier. However, this model has poor scalability and does not give good performance when there are a large number of users.</p><h4>3-Tier Architecture</h4><p>3-Tier database Architecture is an extension of the 2-Tier model. This design adds another layer(called the “Application” or “Server”) between the User and Database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*gim9qteg73qO8V3rtECELg.png" /><figcaption>Image Credits: GeeksForGeeks</figcaption></figure><ul><li><strong>Presentation/User Layer:</strong> This layer is presented to the user, and allows us to hide all the underlying mechanisms and implementations of the database.</li><li><strong>Application/Server Layer: </strong>This is the middle tier between the Database and the Presentation tier and acts as a middle-man or a connection between the end-user and the database. It holds the programs and the application server along with the programs that could access the database and provides a complete abstraction to the database layer.</li><li><strong>Database Tier: </strong>This tier holds the primary database along with all the data and the query languages for processing. The relations of data with their constraints are also defined at this level. The user is not made aware of this tier and cannot interact with it directly.</li></ul><p>The 3-tier DBMS is the most widely used model in Computer Science and hence comes with a large number of <strong>advantages </strong>over the other models:</p><ul><li><strong>Enhanced scalability:</strong> Individual connections need not be made between client and server. This allows more users to be connected to our system without causing any bottlenecks.</li><li><strong>Helps enforce A.C.I.D.:</strong> Since there is a middle layer between client and server, data corruption can be avoided. This provides enhanced consistency and durability.</li><li><strong>Security: </strong>As the client does not directly interact with the server, we eliminate unnecessary access to unauthorized data.</li></ul><h3>Summary</h3><p>Database Management Systems come in many shapes and sizes. Just because a particular model is favored by the majority, does not mean it is the recommended model for your use case. While a 3-tier architecture has its merits, it is also difficult to implement. In a classroom setting where the focus is on learning, it may be recommended to use a 1-tier model for its simplicity and quick setup.</p><p>For smaller systems where scalability will not be an issue, a 2-tier architecture will suffice. The final decision should be made after thoroughly analyzing the Requirement Documentation.</p><h3>InterviewNoodle Community</h3><ul><li>👏 Please clap for the story and follow the writer👉</li><li>📰 View more content on <a href="https://medium.com/interviewnoodle">Coding and System Design Interviews</a></li><li>🔔 Subscribe to the InterviewNoodle <a href="https://www.designgurus.io/interview-noodle-page">Newsletter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3648d17c4a19" width="1" height="1" alt=""><hr><p><a href="https://interviewnoodle.com/beginners-guide-to-database-management-systems-architecture-3648d17c4a19">Beginner’s Guide to Database Management Systems: Architecture</a> was originally published in <a href="https://interviewnoodle.com/">InterviewNoodle</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s Guide to Database Management Systems]]></title>
            <link>https://interviewnoodle.com/beginners-guide-to-database-management-systems-db91d6356d4?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/db91d6356d4</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[dbms]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Sun, 31 Oct 2021 04:51:00 GMT</pubDate>
            <atom:updated>2021-11-20T07:32:20.672Z</atom:updated>
            <content:encoded><![CDATA[<h3>Beginner’s Guide to Database Management Systems: Introduction</h3><p>I am a Computer Engineering undergrad student, currently in my 5th semester and I’ve always felt fascinated by DBMS. In this article, I will try to share my learning in the simplest way I can :)</p><p>This article is the first of many. Over the coming weeks, I will cover Database Management Systems as thoroughly and exhaustively as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LJeVeJKqiZ6vlsHKgRdrkw.png" /><figcaption>Image credits: <a href="https://pingcap.com/case-studies/choosing-right-database-for-your-applications">Pingcap</a></figcaption></figure><p>Let us begin with the definitions.</p><p>A database is simply a collection of data whose function is to efficiently and reliably organize the data stored in it. For instance, a college database will store information related to students, teachers, courses, etc.</p><p>A database management system is a software that allows the user to manage, modify, and maintain the data stored within the database. The purpose of a DBMS is to provide users with an abstract view of the data they are dealing with. Hence, some of the information like where the data is stored, or how the data is stored or accessed is hidden. MySQL and Oracle are some well-known examples of DBMS.</p><h3>Types of DBMS:</h3><p>We can divide the database management systems into three major categories:</p><ul><li>File System</li><li>Relational Database Management Systems</li><li>NoSQL, or Not Only Sequel.</li></ul><p>However, these three are not the only types of databases. There are others like Network Databases, Object-Oriented Databases, etc. In an ideal situation, clients and companies tend to focus on creating their own database, which is tailored to their needs.</p><h4>File System</h4><p>A File Management system is a type of DBMS that allows access to single files or tables at a time. In a File System DBMS, information is stored directly in a set of files, which are usually stored on the hard disk. Users may create, update, and delete the data accordingly. File System is the oldest example of a DBMS, and hence comes with its fair share of issues:</p><ul><li><strong>Difficult Access:</strong> To access a particular piece of data, a user must know in which file the data is stored. Additionally, they must also know the exact location of the file.</li><li><strong>Redundancy:</strong> Redundancy simply means duplication of data. If the same data is present in too many files, then that data is said to be redundant. Although this increases the size of our database, redundancy can improve look-up times, but that is a topic for another article. If data is redundant, then a user will have to change it in every single file, leading to a long and tedious process.</li><li><strong>Inconsistency:</strong> With redundancy, comes inconsistency. The data is said to be inconsistent when copies of it do not match with each other. For example, if a student is changing his phone number in a University DBMS, and he forgets to update one of the files, then inconsistency will be introduced.</li><li><strong>Lack of concurrency: </strong>In a file-based DBMS, only one user can access the data at a time. This leads to problems and big wait times in large-scale systems.</li></ul><p>These problems, along with lack of security and backups, motivated a shift to a more advanced and secure Database Management System.</p><h4>Relational DBMS</h4><p>A relational database means the data is stored and accessed in the form of relations or tables. For example, consider the student table below:</p><pre>STUDENT<br><br>+----------+------------------+--------+-------+<br>| Roll No. |       Name       |  Age   | Grade |<br>+----------+------------------+--------+-------+<br>|        1 | Bruce Wayne      |     26 | A     |<br>|        2 | Gandalf the Grey | 24,000 | A+    |<br>|        3 | Harry Potter     |     17 | A+    |<br>|        4 | James T. Kirk    |     49 | A     |<br>+----------+------------------+--------+-------+</pre><p>The student entity here has four attributes: Roll No., Name, Age, and Grade. The relational DBMS also provides us with a “Structured Query Language”, to create, access, modify, and delete the same. This is called SQL and has several variations, like MySQL, Microsoft SQL Server, PostgreSQL, etc. Although SQL has a standard, these distributions vary slightly in syntax. So we might encounter queries that will work in MySQL but not in SQL server.</p><h4>NoSQL</h4><p>NoSQL is a non-relational DBMS, that does not require a fixed schema/structure, avoids joins, and is easy to scale. The purpose of using a NoSQL database is for distributed data stores with extremely large data storage needs. Some common implementations include:</p><ul><li><strong>Document-based:</strong> MongoDB, Cloud Firestore</li><li><strong>Key-value stores:</strong> Amazon SimpleDB, Redis</li><li><strong>Column Family stores: </strong>Cassandra, HyperTable</li><li><strong>Graph:</strong> OrientDB, FlockDB.</li></ul><p>A NoSQL database includes simplicity of design, simpler scaling and finer control over availability. These are used in real-time web applications and big data. The reasons for the rising popularity of NoSQL Databases are:</p><ul><li>Different forms of data with different attributes and structures can be very easily handled.</li><li>Easy scalability.</li><li>A faster pace of development as compared to SQL servers.</li><li>Handle large volumes of data at high speed.</li></ul><p>Companies like Google, Amazon, &amp; Twitter collect terabytes of user data every single day. As such, a slow-performing and less scalable RDBMS will not be the optimal choice for them.</p><h3>Conclusion</h3><p>Database Management System is a collection of related data and a set of programs to access those data. The purpose of DBMS is to provide users with an abstract view of the data. Hence the system hides certain details of how the information is stored and maintained.</p><p>These are a few types of databases that explain the fundamental concepts. As mentioned earlier, clients tend to focus on creating databases that would suit their exclusive needs.</p><p>Thank you for reading! I will see you in the next article :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db91d6356d4" width="1" height="1" alt=""><hr><p><a href="https://interviewnoodle.com/beginners-guide-to-database-management-systems-db91d6356d4">Beginner’s Guide to Database Management Systems</a> was originally published in <a href="https://interviewnoodle.com/">InterviewNoodle</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Express will dominate the coming decade. Here’s why.]]></title>
            <link>https://javascript.plainenglish.io/express-will-dominate-the-coming-decade-heres-why-fef06ca89501?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fef06ca89501</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Sun, 22 Dec 2019 09:15:18 GMT</pubDate>
            <atom:updated>2019-12-22T15:18:40.328Z</atom:updated>
            <content:encoded><![CDATA[<h4>With the stable release completing its seventh month, Express.js comes from humble beginnings, and it will rise to challenge the kings of old.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*r1BTGwo9cd8IGNQQ.jpeg" /></figure><p>Express is a fast, unopinionated, minimalist web framework for Node.js. It is fast, robust and asynchronous. The initial release of the framework was at the start of the decade, and with the end of the 2010s, Express has released its first stable build.</p><h3>Why use Express?</h3><p>This may be oversimplifying it, but express is to node.js what bootstrap is for CSS and web design. Express is already, if not the most, but one of the most popular frameworks for NodeJS. Sometimes, it is almost synonymous with NodeJS. Here is why:</p><ul><li>Very fast I/O (Input Output): This is a cherry on the top with NodeJS.</li><li>Asynchronous</li><li>Easy to understand routes</li></ul><p>Below is a gist which shows how easy it is to set up a route in Express. Compare that to other frameworks, and you will see the difference.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9bca491f9559215198cf023fe6c4084d/href">https://medium.com/media/9bca491f9559215198cf023fe6c4084d/href</a></iframe><h3>Performance</h3><p>Express is definitely not the fastest framework out there. If speed is what you want, then go for fastify. Here is a blog which thoroughly compares express and fastify.</p><p><a href="https://medium.com/@onufrienkos/express-vs-fastify-performance-4dd5d73e08e2">Express vs Fastify performance</a></p><p>However, express is dead easy to use, understand and implement. We can employ different tactics to improve the performance of our application. The best practices for improving express performance includes:</p><ul><li>Use <a href="https://www.npmjs.com/package/compression">gzip</a>.</li><li>Avoid synchronous functions whenever possible.</li><li>Promises are a must for exception handling!</li><li>There is a very clever way to distribute the load. With the help of load balancers, we can run multiple instances. See <a href="http://nginx.org/en/docs/http/load_balancing.html">Nginx</a>.</li></ul><p>In addition to all of the above, <a href="https://expressjs.com/en/guide/migrating-4.html">Express 4</a> introduces some breaking changes to this framework. That means Express 2 and 3 apps will no longer work, and that’s a good thing! Express 4 has introduced a ton of major improvements in terms of routing, speed, and security.</p><p>One may ask, if there are faster frameworks available, then why learn the slower one? Isn’t fastify the superior candidate to express in terms of speed?</p><p>I may ask the same for Python. If C++ is the faster language, then why is Python so popular? The answer to both questions is the same. Express and Python, are very easy to use and are developer-friendly. In Python, “Hello World” is just:</p><pre>print(“Hello World!”)</pre><p>This is something that even a second grader could understand. While if you tell him about:</p><pre>cout&lt;&lt;“Hello World”&lt;&lt;endl;</pre><p>He will ask what is cout, what are those “arrow-ish” symbols and what not? The same goes for express. It is not the fastest framework, but it is the easiest one.</p><p>Express is not what you will call <em>slow. </em>It may not be as fast as fastify, but it is still very fast. Moreover, express with NodeJS can handle a load of many requests simultaneously, thanks to the non-blocking I/O streams.</p><p>We can employ the Cluster module to allow JavaScript to run in parallel on multiple CPUs. One can offload any CPU-intensive tasks to secondary servers via a message queue, a serverless function, or simply another API so that the Node service is just making a non-blocking request to a message queue, and the work is done in a blocking manner on a completely different server.</p><p>When Express was launched, it scratched that itch for a number of developers. It was the first framework with an intuitive route declaration and fixed a lot of past issues. Developers just flocked to this framework. However, express still has a lot to do, and a long way to go! In the end, all I can say is, Rome wasn’t built in a day. :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fef06ca89501" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/express-will-dominate-the-coming-decade-heres-why-fef06ca89501">Express will dominate the coming decade. Here’s why.</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top JavaScript Frameworks to learn in 2020]]></title>
            <link>https://javascript.plainenglish.io/top-javascript-frameworks-to-learn-in-2020-7ec198d05bfa?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ec198d05bfa</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Sat, 30 Nov 2019 09:24:03 GMT</pubDate>
            <atom:updated>2019-11-30T09:24:03.037Z</atom:updated>
            <content:encoded><![CDATA[<h4>As quick as it was here, 2019 is going away. Today I will be discussing the top JavaScript frameworks to learn in 2020 to take your game to a whole another level</h4><p>The programming scenario is ever-changing, and that is true for JavaScript as well. To survive in this cut-throat competition, step up your game with the <strong>big three</strong> of JavaScript mythology.</p><h3>Express:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*jukmvogCp9it7BUHdX9DUQ.png" /></figure><p><a href="https://expressjs.com/">Express</a> is a lightweight, minimalist framework for JavaScript. Most JavaScript developers prefer Node.js purely for its speed, and what’s a better way to compliment it than by using Express? Express can create your applications without any fuss and it does not have a steep learning curve either. Even though Express is unopinionated, you can get <a href="http://expressjs.com/en/starter/generator.html">express-generator</a> to get the balls rolling.</p><p>A big, big plus point of using express is databases. Since it is a minimalistic framework, express doesn’t really lean towards a particular database and hence, you can install either MySQL, MongoDB, Redis or whatever you want. All you need to do is install the driver with npm install and you are good to go!</p><p>Plus, I am a bit biased towards express. Since it was the first framework I ever learned, express holds a special place in my heart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Cez_TTVdqg-azgILcFPjw.png" /></figure><h3>React:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WA_9JsyqFkge2HwYKcdJQw.png" /></figure><p>React is another famous framework, based on “<a href="https://en.wikipedia.org/wiki/Reactive_programming">Reactive Programming</a>”. Of course, to master react, you will need to learn a lot of other technologies, such as Redux, MobX, Fluxy, Fluxible, or RefluxJS. React can also be used with jQuery AJAX, fetch API, Superagent, and Axios. React also introduced Suspense to improve the developer’s experience when handling asynchronous data fetching in React apps. In short, the new update to Suspense lets the component wait until a condition is met.</p><p>React also introduced objects, like state and props. With the state and props objects, you can simply pass data from a component to the layout or from a parent component to a child component.</p><p>React currently is one of the most popular frameworks out there, and it is normally the first choice.</p><h3>Meteor.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*NoL5KqhBHkxUyi_cWvvUlg.png" /></figure><p>Ok, I will go with an unconventional choice for my spot #3. Meteor is downright interesting framework once you really get into it. It has had its fair share of problems, yes, but so have other frameworks! Here is a fun blog I came across that I will recommend everyone to read.</p><p><a href="https://codeburst.io/why-i-chose-meteor-js-6bddab6d48f3">Why I chose Meteor JS</a></p><p>Meteor has over 40k stars on Github, which is no mean feat. It comes with a “constant testing tool” which undoubtedly improves efficiency of the coder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DX_B37-rYVHDkJ6cWXx0Ug.png" /><figcaption>Source: Google Trends</figcaption></figure><p>This is the graph of interest over time in meteor.js, some of the hype has died, yes, but it still stands proud! I will definitely recommend learning meteor.js, as it can be a really powerful framework.</p><p>These are not the only ones useful in 2020, but there are a ton of other frameworks as well, such as Koa, Vue, Angular etc. I compiled this small list purely based on my own opinion. I will sign off by saying what I always say.</p><blockquote>You don’t really need to stick religiously with a framework or a language. A good programmer adapts to the situation in front of him, and if it involves using a new technology to tackle it, he shall do so.</blockquote><p>I also did a Node.js vs Ruby comparison a couple of months back. You can check that out as well.</p><p><a href="https://medium.com/javascript-in-plain-english/is-ruby-still-relevant-in-2019-6ee3093909f9">Now that we have Node, is Ruby still relevant in 2019?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ec198d05bfa" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/top-javascript-frameworks-to-learn-in-2020-7ec198d05bfa">Top JavaScript Frameworks to learn in 2020</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain: Explained like you are five]]></title>
            <link>https://medium.com/swlh/blockchain-explained-like-you-are-five-28828e753d1a?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/28828e753d1a</guid>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Wed, 30 Oct 2019 01:04:18 GMT</pubDate>
            <atom:updated>2019-10-30T10:31:09.423Z</atom:updated>
            <content:encoded><![CDATA[<h4>The technology of the future is in our hands today.</h4><p>A blockchain is essentially an ever-growing list of records(called blocks) that are linked using cryptography. In simple terms, it is a ledger. As the name suggests, it is a series of blocks that are grouped or rather, “chained” together.</p><blockquote>I would like to clear a common misconception at the beginning itself. Blockchain is NOT A CRYPTOCURRENCY and it is definitely not bitcoin!!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yN05x38VgQ63tc_leeMVzQ.jpeg" /></figure><p>Let us clear it up here. Foremost, blockchain is a technology, and bitcoin has been the first to successfully implement it. It is simply, a ledger which can be programmed to record not just financial transactions, but virtually anything. What separates Blockchain from others is that it does not require a central authority for any sort of validation, making it faster than other models. Even though we can trace its origin to the 90s, blockchain’s popularity was boosted after the success of Bitcoin.</p><h3>How does Blockchain work?</h3><p>The blockchain can be divided into 4 major parts:</p><h4>Hash function:</h4><p>A hash function is a <a href="http://www.unit-conversion.info/texttools/md5/">program</a> that converts the input into a series of letters and numbers. The input can have any number of digits, however, the hash string will always have a fixed number of elements. Even the smallest change in this string creates a new hash. Now, in our ledger, each entry corresponds to a particular hash. Moreover, each hash entry is dependent on the previous hash.</p><h4>Nonce:</h4><p>In simple words, a <strong>Nonce </strong>is just like your <strong>O</strong>ne-<strong>T</strong>ime <strong>P</strong>assword or OTP. It is a single-use code in cryptography. A nonce is extremely difficult to forge. Let alone a human, even <a href="https://en.wikipedia.org/wiki/P_versus_NP_problem">computers cannot figure out the nonce</a> in a limited time frame.</p><h4>Nodes:</h4><p>As mentioned earlier, a blockchain system is lacking in a central authority. In such a case, we employ a number of “sub-systems” or nodes to do the task for us. Nodes are just computer systems each of whom maintains its own version of the spreadsheet or ledger. Consider the below example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*cwmemYNl1yV0d9rlyWAf1Q.png" /><figcaption>This is Person A, with 500 coins in his wallet.</figcaption></figure><p>Person A is friends with B and C. All three of them are really close friends and regularly borrow and lend coins among each other. Person A had lent 300 coins to person B a couple of weeks back, and he himself had taken 700 coins from person C. Now, C is short on money and asks for those 700 coins back, but our good guy here has only 500!! In this case, he decides to call up B to return his 300 coins so that he can pay C. B agrees to do so and transfers his 300 coins to A. After this, A immediately transfers 700 coins to C. Sounds simple, right?</p><p>Now here’s the real dilemma. The<a href="https://www.youtube.com/watch?v=Gfoc3Cxgnpk"> transfer of data takes time</a>, and we have our node servers all over the world, and there’s data loss as well! Suppose a particular node X in a remote corner of the world could not receive the data for the transaction that B did, but instead got the one with A and C. The node in question would think that something is wrong since A has only 500 coins with him and cannot give 700 and label poor A has fraud!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*UvWE1eRrZEKhrHwAsSWqdA.png" /><figcaption>He just wanted to return the money!!!!!</figcaption></figure><p>Transactions can get really messy due to their fast pace. Some nodes will take a particular transaction as valid, while others may think it is fraudulent. This is solved by voting on a particular transaction. For the sake of it, we will assume most nodes got the transaction by B first, and A’s name will be cleared!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*63Nk_sKeEkvUlfKUhT1o7A.png" /></figure><p>Of course, use of node also eliminates the possibility of a person manipulating the ledgers because the other nodes will vote on it and reject the change. Sorry guys, you cannot get infinite money just because you happen to have a node on your computer. To quote Emperor Palpatine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*o30fIryRHSiqvotYphTjQQ.gif" /></figure><h4>Block:</h4><p>The singular element of the blockchain is termed block. Transaction data is permanently recorded in files called <strong>blocks</strong>. They can be thought of as the individual pages of a city recorder’s recordbook (where changes to title to real estate are recorded) or a stock transaction ledger. Once a certain number of transactions have been recorded in a block, that block is archived and a new one is formed. Thus, it is impossible to manipulate it. You may still add data to it, but changing a previous data is just not possible.</p><h3>Where can we employ blockchain?</h3><p>Blockchain is already being used in bitcoin. It was the first successful actualisation of the technology, but the scope of blockchain is not limited to financial transactions. We can certainly find novel solutions to common problems faced by the people using blockchain. For instance:</p><p>In India, land disputes are really common. People use money and muscle power to manipulate the land owned by them, illegally encroaching on some else’s property. Or, the recordkeeper just makes a mistake while writing down some figures on the notebook. There are many more ways by which these records are changed and I would not like to go deeper into those. Back to the topic.</p><p>In a public blockchain like bitcoin, all participants are allowed to create or modify the blockchain, while in a private blockchain, like what has been envisioned for land records, only select participants are given that responsibility. New information is chained to the old entry, ensuring that a trail of changes to a record is established since its creation. There is no need for a central authority to keep records as they are distributed across a system of networked computer nodes. All participants can see and use the latest version of the record without relying on anyone else. In short, data stored using blockchain is secure, transparent, easy to access, and hard to dispute.</p><p>Our next problem is to transition legacy records. Before we even begin with the transfer, one must first ensure the starting data is absolutely correct and indisputable. A possible method of seeing this through is to start keeping records of the land owned by recognised authorities, such as state and central governments. Next step would be to include mortgaged land and systematically proceeding further ahead.</p><p>Real estate information is currently centralized and prone to manipulation between stakeholders. This increases the possibility of inefficient and potentially inaccurate sharing of information. A decentralized and open property market blockchain database where information is published by the public rather than a central body provides transparency around the validity of property data.</p><p>Insurance sector can also be hugely benefitted by this. Believe me when I say fraud is a huge issue here. When claims, payments and other documentation are recorded and stored in unchangeable ways, lots of fraud can be eliminated, with savings for both companies and consumers.</p><h3>Conclusion:</h3><p>To sum it up, blockchain is a technology which makes life for scammers and fraudsters difficult. With several nodes maintaining the same ledger, it is impossible to manipulate them all. Forgery of data is just not possible since everything is encrypted. The use of hashes and nonces are the cherry on the top. All-in-all, blockchain is going to make life easier for all of us. Eventually. :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28828e753d1a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/blockchain-explained-like-you-are-five-28828e753d1a">Blockchain: Explained like you are five</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How do self-driving cars “see”?]]></title>
            <link>https://medium.com/swlh/how-do-self-driving-cars-see-2e02dc23b51c?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e02dc23b51c</guid>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[lidar]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Wed, 23 Oct 2019 15:17:00 GMT</pubDate>
            <atom:updated>2019-10-25T09:09:26.236Z</atom:updated>
            <content:encoded><![CDATA[<h4>Take a look at how the LIDAR technology helps the self-driving cars to navigate through the obstacles.</h4><p>Imagine that a self-driving car winds down a narrow road. It is pitch black, windy and your typical horror movie scenario. All of a sudden, three obstacles appear on the road along with a jumpscare effect. What happens next?</p><h3>To successfully navigate through those, our car first needs to detect them</h3><p>Of course, without any human interference, a car would need its own “digital” eye to do the task so that its control algorithm can plot the safest course. This is made possible by a laser-based probing mechanism called <strong>LIDAR</strong> and as well as integrated photonics. In aviation, radar antennas launch “pulses” of radio or microwaves towards the plane to pinpoint their location by measuring the time it takes for the wave pulse to return. In the maritime industry, a similar technology called SONAR is used, which is based on the principle of echo. SONAR uses sound waves and due to their large wavelength, they can only be used for detecting large objects or for calculating the depth of the sea bed.</p><p>Radio/microwaves have a much smaller wavelength but even they cannot be used to visualize finer details on the road. In such a scenario, <strong>LIDAR </strong>offered us a very suitable solution in the form of laser, whose wavelength ranges in just nanometers. LIDAR system, which stands for Light Detection and Ranging, can visualize details as fine as the teeth of a smiling pedestrian.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*z_Hr4jtjlAzSKtL2rEnGZQ.jpeg" /><figcaption>Source: Google</figcaption></figure><p>LIDAR fires a chain of super-short laser pulses to give depth resolution. Suppose our obstacle #1 is a rabbit. As the car drives by, a pulse scatters off the base of the ears, while the next one may strike the tip before returning. By measuring how long the second pulse takes, we can calculate the shape of the obstacle. With a long series of such pulses, LIDAR quickly creates a miniature profile of the rabbit. However, with so many switch ONs and OFFs, the laser becomes unstable and it, in turn, affects the precise timing of the pulses which ultimately limit our depth resolution.</p><p>This is the part where integrated photonics come in. The laser beam is left on, and something is used to block it periodically. One way to create the pulses is to employ a really common phenomenon known as interference. Imagine throwing a stone in a pond or a lake to create ripples. Those ripples are nothing but a series of crests(ups) and troughs(downs). If you drop another stone at the exact same point, and at a time where there is no phase difference between the two sets of ripples, you will notice that the new ripples or pulses are larger than before. This is known as interference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhvAcqrpD9duTbi78J-zVA.png" /><figcaption>Source: Wikipedia</figcaption></figure><p>On the left, as there is no phase difference between the two waves, their amplitudes add up to create a much bigger wave. On the right, as there is a phase difference of 180°, the waves effectively cancel each other out. You can also understand this as “graphical arithmetic”, where you have one waveform, and the other modifies its change by pulling it upward/downward depending on the phase difference.</p><p>In self-driving cars, this is achieved by <a href="https://en.wikipedia.org/wiki/Mach%E2%80%93Zehnder_interferometer">Mach-Zehnder modulator</a>. Its working is somewhat similar to Quincke’s tube. The light is split along two parallel arms and eventually rejoined later. If the light is slowed down one of the arms, then it introduces a phase difference. By toggling this, the modulator effectively acts like an on/off switch. A light pulse lasting a hundred picoseconds gives us a depth resolution of a couple of centimetres.</p><p>Spoiler alert! That’s way better than our normal eye vision.</p><p>Instead of totally killing off the light, we can instead make the delay really less and the device will instead act as a dimmer than a switch. If these are stacked in parallel, then we can effectively get a steerable laser beam.</p><p>In the end, these “digital” eyes have the potential to see much better than our own eye, and more thoroughly than any of our instruments/inventions. They can help navigate any number of obstacles without anyone else experiencing a jumpscare, except for maybe one adorable rabbit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e02dc23b51c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/how-do-self-driving-cars-see-2e02dc23b51c">How do self-driving cars “see”?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Now that we have Node, is Ruby still relevant in 2019?]]></title>
            <link>https://javascript.plainenglish.io/is-ruby-still-relevant-in-2019-6ee3093909f9?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ee3093909f9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Sat, 28 Sep 2019 06:56:44 GMT</pubDate>
            <atom:updated>2019-10-15T03:58:54.467Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is Ruby still relevant in 2019?</h3><h4>If you asked this 10 years ago, the answer would definitely be yes. However, times are changing, and so is the development paradigm. After Node, web development has never been the same.</h4><p>Before we begin, we must first understand what is Ruby, what is Node, and what contrasts them.</p><p>Note: Some of the points were written keeping Rails in mind instead of Ruby. Thanks to the guys who pointed it out in the comments :-)</p><h3>What is Ruby?</h3><p>According to <a href="https://www.ruby-lang.org/en/">Ruby’s official website</a>, Ruby is “<em>a dynamic, open-source programming language with a focus on simplicity and productivity.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*k18dB6Z2APyoegU3LqlxFQ.jpeg" /></figure><p>Ruby is among the most popular programming and scripting languages around the world. It is used in a wide range of fields but is best known as a language for Web Applications. For the sake of it, I will be restricting the scope of this blog to Web Development. The general-purpose nature of Ruby makes it suitable for a wide array of programming tasks, just like Perl, Python and other general-purpose languages. However, Node has been getting all the attention as of late. Google trends show the following data for interest over time in Ruby:</p><figure><img alt="The graph is decreasing over-time." src="https://cdn-images-1.medium.com/max/1024/1*-GyoxzOUHDBmmca5thhb8w.png" /><figcaption>Visual representation of interest over time in Ruby.</figcaption></figure><p>There is a gradual decline in search trends over time, save the sudden spikes in the graph. As of August 2019, it scored 55. While on the other hand, Node is showing a significant rise in its popularity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IMoHF0lFDQngrOSrnhWyzA.png" /><figcaption>Visual representation of interest over time in Node.js</figcaption></figure><p>Node was launched about 10 years ago, and it boasts a proud 89 on Google trends. While Node is gaining popularity, Ruby, once a mammoth in this field, is declining. So what exactly makes Node.js so special that it can cause whole languages to become obsolete? For the sake of comparison, here is a graph which shows both Ruby(red) and Node(blue):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rDSEP77rLqY0V2u2Eftn-g.png" /><figcaption>Visual representation of interest over time in Ruby and Node. Former being red in colour.</figcaption></figure><h3>A glimpse at Node.js</h3><p>In short, <strong>Node.js is a runtime environment</strong>(and not a language) that allows you to execute server-side, which used to be essentially client-side, code. The “js” in Node.js stands for JavaScript. A scripting language that’s been in use on the client side since the late 90s.</p><h4>Node uses JavaScript</h4><p>JavaScript is the essence of front-end web development. With node, you can write it on the backend as well. If you write your code in only one language on both the front-end and server-side, you progress quicker. Due to this, it’s easy to line up with front-end techniques to make effective with less hassle. Your team can be smaller and more efficient while also delivering faster results.</p><p>Another advantage of Node is its “Scalability”. It means to increase the size of an application in terms of user’s interactions, data, workflows, and architecture. In simple words, an application has good scalability if it can maintain its performance while its volume of data or requests increase. That is, performance should hold steady for any individual user while the number of users increases. Node is more scalable as it has clusters with abstractions which can spawn processes based on the workload.</p><blockquote>The biggest advantage of Node over its counterparts is its speed. Partly thanks to its asynchronous programming, plus I/O (Input Output) which avoids blockages, Node maximizes the use of a single core. Effectively, Node.js can handle more requests at the same time, and by definition, the load of many web servers at the same time. Hence, we can achieve low latency and high throughput and make it lightweight and efficient.</blockquote><p>However, the one point where it loses to Ruby is CPU intensive tasks. The efficiency of Node in tasks like image processing, video playback etc. is questionable. This is simply because Node is single-threaded. Node.js is a great choice for web applications which call for small, frequent and simultaneous requests. There are workarounds, but they simply add to the development time and cost.</p><p>Since Node is open-source, it has a TON of <a href="https://www.npmjs.com/">libraries and frameworks</a>. There are a lot of good resources on npm which is the default package manager for Node. However, sometimes modules are low-quality and can be buggy. One framework I would definitely recommend every Node developer to learn is <a href="http://expressjs.com/">Express</a>. Express is a lightweight framework which gives our application more flexibility than others.</p><h3>Contrasting Ruby and Node:</h3><p>Ruby is opinionated, that is, it expects to do things in a certain way. It can be a disadvantage when it comes to debugging. While Node is unopinionated, and it provides more control over the workflow, there are no standard rules. This can be viewed as a disadvantage for newer developers.</p><p>Development time will definitely be faster in Ruby than in Node.js as in the latter we will need to write code, find modules, and integrate them. However, in Ruby, we can create a total CRUD (Create Read Update Destroy) application with ease. Since Ruby is an older language, it has a bigger and more active community and resources for learning. Node.js is relatively new, but the learning curve is not so steep.</p><p>Ruby needs to have a definite file/folder structure while on the other hand, Node.js is very flexible we can put entire code in a single file or in multiple files or directories. In Ruby, there are no callbacks i.e. all instructions are executed in a sequential manner whereas Node.js has callbacks and works in an asynchronous fashion.</p><h3>How to pick between Ruby and Node?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*FxQK854-zDYZM_0-Se9SFQ.jpeg" /><figcaption>Source: Google</figcaption></figure><p>It is clear that neither of these two is versatile and efficient in every situation and your choice should be dependent on what you are trying to achieve. Node.js is great for applications that are real-time i.e. constantly updating. This is because of its non-blocking I/O system. These kinds of applications include chatting applications, stock market trends, live sports commentary applications etc. Ruby, on the other hand, wins every single time you need high development speed and are performing CPU intensive tasks, such as anything graphical. This single thread can bottleneck all other processes and render the advantage of Node useless. To sum it up:</p><p>Both of these platforms are great. When you are to make a choice between the two platforms, the main points you should keep in mind are the development speed you require, and the server performance. Are you running lots of simple, concurrent requests through the application? Or more complex, CPU intensive requests? Go with Node.js for concurrency, and Ruby for CPU intensive applications.</p><p>The time today asks for speed, and hence Node.js is gaining popularity like never before. However, that does not necessarily make the purpose of Ruby void. As mentioned earlier, Node loses its usefulness during CPU intensive processes, hence it is imperative that we use something like Ruby for these kinds of task.</p><p><strong>TL;DR Choosing one over the other depends upon what needs to be get done.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ee3093909f9" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/is-ruby-still-relevant-in-2019-6ee3093909f9">Now that we have Node, is Ruby still relevant in 2019?</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do you really need jQuery?]]></title>
            <link>https://javascript.plainenglish.io/do-you-really-need-jquery-2bd0bbcf1b56?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bd0bbcf1b56</guid>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Sun, 15 Sep 2019 08:33:29 GMT</pubDate>
            <atom:updated>2019-09-15T08:35:04.287Z</atom:updated>
            <content:encoded><![CDATA[<h4>jQuery is great and by all means, use it if it makes your job writing code easier, but here’s why you might not need it as much as you think</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k9eIDARy3rAEuyGjlpaTqg.png" /><figcaption>jQuery is not the same as JavaScript</figcaption></figure><p>Front end web development is a rapidly expanding, never-ending phenomenon, and with regular updates, jQuery might have been finally out. Modern browsers already have implemented a large number of BOM/DOM APIs which are the new industry standard and can be used professionally.</p><h3>What is jQuery?</h3><p>jQuery is a JavaScript library which makes DOM manipulation and event handling easier. It was released in early 2006, and that was the time when the DOM API was not what you would call outstanding. With the advent of jQuery, web development was <strong>revolutionized</strong> because of an easy-to-use, simple, and understandable JavaScript library.</p><p>At one point, people did think that writing JavaScript without jQuery is a really painful task, and those two terms almost became synonymous, it is no longer relevant in the modern scenario. We must accept the fact that JavaScript is a language, while jQuery is an API. With newer and newer advancements in DOM/BOM APIs, we don’t have to learn jQuery from scratch for DOM manipulation or event handling.</p><p>In the meantime, thanks to the spread of frontend libraries such as React, Angular and Vue, manipulating the DOM directly becomes anti-pattern, so that jQuery usage has never been less important.</p><h3>Comparing jQuery and Vanilla JavaScript</h3><p>Below are some codes contrasting the difference between jQuery and Vanilla JavaScript.</p><h4>Finding Elements by ID</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc95318ad5b72ffa08e906d62c964aaa/href">https://medium.com/media/dc95318ad5b72ffa08e906d62c964aaa/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ced030b7f288711dc0444cda7a9ed17/href">https://medium.com/media/3ced030b7f288711dc0444cda7a9ed17/href</a></iframe><h4>Adding a Class</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc629bd695ee5acb284a2a63162c627b/href">https://medium.com/media/dc629bd695ee5acb284a2a63162c627b/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e67a846eb43eebedb6702b70c7ac6140/href">https://medium.com/media/e67a846eb43eebedb6702b70c7ac6140/href</a></iframe><h4>Query Selector</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/493bd92d373ef3882e691e957feb1218/href">https://medium.com/media/493bd92d373ef3882e691e957feb1218/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fda2aab10ad264b12eb25a4decb03009/href">https://medium.com/media/fda2aab10ad264b12eb25a4decb03009/href</a></iframe><h4>Position Relative To Viewport</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d2e98007a7224373d9e0f51b4c1b919/href">https://medium.com/media/5d2e98007a7224373d9e0f51b4c1b919/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d531007e5262769e3d9c960f23d9edab/href">https://medium.com/media/d531007e5262769e3d9c960f23d9edab/href</a></iframe><p><em>References are taken from </em><a href="http://youmightnotneedjquery.com/"><em>here</em></a><em>. There are many more examples you can find on the linked site.</em></p><p>From the above cases, you can see that whatever we want to do using jQuery, we can achieve with vanilla JavaScript as well and sometimes, in less number of lines.</p><blockquote><strong>Spoiler Alert!</strong></blockquote><blockquote>The vanilla JS selector is faster than the jQuery counter-part every time.</blockquote><h3>You might still want to use it</h3><p>jQuery is one of those tools that was almost a necessity when browsers were not standard, but the browsers, for the most part, have standardized on most APIs and are adding support much quicker than in the past. This is not to say jQuery still doesn’t have its place, but you should not default to using it for every project just because it is jQuery. For what it’s worth, jQuery can be really helpful in writing a complicated piece of code which can easily introduce bugs/errors if written in Vanilla. Example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bee748d1934e878af8b3173a59e9c729/href">https://medium.com/media/bee748d1934e878af8b3173a59e9c729/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0150fe023295da2a765ee0d7b476bd0b/href">https://medium.com/media/0150fe023295da2a765ee0d7b476bd0b/href</a></iframe><p>Both the above codes are for ready state. Even though the readyState property is relatively simple, it can be quite complicated for a newer developer.</p><blockquote>The readyState property returns the (loading) status of the current document.</blockquote><p>Another example is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79e2110533eb68d405b99353b467225d/href">https://medium.com/media/79e2110533eb68d405b99353b467225d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ee7056e4390f098beaaedee234a79b2/href">https://medium.com/media/9ee7056e4390f098beaaedee234a79b2/href</a></iframe><h3>Conclusion</h3><p>jQuery is a great JavaScript library. No doubt about it. However, saying that one cannot write JavaScript without learning jQuery, is downright wrong. When you need to write extremely long pieces of code, you are better off using jQuery, as it may offer a shorter solution. However, using jQuery every time you need to write a JavaScript code, is not really recommended. I have seen developers who add jQuery to their application without even starting anything.</p><p>Vanilla JavaScript is as much powerful as jQuery. Preferring one over the other depends on what needs to get done.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bd0bbcf1b56" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/do-you-really-need-jquery-2bd0bbcf1b56">Do you really need jQuery?</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Refactoring Code in JavaScript]]></title>
            <link>https://medium.com/swlh/refactoring-code-in-javascript-23802cae448b?source=rss-a20eff069f3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/23802cae448b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[refactoring]]></category>
            <dc:creator><![CDATA[Aditya Prakash]]></dc:creator>
            <pubDate>Sat, 07 Sep 2019 07:31:01 GMT</pubDate>
            <atom:updated>2019-09-15T19:02:19.903Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Tzu-li and Tzu-ssu were boasting about the size of their latest programs. ‘Two-hundred thousand lines,’ said Tzu-li, ‘not counting comments!’ Tzu-ssu responded, ‘Pssh, mine is almost a million lines already.’ Master Yuan-Ma said, ‘My best program has five hundred lines.’ Hearing this, Tzu-li and Tzu-ssu were enlightened.</blockquote><blockquote>— Master Yuan-Ma, The Book of Programming</blockquote><p>A large program is not necessarily a good program, and not just because of the time and effort, it takes to build. It also puts unnecessary load on the machine. Complexity ensues size, and bug ensues complexity. Plus, a large program also provides a lot of space to hide these bugs, making the much needed debugging process unnecessarily long and resource consuming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZA__tJ4qTgd-WafUhutv6w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@shemul?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shahadat Shemul</a> on <a href="https://unsplash.com/search/photos/function?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>For instance, let us take a simple piece of code for the sum of the first ‘<strong>n’ </strong>natural numbers.</p><p>Code 1:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/435011bbd2247fdc90d592efef5ef2b0/href">https://medium.com/media/435011bbd2247fdc90d592efef5ef2b0/href</a></iframe><p>Code 2:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3468e120831853b3899ee4d6e9c25a9/href">https://medium.com/media/b3468e120831853b3899ee4d6e9c25a9/href</a></iframe><p>While both these programs give us the sum of natural numbers the latter is much more simpler and easier to understand. Plus, it is only 1/7th of the first code.</p><p>In real-world applications, we won’t really be specifically writing the sum of first n natural numbers, but it will be something much more complex. This, in turn, increases the chances of encountering a bug which is something we do not want(obviously). Hence, it becomes imperative that we refactor our code, and cut down on unneeded bits and make our code <strong>DRY </strong>or <strong>D</strong>on’t <strong>R</strong>epeat <strong>Y</strong>ourself.</p><p>A dry code is a code which has minimum repetitions of a particular segment.</p><p>I happen to be a strong advocate of a dry code. It is shorter, simpler, and better than its counter-part <strong>WET </strong>code. Below is a WET code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1856c337fbee9615635d230d387ccf0/href">https://medium.com/media/d1856c337fbee9615635d230d387ccf0/href</a></iframe><p>Now, here is the refactored version of the same code to make it dry.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21462f518c97b4416673a6d011edde18/href">https://medium.com/media/21462f518c97b4416673a6d011edde18/href</a></iframe><p>We reduced the WET code to DRY code by refactoring it and got it down to 75% of its initial size! But, there’s a catch! See that line 17 in the second code? That can create some problems for us. While there are numerous advantages of having a DRY code, there are some disadvantages as well.</p><h3>Advantages of DRY Code</h3><ul><li>Maintainability: Since you already defined the logic that would do more stuff, when you need to update your code later, it would be easier to change the stuff in one logic, which then applies to every other applicable point.</li><li>Reusability: A logic can be re-used any number of times.</li><li>Resourceful: DRY coding approach saves you time and precious space.</li><li>Ease of Access: DRY code is easier to read, and saves your time during the crucial debugging process.</li></ul><p>However, drying your clothes(or anything for that matter) too much can cause them to burn!</p><h3>Disadvantages of DRY Code</h3><ul><li>Over-dried code may not be easier to read because you will have too many logical callings to follow and keep in place. This gets confusing once you have a really big application with hundreds of logic.</li><li>You may need to think a lot when you’re implementing DRY code, especially if you’re not that familiar with them. Keeping track of hundreds of logic can get ugly really fast.</li></ul><h3>Conclusion</h3><p>Despite its disadvantages, a DRY code is really desirable. WET code can get nasty pretty quickly. But, how should someone approach writing a DRY code?</p><p>My preferred method is to write a WET code first, then DRY it up. I like to hard code everything and then I refactor it, step by step. Once I get the basic skeleton up and running, only then do I work on more complex parts of it like looping through arrays instead of writing every single one etc. For me, having a code which actually works is more important than having a good looking code. Once I get it working, I can spend time making it look good.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23802cae448b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/refactoring-code-in-javascript-23802cae448b">Refactoring Code in JavaScript</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>