<?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"><channel><title><![CDATA[Blog | Nurul Huda (Apon)]]></title><description><![CDATA[Staff Engineer and Undergrad Student]]></description><link>https://blog.nurulhudaapon.com</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 17:18:15 GMT</lastBuildDate><atom:link href="https://blog.nurulhudaapon.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Personal Reflection on University Life]]></title><description><![CDATA[https://youtu.be/ZD78D-F4eA0?si=6FeVKqGKzAngIccM
 
Moments
I tried organizing Iftar with classmates from my section 4 times in all four year of university. And also organized semester final day tour. So most of the photos are just from those events.
...]]></description><link>https://blog.nurulhudaapon.com/personal-reflection-on-university-life</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/personal-reflection-on-university-life</guid><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Fri, 30 Jan 2026 08:53:15 GMT</pubDate><content:encoded><![CDATA[<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/ZD78D-F4eA0?si=6FeVKqGKzAngIccM">https://youtu.be/ZD78D-F4eA0?si=6FeVKqGKzAngIccM</a></div>
<p> </p>
<h2 id="heading-moments">Moments</h2>
<p>I tried organizing Iftar with classmates from my section 4 times in all four year of university. And also organized semester final day tour. So most of the photos are just from those events.</p>
<h3 id="heading-year-1-2022"><strong>Year 1 (2022)</strong></h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739263347489/1087c989-ae06-45d9-80ea-dac0c7dcc22b.png" alt="Iftar at Dhaka" class="image--center mx-auto" /></p>
<p>→ Iftar at <strong>Dhaka South.</strong></p>
<hr />
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739263371306/a018eec0-25b3-4412-8bd0-adc724fd5348.png" alt class="image--center mx-auto" /></p>
<p>→ Iftar at <strong>Narayanganj.</strong></p>
<hr />
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739263417468/36392c3c-67d2-4624-a05e-3184ece77c96.png" alt class="image--center mx-auto" /></p>
<p>→ Semester end day tour with DF Section.</p>
<h3 id="heading-year-2-2023">Year 2 (2023)</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739263514380/ad103576-dd1a-4cb1-b290-34a425047132.jpeg" alt class="image--center mx-auto" /></p>
<p>→ Iftar at <strong>Dhaka North.</strong></p>
<hr />
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739263537725/1dd1b01b-bed4-4dc1-923a-4a0c688a0a57.jpeg" alt class="image--center mx-auto" /></p>
<p>→ Semester final day tour to <strong>Zinda Park.</strong></p>
<hr />
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739263574460/5fe692cd-620e-4976-9bc1-e1e6b8509ab1.png" alt class="image--center mx-auto" /></p>
<p>→ Semester finally day tour to <strong>Jolshiri Central Park</strong>.</p>
<h3 id="heading-year-3-2024">Year 3 (2024)</h3>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/hgU2TvsLvFI">https://youtu.be/hgU2TvsLvFI</a></div>
<p> </p>
<p>→ Iftar at <strong>Narayanganj</strong></p>
<h3 id="heading-year-4-2025">Year 4 (2025)</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759673605918/353630b7-7e06-4c52-99e7-82031320bb81.jpeg" alt class="image--center mx-auto" /></p>
<p>→ Iftar at <strong>Naryanganj</strong></p>
<hr />
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759673629084/e8b60cb7-8973-46e5-879a-1729bc8e9649.jpeg" alt class="image--center mx-auto" /></p>
<p>→ Iftar at <strong>Dhaka South</strong></p>
<hr />
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759673667748/4c3acbb1-fe57-47e9-a914-3f95993d29ae.jpeg" alt class="image--center mx-auto" /></p>
<p>→ Iftar at <strong>Dhaka North</strong></p>
]]></content:encoded></item><item><title><![CDATA[How to smile 101!]]></title><description><![CDATA[Smiling is very important; a good smile can make people happy. A smiley face makes you look approachable and keeps you happy in life.
There is no perfect way to smile; a genuine smile comes from within. It happens when you are free from pain and suff...]]></description><link>https://blog.nurulhudaapon.com/how-to-smile-101</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/how-to-smile-101</guid><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Mon, 19 May 2025 13:01:41 GMT</pubDate><content:encoded><![CDATA[<p>Smiling is very important; a good smile can make people happy. A smiley face makes you look approachable and keeps you happy in life.</p>
<p>There is no perfect way to smile; a genuine smile comes from within. It happens when you are free from pain and suffering, or when you choose to see them as just parts of life. To smile genuinely, focus on the positives and ignore the negatives in your life.</p>
]]></content:encoded></item><item><title><![CDATA[My Journey with Braces]]></title><description><![CDATA[In my childhood, I had straight teeth, and I always used to smile a lot with my teeth showing. However, I only have one photo of it.

I have some interesting stories about how I lost my baby teeth. One time, I bit into the white part of a coconut, an...]]></description><link>https://blog.nurulhudaapon.com/my-journey-with-braces</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/my-journey-with-braces</guid><category><![CDATA[Braces]]></category><category><![CDATA[Orthodontics ]]></category><category><![CDATA[dental]]></category><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Fri, 14 Mar 2025 20:18:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1741983268923/16864bfc-3908-4177-ae30-cfb8e3f609b5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In my childhood, I had straight teeth, and I always used to smile a lot with my teeth showing. However, I only have one photo of it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741984303946/4d3b5fb2-1cef-49e0-9122-1ce302e1cae3.png" alt class="image--center mx-auto" /></p>
<p>I have some interesting stories about how I lost my baby teeth. One time, I bit into the white part of a coconut, and my tooth got stuck and pulled out. On another occasion, I was biting down on a towel when one of my cousins snatched it away, causing me to lose a few more teeth. New teeth grew in, but probably in kindergarten, I lost a few more teeth, and the new ones that came in were not straight. Suddenly, I had crooked teeth, and two of my front teeth were severely crooked, which caused me a lot of issues. I was constantly cutting my lips and would get severe injuries from those cuts. As time went on, I got used to the cuts, and the number of cuts slowly decreased but never went to zero. Or maybe I just got used to it.</p>
<p>When I first noticed my crooked teeth, I always wanted to get them straightened, but I was a kid and didn't have the power to go to the dentist for that. I probably learned from my mom that there are ways to straighten them using some wire or something. I always dreamed of getting them straightened.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741984102570/1d0e0fd2-add4-4adb-9283-8a727a19002d.png" alt class="image--center mx-auto" /></p>
<p>Fast forward to university life when I had money but was still not considering getting braces, probably due to the issue of it not being Halal. However, I saw Mufti Menk with braces and learned that if I'm not doing it just for cosmetic purposes, then it is not prohibited. Yet, I was still hesitant because it is mostly a lifelong commitment. As time passed, I began to notice more issues with my dental health, especially since I almost never used my front teeth. Thinking about my future old age, I started researching for months and finally decided to get braces.<br />I started searching for the best dental office around me, but at the time, I was living in Rupganj, Narayanganj near my campus 70% of the time and 30% in Dhaka with my family. However, searching online (hmm, that’s the only tool I have) and around Dhaka, close to my family home, I couldn’t find any dental office that had an orthodontic program. Also, in Narayanganj, there were none around me as well. So, searching online, I ended up choosing <a target="_blank" href="https://www.promidentdental.com">Promident Dental Clinic</a> in Banani, which is easier to reach from my campus.</p>
<p>I went for my first appointment, and they told me to come back with an x-ray the next week, which I did. They took some measurements and asked me to come again the following week. In the next appointment, the doctor sat with me and mentioned that I might need to undergo tooth extraction to get things 100% straightened. However, I refused to go that route and chose to have nearly straightened teeth while keeping all my teeth intact. The doctor partially agreed and mentioned that we might need to extract in the middle of the treatment, but we most probably won't have to do that.</p>
<p>Regarding options, there were three: traditional braces, self-ligating braces, and <strong>Invisalign</strong>. I went with self-ligating braces, which would cost around 165K over the span of 1 and a half years. So finally, in mid-July'23, I got my braces on!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741984135018/ec8e8876-40d7-445a-8343-097f42877f3e.png" alt class="image--center mx-auto" /></p>
<p>The first few weeks were very painful and uncomfortable, and I thought it would be a nightmare to endure this for the next 1.5 years! But as time went on, I started to feel normal, and only every 3 weeks would the braces be adjusted, which would bring back pain for a few days and then return to normal. In the beginning, I noticed a huge shift in my teeth. After about half a year, things were almost there.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741984228685/4a50156a-1a70-4cd6-b7da-2526747a4f19.png" alt class="image--center mx-auto" /></p>
<p>And after one year passed, things were pretty good already. But it was only for the upper jaw; for the lower jaw, I got braces after about 4 months, and it took a while for those to get close to straight.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741984241269/f850ec48-7896-40fa-bcff-b67fd2b3eedd.png" alt class="image--center mx-auto" /></p>
<p>And finally, in February'25, I got my braces off!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741984255336/5d3f04cc-6bd1-4ae8-8f62-76e3fbde9496.png" alt class="image--center mx-auto" /></p>
<p>Now I no longer have braces and have nearly straight teeth. However, I’ll have to wear a retainer every night for 2 more years to ensure they stay straight without returning to their original position.</p>
]]></content:encoded></item><item><title><![CDATA[My Journey to Software Development]]></title><description><![CDATA[Hi, I'm Nurul. I'm currently an undergraduate student at Green University of Bangladesh, pursuing a bachelor's degree in Computer Science and Engineering, and working as a Staff Engineer.
My journey into Software Development began in January 2019 whe...]]></description><link>https://blog.nurulhudaapon.com/software-development-journey</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/software-development-journey</guid><category><![CDATA[- Software Development - Learning JavaScript - Career Journey - Balancing Work and Study - Remote Work - Personal Growth - University Experience - Overcoming Challenges - Determination and Adaptability]]></category><category><![CDATA[Career]]></category><category><![CDATA[journey]]></category><category><![CDATA[Study ]]></category><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Wed, 01 Jan 2025 08:19:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1740231687510/79e89fed-2fc1-4c93-a8f7-7f02e94778a3.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi, I'm Nurul. I'm currently an undergraduate student at Green University of Bangladesh, pursuing a bachelor's degree in Computer Science and Engineering, and working as a Staff Engineer.</p>
<p>My journey into Software Development began in January 2019 when I was a second-year student (12th grade) at <a target="_blank" href="https://www.facebook.com/OfficialDUC/">Dania College</a>. I already had some knowledge of HTML/CSS but had never coded because I was afraid of it. I was more interested in graphic design and animation, but unfortunately, my computer at the time couldn't run the programs needed for animation. Determined to do something, I decided to learn JavaScript as my first programming language.</p>
<h3 id="heading-learning-phase">Learning Phase</h3>
<p>I researched different programming languages and chose JavaScript. I started learning it using various resources, and these were the most helpful:</p>
<ul>
<li><p><a target="_blank" href="https://www.w3schools.com/">W3Schools</a> [Interactive Learning Platform]</p>
</li>
<li><p><a target="_blank" href="https://eloquentjavascript.net/">Eloquent JavaScript</a> [Book]</p>
</li>
<li><p><a target="_blank" href="https://zerotomastery.io/courses/coding-bootcamp/">Zero to Mastery</a> [Video Tutorial]</p>
</li>
</ul>
<p>I studied and practiced on W3Schools while at home and printed the book to take to college for practice during class breaks. I also worked on practice projects late at night. Five months into my journey, I learned and built various real-world projects. One of my instincts was to never rebuild the same project shown in a tutorial but to use the knowledge for other interesting and useful projects. For example, a classmate and I built a <a target="_blank" href="https://scienceclubofdaniacollege.github.io/">website</a> for our <a target="_blank" href="https://www.facebook.com/ScienceClubofDaniaCollege/">Science Club at Dania College</a>. Personally, I created a full-stack <a target="_blank" href="https://github.com/nurulhudaapon/bank-management-system">mini banking system</a> for one of my initiatives, where I set up a mini bank for kids to help them learn about banking and saving small amounts.</p>
<h3 id="heading-landing-job">Landing Job</h3>
<p>While working on the project, I came across this <a target="_blank" href="https://www.dhakatribune.com/bangladesh/government-affairs/182419/joy-launches-nid-verification-gateway-server">news</a> post and thought about building an app where people could scan and verify their own or others' NID. I searched for the API documentation and built the app, but while working with the sandbox API, I encountered many issues in the documentation and the API itself. I contacted them via the email provided on the website to report the issues and also shared a corrected version of the documentation. After much communication, I completed the project, but when I requested production access, I realized it was only available for government organizations, not developers. They appreciated my initiative and asked for my CV for future opportunities. Initially, I declined because I was still a student and couldn't take a job. However, I shared this <a target="_blank" href="https://nurulhudaapon.github.io/nurulhudaapon/archives/legacy-portfolio/pages/resume.html">portfolio site</a>. A month later, they asked me to help with load testing some APIs they provided, so I assisted with that. They liked my work and referred me to a US company as a QA Engineer, working remotely. I researched what a remote job was and figured I could replace my current home tutoring work with it. After some thought, I accepted the offer, and in mid-September 2019, I joined. Initially, everything at the job was overwhelming, but I didn't give up and gave it my all, spending almost all my available time on the job. When I received my first salary of around 35K BDT (~400 USD), I couldn't believe it.</p>
<h3 id="heading-growth-at-job">Growth at Job</h3>
<p>Getting a job can be tough, but for me, it seemed easy. However, staying in the job was not as simple. Everything I encountered was new, but instead of losing hope, I took the time to learn. I didn't take weekends or time off for the first two years. Fortunately, the COVID-19 shutdown allowed me to dedicate even more time to work, spending 15-20 hours a day working and learning. I started taking on more responsibilities than I was assigned, which helped me grow and become a team player, leading to not just survival but also promotions! This approach of taking on more responsibilities has brought me to where I am today.</p>
<h3 id="heading-job-and-study">Job and Study</h3>
<p>Until 2022, I didn't worry about my studies because, due to the COVID shutdown, there were no classes, and our <a target="_blank" href="https://en.wikipedia.org/wiki/Higher_Secondary_Certificate">High School Exam</a> was canceled. We were all given an automatic pass based on our <a target="_blank" href="https://en.wikipedia.org/wiki/Junior_School_Certificate">Junior School Exam</a>. However, in late 2021, I had to choose between my job and my studies. I was unsure if it was possible to pursue both at the same time, so I did a lot of research and asked my colleagues and others I knew. If I did both, I would have to choose one as my main priority. I've always been focused on academics, but I didn't want to fall behind at work either. Initially, I decided to work part-time and focus more on my studies. But four years seemed like too long to invest in a degree, especially since I learned that a computer science degree might not offer much new knowledge. However, I didn't want to miss out on the university experience. So, I decided to stay full-time at my job and see if I could manage university at the same time. If not, I would switch to part-time work. The first two semesters were extremely challenging. To save time, I moved into the university hostel, even though I had never lived away from my family. I couldn't afford to spend 2-3 hours commuting. Imagine working late until 3 AM and then going to campus by 8 AM. It gradually became harder, but I started to adapt to this tough routine, hoping for a better future. Life is still hard, but instead of complaining, I just deal with it. I also wrote an article on how I manage both studying and a full-time job <a target="_blank" href="https://blog.nurulhudaapon.com/study-while-working-full-time">here</a>.</p>
<h3 id="heading-concluding">Concluding</h3>
<p>Reflecting on my journey into software development, it's clear that determination and adaptability have been crucial for me. From overcoming my initial fears of coding to getting a job and balancing work with studies, each step has been a learning experience. Embracing challenges and taking on responsibilities outside my comfort zone have helped me grow. As I continue to navigate the complexities of both my career and education, I stay committed to learning constantly.</p>
]]></content:encoded></item><item><title><![CDATA[2024 Year in Review]]></title><description><![CDATA[2024 has been the best year for me so far! I was able to accomplish so much this year that I’m proud of, by the grace of Almighty.
Here is a quick summary of what the events that took place in this year!

Saint Martin Tour: It was my first time visit...]]></description><link>https://blog.nurulhudaapon.com/2024-year-in-review</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/2024-year-in-review</guid><category><![CDATA[2024 year in review]]></category><category><![CDATA[life update]]></category><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Mon, 16 Dec 2024 13:43:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1734356363631/e8463120-43b0-47ba-a778-a7090b04cbe2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>2024 has been the best year for me so far! I was able to accomplish so much this year that I’m proud of, by the grace of Almighty.</p>
<p>Here is a quick summary of what the events that took place in this year!</p>
<ul>
<li><p><strong>Saint Martin Tour:</strong> It was my first time visiting a beach and an island, and it was fantastic!</p>
</li>
<li><p><strong>Umrah</strong>: Alhamdulillah, I was able to complete my Umrah by the mercy of the Almighty.</p>
</li>
<li><p><strong>CodeSamurai’24:</strong> For the first time, I participated in a national hackathon and was part of the winning team, placing 9th.</p>
</li>
<li><p><strong>Promotion:</strong> I got promoted to the Staff Engineer role at my current workplace.</p>
</li>
</ul>
<h1 id="heading-saint-martin-tour">Saint Martin Tour</h1>
<p><strong>January’24</strong> — A big thanks to my amazing university friends for organizing such a smooth and memorable tour. Initially, it was challenging to gather enough participants, but in the end, we had a group of 20 people, and everyone thoroughly enjoyed the experience.</p>
<p>We spent five days on the island, with each day bringing its own unique activities. From cycling and playing football to multiple barbecue parties, every moment was filled with fun and excitement. I missed out on a few activities because, once again, I couldn’t take a full vacation and had to spend some time working.</p>
<p>Despite that, the tour was absolutely fantastic and particularly special as it was my first trip with both my siblings and university friends.</p>
<p>Here is more on <a target="_blank" href="https://en.wikipedia.org/wiki/St._Martin%27s_Island">Saint Martin Island</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734175206181/7627cfc7-86c3-4f41-b40b-b3cd60cc7660.png" alt /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734872374426/dbfe3d2a-e644-4a8e-a9aa-643e749e51ec.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-umrah">Umrah</h1>
<p><strong>March’24</strong> — Following my "one international tour a year" schedule, I started exploring nearby Middle Eastern countries for my next trip. Initially, the United Arab Emirates and Saudi Arabia came to mind, but then I thought, why not do the Umrah? So, I booked the trip with a group of amazing elderly religious people. The Umrah was scheduled right in the middle of Ramadan, making it the best time for this spiritual journey.</p>
<p>Our flight had a transit at <strong>Kuwait Airport</strong> from <strong>Dhaka Airport</strong>, where we entered into the state of Ihram. It was an indescribable feeling! After a 3-hour layover at <strong>Kuwait Airport</strong>, we continued our journey to Jeddah. By around 2 PM local time, we landed at Jeddah Airport and completed the immigration process. From there, we began our journey to the holy city of Mecca by bus. Since we were fasting, and due to the time zone difference, it ended up being the longest fast any of us had experienced.</p>
<p>Once we reached our hotel in Mecca, we took a short rest and then broke our fast with Iftar. After the Isha prayer, we went to the Kaaba to perform Tawaf and Sa'ay. For the first time in my life, I shaved my head and exited the state of Ihram.</p>
<p>It was an awe-inspiring experience, seeing Muslims from all over the world and visiting all the sacred places. We spent the first week in Mecca, visiting every sacred site and mosque. The following week, we traveled to Medina and similarly visited all the sacred places and mosques there.</p>
<p>An interesting part of my trip was that I had to spend some time in Medina coding for the CodeSamurai’24 Hackathon. It felt surreal to be coding while in such a holy city, but that's how my life goes. The picture below was taken right in front of Al-Masjid an-Nabawi (the <a target="_blank" href="https://en.wikipedia.org/wiki/Prophet%27s_Mosque">Prophet's Mosque).</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734175309192/0a6ae875-ce95-4bed-b23a-1f7367d53112.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-codesamurai24"><strong>CodeSamurai’24</strong></h1>
<p><strong>December’23 - May’24</strong> — It was the first hackathon I had ever participated in. I’m not much into competitions, but circumstances led me to join this one with my mates, <a target="_blank" href="https://zahin.netlify.app/">Zahin Afsar</a> and <a target="_blank" href="https://suaebahmed.github.io/my-portfolio/">Suaeb Ahmed</a>. We had zero expectations for the competition since all of us had full-time jobs and couldn’t take time off for a vacation.</p>
<p>After a disastrous performance in the mock preliminary round, we failed because our program couldn’t even execute properly. However, in the actual preliminary round, we managed to place 5th out of 400+ registered teams. From there, 91 teams were selected for the second phase (essentially the main phase) in March 2024.</p>
<p>Unfortunately, the second phase coincided with my Umrah schedule, which left me unable to contribute much during that stage. Nevertheless, we got selected for the final onsite phase, where we were tasked with enhancing what we had built in phase 2 and creating a mobile app.</p>
<p>We were lagging behind in phase 2, but somehow (well, not “somehow”—we worked incredibly hard during the final 24 hours!) we managed to make it to the winners' list with a rank of 9. The top 10 teams were honored as winners, and making it onto that list was an incredible feeling.</p>
<p>Learn more about CodeSamurai here: <a target="_blank" href="https://www.codesamuraibd.net/">https://www.codesamuraibd.net/</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1734884526025/50bb431c-b5e4-4f19-989b-428dbd77c5cd.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-promotion"><strong>Promotion</strong></h1>
<p><strong>June’24</strong> — I’ve been leading the engineering team for a while now, but my CEO encouraged me to further enhance my leadership skills and suggested transitioning to a Staff Engineer role. Initially, I was skeptical and felt unprepared for such a significant position, thinking I was too young for the role. Nevertheless, I decided to embrace the opportunity, knowing that my experience outweighed any doubts tied to my age.</p>
<p>Since then, I’ve been actively working on refining my leadership abilities and started following the principles outlined in the book <a target="_blank" href="https://en.wikipedia.org/wiki/How_to_Win_Friends_and_Influence_People"><em>How to Win Friends and Influence People</em></a>. This journey has been both challenging and rewarding, pushing me to grow as a leader.</p>
<h1 id="heading-concluding">Concluding</h1>
<p>In conclusion, the moments I’ve highlighted above were just a few standout occasions that I felt deserved their own mention, but so much more happened beyond these events. I made several transformative changes to my future plans—changes I could never have imagined before.</p>
<p>Amid all these personal milestones, my motherland, Bangladesh, witnessed a historic mass student uprising, which ultimately led to the toppling of the government. It was a year of profound personal and societal change, shaping both my perspective and the world around me.</p>
]]></content:encoded></item><item><title><![CDATA[30 Programming Design Patterns]]></title><description><![CDATA[1. Singleton Pattern
Ensures a class has only one instance and provides a global point of access to it.
When to use: When exactly one instance of a class is needed to control the action.Why to use: To prevent multiple instances of a class and provide...]]></description><link>https://blog.nurulhudaapon.com/30-programming-design-patterns</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/30-programming-design-patterns</guid><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Sat, 13 Jul 2024 11:27:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1720871678776/95a92760-1947-48b7-b6f9-7c767960909f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-1-singleton-pattern">1. <strong>Singleton Pattern</strong></h3>
<p>Ensures a class has only one instance and provides a global point of access to it.</p>
<p><strong>When to use</strong>: When exactly one instance of a class is needed to control the action.<br /><strong>Why to use</strong>: To prevent multiple instances of a class and provide a single point of access.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Singleton {
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> instance: Singleton;
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) {}
    <span class="hljs-keyword">static</span> getInstance(): Singleton {
        <span class="hljs-keyword">if</span> (!Singleton.instance) {
            Singleton.instance = <span class="hljs-keyword">new</span> Singleton();
        }
        <span class="hljs-keyword">return</span> Singleton.instance;
    }
}
<span class="hljs-keyword">const</span> instance1 = Singleton.getInstance();
<span class="hljs-keyword">const</span> instance2 = Singleton.getInstance();
<span class="hljs-built_in">console</span>.log(instance1 === instance2); <span class="hljs-comment">// true</span>
</code></pre>
<hr />
<h3 id="heading-2-factory-pattern">2. <strong>Factory Pattern</strong></h3>
<p>Creates objects without specifying the exact class of object that will be created.</p>
<p><strong>When to use</strong>: When the exact type of the object is determined at runtime.<br /><strong>Why to use</strong>: To encapsulate object creation.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Product {
    operation(): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">class</span> ConcreteProduct1 <span class="hljs-keyword">implements</span> Product {
    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'ConcreteProduct1'</span>;
    }
}

<span class="hljs-keyword">class</span> ConcreteProduct2 <span class="hljs-keyword">implements</span> Product {
    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'ConcreteProduct2'</span>;
    }
}

<span class="hljs-keyword">class</span> Creator {
    <span class="hljs-keyword">static</span> factoryMethod(<span class="hljs-keyword">type</span>: <span class="hljs-built_in">string</span>): Product {
        <span class="hljs-keyword">if</span> (<span class="hljs-keyword">type</span> === <span class="hljs-string">'1'</span>) {
            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ConcreteProduct1();
        } <span class="hljs-keyword">else</span> {
            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ConcreteProduct2();
        }
    }
}

<span class="hljs-keyword">const</span> product1 = Creator.factoryMethod(<span class="hljs-string">'1'</span>);
<span class="hljs-built_in">console</span>.log(product1.operation()); <span class="hljs-comment">// ConcreteProduct1</span>
</code></pre>
<hr />
<h3 id="heading-3-abstract-factory-pattern">3. <strong>Abstract Factory Pattern</strong></h3>
<p>Provides an interface for creating families of related or dependent objects without specifying their concrete classes.</p>
<p><strong>When to use</strong>: When families of related objects need to be created.<br /><strong>Why to use</strong>: To ensure consistency among products.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> AbstractFactory {
    createProductA(): AbstractProductA;
    createProductB(): AbstractProductB;
}

<span class="hljs-keyword">class</span> ConcreteFactory1 <span class="hljs-keyword">implements</span> AbstractFactory {
    createProductA(): AbstractProductA {
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ProductA1();
    }
    createProductB(): AbstractProductB {
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ProductB1();
    }
}

<span class="hljs-keyword">interface</span> AbstractProductA {
    usefulFunctionA(): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">interface</span> AbstractProductB {
    usefulFunctionB(): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">class</span> ProductA1 <span class="hljs-keyword">implements</span> AbstractProductA {
    usefulFunctionA(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'The result of ProductA1'</span>;
    }
}

<span class="hljs-keyword">class</span> ProductB1 <span class="hljs-keyword">implements</span> AbstractProductB {
    usefulFunctionB(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'The result of ProductB1'</span>;
    }
}

<span class="hljs-keyword">const</span> factory1 = <span class="hljs-keyword">new</span> ConcreteFactory1();
<span class="hljs-keyword">const</span> productA1 = factory1.createProductA();
<span class="hljs-keyword">const</span> productB1 = factory1.createProductB();
<span class="hljs-built_in">console</span>.log(productA1.usefulFunctionA()); <span class="hljs-comment">// The result of ProductA1</span>
<span class="hljs-built_in">console</span>.log(productB1.usefulFunctionB()); <span class="hljs-comment">// The result of ProductB1</span>
</code></pre>
<hr />
<h3 id="heading-4-builder-pattern">4. <strong>Builder Pattern</strong></h3>
<p>Separates the construction of a complex object from its representation, allowing the same construction process to create various representations.</p>
<p><strong>When to use</strong>: When an object needs to be created with various configurations.<br /><strong>Why to use</strong>: To construct a complex object step by step.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Product {
    <span class="hljs-keyword">public</span> parts: <span class="hljs-built_in">string</span>[] = [];
    <span class="hljs-keyword">public</span> listParts(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Product parts: <span class="hljs-subst">${<span class="hljs-built_in">this</span>.parts.join(<span class="hljs-string">', '</span>)}</span>`</span>);
    }
}

<span class="hljs-keyword">class</span> Builder {
    <span class="hljs-keyword">private</span> product: Product;
    <span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) {
        <span class="hljs-built_in">this</span>.product = <span class="hljs-keyword">new</span> Product();
    }
    <span class="hljs-keyword">public</span> reset(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.product = <span class="hljs-keyword">new</span> Product();
    }
    <span class="hljs-keyword">public</span> addPartA(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.product.parts.push(<span class="hljs-string">'PartA'</span>);
    }
    <span class="hljs-keyword">public</span> addPartB(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.product.parts.push(<span class="hljs-string">'PartB'</span>);
    }
    <span class="hljs-keyword">public</span> getProduct(): Product {
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.product;
    }
}

<span class="hljs-keyword">const</span> builder = <span class="hljs-keyword">new</span> Builder();
builder.addPartA();
builder.addPartB();
<span class="hljs-keyword">const</span> product = builder.getProduct();
product.listParts(); <span class="hljs-comment">// Product parts: PartA, PartB</span>
</code></pre>
<hr />
<h3 id="heading-5-prototype-pattern">5. <strong>Prototype Pattern</strong></h3>
<p>Creates new objects by copying an existing object, known as the prototype.</p>
<p><strong>When to use</strong>: When the cost of creating a new object is expensive.<br /><strong>Why to use</strong>: To reduce the cost of creating objects.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Prototype {
    <span class="hljs-keyword">public</span> primitive: <span class="hljs-built_in">any</span>;
    <span class="hljs-keyword">public</span> component: <span class="hljs-built_in">object</span>;
    <span class="hljs-keyword">public</span> circularReference: ComponentWithBackReference;

    <span class="hljs-keyword">public</span> clone(): <span class="hljs-built_in">this</span> {
        <span class="hljs-keyword">const</span> clone = <span class="hljs-built_in">Object</span>.create(<span class="hljs-built_in">this</span>);
        clone.component = <span class="hljs-built_in">Object</span>.create(<span class="hljs-built_in">this</span>.component);
        clone.circularReference = {
            ...this.circularReference,
            prototype: { ...this }
        };
        <span class="hljs-keyword">return</span> clone;
    }
}

<span class="hljs-keyword">class</span> ComponentWithBackReference {
    <span class="hljs-keyword">public</span> prototype;
    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">prototype: Prototype</span>) {
        <span class="hljs-built_in">this</span>.prototype = prototype;
    }
}

<span class="hljs-keyword">const</span> prototype = <span class="hljs-keyword">new</span> Prototype();
prototype.primitive = <span class="hljs-number">245</span>;
prototype.component = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>();
prototype.circularReference = <span class="hljs-keyword">new</span> ComponentWithBackReference(prototype);

<span class="hljs-keyword">const</span> clone = prototype.clone();
<span class="hljs-built_in">console</span>.log(clone.primitive); <span class="hljs-comment">// 245</span>
<span class="hljs-built_in">console</span>.log(clone.component); <span class="hljs-comment">// Date object</span>
<span class="hljs-built_in">console</span>.log(clone.circularReference.prototype === prototype); <span class="hljs-comment">// false</span>
</code></pre>
<hr />
<h3 id="heading-6-adapter-pattern">6. <strong>Adapter Pattern</strong></h3>
<p>Allows incompatible interfaces to work together.</p>
<p><strong>When to use</strong>: When you want to use an existing class, but its interface is not compatible with the rest of your code.<br /><strong>Why to use</strong>: To enable collaboration between classes with incompatible interfaces.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Target {
    request(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'Target: The default target\'s behavior.'</span>;
    }
}

<span class="hljs-keyword">class</span> Adaptee {
    specificRequest(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'.eetpadA eht fo roivaheb laicepS'</span>;
    }
}

<span class="hljs-keyword">class</span> Adapter <span class="hljs-keyword">extends</span> Target {
    <span class="hljs-keyword">private</span> adaptee: Adaptee;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">adaptee: Adaptee</span>) {
        <span class="hljs-built_in">super</span>();
        <span class="hljs-built_in">this</span>.adaptee = adaptee;
    }

    request(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">`Adapter: (TRANSLATED) <span class="hljs-subst">${<span class="hljs-built_in">this</span>.adaptee.specificRequest().split(<span class="hljs-string">''</span>).reverse().join(<span class="hljs-string">''</span>)}</span>`</span>;
    }
}

<span class="hljs-keyword">const</span> adaptee = <span class="hljs-keyword">new</span> Adaptee();
<span class="hljs-keyword">const</span> adapter = <span class="hljs-keyword">new</span> Adapter(adaptee);
<span class="hljs-built_in">console</span>.log(adapter.request()); <span class="hljs-comment">// Adapter: (TRANSLATED) Special behavior of the Adaptee.</span>
</code></pre>
<hr />
<h3 id="heading-7-bridge-pattern">7. <strong>Bridge Pattern</strong></h3>
<p>Decouples an abstraction from its implementation so that the two can vary independently.</p>
<p><strong>When to use</strong>: When you want to separate a monolithic class into several class hierarchies.<br /><strong>Why to use</strong>: To avoid a permanent binding between an abstraction and its implementation.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Implementation {
    operationImplementation(): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">class</span> ConcreteImplementationA <span class="hljs-keyword">implements</span> Implementation {
    operationImplementation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'ConcreteImplementationA: Here\'s the result on the platform A.'</span>;
    }
}

<span class="hljs-keyword">class</span> ConcreteImplementationB <span class="hljs-keyword">implements</span> Implementation {
    operationImplementation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'ConcreteImplementationB: Here\'s the result on the platform B.'</span>;
    }
}

<span class="hljs-keyword">class</span> Abstraction {
    <span class="hljs-keyword">protected</span> implementation: Implementation;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">implementation: Implementation</span>) {
        <span class="hljs-built_in">this</span>.implementation = implementation;
    }

    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">`Abstraction: Base operation with:\n<span class="hljs-subst">${<span class="hljs-built_in">this</span>.implementation.operationImplementation()}</span>`</span>;
    }
}

<span class="hljs-keyword">const</span> implementationA = <span class="hljs-keyword">new</span> ConcreteImplementationA();
<span class="hljs-keyword">let</span> abstraction = <span class="hljs-keyword">new</span> Abstraction(implementationA);
<span class="hljs-built_in">console</span>.log(abstraction.operation()); <span class="hljs-comment">// Abstraction: Base operation with: ConcreteImplementationA: Here's the result on the platform A.</span>

<span class="hljs-keyword">const</span> implementationB = <span class="hljs-keyword">new</span> ConcreteImplementationB();
abstraction = <span class="hljs-keyword">new</span> Abstraction(implementationB);
<span class="hljs-built_in">console</span>.log(abstraction.operation()); <span class="hljs-comment">// Abstraction: Base operation with: ConcreteImplementationB: Here's the result on the platform B.</span>
</code></pre>
<hr />
<h3 id="heading-8-composite-pattern">8. <strong>Composite Pattern</strong></h3>
<p>Composes objects into tree structures to represent part-whole hierarchies.</p>
<p><strong>When to use</strong>: When you need to treat individual objects and compositions of objects uniformly.<br /><strong>Why to use</strong>: To simplify client code that deals with complex tree structures.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Component {
    operation(): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">class</span> Leaf <span class="hljs-keyword">implements</span> Component {
    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'Leaf'</span>;
    }
}

<span class="hljs-keyword">class</span> Composite <span class="hljs-keyword">implements</span> Component {
    <span class="hljs-keyword">private</span> children: Component[] = [];

    add(component: Component): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.children.push(component);
    }

    remove(component: Component): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">const</span> index = <span class="hljs-built_in">this</span>.children.indexOf(component);
        <span class="hljs-built_in">this</span>.children.splice(index, <span class="hljs-number">1</span>);
    }

    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">const</span> results = [];
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> child <span class="hljs-keyword">of</span> <span class="hljs-built_in">this</span>.children) {
            results.push(child.operation());
        }
        <span class="hljs-keyword">return</span> <span class="hljs-string">`Branch(<span class="hljs-subst">${results.join(<span class="hljs-string">'+'</span>)}</span>)`</span>;
    }
}

<span class="hljs-keyword">const</span> leaf = <span class="hljs-keyword">new</span> Leaf();
<span class="hljs-keyword">const</span> tree = <span class="hljs-keyword">new</span> Composite();
<span class="hljs-keyword">const</span> branch1 = <span class="hljs-keyword">new</span> Composite();
<span class="hljs-keyword">const</span> branch2 = <span class="hljs-keyword">new</span> Composite();

branch1.add(leaf);
branch2.add(leaf);
tree.add(branch1);
tree.add(branch2);

<span class="hljs-built_in">console</span>.log(tree.operation()); <span class="hljs-comment">// Branch(Branch(Leaf)+Branch(Leaf))</span>
</code></pre>
<hr />
<h3 id="heading-9-decorator-pattern">9. <strong>Decorator Pattern</strong></h3>
<p>Adds additional responsibilities to an object dynamically.</p>
<p><strong>When to use</strong>: When you need to add responsibilities to objects dynamically.<br /><strong>Why to use</strong>: To avoid subclassing for functionalities.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Component {
    operation(): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">class</span> ConcreteComponent <span class="hljs-keyword">implements</span> Component {
    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'ConcreteComponent'</span>;
    }
}

<span class="hljs-keyword">class</span> Decorator <span class="hljs-keyword">implements</span> Component {
    <span class="hljs-keyword">protected</span> component: Component;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">component: Component</span>) {
        <span class="hljs-built_in">this</span>.component = component;
    }

    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.component.operation();
    }
}

<span class="hljs-keyword">class</span> ConcreteDecoratorA <span class="hljs-keyword">extends</span> Decorator {
    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">`ConcreteDecoratorA(<span class="hljs-subst">${<span class="hljs-built_in">super</span>.operation()}</span>)`</span>;
    }
}

<span class="hljs-keyword">class</span> ConcreteDecoratorB <span class="hljs-keyword">extends</span> Decorator {
    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">`ConcreteDecoratorB(<span class="hljs-subst">${<span class="hljs-built_in">super</span>.operation()}</span>)`</span>;
    }


}

<span class="hljs-keyword">const</span> simple = <span class="hljs-keyword">new</span> ConcreteComponent();
<span class="hljs-built_in">console</span>.log(simple.operation()); <span class="hljs-comment">// ConcreteComponent</span>

<span class="hljs-keyword">const</span> decorator1 = <span class="hljs-keyword">new</span> ConcreteDecoratorA(simple);
<span class="hljs-keyword">const</span> decorator2 = <span class="hljs-keyword">new</span> ConcreteDecoratorB(decorator1);
<span class="hljs-built_in">console</span>.log(decorator2.operation()); <span class="hljs-comment">// ConcreteDecoratorB(ConcreteDecoratorA(ConcreteComponent))</span>
</code></pre>
<hr />
<h3 id="heading-10-facade-pattern">10. <strong>Facade Pattern</strong></h3>
<p>Provides a simplified interface to a complex subsystem.</p>
<p><strong>When to use</strong>: When you need to provide a simple interface to a complex subsystem.<br /><strong>Why to use</strong>: To hide the complexities of the system.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Subsystem1 {
    operation1(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'Subsystem1: Ready!'</span>;
    }
    operationN(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'Subsystem1: Go!'</span>;
    }
}

<span class="hljs-keyword">class</span> Subsystem2 {
    operation1(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'Subsystem2: Get ready!'</span>;
    }
    operationZ(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'Subsystem2: Fire!'</span>;
    }
}

<span class="hljs-keyword">class</span> Facade {
    <span class="hljs-keyword">protected</span> subsystem1: Subsystem1;
    <span class="hljs-keyword">protected</span> subsystem2: Subsystem2;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">subsystem1: Subsystem1, subsystem2: Subsystem2</span>) {
        <span class="hljs-built_in">this</span>.subsystem1 = subsystem1;
        <span class="hljs-built_in">this</span>.subsystem2 = subsystem2;
    }

    operation(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">let</span> result = <span class="hljs-string">'Facade initializes subsystems:\n'</span>;
        result += <span class="hljs-built_in">this</span>.subsystem1.operation1() + <span class="hljs-string">'\n'</span>;
        result += <span class="hljs-built_in">this</span>.subsystem2.operation1() + <span class="hljs-string">'\n'</span>;
        result += <span class="hljs-string">'Facade orders subsystems to perform the action:\n'</span>;
        result += <span class="hljs-built_in">this</span>.subsystem1.operationN() + <span class="hljs-string">'\n'</span>;
        result += <span class="hljs-built_in">this</span>.subsystem2.operationZ();
        <span class="hljs-keyword">return</span> result;
    }
}

<span class="hljs-keyword">const</span> subsystem1 = <span class="hljs-keyword">new</span> Subsystem1();
<span class="hljs-keyword">const</span> subsystem2 = <span class="hljs-keyword">new</span> Subsystem2();
<span class="hljs-keyword">const</span> facade = <span class="hljs-keyword">new</span> Facade(subsystem1, subsystem2);
<span class="hljs-built_in">console</span>.log(facade.operation());
</code></pre>
<hr />
<h3 id="heading-11-flyweight-pattern">11. <strong>Flyweight Pattern</strong></h3>
<p>Uses sharing to support large numbers of fine-grained objects efficiently.</p>
<p><strong>When to use</strong>: When a large number of similar objects are needed.<br /><strong>Why to use</strong>: To reduce memory consumption.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Flyweight {
    <span class="hljs-keyword">private</span> sharedState: <span class="hljs-built_in">any</span>;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">sharedState: <span class="hljs-built_in">any</span></span>) {
        <span class="hljs-built_in">this</span>.sharedState = sharedState;
    }

    operation(uniqueState: <span class="hljs-built_in">any</span>): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">const</span> s = <span class="hljs-built_in">JSON</span>.stringify(<span class="hljs-built_in">this</span>.sharedState);
        <span class="hljs-keyword">const</span> u = <span class="hljs-built_in">JSON</span>.stringify(uniqueState);
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Flyweight: Displaying shared (<span class="hljs-subst">${s}</span>) and unique (<span class="hljs-subst">${u}</span>) state.`</span>);
    }
}

<span class="hljs-keyword">class</span> FlyweightFactory {
    <span class="hljs-keyword">private</span> flyweights: { [key: <span class="hljs-built_in">string</span>]: Flyweight } = {};

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">initialFlyweights: <span class="hljs-built_in">string</span>[][]</span>) {
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> state <span class="hljs-keyword">of</span> initialFlyweights) {
            <span class="hljs-built_in">this</span>.flyweights[<span class="hljs-built_in">this</span>.getKey(state)] = <span class="hljs-keyword">new</span> Flyweight(state);
        }
    }

    <span class="hljs-keyword">private</span> getKey(state: <span class="hljs-built_in">string</span>[]): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> state.join(<span class="hljs-string">'_'</span>);
    }

    getFlyweight(sharedState: <span class="hljs-built_in">string</span>[]): Flyweight {
        <span class="hljs-keyword">const</span> key = <span class="hljs-built_in">this</span>.getKey(sharedState);

        <span class="hljs-keyword">if</span> (!(key <span class="hljs-keyword">in</span> <span class="hljs-built_in">this</span>.flyweights)) {
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'FlyweightFactory: Can\'t find a flyweight, creating new one.'</span>);
            <span class="hljs-built_in">this</span>.flyweights[key] = <span class="hljs-keyword">new</span> Flyweight(sharedState);
        } <span class="hljs-keyword">else</span> {
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'FlyweightFactory: Reusing existing flyweight.'</span>);
        }

        <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.flyweights[key];
    }
}

<span class="hljs-keyword">const</span> factory = <span class="hljs-keyword">new</span> FlyweightFactory([
    [<span class="hljs-string">'Chevrolet'</span>, <span class="hljs-string">'Camaro2018'</span>, <span class="hljs-string">'pink'</span>],
    [<span class="hljs-string">'Mercedes Benz'</span>, <span class="hljs-string">'C300'</span>, <span class="hljs-string">'black'</span>],
    [<span class="hljs-string">'Mercedes Benz'</span>, <span class="hljs-string">'C500'</span>, <span class="hljs-string">'red'</span>],
]);

<span class="hljs-keyword">const</span> flyweight1 = factory.getFlyweight([<span class="hljs-string">'Chevrolet'</span>, <span class="hljs-string">'Camaro2018'</span>, <span class="hljs-string">'pink'</span>]);
flyweight1.operation([<span class="hljs-string">'John Doe'</span>, <span class="hljs-string">'CL234IR'</span>]);
<span class="hljs-keyword">const</span> flyweight2 = factory.getFlyweight([<span class="hljs-string">'Mercedes Benz'</span>, <span class="hljs-string">'C300'</span>, <span class="hljs-string">'black'</span>]);
flyweight2.operation([<span class="hljs-string">'Jane Doe'</span>, <span class="hljs-string">'CL234IR'</span>]);
</code></pre>
<hr />
<h3 id="heading-12-proxy-pattern">12. <strong>Proxy Pattern</strong></h3>
<p>Provides a surrogate or placeholder for another object to control access to it.</p>
<p><strong>When to use</strong>: When you need a more versatile or sophisticated reference to an object.<br /><strong>Why to use</strong>: To control access and add additional functionality.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Subject {
    request(): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> RealSubject <span class="hljs-keyword">implements</span> Subject {
    request(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'RealSubject: Handling request.'</span>);
    }
}

<span class="hljs-keyword">class</span> <span class="hljs-built_in">Proxy</span> <span class="hljs-keyword">implements</span> Subject {
    <span class="hljs-keyword">private</span> realSubject: RealSubject;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">realSubject: RealSubject</span>) {
        <span class="hljs-built_in">this</span>.realSubject = realSubject;
    }

    request(): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.checkAccess()) {
            <span class="hljs-built_in">this</span>.realSubject.request();
            <span class="hljs-built_in">this</span>.logAccess();
        }
    }

    <span class="hljs-keyword">private</span> checkAccess(): <span class="hljs-built_in">boolean</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Proxy: Checking access prior to firing a real request.'</span>);
        <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
    }

    <span class="hljs-keyword">private</span> logAccess(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Proxy: Logging the time of request.'</span>);
    }
}

<span class="hljs-keyword">const</span> realSubject = <span class="hljs-keyword">new</span> RealSubject();
<span class="hljs-keyword">const</span> proxy = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Proxy</span>(realSubject);
proxy.request(); <span class="hljs-comment">// Proxy: Checking access prior to firing a real request. RealSubject: Handling request. Proxy: Logging the time of request.</span>
</code></pre>
<hr />
<h3 id="heading-13-chain-of-responsibility-pattern">13. <strong>Chain of Responsibility Pattern</strong></h3>
<p>Passes a request along a chain of handlers.</p>
<p><strong>When to use</strong>: When more than one object can handle a request.<br /><strong>Why to use</strong>: To decouple sender and receiver.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Handler {
    setNext(handler: Handler): Handler;
    handle(request: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">abstract</span> <span class="hljs-keyword">class</span> AbstractHandler <span class="hljs-keyword">implements</span> Handler {
    <span class="hljs-keyword">private</span> nextHandler: Handler;

    <span class="hljs-keyword">public</span> setNext(handler: Handler): Handler {
        <span class="hljs-built_in">this</span>.nextHandler = handler;
        <span class="hljs-keyword">return</span> handler;
    }

    <span class="hljs-keyword">public</span> handle(request: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.nextHandler) {
            <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.nextHandler.handle(request);
        }
        <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>;
    }
}

<span class="hljs-keyword">class</span> MonkeyHandler <span class="hljs-keyword">extends</span> AbstractHandler {
    <span class="hljs-keyword">public</span> handle(request: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">if</span> (request === <span class="hljs-string">'Banana'</span>) {
            <span class="hljs-keyword">return</span> <span class="hljs-string">`Monkey: I'll eat the <span class="hljs-subst">${request}</span>.`</span>;
        }
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">super</span>.handle(request);
    }
}

<span class="hljs-keyword">class</span> SquirrelHandler <span class="hljs-keyword">extends</span> AbstractHandler {
    <span class="hljs-keyword">public</span> handle(request: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">if</span> (request === <span class="hljs-string">'Nut'</span>) {
            <span class="hljs-keyword">return</span> <span class="hljs-string">`Squirrel: I'll eat the <span class="hljs-subst">${request}</span>.`</span>;
        }
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">super</span>.handle(request);
    }
}

<span class="hljs-keyword">const</span> monkey = <span class="hljs-keyword">new</span> MonkeyHandler();
<span class="hljs-keyword">const</span> squirrel = <span class="hljs-keyword">new</span> SquirrelHandler();

monkey.setNext(squirrel);

<span class="hljs-built_in">console</span>.log(monkey.handle(<span class="hljs-string">'Banana'</span>)); <span class="hljs-comment">// Monkey: I'll eat the Banana.</span>
<span class="hljs-built_in">console</span>.log(monkey.handle(<span class="hljs-string">'Nut'</span>)); <span class="hljs-comment">// Squirrel: I'll eat the Nut.</span>
</code></pre>
<hr />
<h3 id="heading-14-command-pattern">14. <strong>Command Pattern</strong></h3>
<p>Turns a request into a stand-alone object that contains all information about the request.</p>
<p><strong>When to use</strong>: When you want to parameterize objects with operations.<br /><strong>Why to use</strong>: To encapsulate requests as objects.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Command {
    execute(): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> SimpleCommand <span class="hljs-keyword">implements</span> Command {
    <span class="hljs-keyword">private</span> payload: <span class="hljs-built_in">string</span>;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">payload: <span class="hljs-built_in">string</span></span>) {
        <span class="hljs-built_in">this</span>.payload = payload;
    }

    <span class="hljs-keyword">public</span> execute(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`SimpleCommand: See, I can do simple things like printing (<span class="hljs-subst">${<span class="hljs-built_in">this</span>.payload}</span>)`</span>);
    }
}

<span class="hljs-keyword">class</span> ComplexCommand <span class="hljs-keyword">implements</span> Command {
    <span class="hljs-keyword">private</span> receiver: Receiver;
    <span class="hljs-keyword">private</span> a: <span class="hljs-built_in">string</span>;
    <span class="hljs-keyword">private</span> b: <span class="hljs-built_in">string</span>;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">receiver: Receiver, a: <span class="hljs-built_in">string</span>, b: <span class="hljs-built_in">string</span></span>) {
        <span class="hljs-built_in">this</span>.receiver = receiver;
        <span class="hljs-built_in">this</span>.a = a;
        <span class="hljs-built_in">this</span>.b = b;
    }

    <span class="hljs-keyword">public</span> execute(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ComplexCommand: Complex stuff should be done by a receiver object.'</span>);
        <span class="hljs-built_in">this</span>.receiver.doSomething(<span class="hljs-built_in">this</span>.a);
        <span class="hljs-built_in">this</span>.receiver.doSomethingElse(<span class="hljs-built_in">this</span>.b);
    }
}

<span class="hljs-keyword">class</span> Receiver {
    <span class="hljs-keyword">public</span> doSomething(a: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Receiver: Working on (<span class="hljs-subst">${a}</span>).`</span>);
    }

    <span class="hljs-keyword">public</span> doSomethingElse(b: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Receiver: Also working on (<span class="hljs-subst">${b}</span>).`</span>);
    }
}

<span class="hljs-keyword">class</span> Invoker {
    <span class="hljs-keyword">private</span> onStart: Command;
    <span class="hljs-keyword">private</span> onFinish: Command;

    <span class="hljs-keyword">public</span> setOnStart(command: Command): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.onStart = command;
    }

    <span class="hljs-keyword">public</span> setOnFinish(command: Command): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.onFinish = command;
    }

    <span class="hljs-keyword">public</span> doSomethingImportant(): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.onStart) {
            <span class="hljs-built_in">this</span>.onStart.execute();
        }

        <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.onFinish) {
            <span class="hljs-built_in">this</span>.onFinish.execute();
        }
    }
}

<span class="hljs-keyword">const</span> invoker = <span class="hljs-keyword">new</span> Invoker();
invoker.setOnStart(<span class="hljs-keyword">new</span> SimpleCommand(<span class="hljs-string">'Say Hi!'</span>));
<span class="hljs-keyword">const</span> receiver = <span class="hljs-keyword">new</span> Receiver();
invoker.setOnFinish(<span class="hljs-keyword">new</span> ComplexCommand(receiver, <span class="hljs-string">'Send email'</span>, <span class="hljs-string">'Save report'</span>));

invoker.doSomethingImportant();
</code></pre>
<hr />
<h3 id="heading-15-iterator-pattern">15. <strong>Iterator Pattern</strong></h3>
<p>Provides a way to access elements of a collection sequentially without exposing its underlying representation.</p>
<p><strong>When to use</strong>: When you need to traverse a collection without exposing its implementation.<br /><strong>Why to use</strong>: To provide a standard way to iterate over a collection.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Iterator&lt;T&gt; {
    next(): T;
    hasNext(): <span class="hljs-built_in">boolean</span>;
}

<span class="hljs-keyword">interface</span> Aggregator {
    getIterator(): Iterator&lt;<span class="hljs-built_in">string</span>&gt;;
}

<span class="hljs-keyword">class</span> ConcreteIterator <span class="hljs-keyword">implements</span> Iterator&lt;<span class="hljs-built_in">string</span>&gt; {
    <span class="hljs-keyword">private</span> collection: ConcreteCollection;
    <span class="hljs-keyword">private</span> position: <span class="hljs-built_in">number</span> = <span class="hljs-number">0</span>;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">collection: ConcreteCollection</span>) {
        <span class="hljs-built_in">this</span>.collection = collection;
    }

    <span class="hljs-keyword">public</span> next(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">const</span> item = <span class="hljs-built_in">this</span>.collection.items[<span class="hljs-built_in">this</span>.position];
        <span class="hljs-built_in">this</span>.position += <span class="hljs-number">1</span>;
        <span class="hljs-keyword">return</span> item;
    }

    <span class="hljs-keyword">public</span> hasNext(): <span class="hljs-built_in">boolean</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.position &lt; <span class="hljs-built_in">this</span>.collection.items.length;
    }
}

<span class="hljs-keyword">class</span> ConcreteCollection <span class="hljs-keyword">implements</span> Aggregator {
    <span class="hljs-keyword">public</span> items: <span class="hljs-built_in">string</span>[] = [];

    <span class="hljs-keyword">public</span> getIterator(): Iterator&lt;<span class="hljs-built_in">string</span>&gt; {
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ConcreteIterator(<span class="hljs-built_in">this</span>);
    }
}

<span class="hljs-keyword">const</span> collection = <span class="hljs-keyword">new</span> ConcreteCollection();
collection.items.push(<span class="hljs-string">'Item 1'</span>);
collection.items.push(<span class="hljs-string">'Item 2'</span>);
collection.items.push(<span class="hljs-string">'Item 3'</span>);

<span class="hljs-keyword">const</span> iterator = collection.get

Iterator();
<span class="hljs-keyword">while</span> (iterator.hasNext()) {
    <span class="hljs-built_in">console</span>.log(iterator.next());
}
</code></pre>
<hr />
<h3 id="heading-16-mediator-pattern">16. <strong>Mediator Pattern</strong></h3>
<p>Defines an object that encapsulates how a set of objects interact.</p>
<p><strong>When to use</strong>: When you need to reduce the complexity of communication between objects.<br /><strong>Why to use</strong>: To promote loose coupling by keeping objects from referring to each other explicitly.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Mediator {
    notify(sender: <span class="hljs-built_in">object</span>, event: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> ConcreteMediator <span class="hljs-keyword">implements</span> Mediator {
    <span class="hljs-keyword">private</span> component1: Component1;
    <span class="hljs-keyword">private</span> component2: Component2;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">c1: Component1, c2: Component2</span>) {
        <span class="hljs-built_in">this</span>.component1 = c1;
        <span class="hljs-built_in">this</span>.component1.setMediator(<span class="hljs-built_in">this</span>);
        <span class="hljs-built_in">this</span>.component2 = c2;
        <span class="hljs-built_in">this</span>.component2.setMediator(<span class="hljs-built_in">this</span>);
    }

    <span class="hljs-keyword">public</span> notify(sender: <span class="hljs-built_in">object</span>, event: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">if</span> (event === <span class="hljs-string">'A'</span>) {
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Mediator reacts on A and triggers following operations:'</span>);
            <span class="hljs-built_in">this</span>.component2.doC();
        }

        <span class="hljs-keyword">if</span> (event === <span class="hljs-string">'D'</span>) {
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Mediator reacts on D and triggers following operations:'</span>);
            <span class="hljs-built_in">this</span>.component1.doB();
            <span class="hljs-built_in">this</span>.component2.doC();
        }
    }
}

<span class="hljs-keyword">class</span> BaseComponent {
    <span class="hljs-keyword">protected</span> mediator: Mediator;

    <span class="hljs-keyword">public</span> setMediator(mediator: Mediator): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.mediator = mediator;
    }
}

<span class="hljs-keyword">class</span> Component1 <span class="hljs-keyword">extends</span> BaseComponent {
    <span class="hljs-keyword">public</span> doA(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Component 1 does A.'</span>);
        <span class="hljs-built_in">this</span>.mediator.notify(<span class="hljs-built_in">this</span>, <span class="hljs-string">'A'</span>);
    }

    <span class="hljs-keyword">public</span> doB(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Component 1 does B.'</span>);
        <span class="hljs-built_in">this</span>.mediator.notify(<span class="hljs-built_in">this</span>, <span class="hljs-string">'B'</span>);
    }
}

<span class="hljs-keyword">class</span> Component2 <span class="hljs-keyword">extends</span> BaseComponent {
    <span class="hljs-keyword">public</span> doC(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Component 2 does C.'</span>);
        <span class="hljs-built_in">this</span>.mediator.notify(<span class="hljs-built_in">this</span>, <span class="hljs-string">'C'</span>);
    }

    <span class="hljs-keyword">public</span> doD(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Component 2 does D.'</span>);
        <span class="hljs-built_in">this</span>.mediator.notify(<span class="hljs-built_in">this</span>, <span class="hljs-string">'D'</span>);
    }
}

<span class="hljs-keyword">const</span> c1 = <span class="hljs-keyword">new</span> Component1();
<span class="hljs-keyword">const</span> c2 = <span class="hljs-keyword">new</span> Component2();
<span class="hljs-keyword">const</span> mediator = <span class="hljs-keyword">new</span> ConcreteMediator(c1, c2);

c1.doA();
c2.doD();
</code></pre>
<hr />
<h3 id="heading-17-memento-pattern">17. <strong>Memento Pattern</strong></h3>
<p>Captures and externalizes an object's internal state without violating encapsulation, so the object can be restored to this state later.</p>
<p><strong>When to use</strong>: When you need to restore an object to a previous state.<br /><strong>Why to use</strong>: To provide the ability to restore an object to its previous state.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Memento {
    <span class="hljs-keyword">private</span> state: <span class="hljs-built_in">string</span>;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">state: <span class="hljs-built_in">string</span></span>) {
        <span class="hljs-built_in">this</span>.state = state;
    }

    <span class="hljs-keyword">public</span> getState(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.state;
    }
}

<span class="hljs-keyword">class</span> Originator {
    <span class="hljs-keyword">private</span> state: <span class="hljs-built_in">string</span>;

    <span class="hljs-keyword">public</span> setState(state: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Originator: Setting state to <span class="hljs-subst">${state}</span>`</span>);
        <span class="hljs-built_in">this</span>.state = state;
    }

    <span class="hljs-keyword">public</span> save(): Memento {
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> Memento(<span class="hljs-built_in">this</span>.state);
    }

    <span class="hljs-keyword">public</span> restore(memento: Memento): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.state = memento.getState();
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Originator: State after restoring from Memento: <span class="hljs-subst">${<span class="hljs-built_in">this</span>.state}</span>`</span>);
    }
}

<span class="hljs-keyword">class</span> Caretaker {
    <span class="hljs-keyword">private</span> mementos: Memento[] = [];
    <span class="hljs-keyword">private</span> originator: Originator;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">originator: Originator</span>) {
        <span class="hljs-built_in">this</span>.originator = originator;
    }

    <span class="hljs-keyword">public</span> backup(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Caretaker: Saving Originator\'s state...'</span>);
        <span class="hljs-built_in">this</span>.mementos.push(<span class="hljs-built_in">this</span>.originator.save());
    }

    <span class="hljs-keyword">public</span> undo(): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">if</span> (!<span class="hljs-built_in">this</span>.mementos.length) {
            <span class="hljs-keyword">return</span>;
        }
        <span class="hljs-keyword">const</span> memento = <span class="hljs-built_in">this</span>.mementos.pop();
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Caretaker: Restoring state to:'</span>, memento.getState());
        <span class="hljs-built_in">this</span>.originator.restore(memento);
    }
}

<span class="hljs-keyword">const</span> originator = <span class="hljs-keyword">new</span> Originator();
<span class="hljs-keyword">const</span> caretaker = <span class="hljs-keyword">new</span> Caretaker(originator);

originator.setState(<span class="hljs-string">'State1'</span>);
caretaker.backup();
originator.setState(<span class="hljs-string">'State2'</span>);
caretaker.backup();
originator.setState(<span class="hljs-string">'State3'</span>);

caretaker.undo(); <span class="hljs-comment">// Caretaker: Restoring state to: State2</span>
caretaker.undo(); <span class="hljs-comment">// Caretaker: Restoring state to: State1</span>
</code></pre>
<hr />
<h3 id="heading-18-observer-pattern">18. <strong>Observer Pattern</strong></h3>
<p>Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.</p>
<p><strong>When to use</strong>: When you need many other objects to receive an update when another object changes.<br /><strong>Why to use</strong>: To allow a single object to notify multiple other objects about changes in its state.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Observer {
    update(subject: Subject): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> ConcreteObserverA <span class="hljs-keyword">implements</span> Observer {
    <span class="hljs-keyword">public</span> update(subject: Subject): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">if</span> (subject.state &lt; <span class="hljs-number">3</span>) {
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteObserverA: Reacted to the event.'</span>);
        }
    }
}

<span class="hljs-keyword">class</span> ConcreteObserverB <span class="hljs-keyword">implements</span> Observer {
    <span class="hljs-keyword">public</span> update(subject: Subject): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">if</span> (subject.state === <span class="hljs-number">0</span> || subject.state &gt;= <span class="hljs-number">2</span>) {
            <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteObserverB: Reacted to the event.'</span>);
        }
    }
}

<span class="hljs-keyword">class</span> Subject {
    <span class="hljs-keyword">public</span> state: <span class="hljs-built_in">number</span>;
    <span class="hljs-keyword">private</span> observers: Observer[] = [];

    <span class="hljs-keyword">public</span> attach(observer: Observer): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">const</span> isExist = <span class="hljs-built_in">this</span>.observers.includes(observer);
        <span class="hljs-keyword">if</span> (isExist) {
            <span class="hljs-keyword">return</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Subject: Observer has been attached already.'</span>);
        }
        <span class="hljs-built_in">this</span>.observers.push(observer);
    }

    <span class="hljs-keyword">public</span> detach(observer: Observer): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">const</span> observerIndex = <span class="hljs-built_in">this</span>.observers.indexOf(observer);
        <span class="hljs-keyword">if</span> (observerIndex === <span class="hljs-number">-1</span>) {
            <span class="hljs-keyword">return</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Subject: Nonexistent observer.'</span>);
        }
        <span class="hljs-built_in">this</span>.observers.splice(observerIndex, <span class="hljs-number">1</span>);
    }

    <span class="hljs-keyword">public</span> notify(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Subject: Notifying observers...'</span>);
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> observer <span class="hljs-keyword">of</span> <span class="hljs-built_in">this</span>.observers) {
            observer.update(<span class="hljs-built_in">this</span>);
        }
    }

    <span class="hljs-keyword">public</span> someBusinessLogic(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Subject: I\'m doing something important.'</span>);
        <span class="hljs-built_in">this</span>.state = <span class="hljs-built_in">Math</span>.floor(<span class="hljs-built_in">Math</span>.random() * <span class="hljs-number">10</span>);
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Subject: My state has just changed to: <span class="hljs-subst">${<span class="hljs-built_in">this</span>.state}</span>`</span>);
        <span class="hljs-built_in">this</span>.notify();
    }
}

<span class="hljs-keyword">const</span> subject = <span class="hljs-keyword">new</span> Subject();

<span class="hljs-keyword">const</span> observer1 = <span class="hljs-keyword">new</span> ConcreteObserverA();
subject.attach(observer1);

<span class="hljs-keyword">const</span> observer2 = <span class="hljs-keyword">new</span> ConcreteObserverB();
subject.attach(observer2);

subject.someBusinessLogic();
subject.someBusinessLogic();
</code></pre>
<hr />
<h3 id="heading-19-state-pattern">19. <strong>State Pattern</strong></h3>
<p>Allows an object to alter its behavior when its internal state changes. The object will appear to change its class.</p>
<p><strong>When to use</strong>: When an object must change its behavior at runtime depending on its state.<br /><strong>Why to use</strong>: To simplify state-specific behavior and transitions.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> Context {
    <span class="hljs-keyword">private</span> state: State;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">state: State</span>) {
        <span class="hljs-built_in">this</span>.transitionTo(state);
    }

    <span class="hljs-keyword">public</span> transitionTo(state: State): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Context: Transition to <span class="hljs-subst">${(&lt;<span class="hljs-built_in">any</span>&gt;state).constructor.name}</span>.`</span>);
        <span class="hljs-built_in">this</span>.state = state;
        <span class="hljs-built_in">this</span>.state.setContext(<span class="hljs-built_in">this</span>);
    }

    <span class="hljs-keyword">public</span> request1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.state.handle1();
    }

    <span class="hljs-keyword">public</span> request2(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.state.handle2();
    }
}

<span class="hljs-keyword">abstract</span> <span class="hljs-keyword">class</span> State {
    <span class="hljs-keyword">protected</span> context: Context;

    <span class="hljs-keyword">public</span> setContext(context: Context) {
        <span class="hljs-built_in">this</span>.context = context;
    }

    <span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> handle1(): <span class="hljs-built_in">void</span>;
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> handle2(): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> ConcreteStateA <span class="hljs-keyword">extends</span> State {
    <span class="hljs-keyword">public</span> handle1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteStateA handles request1.'</span>);
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteStateA wants to change the state of the context.'</span>);
        <span class="hljs-built_in">this</span>.context.transitionTo(<span class="hljs-keyword">new</span> ConcreteStateB());
    }

    <span class="hljs-keyword">public</span> handle2(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteStateA handles request2.'</span>);
    }
}

<span class="hljs-keyword">class</span> ConcreteStateB <span class="hljs-keyword">extends</span> State {
    <span class="hljs-keyword">public</span> handle1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteStateB handles request1.'</span>);
    }

    <span class="hljs-keyword">public</span> handle2(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteStateB handles request2.'</span>);
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteStateB wants to change the state of the context.'</span>);
        <span class="hljs-built_in">this</span>.context.transitionTo(<span class="hljs-keyword">new</span> ConcreteStateA());
    }
}

<span class="hljs-keyword">const</span> context = <span class="hljs-keyword">new</span> Context(<span class="hljs-keyword">new</span> ConcreteStateA());
context.request1();
context.request2();
</code></pre>
<hr />
<h3 id="heading-20-strategy-pattern">20. <strong>Strategy Pattern</strong></h3>
<p>Defines a family of algorithms, encapsulates each one, and makes them interchangeable. </p>
<p><strong>When to use</strong>: When you have multiple algorithms for a specific task and you want to switch between them at runtime.<br /><strong>Why to use</strong>: To choose the appropriate algorithm at runtime.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Strategy {
    doAlgorithm(data: <span class="hljs-built_in">string</span>[]): <span class="hljs-built_in">string</span>[];
}

<span class="hljs-keyword">class</span> ConcreteStrategyA <span class="hljs-keyword">implements</span> Strategy {
    <span class="hljs-keyword">public</span> doAlgorithm(data: <span class="hljs-built_in">string</span>[]): <span class="hljs-built_in">string</span>[] {
        <span class="hljs-keyword">return</span> data.sort();
    }
}

<span class="hljs-keyword">class</span> ConcreteStrategyB <span class="hljs-keyword">implements</span> Strategy {
    <span class="hljs-keyword">public</span> doAlgorithm(data: <span class="hljs-built_in">string</span>[]): <span class="hljs-built_in">string</span>[] {
        <span class="hljs-keyword">return</span> data.reverse();
    }
}

<span class="hljs-keyword">class</span> Context {
    <span class="hljs-keyword">private</span> strategy: Strategy;

    <span class="hljs-keyword">constructor</span>(<span class="hljs-params">strategy: Strategy</span>) {
        <span class="hljs-built_in">this</span>.strategy = strategy;
    }

    <span class="hljs-keyword">public</span> setStrategy(strategy: Strategy) {
        <span class="hljs-built_in">this</span>.strategy = strategy;
    }

    <span class="hljs-keyword">public</span> doSomeBusinessLogic(): <span class="hljs-built_in">void</span> {
        <span class="hljs-keyword">const</span> result = <span class="hljs-built_in">this</span>.strategy.doAlgorithm([<span class="hljs-string">'a'</span>, <span class="hljs-string">'b'</span>, <span class="hljs-string">'c'</span>, <span class="hljs-string">'d'</span>, <span class="hljs-string">'e'</span>]);
        <span class="hljs-built_in">console</span>.log(result.join(<span class="hljs-string">','</span>));
    }
}

<span class="hljs-keyword">const</span> context = <span class="hljs-keyword">new</span> Context(<span class="hljs-keyword">new</span> ConcreteStrategyA());
context.doSomeBusinessLogic(); <span class="hljs-comment">// a,b,c,d,e</span>

context.setStrategy(<span class="hljs-keyword">new</span> ConcreteStrategyB());
context.doSomeBusinessLogic(); <span class="hljs-comment">// e,d,c,b,a</span>
</code></pre>
<hr />
<h3 id="heading-21-template-method-pattern">21. <strong>Template Method Pattern</strong></h3>
<p>Defines the skeleton of an algorithm in a method, deferring some steps to subclasses.</p>
<p><strong>When to use</strong>: When you want to let subclasses redefine certain steps of an algorithm without changing its structure</p>
<p>.<br /><strong>Why to use</strong>: To prevent code duplication and ensure the algorithm's structure stays unchanged.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">abstract</span> <span class="hljs-keyword">class</span> AbstractClass {
    <span class="hljs-keyword">public</span> templateMethod(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">this</span>.baseOperation1();
        <span class="hljs-built_in">this</span>.requiredOperations1();
        <span class="hljs-built_in">this</span>.baseOperation2();
        <span class="hljs-built_in">this</span>.hook1();
        <span class="hljs-built_in">this</span>.requiredOperations2();
        <span class="hljs-built_in">this</span>.baseOperation3();
        <span class="hljs-built_in">this</span>.hook2();
    }

    <span class="hljs-keyword">protected</span> baseOperation1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'AbstractClass says: I am doing the bulk of the work'</span>);
    }

    <span class="hljs-keyword">protected</span> baseOperation2(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'AbstractClass says: But I let subclasses override some operations'</span>);
    }

    <span class="hljs-keyword">protected</span> baseOperation3(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'AbstractClass says: But I am doing the bulk of the work anyway'</span>);
    }

    <span class="hljs-keyword">protected</span> <span class="hljs-keyword">abstract</span> requiredOperations1(): <span class="hljs-built_in">void</span>;
    <span class="hljs-keyword">protected</span> <span class="hljs-keyword">abstract</span> requiredOperations2(): <span class="hljs-built_in">void</span>;

    <span class="hljs-keyword">protected</span> hook1(): <span class="hljs-built_in">void</span> { }
    <span class="hljs-keyword">protected</span> hook2(): <span class="hljs-built_in">void</span> { }
}

<span class="hljs-keyword">class</span> ConcreteClass1 <span class="hljs-keyword">extends</span> AbstractClass {
    <span class="hljs-keyword">protected</span> requiredOperations1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteClass1 says: Implemented Operation1'</span>);
    }

    <span class="hljs-keyword">protected</span> requiredOperations2(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteClass1 says: Implemented Operation2'</span>);
    }
}

<span class="hljs-keyword">class</span> ConcreteClass2 <span class="hljs-keyword">extends</span> AbstractClass {
    <span class="hljs-keyword">protected</span> requiredOperations1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteClass2 says: Implemented Operation1'</span>);
    }

    <span class="hljs-keyword">protected</span> requiredOperations2(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteClass2 says: Implemented Operation2'</span>);
    }

    <span class="hljs-keyword">protected</span> hook1(): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'ConcreteClass2 says: Overridden Hook1'</span>);
    }
}

<span class="hljs-keyword">const</span> concreteClass1 = <span class="hljs-keyword">new</span> ConcreteClass1();
concreteClass1.templateMethod();

<span class="hljs-keyword">const</span> concreteClass2 = <span class="hljs-keyword">new</span> ConcreteClass2();
concreteClass2.templateMethod();
</code></pre>
<hr />
<h3 id="heading-22-visitor-pattern">22. <strong>Visitor Pattern</strong></h3>
<p>Lets you separate algorithms from the objects on which they operate.</p>
<p><strong>When to use</strong>: When you need to perform operations across a heterogeneous collection of objects.<br /><strong>Why to use</strong>: To avoid polluting object classes with unrelated behaviors.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Visitor {
    visitConcreteComponentA(element: ConcreteComponentA): <span class="hljs-built_in">void</span>;
    visitConcreteComponentB(element: ConcreteComponentB): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> ConcreteVisitor1 <span class="hljs-keyword">implements</span> Visitor {
    <span class="hljs-keyword">public</span> visitConcreteComponentA(element: ConcreteComponentA): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${element.exclusiveMethodOfConcreteComponentA()}</span> + ConcreteVisitor1`</span>);
    }

    <span class="hljs-keyword">public</span> visitConcreteComponentB(element: ConcreteComponentB): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${element.specialMethodOfConcreteComponentB()}</span> + ConcreteVisitor1`</span>);
    }
}

<span class="hljs-keyword">class</span> ConcreteVisitor2 <span class="hljs-keyword">implements</span> Visitor {
    <span class="hljs-keyword">public</span> visitConcreteComponentA(element: ConcreteComponentA): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${element.exclusiveMethodOfConcreteComponentA()}</span> + ConcreteVisitor2`</span>);
    }

    <span class="hljs-keyword">public</span> visitConcreteComponentB(element: ConcreteComponentB): <span class="hljs-built_in">void</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${element.specialMethodOfConcreteComponentB()}</span> + ConcreteVisitor2`</span>);
    }
}

<span class="hljs-keyword">interface</span> Component {
    accept(visitor: Visitor): <span class="hljs-built_in">void</span>;
}

<span class="hljs-keyword">class</span> ConcreteComponentA <span class="hljs-keyword">implements</span> Component {
    <span class="hljs-keyword">public</span> accept(visitor: Visitor): <span class="hljs-built_in">void</span> {
        visitor.visitConcreteComponentA(<span class="hljs-built_in">this</span>);
    }

    <span class="hljs-keyword">public</span> exclusiveMethodOfConcreteComponentA(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'A'</span>;
    }
}

<span class="hljs-keyword">class</span> ConcreteComponentB <span class="hljs-keyword">implements</span> Component {
    <span class="hljs-keyword">public</span> accept(visitor: Visitor): <span class="hljs-built_in">void</span> {
        visitor.visitConcreteComponentB(<span class="hljs-built_in">this</span>);
    }

    <span class="hljs-keyword">public</span> specialMethodOfConcreteComponentB(): <span class="hljs-built_in">string</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-string">'B'</span>;
    }
}

<span class="hljs-keyword">const</span> components = [<span class="hljs-keyword">new</span> ConcreteComponentA(), <span class="hljs-keyword">new</span> ConcreteComponentB()];

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'The client code works with all visitors via the base Visitor interface:'</span>);
<span class="hljs-keyword">const</span> visitor1 = <span class="hljs-keyword">new</span> ConcreteVisitor1();
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> component <span class="hljs-keyword">of</span> components) {
    component.accept(visitor1);
}

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'It allows the same client code to work with different types of visitors:'</span>);
<span class="hljs-keyword">const</span> visitor2 = <span class="hljs-keyword">new</span> ConcreteVisitor2();
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> component <span class="hljs-keyword">of</span> components) {
    component.accept(visitor2);
}
</code></pre>
]]></content:encoded></item><item><title><![CDATA[How I Study While Working Full-Time]]></title><description><![CDATA[I’m working full-time as a software engineer and studying for a bachelor’s degree in computer science at Green University of Bangladesh. A lot of people wonder how I manage to do both. I’ll explain the how in this post.
Decision
I’ve been working ful...]]></description><link>https://blog.nurulhudaapon.com/study-while-working-full-time</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/study-while-working-full-time</guid><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Mon, 15 May 2023 07:51:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1718440293832/e1207b01-6304-40fd-90e6-0d27e1c62d0c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I’m working full-time as a software engineer and studying for a bachelor’s degree in computer science at Green University of Bangladesh. A lot of people wonder how I manage to do both. I’ll explain the how in this post.</p>
<h3 id="heading-decision">Decision</h3>
<p>I’ve been working full-time even before I enrolled for a bachelor’s degree so I was a little skeptical whether I can manage both. But I decided to give it a try anyway and go part-time at work if I can’t manage both. I’m glad I did because I didn’t want to miss out on the experience of studying at a university.</p>
<h3 id="heading-is-it-possible">Is it possible?</h3>
<p>It is certainly possible just a little hard to do well at both. I chose to prioritize my work over my study. Luckily my work is related to my study so most core courses are easy for me to get good grades without needing to study. On non-core courses, I just attend classes that are enough to pass the exam.</p>
<h3 id="heading-schedule">Schedule</h3>
<p>The schedule I follow is tight but not crazy. I attend classes during the day time and work at night. I also try to get some work or sleep done during class breaks and/or class time. 😀</p>
<ul>
<li>08:00 AM — Wake up</li>
<li>08:00 AM — Get ready, breakfast, etc.</li>
<li>09:00 AM — Classes</li>
<li>12:30 PM — Lunch + Work</li>
<li>02:00 PM — Classes</li>
<li>05:00 PM — Break</li>
<li>06:00 PM — Work</li>
<li>02:00 AM — Sleep</li>
</ul>
<p><strong>Takeaways</strong></p>
<ul>
<li>Use time wisely</li>
<li>Make use of class breaks</li>
</ul>
<p><strong>The Don’ts</strong></p>
<ul>
<li>Don’t waste time</li>
<li>Don’t procrastinate</li>
<li>Don’t skip classes</li>
<li>Don’t skip work</li>
</ul>
<h3 id="heading-study">Study</h3>
<p>You don’t have to study every day to do well at university but make sure you are attending classes and doing assignments and projects as these can make a big difference in your grade. I usually study on weekends if I think I need to for a particular course to get a passing grade. So a few things to keep in mind:</p>
<p><strong>Takeaways</strong></p>
<ul>
<li>Attend classes</li>
<li>Do assignments and projects</li>
<li>Study on weekends</li>
</ul>
<h3 id="heading-work">Work</h3>
<p>My main work schedule is from afternoon to midnight but I work throughout the day whenever I get a chance to keep ahead of my work schedule so that I can sleep early and get enough rest otherwise I’ll have to sleep during class. At work, most of my time is spent on communicating requirements, learning new technologies, coding, and screaming when I can get out of a bug 😂.</p>
<h3 id="heading-offloading-things">Offloading Things</h3>
<p>I try my best to offload or remove things that don’t need to be done by me or don’t align with my goals. For example, I don’t eat food at all to save time just kidding I just don’t do things that are not a must.</p>
<h3 id="heading-social-life">Social Life</h3>
<p>You may wonder after all of this I don’t have any time left for social life. Well, I don’t have much time every day but I do have time on weekends and I try my best to communicate with classmates on social media, spend time with family and friends, and go out on weekends. So I don’t feel like I’m missing out on anything. And yeah it makes my weekends the busiest days of the week.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>I just shared my experience, it doesn’t mean you have to do the same. But I must say that just go above and beyond your limit, you don’t even know what you can do. And don’t forget to have fun along the way. 😊</p>
]]></content:encoded></item><item><title><![CDATA[Learn to Type Fast]]></title><description><![CDATA[Typing fast is really important in todays digital world where most of the communication happens through text. It is also important for being productive and efficient at work or school.
Here are some basic tips to begin typing fast:

Learn to use all ...]]></description><link>https://blog.nurulhudaapon.com/learn-typing-fast</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/learn-typing-fast</guid><category><![CDATA[keyboard]]></category><category><![CDATA[typing]]></category><category><![CDATA[speed]]></category><category><![CDATA[fast typing]]></category><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Sun, 30 Apr 2023 10:41:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1730531090966/7a5cdc4d-7cd7-42d7-9193-69bc4a175d05.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Typing fast is really important in todays digital world where most of the communication happens through text. It is also important for being productive and efficient at work or school.</p>
<p><strong>Here are some basic tips to begin typing fast:</strong></p>
<ul>
<li><p>Learn to use all 10 fingers while typing. (this is called touch typing)</p>
</li>
<li><p>Use a better keyboard. (mechanical keyboards are preferable)</p>
</li>
<li><p>Practice, practice, practice.</p>
</li>
</ul>
<h4 id="heading-touch-typing">Touch Typing</h4>
<p>If you haven’t learn touch typing yet or you know but doesn’t feel comfortable with it, I know the feeling it is hard to get to start feeling comfortable unless you get out of your comfort zone and start practicing. I have been there and I know how it feels but you will eventually start feeling comfortable after few weeks of practice.</p>
<p><strong>Here are some resources to learn touch typing:</strong></p>
<ul>
<li><p><a target="_blank" href="https://www.typingclub.com/">Typing Club</a></p>
</li>
<li><p><a target="_blank" href="https://www.rapidtyping.com/">Rapid Typing</a></p>
</li>
<li><p><a target="_blank" href="https://www.keybr.com/">Keybr</a></p>
</li>
</ul>
<p>You can try them all and see which one works best for you. I personally like Rapid Typing because it has a lot of lessons and it is free.</p>
<h4 id="heading-keyboard">Keyboard</h4>
<p>Keyboard does affect your typing speed a bit. If you are a student, programmer, gamer or anyone who types a lot, I would recommend you to get a mechanical keyboard because they are more compfortable and durable.</p>
<p><strong>Here are some mechanical keyboards that I loved using:</strong></p>
<ul>
<li><p><a target="_blank" href="https://www.keychron.com/products/keychron-k2-pro-qmk-via-wireless-mechanical-keyboard">Keychron K2 Pro</a></p>
</li>
<li><p><a target="_blank" href="https://www.keychron.com/products/keychron-k2-wireless-mechanical-keyboard">Keychron K2</a></p>
</li>
<li><p><a target="_blank" href="https://www.keychron.com/products/keychron-k6-wireless-mechanical-keyboard">Keychron K6</a></p>
</li>
<li><p><a target="_blank" href="https://www.techlandbd.com/rk-royal-kludge-rk84-keyboard-red">RK Royal Kludge RK84</a></p>
</li>
</ul>
<p>I personally like simpler design and smaller keyboard as I can carry them in my backpack, I use Keychron K2 for that reason. but you can choose any keyboard that you like.</p>
<h4 id="heading-practice">Practice</h4>
<p>Practice is the key to building muscle memory and getting comfortable and fast at typing. You don’t have to practice for hours, just 5–10 minutes a day is enough. You can practice while chatting with your friends, writing for work/school or anything that involves typing.</p>
<p><strong>Here are some resources to practice typing:</strong></p>
<ul>
<li><p><a target="_blank" href="https://monkeytype.com/">Monkeytype</a></p>
</li>
<li><p><a target="_blank" href="https://www.typing.com/student">Typing.com</a></p>
</li>
</ul>
<p>Monkeytype is my favorite typing practice website because it is simple and has very modern design. You can also practice typing code with it.</p>
<h4 id="heading-conclusion">Conclusion</h4>
<p>I’m 100% sure that if you start typing faster it will make you more productive personal overall. So why not plan and begin practice typing from today?</p>
]]></content:encoded></item><item><title><![CDATA[Tips on Staying Focused 🧘]]></title><description><![CDATA[Doing things with full focus is really important. Here are some tips that I use to stay focused which might be helpful for you as well.
Remove Distraction
Distraction is something that breaks your focus, so it’s important to remove distractions. Here...]]></description><link>https://blog.nurulhudaapon.com/stay-focused</link><guid isPermaLink="true">https://blog.nurulhudaapon.com/stay-focused</guid><dc:creator><![CDATA[Nurul Huda (Apon)]]></dc:creator><pubDate>Fri, 28 Apr 2023 15:40:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1718440287335/19c9c88f-2747-4ad7-92c8-accd51ce9a50.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Doing things with full focus is really important. Here are some tips that I use to stay focused which might be helpful for you as well.</p>
<h3 id="heading-remove-distraction">Remove Distraction</h3>
<p>Distraction is something that breaks your focus, so it’s important to remove distractions. Here are some tools and tips to help you remove distraction.</p>
<p><strong>Tools</strong></p>
<ul>
<li><a target="_blank" href="https://chrome.google.com/webstore/detail/news-feed-eradicator/fjcldmjmjhkklehbacihaiopjklihlgg?hl=en">News Feed Eradicator — Browser Extension</a></li>
<li><a target="_blank" href="https://chromewebstore.google.com/detail/esuit-ad-blocker-for-face/jkbklfkombochacjoeagggbiohipcbaj">ESUIT — Browser Extension</a></li>
<li><a target="_blank" href="https://play.google.com/store/apps/details?id=com.google.android.apps.wellbeing&amp;hl=en&amp;gl=US&amp;pli=1">Digital Wellbeing — Android</a></li>
<li><a target="_blank" href="https://apps.apple.com/us/app/screen-time/id1232823066">Screen Time — iOS</a></li>
</ul>
<p>Use News Feed Eradicator to remove the news feed from Facebook. This will help you focus on the things that matter. Digital Wellbeing/Screen Time is a tool that helps you monitor your phone usage. It will help you see how much time you spend on your phone and how much time you spend on each app. This will help you see how much time you spend on social media and other distractions. Also using Digital Wellbeing you can turn on focus mode where certain apps will be blocked for a certain amount of time.</p>
<h3 id="heading-the-dos-and-donts"><strong>The do’s and don’ts</strong></h3>
<p><strong>The don’ts</strong></p>
<ul>
<li>Don’t play videos on Facebook because the algorithm is designed to keep you on the app longer and play more videos.</li>
<li>Don’t use the native Facebook app but the web version (facebook.com) if you really need to use Facebook app then keep notifications off.</li>
</ul>
<p><strong>The Do’s</strong></p>
<ul>
<li>Prefer to use a single social media platform.</li>
<li>Keep your phone away from you when you are working on things that matter.</li>
<li>Set a time limit for social media.</li>
</ul>
<h3 id="heading-focus-on-one-thing-at-a-time">Focus on one thing at a time</h3>
<p>Multitasking seems very productive but it’s not. But from my experience finishing one thing at a time then moving to the next thing is more productive. Here are some tips to help you focus on one thing at a time.</p>
<h3 id="heading-the-dos-and-donts-1">The do’s and don’ts</h3>
<p><strong>The don’ts</strong></p>
<ul>
<li>Don’t jump from one task to another unless it’s an emergency.</li>
</ul>
<p><strong>The Do’s</strong></p>
<ul>
<li>Focus on one thing at a time.</li>
<li>Set a timer for 25 minutes and work on one thing for 25 minutes and then take a 5 minute break.</li>
<li>Use the Pomodoro technique.</li>
</ul>
<h3 id="heading-in-conclusion">In conclusion</h3>
<p>Removing distractions and staying focused is essential for achieving success in today’s fast-paced world. The tips I shared in this article might be helpful for you with some tweaks based on your preferences.</p>
]]></content:encoded></item></channel></rss>