<?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 Sandini Pitawala on Medium]]></title>
        <description><![CDATA[Stories by Sandini Pitawala on Medium]]></description>
        <link>https://medium.com/@sandinipitawala1?source=rss-cf90a47f56a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5GWIuQ8SRLZnpQwXfC_j1A.jpeg</url>
            <title>Stories by Sandini Pitawala on Medium</title>
            <link>https://medium.com/@sandinipitawala1?source=rss-cf90a47f56a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 09 May 2026 07:46:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandinipitawala1/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[Understanding About DOCKER..]]></title>
            <link>https://sandinipitawala1.medium.com/understanding-about-docker-4904c03e61ba?source=rss-cf90a47f56a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4904c03e61ba</guid>
            <dc:creator><![CDATA[Sandini Pitawala]]></dc:creator>
            <pubDate>Tue, 18 May 2021 21:20:49 GMT</pubDate>
            <atom:updated>2021-05-18T21:35:33.542Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding about DOCKER..</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9B13VC-sJLpeHY-YAVULw.jpeg" /><figcaption>Docker logo</figcaption></figure><h3><strong>What is Docker?</strong></h3><p>Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.</p><h3>What can you use Docker for?</h3><p><strong>Fast, consistent delivery of your applications</strong></p><p>Docker streamlines the development lifecycle by allowing developers to work in standardized environments using local containers which provide your applications and services. Containers are great for continuous integration and continuous delivery (CI/CD) workflows.</p><p><strong>Responsive deployment and scaling</strong></p><p>Docker’s container-based platform allows for highly portable workloads. Docker containers can run on a developer’s local laptop, on physical or virtual machines in a data center, on cloud providers, or in a mixture of environments.</p><p>Docker’s portability and lightweight nature also make it easy to dynamically manage workloads, scaling up or tearing down applications and services as business needs dictate, in near real time.</p><p><strong>Running more workloads on the same hardware</strong></p><p>Docker is lightweight and fast. It provides a viable, cost-effective alternative to hypervisor-based virtual machines, so you can use more of your compute capacity to achieve your business goals. Docker is perfect for high density environments and for small and medium deployments where you need to do more with fewer resources.</p><h3>Docker architecture</h3><p>Docker uses a client-server architecture. The Docker <em>client</em> talks to the Docker <em>daemon</em>, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon <em>can</em> run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface. Another Docker client is Docker Compose, that lets you work with applications consisting of a set of containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-sFKJB6injCQZx48mf_2jg.png" /><figcaption>Docker Architecture</figcaption></figure><ol><li><strong>Docker Client</strong>: This is how you interact with your containers. Call it the user interface for Docker.</li><li><strong>Docker Objects</strong>: These are your main components of Docker: your containers and images. We mentioned already that containers are the placeholders for your software, and can be read and written to. Container images are read-only, and used to create new containers.</li><li><strong>Docker Daemon</strong>: A background process responsible for receiving commands and passing them to the containers via command line.</li><li><strong>Docker Registry</strong>: Commonly known as Docker Hub, this is where your container images are stored and retrieved.</li></ol><h3>Docker and security</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*zqJn0MHAPULYvgl_basVWA@2x.jpeg" /><figcaption>Docker Security</figcaption></figure><p>Docker brings security to applications running in a shared environment, but containers by themselves are not an alternative to taking proper security measures.</p><p>Dan Walsh, a computer security leader best known for his work on SELinux, gives his perspective on the importance of making sure Docker container are secure. He also provides a detailed breakdown of security features currently within Docker, and how they function.</p><h3>Docker objects</h3><p>When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woycc5Z9X7H6MOwsvUvYSQ.jpeg" /><figcaption>Docker Objects</figcaption></figure><h4>Images</h4><p>An <em>image</em> is a read-only template with instructions for creating a Docker container. Often, an image is <em>based on</em> another image, with some additional customization. For example, you may build an image which is based on the ubuntu image, but installs the Apache web server and your application, as well as the configuration details needed to make your application run.</p><p>You might create your own images or you might only use those created by others and published in a registry. To build your own image, you create a Dockerfile with a simple syntax for defining the steps needed to create the image and run it. Each instruction in a Dockerfile creates a layer in the image. When you change the Dockerfile and rebuild the image, only those layers which have changed are rebuilt. This is part of what makes images so lightweight, small, and fast, when compared to other virtualization technologies.</p><h4>Containers</h4><p>A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.</p><p>By default, a container is relatively well isolated from other containers and its host machine. You can control how isolated a container’s network, storage, or other underlying subsystems are from other containers or from the host machine.</p><p>A container is defined by its image as well as any configuration options you provide to it when you create or start it. When a container is removed, any changes to its state that are not stored in persistent storage disappear.</p><ul><li>Example: docker run” command</li></ul><p>The following command runs an ubuntu container, attaches interactively to your local command-line session, and runs /bin/bash.</p><pre>$ docker run -i -t ubuntu /bin/bash</pre><p>When you run this command, the following happens (assuming you are using the default registry configuration):</p><ol><li>If you do not have the ubuntu image locally, Docker pulls it from your configured registry, as though you had run “docker pull ubuntu” manually.</li><li>Docker creates a new container, as though you had run a “docker container create” command manually.</li><li>Docker allocates a read-write filesystem to the container, as its final layer. This allows a running container to create or modify files and directories in its local filesystem.</li><li>Docker creates a network interface to connect the container to the default network, since you did not specify any networking options. This includes assigning an IP address to the container. By default, containers can connect to external networks using the host machine’s network connection.</li><li>Docker starts the container and executes /bin/bash. Because the container is running interactively and attached to your terminal (due to the -i and -t flags), you can provide input using your keyboard while the output is logged to your terminal.</li><li>When you type exit to terminate the /bin/bash command, the container stops but is not removed. You can start it again or remove it.</li></ol><h3>Docker vs. Virtual Machine</h3><p>Depicted below is a diagrammatic representation of how an application looks when deployed on Docker and virtual machines</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFskhJdbawglTKBuKNeUxQ.jpeg" /><figcaption>Docker vs VMs</figcaption></figure><p>Differences between <strong>VMs vs Docker:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*yxjryiXnygTardix30NW0w.png" /><figcaption>VMs vs Docker Differences</figcaption></figure><h3>Advantages of Docker</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*4DFsU0uk3521vyZc7l7dFQ.jpeg" /><figcaption>Docker Advantages</figcaption></figure><ul><li>Multiple OS support (Debian, Fedora, Windows, RHEL).</li><li>Run applications anywhere without any concern on the tooling and dependencies.</li><li>Security (build with security regulations).</li><li>Support for CI/CD and ideal platform for microservices development.</li><li>Support in multiple cloud providers (ECS).</li><li>Support in multiple container orchestration.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4904c03e61ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React —  A JavaScript library for building user interfaces]]></title>
            <link>https://sandinipitawala1.medium.com/react-a-javascript-library-for-building-user-interfaces-6a8b063d8f4d?source=rss-cf90a47f56a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a8b063d8f4d</guid>
            <dc:creator><![CDATA[Sandini Pitawala]]></dc:creator>
            <pubDate>Wed, 05 May 2021 12:23:34 GMT</pubDate>
            <atom:updated>2021-05-18T21:39:35.858Z</atom:updated>
            <content:encoded><![CDATA[<h3>React — A JavaScript library for building user interfaces</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5PxGgx_aOWpTkul_D3nnbw.jpeg" /></figure><p>React.js is an open-source JavaScript library that is used for building user interfaces specifically for single-page applications.</p><p>React allows developers to create large web applications that can change data, without reloading the page.</p><p>The main purpose of React is to be fast, scalable, and simple.</p><h3>Based On Component</h3><p>Build encapsulated components that manage their own state, then compose them to make complex UIs.</p><p>Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.</p><h4><strong>If you’ve learned it, you can write it anywhere.</strong></h4><p>We don’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code.</p><p>React can also render on the server using Node and power mobile apps using <a href="https://reactnative.dev/">React Native</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*JnOs7oIx-P2fFaE0yCqtIw.jpeg" /></figure><h3><strong>A Simple Component</strong></h3><p>React components implement a <em>render()</em> method that takes input data and returns what to display.</p><p>This example uses an XML-like syntax called JSX. Input data that is passed into the component can be accessed by <em>render()</em> via <em>this.props</em></p><p>JSX is optional and not required to use React.</p><p>Try the <strong>Babel REPL</strong> to see the raw JavaScript code produced by the JSX compilation step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*07VQP70JJHyjfcNrnL4g3A.png" /></figure><blockquote>Output:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*66hYsvpzsVexW6IWfALztw.png" /></figure><h3>A Stateful Component</h3><p>In addition to taking input data (accessed via <em>this.props</em>), a component can maintain internal state data (accessed via<em> this.state</em>).</p><p>When a component’s state data changes, the rendered markup will be updated by re-invoking <em>render()</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*QWJzsk0Oul8b2rOE5O4cAQ.png" /></figure><blockquote>Output:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*YLSTLIcR-_d9qBlXSgjauw.gif" /></figure><h3>An Application</h3><p>Using props and state, we can put together a small Todo application.</p><p>This example uses state to track the current list of items as well as the text that the user has entered.</p><p>Although event handlers appear to be rendered inline, they will be collected and implemented using event delegation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*DlhnOGCBa7AIK0GrfMd3Jg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*wVJWIQvKQY8CkFMDoGepRw.png" /></figure><blockquote>Output:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*VKvgWh3g9aVOTa0376tKmw.gif" /></figure><h3>A Component Using External Plugins</h3><p>React allows you to interface with other libraries and frameworks.</p><p>This example uses remarkable, an external Markdown library, to convert the &lt;textarea&gt;’s value in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*09SGggEsaYZM87R2Qmgo1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*uChgCHKjH8V2Xb824ztsbw.png" /></figure><blockquote>Output:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*nf1JARiGY-OpD7x7FkDEEQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a8b063d8f4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Koa.js Framework: An Overview]]></title>
            <link>https://sandinipitawala1.medium.com/the-koa-js-framework-an-overview-a05a58a53d24?source=rss-cf90a47f56a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a05a58a53d24</guid>
            <dc:creator><![CDATA[Sandini Pitawala]]></dc:creator>
            <pubDate>Tue, 13 Apr 2021 09:13:48 GMT</pubDate>
            <atom:updated>2021-04-13T09:30:06.927Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Koa.js?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SEhpSaIh7-l1jV-yFgeDQ.jpeg" /></figure><blockquote>Koa.js is an open source Node.js web framework that was designed by the team behind express.</blockquote><blockquote>The framework strives to be a smaller, more expressive, and more stable foundation for web applications and APIs, according to their official website.</blockquote><blockquote>Koa makes use of asynchronous functions to help eliminate the need for callbacks and significantly improves error handling.</blockquote><blockquote>Koa does not bundle middlewares within its core.</blockquote><blockquote>It offers a refined set of methods for speeding up the process of making servers and makes it more exciting.</blockquote><h3><strong>Features of Koa.js</strong></h3><p>Koa.js has its own unique features that make it more expressive and developer-friendly, much like all other frameworks. Here are a few highlights of features in koa;-</p><ol><li>Koa.js is modern and future-proof — Unlike other Node.js frameworks, Koa.js is built using ES6, which simplifies the creation of complex applications by providing a bunch of new classes and modules. This helps developers in creating maintainable applications.</li><li>Koa.js makes use of ES6 generators to make synchronous programming easier and the flow of controls more fluid. These generators can also be used to manage the execution of code on the same stack as functions.</li><li>In comparison to other Node.js applications, Koa.js has a small footprint. This helps developers write thinner middlewares.</li><li>Koa.js has a built-in catchall for errors that help prevent website crashes.</li><li>Koa.js uses a context object which is an encapsulation of request and response objects.</li></ol><h3>Who uses Koa.js?</h3><p>For their websites and web APIs, many organizations use the Koa.js framework. The following is a list of five well-known organizations that use the Koa.js framework;-</p><ol><li>Paralect</li><li>Pubu</li><li>Bulb</li><li>GAPO</li><li>Clovis</li></ol><h3>Creating a server using Koa.js framework</h3><p>Let’s get practical and see how to use this new framework to create a simple server.</p><p>Create a new directory for your application first, then use the terminal to navigate to that directory of your app and run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*YMz1akDZgvxVCLGi3PsV5w.png" /></figure><p>(To create a Node.js package.)</p><p>Run to install Koa.js</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*psWE5gdYVhVXqic-0L3QpA.png" /></figure><p>After that, use your code editor to navigate to the index file in your app’s directory and write the code below to build the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*mWoZRqOqMiryJnpDfaeL0w.png" /></figure><p>Importing the koa module and calling its listen method is all that is needed to build the server. Run node ‘name of your index file’ on the terminal to launch the server.</p><h3>Creating routes using Koa.js</h3><p>Koa.js, unlike its predecessor Express, does not have routing as a default feature. Instead, it uses a middleware library Known as Koa Router. So, in order to implement routes in our api, we must first install the Koa router library running the snippet below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*Sy1xrh93MA-QkSeFXUJgFA.png" /></figure><p>Then, in your index file, import the Koa router module and add your desired routes. A code example of route formation using Koa.js is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*5RJAe5gtqizrUjUy6ikuHw.png" /></figure><p>Start the server again and test the route by sending a request from the browser.</p><h3>Handling Responses in Koa.js</h3><p>Koa response objects are embedded in its context object, as previously mentioned. This implies that the response object is accessed via the context object. To illustrate how to handle responses, let’s use a route definition like the one above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*VNijuSHl63PY4BOorlWJcQ.png" /></figure><h3>Handling errors in Koa.js</h3><p>Add an error middleware early in your index file to manage errors in Koa. Only errors identified after the middleware can be caught, so it must be defined early.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*fwQSqPoRwfwbecdzv1AcBA.png" /></figure><p>Let’s put this to the test by modifying the home route method throw an error when the route is called.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*dy4H0mXxxDNw4t2YubiU3A.png" /></figure><p>Now run the server again and call the endpoint using a browser.</p><h3>Pros &amp; Cons about Koa</h3><blockquote><strong>PROS</strong></blockquote><ul><li>Generator support from ground up Using generators (a bleeding edge feature, even for Node.js) would clean up your code from the mess caused by all those callbacks; making your code more manageable.</li><li>Development team has a proven track record</li><li>Koa is developed by the team behind a widely used node.js framework (express.js).</li><li>Extremely lightweight</li><li>Koa is very lightweight with just 550 lines of code.</li><li>sync/await keywords are supported and has transcended beyond generator functions</li><li>Generators functions are of course a huge plus, but at the time Koa team has transcended generations functions and shifted towards async/await style programming. It has made the Koa best framework available in the market.</li></ul><blockquote>CONS</blockquote><ul><li>Community is relatively small.</li><li>Not compatible with express style middleware.</li><li>Koa uses generators which are not compatible with any other type of Node.js framework middleware.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*1k2kUIuMvdtxsy07_F3aNg.png" /></figure><h3>Conclusion</h3><blockquote>So from this article, we learned about Koa.js, including what it is, its functionality, how to use it to build servers and it’s pros and cons. We’ve seen its unique syntax and some of its new features in action by building a simple server. Koa.js is a new Node.js framework that has been implemented by a number of well-known organizations around the world. Koa.js is a good choice for any web developer who wants to try out a new framework.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a05a58a53d24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting to know about Node.JS]]></title>
            <link>https://sandinipitawala1.medium.com/getting-to-know-about-node-js-4c2bc86b009f?source=rss-cf90a47f56a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c2bc86b009f</guid>
            <dc:creator><![CDATA[Sandini Pitawala]]></dc:creator>
            <pubDate>Sun, 21 Mar 2021 17:47:23 GMT</pubDate>
            <atom:updated>2021-03-21T17:47:23.649Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VOGG10_elQyWEert_a0N5w.png" /></figure><blockquote>Node.js was written initially by <a href="https://en.wikipedia.org/wiki/Ryan_Dahl">Ryan Dahl</a> in 2009.</blockquote><blockquote>It’s created with the aim of creating real-time websites with push capabilities (websockets).</blockquote><h3><strong>What is Node.js?</strong></h3><ul><li>Node.js is an open source server environment</li><li>Node.js is free</li><li>Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)</li><li>Node.js uses JavaScript on the server</li></ul><pre>Node.js = Runtime Environment + JavaScript Library</pre><h3><strong>Why Node.js?</strong></h3><p>Opening a file on the server and returning the content to the client is a typical activity for a web server. A file request is handled in PHP or ASP as follows:</p><ul><li>Sends the task to the computer’s file system.</li><li>Waits for the file system to open and read it.</li><li>Returns the content to the client.</li><li>Ready to take on the next task.</li></ul><p>A file request is handled in Node.js as follows:</p><ul><li>Sends the task to the computer’s file system.</li><li>Ready to take on the next task.</li><li>The server returns the content to the client after the file system has opened and read the file.</li><li>Node.js skips the waiting and instantly goes on to the next request.</li></ul><p>Node.js is a memory-efficient single-threaded, non-blocking, asynchronous programming language.</p><h3><strong>Features of Node.js</strong></h3><p>The following are some of the main features that make Node.js the software architect’s first choice.</p><ul><li>Asynchronous and Event Driven</li><li>Very Fast</li><li>Single Threaded but Highly Scalable</li><li>No Buffering</li><li>License</li></ul><h3><strong>Concepts</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*4F9qmoKIEgdTQMMFcc5IvQ.jpeg" /></figure><h3><strong>Where to use Node.js?</strong></h3><p>The places where Node.js is proving to be an excellent technology partner are as follows.</p><ul><li>I/O bound Applications</li><li>Data Streaming Applications</li><li>Data Intensive Real-time Applications (DIRT)</li><li>JSON APIs based Applications</li><li>Single Page Applications</li></ul><h3><strong>Where not to use Node.js?</strong></h3><p>Node.js is not recommended for CPU-intensive applications.</p><h3>What is a Node.js Loop?</h3><ul><li>Node.js files contain tasks that will be executed on certain events</li><li>A typical event is someone trying to access a port on the server</li><li>Node.js files must be initiated on the server before having any effect</li><li>Node.js files have extension “.js”</li></ul><h3>The Event Loop in Node.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHW2xj5jF5kPJev480m01Q.png" /><figcaption>Event Loop</figcaption></figure><blockquote>The<strong> Event loop</strong> is what allows Node.js to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible. Since most modern kernels are multi-threaded, they can handle multiple operations executing in the background.</blockquote><blockquote><strong>Phases of the Event Loop</strong></blockquote><p>The Event Loop consists of the six stages listed below, which are repeated as long as the application’s code needs to be executed:-</p><ol><li>Timers — Callbacks scheduled by setTimeout() or setInterval() are executed in this phase.</li><li>I/O Callbacks — I/O callbacks deferred to the next loop iteration are executed here.</li><li>Waiting / Preparation — Used internally only.</li><li>I/O Polling — Retrieves new I/O events.</li><li>setImmediate() callback — It invokes setIntermediate() callbacks.</li><li>Close events — It handles some close callbacks</li></ol><p>When Node.js starts executing your index.js file, or any other application entry point, the Event Loop begins. These six stages combine to form a tick, which is a cycle or loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*gVUYls3M3GjLJdKeyjGWsw.png" /></figure><p>The Event Loop itself executes some stages, but the main tasks for others are passed to the asynchronous C++ APIs</p><h3><strong>Advantages of using Node.js</strong></h3><ul><li>Open Source</li><li>Java Script language</li><li>Node js is fast</li><li>Asynchronous I/O</li><li>Active community support</li><li>Rest API</li><li>Caching Modules</li><li>Less Problems with Concurrency</li><li>Unit Testing</li><li>Streaming Data</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_FmZpJMTDdjRZ-L22fXPxw.jpeg" /></figure><h3>Disadvantages of using Node.js</h3><ul><li>Not effective with large scale applications</li><li>Inconsistent</li><li>Not suited for CPU-intensive tasks</li><li>Poorly supported to relational databases</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5uRTc_XgSpOsqU-USFLEMw.jpeg" /></figure><h3>Famous Apps Built on Node.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*HjqI2e9POPVa5i3Xh2JrCg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c2bc86b009f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About Version Control Systems]]></title>
            <link>https://sandinipitawala1.medium.com/about-version-control-systems-4b49657cea79?source=rss-cf90a47f56a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b49657cea79</guid>
            <dc:creator><![CDATA[Sandini Pitawala]]></dc:creator>
            <pubDate>Tue, 02 Mar 2021 06:38:09 GMT</pubDate>
            <atom:updated>2021-03-04T04:00:37.204Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Study About Version Control System(VCS)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*zGPVRW4LVB7MrnQpQuEF6A.png" /></figure><h4>What is “Version Control System”?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*pCZE9wS37YjZse-wkFm8Ag.jpeg" /></figure><blockquote>“Version control systems are a category of software tools that helps in records changes to a file or set of files over time so that you can recall specific versions later.”</blockquote><h4><strong>Why we use Version Control Systems?</strong></h4><p>As we all know, a software product is created collaboratively by a community of developers who may be based in various locations and each contributes to a particular collection of functionality/features.</p><p>As a result, they changed the source code in order to contribute to the product (either by adding or removing).A version control system is a type of software that helps the developer team in efficiently communicating and managing(tracking) all changes made to the source code, as well as details such as who made the change and what it was. A separate branch is created for every contributor who made the changes and the changes aren’t merged into the original source code unless all are analyzed as soon as the changes are green signalled they merged to the main source code. It not only keeps source code organized but also improves productivity by making the development process smooth.</p><blockquote>There are many benefits of using a version control system for our projects.</blockquote><p><strong>Benefits of Version Control System;-</strong></p><ul><li>Enhances the project development speed by providing efficient collaboration.</li><li>Version control systems allow you to compare files, identify differences, and merge the changes if needed prior to committing any code.</li><li>Versioning is also a great way to keep track of application builds by being able to identify which <strong>version</strong> is currently in development, QA, and production</li><li>Helps in recovery in case of any disaster or contingent situation.</li><li>Reduce possibilities of errors and conflicts meanwhile project development through traceability to every small change.</li><li>Leverages the productivity, expedite product delivery, and skills of the employees through better communication and assistance.</li><li>Through improved communication and assistance, increases employee productivity, expedites product delivery, and improves employee skills.</li></ul><p><strong>Use of Version Control System;-</strong></p><ul><li><strong>A repository:</strong> It can be thought of as a database of changes. It includes all of the project’s edits and historical versions (snapshots).</li><li><strong>Copy of Work (sometimes called as checkout):</strong>It’s a personal copy of all the project’s files. You can make changes to this copy without impacting other people’s work, and when you’re done, you can commit your changes to a repository.</li></ul><blockquote>There are three different Types of Version Control Systems.</blockquote><ol><li>Local Version Control Systems.</li><li>Centralized Version Control Systems.</li><li>Distributed Version Control Systems.</li></ol><p><strong>01. Local Version Control Systems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*li2AyYMqpet6L1Qn_g-vEw.png" /></figure><ul><li>It is one of the simplest forms and has a database that kept all the changes to files under revision control.</li><li>RCS is one of the most common VCS tools. It keeps patch sets (differences between files) in a special format on disk.</li><li>By adding up all the patches it can then re-create what any file looked like at any point in time.</li></ul><p><strong>02. Centralized Version Control Systems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*SDj9TdcYCPGuH7ZcB6SJbg.png" /></figure><ul><li>All changes to the files are tracked in this system by a centralized server.</li><li>The centralized server holds all versioned file information as well as a list of clients who check out data from that central location.</li></ul><p><em>Example: Tortoise SVN</em></p><p><strong>03. Distributed Version Control Systems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*f-ny70XGzgVDOcx6yNiZiA.png" /></figure><ul><li>The clients completely clone the repository including its full history.</li><li>If any server dies, any of the client repositories can be copied on to the server which help restore the server.</li><li>Every clone is considered as a full backup of all the data.</li></ul><p><em>Example: Git, Mercurial</em></p><h3>Popular Jargons Related To Version Control System:</h3><ol><li>Repository</li></ol><ul><li>Central location where all the files are being kept. Usually a directory with set of files.</li></ul><p>2. Trunk</p><ul><li>Also referred to as master branch. This is where the most stable code is being placed which is referred as the production code.</li></ul><p>3. Stage</p><ul><li>Mark files for tracking changes.</li></ul><p>4. Commit</p><ul><li>Create a snapshot of the changes being made to the files.</li></ul><p>5. Branch</p><ul><li>Copy of the master branch taken at a given point. All the feature developments and bug fixes will be done in a branch. Usually it is allowed to have multiple branches at the same time.</li></ul><p>6. Checkout</p><ul><li>Mark/unlock file for changing.</li></ul><p>7. Merge</p><ul><li>Combining branches together to update the master branch.</li></ul><p>8. Merge conflict</p><ul><li>Merge conflicts occur when merging a file which has been changed in two separate branches or places. Changes that interfere other changes.</li></ul><h3><strong>What is “Git”?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*Vbbgb1GWEFgbuO4vbaqcxg.jpeg" /></figure><p><em>“Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source.”</em></p><p>So regardless of whether you write code that only you will see, or work as part of a team, Git will be useful for you</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*Zk6GM_uDQAUbdYtHPpZjZw.png" /></figure><p><strong>Advantages:</strong></p><ul><li>Branching capabilities and merging are easy.(as they are cheap)</li><li>Good data integrity.</li><li>Free and open-source.</li><li>Add ons can be written in many languages.</li><li>Good and faster network performance.</li><li>Superior disk utilization.</li><li>Object model is very simple.</li><li>Minimizes push/pull data transfers.</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Requires technical excellence.</li><li>Slower on windows.</li><li>It lacks window support and doesn’t track empty folders.</li><li>GIT doesn’t support checking out sub-trees.</li><li>The process of Packing is very expensive completely.</li><li>Do not provide access control mechanisms.</li><li>Doesn’t support binary files.</li></ul><p><strong>Git Commands:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*CWANeDf5bCt4VuP6cSn5OQ.png" /></figure><ul><li>Git init</li><li>Git clone</li><li>Git add</li><li>Git stage</li><li>Git commit</li><li>Git push</li><li>Git pull</li></ul><blockquote>Software developers should have a rudimental understanding of what VCS is and which type of VCS suits them. The adoption of a VCS is a must in software development. It helps software developers manage their codes easily because it is common to have a lot of changes involving addition or deletion of features.</blockquote><blockquote>In order to adopt a VCS, a software developer must know and perfectly understand which approach should be used as it will affect the whole project and team. It is also important for them to have the knowledge of different approaches of VCS because the various approaches will affect their software development process differently.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b49657cea79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding The SOLID Principles….]]></title>
            <link>https://sandinipitawala1.medium.com/understanding-the-solid-principles-9f5db19d106c?source=rss-cf90a47f56a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f5db19d106c</guid>
            <dc:creator><![CDATA[Sandini Pitawala]]></dc:creator>
            <pubDate>Fri, 26 Feb 2021 23:08:12 GMT</pubDate>
            <atom:updated>2021-02-26T23:08:12.252Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*28UucLvh2_sCgAl9AJ8y_A.jpeg" /></figure><p>SOLID Principles is a coding standard that should provide a simple definition for all developers to properly build software to prevent bad design.</p><p>It was promoted by Robert C Martin and it is used throughout the continuum of object-oriented design. It makes the code more extensible, logical, and easier to read when implemented correctly.</p><p>How do we recognize rot as a potential code? Possibly, these signs suggest code rot to come:</p><ul><li>Rigidity — small changes causes the entire system to rebuild.</li><li>Fragility — changes to one module causes other unrelated modules to misbehave. Imagine a car system in which changing the radio station affects windows.</li><li>Immobility — a module’s internal components cannot be extracted and reused in new environments.</li></ul><h3><strong>The SOLID principles of Object Oriented Design include these five principles:</strong></h3><figure><img alt="Five Object Oriented Principles that should be followed when designing software" src="https://cdn-images-1.medium.com/max/874/1*TRtd90NFTxvmBsvc-xEYQg.png" /><figcaption>Five Object-Oriented Principles that should be followed when designing software</figcaption></figure><h3><strong>01. Single Responsibility Principle(SRP)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*z94eDuLTS44GlAsutbKbXg.jpeg" /></figure><p><em>“A class should have only one reason to change, and a class should have only one responsibility.”</em></p><p>Let’s look at this specific class. This class represent a simple book.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*BppGgdvjRhtQ-OwUl-jOHQ.png" /></figure><p>In here, we store name, author and text associated with an instance of a Book. Let’s add some methods for querying the text now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*Zrbcs-0imTZfd5XBmL0_Mw.png" /></figure><p>Imagine a scenario where we need to get output of the book details and add a print details methods in to a similar class. Isn’t it violate the principle of having single responsibility? indeed it violate. So what is the most ideal approach to get the output.</p><p>We should implement a different class that is concerned uniquely with printing details as demonstrated beneath.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*Ie7XGw8hrGmtPbAn0aQ_Lg.png" /></figure><h3>02. Open-Closed Principle(OCP)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*9bvd-paYxozrMRKQyFYwkw.jpeg" /></figure><p><em>“Objects or entities should be open for extension, but closed for modification”</em></p><p>Let’s further explore the idea with an example of a fast code. Assume that you have implement a guitar class as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*vdkmLmsuVLwXvcxE-iaX7A.png" /></figure><p>It works well and it’s loved by users. But you may think this needs to be updated after a few months to be even more appealing by adding a new pattern. It can cause errors that we didn’t expect if you just apply the new pattern to the same application. So the best method is to use our principle of open-closed and simply extend the guitar class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*MJhvNkTsbcRbQvsB54jt7A.png" /></figure><p>We can then be confident that nothing is going to happen to our current class.</p><h3>03. Liskov Substitution Principle(LSP)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*27fBcd3xxgvB5lu2qBOnpQ.jpeg" /></figure><p><em>“Every subclass/derived class should be able to substitute their parent/base class”</em></p><p>The most complex of the 5 principles is Liskov substitution. Simply put, if class A is a subtype of class B, then without disrupting our program’s actions, we should be able to substitute B with A.</p><p>So that is simply, Derived classes must be substitutable to their base classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*lhTz5fuq0v4AkfDxAtTkYA.png" /></figure><p>Above, we define a simple Car interface with a couple of methods that all cars should be able to fulfill — turning on the engine, and accelerating forward.</p><p>Now let’s implement our interface for a motorcar and provide some code for the methods:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*x6y9mo8q-_EQCVFXR97S_Q.png" /></figure><p>We are now having electrical vehicles also. We should perceive what will happen while implementing that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*QoRjq1T2w2H01J_PuIrSSg.png" /></figure><p>We are inherently altering the behavior of our software by throwing a car without an engine into the mix. This violates the Liskov Substitution principle and is a little more difficult to fix than our previous 2 principles.</p><p>One potential solution would be to rework our model into interfaces that take the engine-less condition of our car into account.</p><h3>04. Interface Segregation Principle(ISP)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*E-UljsiLHQrxTSoPxA3Kkg.jpeg" /></figure><p><em>“Clients should not be forced to implement methods they do not use”</em></p><p>Let’s begin with an interface that outlines our roles as a bear keeper,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*MRml5sRvcBc5YWXzJt4xzg.png" /></figure><p>As we know, petting bears is even more risky. We have no option here, according to the code, instead of integrating all three methods in the same implementation.</p><p>Let’s fix this by splitting our large interface into 3 separate ones,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*3yjyqpaPJcHaV6w5aCZjuw.png" /></figure><p>We can now introduce strategies that matter to us without any hesitation, thanks to interface segregation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*OjDHidVhj-yAoMfqgQgebg.png" /></figure><p>And then, we should leave the risky stuff to the crazy people,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*HDCyabnMUXHI5x4-kY-wVg.png" /></figure><h3>05. Dependency Inversion Principle(DIP)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*-ykK6RnSTkH-n0sSMqeUrA.jpeg" /></figure><p><em>“Higher level modules should not depend on lower level modules, but they should depend on abstractions.</em></p><p><em>Abstractions should not depend on details. Details should depend upon abstraction.”</em></p><p>Let’s understand the Dependency Inversion principle through an example,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*7pR82mxodCsptGzypLp5dg.png" /></figure><p>It is worth, if we have not keyboard and mouse to work on Windows. To solve this problem, we create a constructor of the class and add the instances of the keyboard and monitor. After adding the instances, the class looks like the following,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*Vtos5PWuqtcrNMwr_AqiIw.png" /></figure><p>Now we can work on the Windows machine with the help of a keyboard and mouse. But we still face the problem. Because we have tightly coupled the three classes together by using the new keyword. It is hard o test the class windows machine.</p><p>To make the code loosely coupled, we decouple the Windows98Machine from the keyboard by using the Keyboard interface and this keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*QVyuae1ydP_O28npjRpRbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*1cJWQz9458YHrhauVyhAnw.png" /></figure><p>In the above code, we have used the dependency injection to add the keyboard dependency in the Windows98Machine class. Therefore, we have decoupled the classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*AtafdrjeaBAdpvJmiqcB8w.png" /></figure><h3>Why should we use SOLID principles?</h3><ul><li>It reduces the dependencies so that a block of code can be changed without affecting the other code blocks.</li><li>The principles intended to make design easier, understandable.</li><li>By using the principles, the system is maintainable, testable, scalable, and reusable.</li><li>It avoids the bad design of the software.</li></ul><p><em>“Next time when you design software, keeps these five principles in mind. By applying these principles, the code will be much more clear, testable, and expendable.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f5db19d106c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>