<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Inderjit Shahi on Medium]]></title>
        <description><![CDATA[Stories by Inderjit Shahi on Medium]]></description>
        <link>https://medium.com/@inderjeetkmcs?source=rss-7662711bbea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oXpxWPkfG-CKrkNRXYSklQ.jpeg</url>
            <title>Stories by Inderjit Shahi on Medium</title>
            <link>https://medium.com/@inderjeetkmcs?source=rss-7662711bbea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:44:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@inderjeetkmcs/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Designing a Parking Lot System in C++: My First Low-Level Design Journey]]></title>
            <link>https://medium.com/@inderjeetkmcs/designing-a-parking-lot-system-in-c-my-first-low-level-design-journey-548da0d28b0b?source=rss-7662711bbea------2</link>
            <guid isPermaLink="false">https://medium.com/p/548da0d28b0b</guid>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[low-level-design]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Inderjit Shahi]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 07:04:43 GMT</pubDate>
            <atom:updated>2026-01-12T07:19:50.092Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This article may be short, but this a long journey of unlearning and growth. Moving from functional approach of JavaScript to object oriented principles with C++, has shifted my view — how I view software. From just defining the functions to architecting them. I tried to avoid over-engineering while focusing on extensibility, ownership and clarity.</p><h3>Problem Statement</h3><p>We are designing a Parking-Lot with following requirements;</p><p>Multiple floors</p><p>Multiple vehicle types</p><p>Pricing and Payment abstraction</p><p>Concurrency handling</p><p>Ticket based entry/exit</p><h3>Design Philosophy — The Start</h3><p>I began with Separating the stable entities(Objects) and Changeable(Strategies) and avoid one God class. Focusing on extensibility without modifying the existing structure should be the priority (<strong>Open/Closed Principle</strong>). Composition over inheritance gives clear <strong>lifecycle management</strong> avoiding dangling pointers and <strong>explicit ownership</strong>.</p><p><strong>Entities </strong>→ Stable (Vehicle, Spot, Ticket)<br><strong>Strategies </strong>→ Changeable (Pricing, Payment)<br><strong>Orchestrator </strong>→ Flow controller (ParkingLot)</p><h3>Core Entities</h3><ol><li><strong>Vehicle</strong></li></ol><p>Just simple data holder, know what it is but not how much pays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2kC66bzDyZSgte8nhiYIfQ.png" /><figcaption>Vehicle class- simple data object</figcaption></figure><p><strong>2. ParkingSpot</strong></p><p>Knows which type of vehicle it can accommodate and it is already occupied. Since ParkingSpot is a physical attribute of ParkingFloor, ParkingSpot must cease to exist<strong> </strong>with ParkingFloor, i.e. ParkingSpot is owned by ParkingFloor, <strong>the composition</strong>.</p><p><strong>3. ParkingFloor</strong></p><p>Owns ParkingSpots, finds the available spot for a vehicle type. Don’t know about payment or ticket (<strong>Separation of Responsibility</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZBfJjK2pQEOfSIL3pSfQQ.png" /><figcaption>ParkingFloor class</figcaption></figure><p><strong>4. Ticket</strong></p><p>The Ticket handles entry and exit timings while mapping a Vehicle to a specific ParkingSpot. Crucially, the Ticket accesses the ParkingSpot via a <strong>raw pointer</strong>. It does not own the spot; it simply references it. Since the ParkingSpot has a single-point lifecycle managed by the ParkingFloor, the ticket acts as a temporary observer rather than an owner.</p><p><strong>5. Strategy Pattern — Pricing &amp; Payment</strong></p><p>I defined a common interface/abstract for pricing and payment. This gives liberty to add any payment method or pricing method inheriting from common interface. Giving access to use same interface pointer with different strategies at runtime, the polymorphism. Hence we can add new payment methods and pricing strategies without modifying the existing ones and can change the strategies at runtime by using the same base class pointer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*C40J7mY8kyg7QyT7YXgKxg.png" /><figcaption>Strategy patten for payments following DIP and OCP principles</figcaption></figure><p><strong>6. ParkingLot — The Orchestrator</strong></p><p>This is the manager of the systems. Owns the active tickets as Tickets have no meaning without the ParkingLot itself. Coordinates payments, parking allotments etc. but doesn&#39;t own the business logic itself. I don’t made ParkingLot a single God class with singleton pattern because that would tightly couple, make testing difficult and will violate the OCP and SRP principles.</p><p><strong>7. Memory Management and Concurrency Control</strong></p><p>I am using:</p><p><strong>unique_ptr</strong>: for single ownership, ParkingSpot, ParkingFloor, Tickets</p><p><strong>shared_ptr</strong>: shared access, vehicle</p><p>raw<strong> </strong>pointer: no-owning reference</p><p>for <strong>concurrency control,</strong> we are using mutex at <strong>global-level</strong> in ParkingLot which locks all floors at once, but we can move this to <strong>floor-level</strong> at ParkingFloor which allows each floor work independently.</p><p><strong>8. Simple Workflow</strong></p><ol><li>Vehicle arrives</li><li>Spot allocated</li><li>Ticket generated</li><li>Time passes</li><li>Vehicle exits</li><li>Pricing calculated</li><li>Payment done</li><li>Spot freed</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*4MqEdgm9RgLn8aSvpOyvBQ.png" /><figcaption>The workflow</figcaption></figure><h3>What I Learned</h3><p>Low level designing or architecting a software is not about huge codebase, its about <strong>lifecycle-management</strong>, that where to inherit and where to own. Its about defining the <strong>extensibility </strong>without modifying the already written codebase. Its about giving each class its <strong>well defined responsibility</strong> without making a single God class. Its about making the software <strong>testable </strong>with increasing complexities. <strong>And more than all, its a continuous improvement and learning.</strong></p><h3>Code</h3><p><a href="https://github.com/inderjitshahi/Low-level-design-LLD/commit/6adfafa2f40c7af7317e41ee92e5484256f80030#diff-0a609d8b6b6a0d30d245c148d4251e586f868be53174899fdfd329c44be69f5e">added parking lot lld · inderjitshahi/Low-level-design-LLD@6adfafa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=548da0d28b0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pleased to Launch “ISBLog”​, A website to Spread Expertise]]></title>
            <link>https://medium.com/@inderjeetkmcs/pleased-to-launch-isblog-a-website-to-spread-expertise-c59ca58b41e3?source=rss-7662711bbea------2</link>
            <guid isPermaLink="false">https://medium.com/p/c59ca58b41e3</guid>
            <category><![CDATA[website-launch]]></category>
            <category><![CDATA[mern-stack-developer]]></category>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Inderjit Shahi]]></dc:creator>
            <pubDate>Sat, 17 Dec 2022 10:37:33 GMT</pubDate>
            <atom:updated>2022-12-17T10:37:33.419Z</atom:updated>
            <content:encoded><![CDATA[<p>After working for several days continuously, I am pleased to present You with “<a href="https://is-blog.vercel.app/">ISBlog</a>.”</p><p>The goal is to provide a free and valuable platform to Read, Write and Grow. Anyone can contribute and read the knowledge freely on the website. The website uses Server Side Rendering (SSR) for a fast and best User Experience. The website uses NextJS, Firebase, and TailwindCSS, which makes it very customizable and easy to upgrade.</p><p>Although the website is in its initial stage of development, there is a big plan for future upgradation with lots of new features. I am also asking for your valuable time to contribute at least one article to the website. It will genuinely motivate my hard work.</p><p>Feel accessible to me for any comments and suggestions. Finally, I want to thank my parents for being a motivation throughout the journey and at every stage of my life.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c59ca58b41e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>