<?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 S M Asad Rahman on Medium]]></title>
        <description><![CDATA[Stories by S M Asad Rahman on Medium]]></description>
        <link>https://medium.com/@asad.rahman?source=rss-3c37ef99f342------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*5XdUCNtkMv2hmvu8L0Z07A.jpeg</url>
            <title>Stories by S M Asad Rahman on Medium</title>
            <link>https://medium.com/@asad.rahman?source=rss-3c37ef99f342------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:41:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@asad.rahman/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[কিছু এলেবেলে কথা, বাবা ..]]></title>
            <link>https://medium.com/@asad.rahman/%E0%A6%95%E0%A6%BF%E0%A6%9B%E0%A7%81-%E0%A6%8F%E0%A6%B2%E0%A7%87%E0%A6%AC%E0%A7%87%E0%A6%B2%E0%A7%87-%E0%A6%95%E0%A6%A5%E0%A6%BE-%E0%A6%AC%E0%A6%BE%E0%A6%AC%E0%A6%BE-83c1d29d97bc?source=rss-3c37ef99f342------2</link>
            <guid isPermaLink="false">https://medium.com/p/83c1d29d97bc</guid>
            <category><![CDATA[বাবা-মা]]></category>
            <category><![CDATA[বাংলা]]></category>
            <category><![CDATA[এলেবেলে]]></category>
            <dc:creator><![CDATA[S M Asad Rahman]]></dc:creator>
            <pubDate>Sun, 01 Mar 2020 09:53:17 GMT</pubDate>
            <atom:updated>2020-03-01T10:12:31.034Z</atom:updated>
            <content:encoded><![CDATA[<h3>কিছু এলেবেলে কথা, বাবা ..</h3><p>বাবা তোমাকে খুব ভালোবাসি ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YND4xExtW1uJFzPhaBn0Aw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@keagankharris?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Keagan harris</a> on <a href="https://unsplash.com/s/photos/oldeasy-chair?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>আমাদের টুনি ..</h4><p>আমার ভাইয়ের বাসায় ১০/১১ বছরের ফুটফুটে লক্ষী একটা মেয়ে কাজ করে, নাম টুনি। টুনির বাড়ী রংপুর। অভাবী পরিবারে বাবার ঋণ শোধ করতে ঢাকায় এসে কাজ করছে টুনি। ওর জন্য আলহামদুলিল্লাহ ভাইয়ার বাসায় এক মহিলাকে রাখা হয়েছে কোরআন শেখানোর জন্য। টুনি, সারাদিনের সব কাজ হাসি মুখে করে সন্ধ্যার সেই মহিলার কাছে কোরআন শিখতে বসে। টুনিকে সেদিন দেখলাম বুকে কোরআন জড়িয়ে পড়তে যাচ্ছে। মাশাআল্লাহ! এই ছোট্ট বয়সেই টুনি তার বাবা মায়ের জন্য কতো বড়ো স্যাকরিফাইস হাসি মুখে করে যাচ্ছে। টুনির চোখে একরাশ স্বপ্ন — একদিন সে তার বাবার ঋণ শোধ করে রংপুরের নিজ গ্রামে ফিরে যাবে।</p><h4>আমার কথা ..</h4><p>আমার আব্বু একসময় খুব কড়া বাপ ছিলেন। ছোটবেলায় লোড শেডিং শুরু হলেই সবাই যখন হই হই করে উঠত খুশিতে, তখন আব্বুকে আমার নামতা পড়ে শোনাতে হতো। যতক্ষন কারেন্ট না আসতো, অন্ধকারে নামতার পারদ সংখ্যা ততো বারতে থাকতো। ২৭ এর নামতা কিম্বা ৩৯ এর নামতা কোন বাপের ব্যাটার পক্ষে মুখস্ত করা সম্ভব না। কুইক সংখ্যাটাকে ভেংগে ছোট ছোট গুনফল গুলো মনে মনে যোগ বিয়োগ করে কাজ চালাতে হতো। যেমন ৩৯ * ৯ = ৩৯ * ১০ — ৩৯ = ৩৯০ — (৪০ — ১) = ৩৯০ — ৪০ + ১ = ৩৫১। আমি মনে মনে হিসাব করে কাজ চালাতাম, আব্বু নিশ্চয়ই বুঝত, কিছু বলত না। আরেকটা প্যারা ছিলো ট্রান্সেলেশান। অংকে আটকাতে পারবে না বলে আব্বু ইংরেজিতে প্যারা দিত, আমি ইংরেজিতে আজ অব্দি ভীষন কাচা। তাই ঝাড়ি খেতে হতো — কিছুই করার ছিলো না।</p><p>আমার সেই রাগি রাগি কড়া আব্বুটা চাকরির শেষ জীবনে অনেক নরম হয়ে গিয়েছিলো। ভাইয়া তখন ঢাকায় ভার্সিটিতে পড়ে, যশোরের বাসায় আদর নেওয়ার জন্য আমি ছাড়া কেউ নাই। সারাক্ষন পড়তে বসতে বলা আমার আব্বুই তখন আমাকে ডেকে ডেকে খেলা দেখতে বসাতো। কোন খেলোয়ার ঘুষ খেয়েছে, আরেকটু দৌড়ালেই চারটা আটকানো যেতো, আরেকটু জোরে বল করলে টেনডুলকারকে আউট করে দেওয়া যেতো — আব্বুর এসব এক্সপার্ট কমেন্ট শোনানোর জন্য তখন হাতের কাছে আমি ছাড়া কেউ নাই। আব্বুর সাথে সেই সময় আমার একটা অদ্ভুত বন্ধুত্ব্য গড়ে উঠে। আমরা দুজনই জানি আমরা বন্ধু, কিন্তু বাপ — ছেলের কপট একটা মুখোশ পড়ে থাকি। আমি তখন যা ইচ্ছা আব্বুর কাছে চাইতে পারি, আমার বন্ধুরা যখন তখন আমার বাসায় আসে, আব্বু বিকেল বেলা বাসার গাড়ী বারান্দায় ইজি চেয়ারে চা নিয়ে বসে, আমি বন্ধুদের নিয়ে হই হুল্লোর করে ক্রিকেট খেলি, বিন্দাস সেই জীবন।</p><h4>শেষ বেলা ..</h4><p>আমার আব্বু চাকরিতে আবসরে যান ২০০৭ এ, এর পরপরই লিভার সিরোসিসে বিছানায় পড়ে ২০০৮ এ মারা যান। আমার চাকরির শুরুও ২০০৭ এ। বেতন তেমন খুব অল্প কিছু পাই। নতুন চাকরিতে অনেক কিছু শিখতে হয়। সন্ধ্যার পড়ে আব্বুকে হাসপাতালে দেখতে যাই। আবার রাতে এসে টুকটাক কম্পিউটারে বসতে হয়। একসময় ডাক্তার জানিয়ে দিলো আব্বু আর মাস ছয়েক বাচবে। আম্মুকে জানানো হয় নাই তখনো, আমরা দুই ভাই শুধু জানি। রোজা চলছে । স্বভাবতই আমাদের বাসায় তেমন কোন ঈদের প্রস্তুতি বা কেনা কাটা নাই। খুব সম্ভবত ২৯ রোজার ইফতারি করছিলাম। ঈদের চাদ দেখা গেলে পরদিন ঈদ হবে। কিন্তু চাদ দেখা গেলো না, আমাদের হঠাত করেই মনে হলো এই সুযোগ। আমাদের মন খারাপ না করে বরং এবারের ঈদটাই হই হুল্লোর করে পালন করা দরকার। কারন এটাই আব্বুর সাথে আমাদের শেষ রোজার ঈদ! আব্বু বিছানায় শুয়ে ছিলো। আব্বুকে হাসতে হাসতে বললাম — আব্বু বেশি করে টাকা দাও তো — এটাই তোমার ছেলেকে শেষবারের মতন দিচ্ছো। এরপর আমার বেতন এতো বেড়ে যাবে যে শুধু আমি তোমাকে দিবো — তুমি আর আমাকে দিতে পারবে না। আব্বু কিছু বুঝলো কিনা কে জানে … আব্বু শুয়ে শুয়েই বাসায় সবার কেনা কাটার জন্য বাজেট দিয়ে দিলো। দুই ভাই রাত ৮ বের হলাম ঈদের শপিং করতে। সবার জন্য কেনাকাটা করা হলো। আব্বুর জন্য যত্ন করে ফতুয়া, সাদা লুংগি, আর চামড়ার স্যান্ডেল কিনলাম। আব্বুর সবকিছুর দাম সেবার আমি দিয়েছিলাম। ভাইয়া আব্বু আম্মুকে কতো কিছুই তো কিনে দিয়েছে — আমার তো কোন কিছুই দেওয়া হয় নাই। আমি আমার প্রিয় বন্ধু আব্বুটার জন্য জীবনে প্রথম আর শেষবারের জন্য নিজের টাকায় কিছু কিনলাম।</p><p>পরদিন সকালে দুইভাই ঈদের নামাজে গেলাম, প্রথমবারের মতন আব্বুকে ছাড়া। নামাজ পড়ে সবার আগে গেলাম আব্বুর ঘরে। আম্মু আব্বুকে গোসল করিয়ে আমাদের কেনা লুংগি আর ফতুয়া পড়িয়ে শুইয়ে রেখেছেন, আব্বুর বিছানায়ই সেমাই খেলাম। আহ! কতো না আনন্দের সেই ঈদ।।</p><h4>শেষ চুমু ..</h4><p>এর ২ মাস পর কোরবানি ঈদের দিন বিকালে আব্বু বিছানায় পড়ে গেলেন। আর মাস তিনেক বিছানায় ভূগে মারা গেলেন ফেব্রুয়ারির ১২ তারিখ সকালে। আমরা ফ্যামিলির সবাই আব্বুর পাশে বসে ছিলাম। আব্বুর শরীরটা আস্তে আস্তে অসার হয়ে আসছিলো। চোখগুলো ঘোলাটে — যেন আমাদের না অন্য কিছু দেখছে। আব্বুর নি:স্বাস তখনো আস্তে আস্তে চলছে। সেই সময় শেষবারের মতন আব্বুর কপালে একটা চুমু দিয়েছিলাম। আব্বুকে দেওয়া আমার শেষ চুমু।</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NM8utHAVLJBGtwYGupvQNA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@garciasaldana_?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Pablo García Saldaña</a> on <a href="https://unsplash.com/s/photos/dead-tree?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>আজ ১১ বছর পরে, আমি নিজে যখন ৩ বাচ্চার বাপ — এখন বুঝি একটা সন্তান তার বাবাকে কতোই না আনন্দ দিতে পারে। ছোট খাট খুনশুটি, আব্দার, এমনকি বাচ্চাদের জেদও বাবার বুকে কতো আনন্দই না দেয়। মায়েরা তো কেদে কেটে আহলাদ করে তাদের ভালোবাসা ঠিকই বুঝিয়ে দিতে পারে। কিন্তু বাবারা রোবটের খোলস পরে মনে মনে অপেক্ষা করে বাচ্চা আদর, ভালোবাসা আর জেদ মেটানোর জন্য। আমার ছোট ছেলেটা হয়েছে বেশি মা ন্যাওটা। আমি জড়িয়ে ধরলেই কেদে কেটে মায়ের কাছে চলে যায়। কিন্তু আমিও হাল ছাড়ি না, জোর করে ওকে কাদিয়েও বেশি করে আদর করতে থাকি। আফসোস রাখতে চাই না — কে জানে কয়দিন বাচি …</p><h4>শেষ কথা</h4><p>কেন যেন — বেচে থাকতে খুব কম ছেলেই বাবাদের ভালোবাসা বুঝতে পারে। বরং শেষ জীবনে বাবাদের সহ্য করতে হয় সবচেয়ে রুক্ষ ব্যাবহার। শেষ বয়সের বাবা হলো সেই ক্যারেক্টার — যার জীবনের সব ডিসিশান খারাপ, শুধু বাবার ব্যাংকে জমানো পেনশানটাই ভালো। বাবারা কেন যে কিচ্ছু বোঝে না, কিন্তু ছেলে ঠিকই বুঝে বাবার তিলেতিলে গড়া জমিগুলোর বিক্রয় মূল্য। তাই বাবার জমি বেচে, পেনশন বেচে ছেলেরা ফ্ল্যাট কিনে, কিন্তু সেই ফ্ল্যাটে জায়গা হয়না খ্যাত আনকালচারড বাবা মায়ের। আফসোস।</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aPG7gVqg5Fqdoq6iA-7Clw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ahmed72559?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ahmed Nasr</a> on <a href="https://unsplash.com/s/photos/dead-tree?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>আমি বাবাকে হারিয়েছি সেই কবে। আজোও খুব মিসকরি। আজ বাবা বেচে থাকলে মাশরাফির অবসর এ যাওয়া নিয়ে খুব একটা জম্পেস আড্ডা দেয়া যেতো।</p><p>আপনার বাবা যদি আজো বেচে থাকেন তাহলে আপনি লাকি। বাবার পাশে বসে গল্প করুন। নিজের মনের কথা, নিজের বিপদের কথা, নিজের না বলা ভালোবাসার কথা বাবাকে বলুন। মানুষটা অনেকদিন ধরে হয়ত অপেক্ষায় আছে — আপনি এই বুড়ো বয়সে একটা জোর করে চুমু দিয়ে দিবেন তার কপালে। বাবা লজ্জা পেয়ে যাবে। বাবাকে জম্পেস করে জড়িয়ে ধরে বলুন — <strong>বাবা তুমি/আমি যে কেউ যেকোন সময় হয়ত মারা যাবো — কিন্তু মরে যাওয়ার আগে তুমি একটা কথা যেনে যেও — বাবা তোমাকে খুব ভালোবাসি।</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83c1d29d97bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Element: How to use Angular components in React Vue Js ?]]></title>
            <link>https://medium.com/monstar-lab-bangladesh-engineering/angular-element-how-to-use-angular-components-in-react-vue-js-93757c92357b?source=rss-3c37ef99f342------2</link>
            <guid isPermaLink="false">https://medium.com/p/93757c92357b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[micro-frontends]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[S M Asad Rahman]]></dc:creator>
            <pubDate>Mon, 04 Nov 2019 07:03:49 GMT</pubDate>
            <atom:updated>2019-11-12T16:01:33.042Z</atom:updated>
            <content:encoded><![CDATA[<h3>Angular Element: Use Angular components outside the Angular</h3><figure><img alt="Photo by Esteban Lopez on Unsplash" src="https://cdn-images-1.medium.com/max/1024/1*B2vxcoeYcFr7dGnXp8loSA.jpeg" /></figure><h3>Teaser:</h3><p>We all are familiar with <em>components:</em> the most powerful building block in the Angular ecosystem. Components are where the Dom gets rendered, services get injected, views get re-rendered with change detection. Components can take values as inputs and trigger events as outputs. But the problem is, this beautiful block so far works only inside an Angular ecosystem. <strong>I wish we could help humanity by using angular components even outside the angular ecosystem.</strong></p><p><strong>Yes! From Angular 7, Angular brings the feature “Angular Element”. Now an angular component can be exported as a standalone web component. We can use it exactly like a typical HTML tag like div or span, in any HTML page, CMS or even inside a React or Vue.js project.</strong></p><h3>How it works:</h3><figure><img alt="photo: https://angular.io/guide/elements" src="https://cdn-images-1.medium.com/max/600/1*wI2wCqw0DIRvTzWqs2lDeQ.png" /></figure><p>Web Component is a web standard to define a new custom HTML element in the browser. Browsers maintain a registry called <a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry"><em>customElementRegistry</em></a> . Using the method <a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define">CustomElementRegistry.define()</a> we can register a “dom string” and a class that defines its behavior.</p><p>Angular’s <a href="https://angular.io/guide/elements">@angular/elements</a> package exposes the method <a href="https://angular.io/api/elements/createCustomElement">createCustomElement</a> which converts angular component and its dependencies as a class compatible as a web component.</p><p>Currently, web standard is supported by All Chrome, Firefox, Safari and Opera browsers. We can also make it workable in other browsers using polyfills.</p><h3>Use Cases:</h3><p>There are at least 3 use cases where we can make use of exportable fully functional angular components as web components:</p><ul><li>Micro front end</li><li>Legacy code migration</li><li>Plug &amp; play web components for third-party services</li></ul><h4>Micro front end:</h4><p>Like micro-service, there is another similar concept called micro-frontend. In a micro-frontend architecture, a small full-stack team is responsible to deliver not only the APIs but also their corresponding front-end components. For example, the “product team” will create product APIs and all product-related views used in different category pages, product detail page, cart &amp; checkout page. In a case like this, all team will provide different web components and one front end team will only glue those components together in different pages.</p><h4>Migration:</h4><p>Projects written in Angular 1.x, Migration to Angular always has been a challenge. There is no easy magic spell-like <strong>ng update</strong>. The same is true for a case where someone wants to migrate their project to Angular from React or Vue. Web components is the best fit here. They can gradually convert their existing components/controllers to Angular web components and replace them from the existing system. Once all components/controllers are converted they can just replace the legacy system with the latest angular.</p><h4>Third-party services:</h4><p>Service providers can provide plug &amp; play web components to be glued in their client’s website without any further engineering needed.</p><p>So seems it is promising if we can actually ship an angular component as a web component. So let’s make our hands dirty with the actual coding.</p><h3>Example project:</h3><p>Here is an example code we write a <em>my-todo-list</em> web component. <strong>FYI you can check the entire code here in </strong><a href="https://github.com/asad-mlbd/example-ng-element"><strong>Github</strong></a><strong>.</strong></p><h4>Step 1: Write the component and service</h4><ul><li>A TodoList component to show a list of todos.</li><li>A TodoService to fetch todo’s from placeholder JSON API.</li><li>The TodoList component will take “name” as input.</li><li>TodoList component will trigger the onTodoComplete event when any todo will be marked as done.</li></ul><figure><img alt="todo-list.component.ts" src="https://cdn-images-1.medium.com/max/1024/1*xKrZU3K8G-wxmWVP6QWEEA.png" /><figcaption><a href="https://github.com/asad-mlbd/example-ng-element/blob/master/src/app/todo-list/todo-list.component.ts">https://github.com/asad-mlbd/example-ng-element/blob/master/src/app/todo-list/todo-list.component.ts</a></figcaption></figure><figure><img alt="todo.service.ts" src="https://cdn-images-1.medium.com/max/1024/1*Ic8Q-hLSkD10AQb8WmRPYQ.png" /><figcaption><a href="https://github.com/asad-mlbd/example-ng-element/blob/master/src/app/todo-list/todo.service.ts">https://github.com/asad-mlbd/example-ng-element/blob/master/src/app/todo-list/todo.service.ts</a></figcaption></figure><h4>Step 2: Tweak app.modules to export todo-list component</h4><ul><li>Since the project will be used only to export angular modules as a web component we do not need bootstrapping through the app component.</li><li>We have to declare our exportable todo-list component as entry components.</li><li>Install @angular/elements package.</li><li>Inside <strong>ngDoBootstrap </strong>hook we use <strong>createCustomElement </strong>method<strong> </strong>to compile our TodoList component as a standard web component.</li><li>TodoList component has dependency on TodoService. Since it will be used outside the angular ecosystem, we need to pass the Dependency Injector manually so that it can load dependencies.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnKdMCe7rB9YMHtMJLz7ng.png" /><figcaption><a href="https://github.com/asad-mlbd/example-ng-element/blob/master/src/app/app.module.ts">https://github.com/asad-mlbd/example-ng-element/blob/master/src/app/app.module.ts</a></figcaption></figure><p><strong>Step 3: Bundling</strong></p><ul><li>Now if we run build — files will be generated in “dist” folder. Since we want to use this in another ecosystem better to concat the files as one output file. So add these commands in package.json script section:-</li></ul><pre><br>&quot;concat-es5&quot;: &quot;concat -o output/output-es5.js ./dist/example-ng-element/runtime-es5.js ./dist/example-ng-element/polyfills-es5.js ./dist/example-ng-element/scripts.js ./dist/example-ng-element/main-es5.js&quot;,</pre><pre>&quot;concat-es2015&quot;: &quot;concat -o output/output-es2015.js ./dist/example-ng-element/runtime-es2015.js ./dist/example-ng-element/polyfills-es2015.js ./dist/example-ng-element/scripts.js ./dist/example-ng-element/main-es2015.js&quot;,</pre><pre>&quot;concat&quot;: &quot;npm run concat-es5 &amp;&amp; npm run concat-es2015&quot;,</pre><pre>&quot;build&quot;: &quot;ng build --prod --output-hashing=none &amp;&amp; npm run concat&quot;,</pre><ul><li>Now if we run the command <strong>npm run build </strong>two separate files <strong>output-es5.js</strong> and <strong>output-es2015.js</strong> will be generated inside the <strong>output </strong>folder<strong>.</strong></li></ul><h4>Step 4: Use as a web component</h4><ul><li>Now all is set. We can use these output files as our standalone web component like this:-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VyBH5rpD0JsZACDMRO7MQQ.png" /><figcaption><a href="https://github.com/asad-mlbd/example-ng-element/blob/master/output/index.html">https://github.com/asad-mlbd/example-ng-element/blob/master/output/index.html</a></figcaption></figure><ul><li>If we run this HTML page, we can see the todo list will be fetched and showed.</li><li>We passed the name as input, we can see the name inside the web component — which means component’s input, change detection are working!</li><li>Once we check/uncheck any todo, event-triggered and todo data will be logged in the console. So the output event is working as well!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMOiQaHUvESmJI_xVwo6NQ.png" /></figure><p>So, like this, we can use an angular component in any other project. You can try yourself cloning the code from <a href="https://github.com/asad-mlbd/example-ng-element"><strong>Github</strong></a><strong>.</strong></p><p>Ref:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements">https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry">https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry</a></li><li><a href="https://angular.io/guide/elements">https://angular.io/guide/elements</a></li></ul><p>Feel free to make your comment here or catch me on twitter <a href="https://twitter.com/asad_rahman">@asad_rahman</a>.</p><p>Visit our website to learn more about us:<br><a href="http://www.monstar-lab.co.bd/">www.monstar-lab.co.bd</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93757c92357b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/monstar-lab-bangladesh-engineering/angular-element-how-to-use-angular-components-in-react-vue-js-93757c92357b">Angular Element: How to use Angular components in React Vue Js ?</a> was originally published in <a href="https://medium.com/monstar-lab-bangladesh-engineering">Monstar Lab Bangladesh Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I choose NestJS over other Node JS frameworks]]></title>
            <link>https://medium.com/monstar-lab-bangladesh-engineering/why-i-choose-nestjs-over-other-node-js-frameworks-6cdbd083ae67?source=rss-3c37ef99f342------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cdbd083ae67</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[S M Asad Rahman]]></dc:creator>
            <pubDate>Tue, 20 Aug 2019 06:34:22 GMT</pubDate>
            <atom:updated>2019-11-10T09:32:13.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKyL1ChtVVL3VlYRmO0ncA.jpeg" /></figure><p>I am a big fan of <a href="https://nodejs.org/en/">NodeJS</a> for its thin simplistic approach. I have been using Node.js since 2011–12 and <a href="https://expressjs.com/">Express</a> has been my default framework of choice for quick prototyping or writing micro-service API. Over time I have played with some other Node.js frameworks like sails, koa, loopback, etc. Somehow end of the day I always had to come back to Express.</p><p>But from late 2018, I have been using <a href="https://nestjs.com/">NestJS</a> and kind of feeling like: at last, I have found the right framework I have been looking for this long time. This post is about self-reasoning why I am choosing Nest over Express or other frameworks.</p><h4>Highly opinionated Vs Un-opinionated framework</h4><p>Express is an un-opinionated, minimalistic framework. Un-Opinionated frameworks highly trust the developers to make the right choice. It allows developers to choose whatever tools or technologies, middleware, hooks they want to use. Developers structure their codes without any specific structure that is forced by the framework.</p><p>Express being an un-opinionated framework does not come with any specific template engine, body-parser, error handler, etc. This is kind of good for a geek developer. I used to love this freedom. Every time I had to scaffold a new project, I used to decorate it with the tools of my own choice. But making a choice for a team is always difficult. If you have two other developers in your team, one might love ejs, the other might love blade as the template engine. And thus, every Express project eventually becomes a unique one.</p><p>Even within one big project, different micro-service team’s project structure and tooling becomes different. One cannot just jump from one micro-service team to another due to this.</p><p>And “freedom” is not something everyone deserves, I think. Un-opinionated frameworks allow developers to code anything anywhere. I have seen many messy projects with ugly project structures. I have seen many unnecessary design pattern heavy projects where more efforts given on unnecessary abstraction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*EGrPBUoYfKm-2DjfE5BHIA.png" /></figure><p>Nest is a highly opinionated framework. It follows the design paradigm “convention over configuration”. It strongly guide developers to use certain tools and to code in a certain way. Behind the scene it already wraps the controller with a try-catch block, already parse the request body, adds error handler, middleware, logger, etc. So, I do not need to do these common things every-time while scaffolding a new project. Developers have to write the controller, service, repositories in certain places in a certain way.</p><p>So, I think anyone familiar with the Nest can jump into a project without spending much time on how code is being organized or which tools are being used. Unless you are a developer who is super creative in writing messy code, code in a Nest project should be much more maintainable than in an un-opinionated Express project.</p><h4>TypeScript</h4><p>I know many JS developers do not like TypeScript. They can come up with some really strange logic. Like Typescript is a Microsoft product, so we cannot rely on it! Anyway, I believe Typescript is the sweetest thing introduced in the recent JavaScript renaissance.</p><p>With loosely typed languages like PHP, Python, or JavaScript developers might write a bunch of code quickly. But without strict typing, there is always a chance of creating bugs. As projects grow, you have to always go back to several service files or component files to check what methods are available or what parameters they are expecting. Most of the bugs are created when you are expecting a user object, but you passed a user id. Maybe you misspelled an object’s attribute name. Without type hinting, you have to spend hours &amp; hours debugging this sort of silly mistake. And if you are a new developer and just joined a year-old project you will be just lost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*MjkBcGkCPD1Z-wwIP1h-zg.png" /></figure><p>But with Typescript from request body to response — if we use strict typing, you can code a lot faster and chances of creating these sorts of silly bugs are reduced to near 0 %.</p><p>Nest is probably the only available well-structured framework that is written entirely with Typescript. Even though — you can use Typescript in Express (by some tweaking) but that is not 100% Typescript.</p><h4>Use of Decorators, custom decorators</h4><p>Decorators are a proposed feature of JavaScript. But Typescript already has this feature. All major backend frameworks of Java, Python, Php use decorators/annotations heavily. Decorators allow metadata programming, a mechanism for modifying classes, class members in a declarative fashion.</p><p>In NEST I can bind the controller to routes, set request method, inject request body or parse params, control auth/role guards beautifully with decorators. Whether an input attribute is required, whether to check email or whether to serialize an attribute into JSON or not — everything can be controlled with decorators.</p><pre>/**<br>* A typical example of using different decorators in <br>* a nest controller method<br>*/</pre><pre>@Get(&#39;/me&#39;)<br>@ApiBearerAuth()<br>@UseGuards(RolesGuard)<br>@Roles(&#39;user&#39;, &#39;admin&#39;)<br>@UseInterceptors(ClassSerializerInterceptor)<br><strong>async</strong> getMe(<br>    @AuthUser() user: IAuthUser,<br>): Promise&lt;User&gt; {}</pre><p>Nest also provides an easy way to declare custom decorators. So, if any common task is there that can be used in different parts of my project, I can easily write it as a decorator and use it in multiple places.</p><h4>Domain-Driven Development</h4><p>Nest provides a way to define multiple modules under the one root module. Modules encapsulate providers, controller, repositories, interceptors, middleware, etc. With this, we can logically distribute the entire project’s code into logical domains. Unless a provider/service is defined within the same module it cannot be injected into a controller or service class. If we have to use a service from another module, that service needs to be exported and that module needs to include in this module. Through this, we can create domain wise clear boundaries, write reusable modules, and write loosely coupled and maintainable code.</p><h4>Angular like architecture</h4><p>A major reason for the growing Node.js popularity is using the same language in both back-end and front-end. Unfortunately, the only benefit we have been getting so far is the same syntax. Coding architecture, philosophy, terms — everything has been completely different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQf1E11CilN0Kwb8THX9yA.png" /></figure><p>Architecture wise NEST is heavily inspired by Angular. It’s a module, service, controller, pipe, decorators — everything’s syntax, usage, and philosophy exactly matches that of Angular. A frontend Angular developer can easily jump into the backend NEST project — feeling like working in the same project. With the same concept and philosophy for both backend and frontend without much time wasted in context switching.</p><h4>Command-line interface (CLI)</h4><p>Nest comes with its own CLI to initiate and scaffold a project quickly. With this, we can easily generate modules, controllers, pipes, and middlewares to ease a developer’s pain.</p><h4>Testing</h4><p>Nest CLI generated application starter comes with a default testing environment configured with <a href="https://jestjs.io/">Jest framework</a>. Whenever we generate a service, controller, middle wire, interceptors, etc — CLI generates a “spec” file alongside with it. It provides auto-generated testing bed code, so developers don’t have to write the scaffolding code need for the unit test. So, writing unit testing becomes much easier with NestJs.</p><h4>Performance</h4><p>There are some threads in stack overflow where people are comparing a “hello world” performance benchmark between Express and Nest. Since Nest itself uses Express underneath, it’s really stupid to compare these two. To get a lot better performance, Nest gives an alternative way to change the underneath framework implementation from Express to <a href="https://www.fastify.io/">Fastify</a> (another node framework).</p><pre>$ npm i --save @nestjs/platform-fastify</pre><p><a href="https://docs.nestjs.com/techniques/performance"><em>https://docs.nestjs.com/techniques/performance</em></a></p><p>Using Fastify we can get even better performance from Nest than a simple plain Express “hello world”.</p><p><a href="https://stackoverflow.com/questions/47733390/nestjs-vs-plain-express-performance">nestjs vs plain express performance</a></p><p>You can get the performance benchmark report <a href="https://github.com/nestjs/nest/blob/master/benchmarks/all_output.txt">here</a>.</p><h4>Conclusion</h4><p>NestJS is one of the most rapidly growing Node.js framework in 2018/2019. Till today (Aug 2019) it has 18k+ GitHub stars and over 91k weekly npm downloads. Being an Angular+TypeScript developer Nest was my obvious choice. But someone who is not familiar with TypeScript or Angular philosophy might find a bit difficult to getting started with it.</p><p>If you are not using Angular or Typescript, please give NestJS a go, I would like to know your view from a neutral position.</p><p>You can learn more about NestJS from its official <a href="https://nestjs.com/">site</a> and <a href="https://docs.nestjs.com/">documentation</a>. Feel free to make your comment here or catch me on twitter <a href="https://twitter.com/asad_rahman">@asad_rahman</a>.</p><p>Visit our website to learn more about us:<br><a href="http://www.monstar-lab.co.bd/">www.monstar-lab.co.bd</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cdbd083ae67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/monstar-lab-bangladesh-engineering/why-i-choose-nestjs-over-other-node-js-frameworks-6cdbd083ae67">Why I choose NestJS over other Node JS frameworks</a> was originally published in <a href="https://medium.com/monstar-lab-bangladesh-engineering">Monstar Lab Bangladesh Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>