<?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 Raj R. Sharma on Medium]]></title>
        <description><![CDATA[Stories by Raj R. Sharma on Medium]]></description>
        <link>https://medium.com/@rajrsharma2004?source=rss-2df28e8a03fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-g6_jZc9B20yec2WwHw8aw.png</url>
            <title>Stories by Raj R. Sharma on Medium</title>
            <link>https://medium.com/@rajrsharma2004?source=rss-2df28e8a03fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:19:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajrsharma2004/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[The Secret Behind Fast Data Lakes: Apache Parquet]]></title>
            <link>https://medium.com/@rajrsharma2004/the-secret-behind-fast-data-lakes-apache-parquet-fdabd0cb6c7c?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdabd0cb6c7c</guid>
            <category><![CDATA[apache-parquet]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-lake]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[query]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Sun, 12 Jul 2026 19:00:01 GMT</pubDate>
            <atom:updated>2026-07-28T00:54:36.688Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with modern data lakes, storage efficiency and query performance are two of the biggest challenges. As datasets grow from gigabytes to terabytes or even petabytes, choosing the right file format becomes just as important as choosing the right database.</p><p>One file format has become the industry standard for analytical workloads: <strong>Apache Parquet</strong>.</p><p>Apache Parquet is an <strong>open-source, columnar storage file format</strong> designed specifically for big data processing. Compared to traditional formats like <strong>CSV</strong> and <strong>JSON</strong>, Parquet offers significantly better compression and much faster analytical queries, making it the preferred choice for data lakes and modern analytics platforms.</p><h3>What is Apache Parquet?</h3><p>Apache Parquet is a <strong>column-oriented file format</strong> that stores data by columns instead of rows.</p><p>It was created to solve two common problems in large-scale analytics:</p><ul><li>Slow query performance</li><li>High storage consumption</li></ul><p>Today, Parquet is widely used with technologies such as:</p><ul><li>Apache Spark</li><li>Apache Hive</li><li>Apache Iceberg</li><li>Apache Hudi</li><li>Delta Lake</li><li>AWS Athena</li><li>Snowflake</li><li>Google BigQuery</li></ul><h3>Why Use Apache Parquet?</h3><p>Parquet offers several advantages over traditional raw file formats.</p><h3>1. Column-Oriented Storage</h3><p>Unlike CSV or JSON, Parquet stores all values of the same column together.</p><p>Instead of storing data like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*URYCg8xuBH7FpkXbkxBnag.png" /></figure><p>Parquet internally stores it more like:</p><pre>Roll No :<br>1<br>2<br>3</pre><pre>Name:<br>Alice<br>Bob<br>Charlie</pre><pre>Age:<br>20<br>21<br>19</pre><pre>City:<br>Delhi<br>Pune<br>Mumbai</pre><p>Because each column is stored separately, query engines can read only the columns they need.</p><h3>2. Excellent Compression</h3><p>Data within a column is usually very similar.</p><p>For example:</p><pre>Department</pre><pre>IT<br>IT<br>IT<br>IT<br>IT<br>IT<br>Finance<br>Finance<br>Finance</pre><p>Since similar values are stored together, Parquet achieves much higher compression than row-based formats.</p><p>This results in:</p><ul><li>Lower storage costs</li><li>Faster data transfer</li><li>Reduced disk I/O</li></ul><h3>3. Faster Analytical Queries</h3><p>Most analytical queries require only a few columns rather than every column in a dataset.</p><p>For example:</p><pre>SELECT name<br>FROM students<br>WHERE roll_no = 7;</pre><p>Suppose the <strong>students</strong> table contains <strong>50 columns</strong>.</p><h3>Using CSV or JSON</h3><p>The query engine must:</p><ul><li>Read every row</li><li>Load all 50 columns</li><li>Ignore 48 unnecessary columns</li><li>Finally return only name</li></ul><p>This wastes both CPU and memory.</p><h3>Using Parquet</h3><p>Since data is stored column-wise, the engine reads only:</p><ul><li>roll_no</li><li>name</li></ul><p>The remaining 48 columns are never read.</p><p>Less data is scanned, making the query much faster.</p><h3>Row-Oriented vs Column-Oriented Storage</h3><h3>Row-Oriented Formats (CSV, JSON)</h3><p>Data is stored like this:</p><pre>Row 1<br>Roll: 1<br>Name: Alice<br>Age: 20<br>City: Delhi</pre><pre>Row 2<br>Roll: 2<br>Name: Bob<br>Age: 21<br>City: Pune</pre><p>To find one column, the engine still reads every row along with all its columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfRLMboH5MbDmMXZrsfs1w.png" /></figure><p>These formats are excellent for:</p><ul><li>Transactional systems</li><li>Frequent inserts</li><li>Operational databases</li></ul><p>But they are inefficient for analytics.</p><h3>Column-Oriented Format (Parquet)</h3><p>Data is stored by columns:</p><pre>Roll Numbers:<br>1<br>2<br>3</pre><pre>Names<br>Alice<br>Bob<br>Charlie</pre><pre>Cities<br>Delhi<br>Pune<br>Mumbai</pre><p>Now the engine scans only the required columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*19dQylF46lv53XxDko15CQ.png" /></figure><p>This dramatically reduces:</p><ul><li>Disk reads</li><li>Memory usage</li><li>Query execution time</li></ul><h3>The Secret Optimization: Row Groups</h3><p>One of Parquet’s biggest performance optimizations is <strong>Row Groups</strong>.</p><p>A Parquet file is not simply divided into columns.</p><p>Instead, it is organized like this:</p><pre>├── Row Group 1<br>│     ├── Roll Number Column<br>│     ├── Name Column<br>│     ├── Age Column<br>│<br>├── Row Group 2<br>│     ├── Roll Number Column<br>│     ├── Name Column<br>│     ├── Age Column<br>│<br>├── Row Group 3<br>│     ├── Roll Number Column<br>│     ├── Name Column<br>│     ├── Age Column</pre><p>Each row group contains a subset of rows, but within that group, data is still stored column-wise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*Mv0F0hnmzHTYz6d8AgmdiA.png" /></figure><p>This design provides two major advantages:</p><ul><li>Only the required columns are read.</li><li>Only the relevant row groups are scanned.</li></ul><p>If the required data exists only in one row group, the query engine can skip the others entirely.</p><p>This significantly reduces the amount of data read from disk.</p><h3>Example</h3><p>Imagine a dataset containing <strong>100 million student records</strong> with <strong>50 columns</strong>.</p><p>You run:</p><pre>SELECT name<br>FROM students<br>WHERE roll_no = 7;</pre><h3>CSV</h3><p>The engine scans:</p><ul><li>Every row</li><li>Every column</li></ul><p>Even though only two columns are required.</p><h3>Parquet</h3><p>The engine scans only:</p><ul><li>roll_no</li><li>name</li></ul><p>And if metadata indicates that roll_no = 7 exists in only one row group, only that row group is accessed.</p><p>Instead of scanning gigabytes of data, the engine may read only a few megabytes.</p><h3>Why Data Lakes Prefer Parquet</h3><p>Modern data lakes store enormous volumes of historical data.</p><p>Formats like CSV become inefficient because they:</p><ul><li>Consume more storage</li><li>Read unnecessary data</li><li>Increase query execution time</li></ul><p>Parquet solves these problems by offering:</p><ul><li>Columnar storage</li><li>High compression</li><li>Efficient metadata</li><li>Row group organization</li><li>Better analytical performance</li></ul><p>This is why Parquet has become the default storage format for platforms like Spark, Hive, Athena, Snowflake, BigQuery, and many others.</p><h3>Key Advantages of Apache Parquet</h3><ul><li><strong>Column-oriented storage</strong> for efficient data access.</li><li><strong>Excellent compression</strong>, reducing storage costs.</li><li><strong>Faster analytical queries</strong> by reading only the required columns.</li><li><strong>Row Groups</strong> that minimize data scanning.</li><li><strong>Language and platform agnostic</strong>, supported across most big data ecosystems.</li><li><strong>Open-source</strong> and widely adopted in modern data engineering.</li></ul><h3>Conclusion</h3><p>Apache Parquet is more than just another file format — it’s one of the core technologies that makes modern data lakes fast and cost-efficient.</p><p>By storing data <strong>column-wise</strong> instead of <strong>row-wise</strong>, Parquet allows query engines to read only the data they actually need. Combined with powerful compression techniques and intelligent organization through <strong>Row Groups</strong>, it significantly reduces storage usage and accelerates analytical queries.</p><p>If you’re building data pipelines, data lakes, or analytics platforms, understanding Apache Parquet is essential. It’s one of the reasons today’s big data systems can process billions of records efficiently while keeping storage costs under control.</p><p><strong>In short:</strong> CSV and JSON are excellent for data exchange, but when it comes to analytics at scale, Apache Parquet is the format that truly shines.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuOlq-8YvckU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuOlq-8YvckU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuOlq-8YvckU%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd9810e460ec86133e25df82443e8c85/href">https://medium.com/media/dd9810e460ec86133e25df82443e8c85/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdabd0cb6c7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross-Cutting Concerns in Java: Why AOP Matters]]></title>
            <link>https://medium.com/@rajrsharma2004/cross-cutting-concerns-in-java-why-aop-matters-ea387ee477e1?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea387ee477e1</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[aop]]></category>
            <category><![CDATA[spring-aop]]></category>
            <category><![CDATA[aspect-oriented]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 13:12:25 GMT</pubDate>
            <atom:updated>2026-03-03T13:12:25.708Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern software systems often grow into complex ecosystems. As developers, we aim to write clean, focused business logic — yet real-world requirements constantly introduce extra responsibilities: logging, security checks, performance monitoring, error tracking, transactions, auditing, and more.</p><p>These concerns appear everywhere, across many classes and methods. Over time, they clutter codebases, making systems harder to maintain and reason about.</p><p>This is exactly the problem that <strong>Aspect-Oriented Programming (AOP)</strong> was created to solve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*eH2AlytiJZJumOcD4BzOWQ.png" /></figure><h3>Why AOP Exists?</h3><p>In traditional object-oriented design, cross-cutting concerns spread across multiple classes. This leads to:</p><ul><li>Duplicate code</li><li>Reduced readability</li><li>Increased maintenance cost</li><li>Hard-to-change system-wide behaviors</li></ul><p>AOP separates these concerns into dedicated modules called <strong>aspects</strong>.</p><p><strong>Aspect-Oriented Programming (AOP)</strong> is a way of organising code so that common tasks like logging, security checks, or transaction handling are separated from the main business logic. It allows us to automatically run extra code before, after, or around certain methods, without changing the original method’s code.</p><h3>How AOP Works Internally (Conceptual View)</h3><p>In many frameworks like Spring, AOP works by introducing a proxy layer.</p><p>Normal execution:</p><p>Client → Service → Method execution</p><p>With AOP:</p><p>Client → Proxy → Aspect logic → Real service → Aspect logic → Client</p><p>The proxy intercepts method calls and applies additional behaviour before or after execution.</p><h3>Terminologies</h3><ol><li>Aspect: A module in AOP that contains code of cross-cutting concerns.</li><li>Advice: action taken by an aspect at a particular point in execution.</li><li>Join Point: A join point is a place in your program (usually a method execution) where an aspect can run extra code.</li><li>PointCut: <strong>A pointcut</strong> is an expression that selects which join points (places in the program) an aspect should apply to.</li></ol><h3>Types of Advice (Behaviour Applied by Aspects)</h3><p>Common types include:</p><ul><li><strong>Before advice</strong> — runs before method execution (e.g., security checks)</li><li><strong>After advice</strong> — runs after completion (e.g., logging)</li><li><strong>Around advice</strong> — wraps entire execution (e.g., performance monitoring)</li><li><strong>After throwing advice</strong> — runs when exceptions occur (e.g., error tracking)</li></ul><h3>Example:</h3><h4><strong>1. Add dependency</strong></h4><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-aop&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h4>2. Business Logic</h4><pre>package com.example.demo.service;<br>import org.springframework.stereotype.Service;<br>@Service<br>public class UserService {<br>    public void createUser(String name) {<br>        System.out.println(&quot;Creating user: &quot; + name);<br>    }<br>}</pre><h4>3. Create Aspect</h4><pre>package com.example.demo.aspect;<br><br>import org.aspectj.lang.JoinPoint;<br>import org.aspectj.lang.annotation.*;<br>import org.springframework.stereotype.Component;<br><br>@Aspect<br>@Component<br>public class LoggingAspect {<br>    // Pointcut: apply to all methods inside service package<br>    @Pointcut(&quot;execution(* com.example.demo.service.*.*(..))&quot;)<br>    public void serviceMethods() {}<br><br>    // Before advice<br>    @Before(&quot;serviceMethods()&quot;)<br>    public void logBefore(JoinPoint joinPoint) {<br>        System.out.println(&quot;Method started: &quot; + joinPoint.getSignature().getName());<br>    }<br><br>    // After advice<br>    @After(&quot;serviceMethods()&quot;)<br>    public void logAfter(JoinPoint joinPoint) {<br>        System.out.println(&quot;Method finished: &quot; + joinPoint.getSignature().getName());<br>    }<br>}</pre><h4>If I call:</h4><pre>userService.createUser(&quot;Raj&quot;);</pre><h4>Output will be:</h4><pre>Method started: createUser<br>Creating user: Raj<br>Method finished: createUser</pre><h4>Notice:</h4><ul><li>We never added logging inside UserService.</li><li>The aspect automatically applies logging.</li><li>Spring created a proxy behind the scenes.</li></ul><h4>In the code:</h4><ul><li><strong>Aspect</strong> → LoggingAspect</li><li><strong>Join Point</strong> → createUser() execution</li><li><strong>Pointcut</strong> → execution (*com.example.demo.service.*.*(..))</li><li><strong>Advice</strong> → @Before and @After</li></ul><blockquote>In this example, the logging behaviour is separated from the business logic. The aspect intercepts method execution in the service layer and automatically injects logging, demonstrating how AOP modularises cross-cutting concerns.</blockquote><p>AOP is widely used in enterprise systems for:</p><ul><li>Logging and auditing</li><li>Security authorization</li><li>Transaction management</li><li>Performance monitoring</li><li>Metrics collection</li><li>Retry logic</li><li>Distributed tracing</li></ul><h3>Final Thoughts</h3><p>Aspect-Oriented Programming (AOP) is not just a coding technique — it’s a smarter way to organise your code.</p><p>Instead of repeating common tasks like logging, security checks, or transaction handling in many places, AOP keeps them in one central place and applies them automatically where needed.</p><p>This keeps your main business logic clean and easy to understand.</p><p>When you understand AOP, you’re not just learning a feature of a framework — you’re learning how large, well-designed systems stay organised and maintainable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea387ee477e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elasticsearch | Search. Analyze. Scale.]]></title>
            <link>https://medium.com/@rajrsharma2004/elasticsearch-search-analyze-scale-34252de8d6f2?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/34252de8d6f2</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[tf-idf]]></category>
            <category><![CDATA[search-engines]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Wed, 12 Nov 2025 09:10:49 GMT</pubDate>
            <atom:updated>2025-11-12T09:10:49.597Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s <strong>data-driven world</strong>, every click, search, and log entry generates valuable information. But with data growing at <strong>lightning speed</strong>, how do we <strong>store</strong>, <strong>search</strong>, and <strong>analyze</strong> it efficiently — and in <strong>real time</strong>?</p><p>That’s where <strong>Elasticsearch</strong> comes into the picture.</p><h3>What Is Elasticsearch?</h3><p><strong>Elasticsearch</strong> is a <strong>distributed, RESTful search and analytics engine</strong> built to handle <strong>massive volumes of structured and unstructured data</strong> — all in real time.</p><p>Think of it as a <strong>superfast, intelligent search bar</strong> that can sift millions of records in milliseconds and tell you exactly what you’re looking for.</p><p>Whether it’s powering your <strong>e-commerce product search</strong>, <strong>analyzing application logs</strong>, or <strong>visualizing trends</strong> in dashboards — <strong>Elasticsearch does it all.</strong></p><h3>Core Building Blocks of Elasticsearch</h3><p>Before diving into how it works, let’s break down its <strong>main components</strong> 👇</p><h3>1. Document</h3><p>A <strong>document</strong> is the <strong>smallest unit of data</strong> in Elasticsearch.<br> It’s stored as a <strong>JSON object</strong> and contains all the relevant information you want to search.</p><pre>{<br>  &quot;name&quot;: &quot;Raj Sharma&quot;,<br>  &quot;role&quot;: &quot;Developer&quot;,<br>  &quot;skills&quot;: [&quot;Node.js&quot;, &quot;Elasticsearch&quot;]<br>}</pre><h3>2. Index</h3><p>An <strong>index</strong> is a <strong>logical collection of documents</strong> that share similar characteristics — much like a <strong>database</strong> in traditional systems.<br> Each index is divided into smaller pieces called <strong>shards</strong> for distributed storage and scalability.</p><h3>3. Cluster</h3><p>A <strong>cluster</strong> is a group of one or more <strong>nodes (servers)</strong> that work together to <strong>store data</strong> and <strong>perform search and indexing tasks</strong>.</p><p>If one node fails, others pick up the slack — ensuring <strong>high availability</strong> and <strong>fault tolerance</strong>.</p><h3>4. Node</h3><p>Each <strong>node</strong> in the cluster plays a specific role:</p><ul><li><strong>Master Node:</strong> Handles cluster-level operations (like creating or deleting an index).</li><li><strong>Data Node:</strong> Stores data and processes search and indexing requests.</li><li><strong>Ingest Node:</strong> Preprocesses data before it’s indexed (e.g., transforming or enriching it).</li></ul><h3>5. Shards and Replicas</h3><ul><li><strong>Shards</strong> split an index into smaller parts for better <strong>scalability</strong> and <strong>parallel processing</strong>.</li><li><strong>Replicas</strong> are exact copies of shards that ensure <strong>data redundancy</strong> and handle queries when primary shards are busy or unavailable.</li></ul><p>Together, they form the backbone of Elasticsearch’s <strong>speed</strong> and <strong>reliability</strong>.</p><h3>How Does It Actually Work?</h3><p>Let’s uncover the magic behind Elasticsearch’s <strong>lightning-fast search</strong>.</p><p>The process can be divided into <strong>two main stages</strong>: <strong>Indexing</strong> and <strong>Searching</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaVhw82jdWh4dCu-Ew8A1Q.png" /><figcaption>Working of Elasticsearch</figcaption></figure><h3>1. Indexing</h3><p>When you send data (a document) to Elasticsearch, it doesn’t just store it — it <strong>analyzes the text</strong>, <strong>breaks it into tokens (terms)</strong>, and builds a data structure called an <strong>inverted index</strong> — the <strong>secret sauce</strong> that makes search so fast.</p><h4>Here’s how it happens:</h4><ol><li><strong>Tokenization:</strong> Breaks text into individual terms.<br> <em>Example:</em> &quot;Elasticsearch is powerful&quot; → [&quot;elasticsearch&quot;, &quot;is&quot;, &quot;powerful&quot;]</li><li><strong>Normalization:</strong> Converts all tokens to lowercase or standard formats.</li><li><strong>Stopword Removal:</strong> Removes common words like “is” or “the”.</li><li><strong>Mapping to Documents:</strong> Each term is mapped to all documents containing it.</li></ol><p><strong>Inverted Index: </strong>Instead of scanning all documents for every search, Elasticsearch keeps an <strong>inverted index</strong> — a data structure that maps <strong>each unique term</strong> to the list of <strong>documents</strong> where it appears.</p><p>This makes searches <strong>incredibly fast</strong>, even across <strong>billions of records</strong>.</p><h3>2. Searching</h3><p>When you send a query (for example, <em>“Find all developers skilled in Elasticsearch”</em>), the process looks like this:</p><ol><li>The <strong>coordinating node</strong> receives the query and determines which shards contain relevant data.</li><li>The query is <strong>distributed</strong> across those shards.</li><li>Each shard <strong>executes the query independently</strong>, returning results with <strong>relevance scores</strong>.</li><li>The coordinating node then <strong>merges, sorts, and ranks</strong> the results before sending them back to you.</li></ol><p>This distributed architecture ensures Elasticsearch remains <strong>fast</strong> and <strong>scalable</strong>, no matter how large your dataset grows.</p><h3>3. Relevance &amp; Scoring</h3><p>Elasticsearch doesn’t just return results — it <strong>ranks them by relevance</strong> using algorithms like <strong>TF-IDF</strong> and <strong>BM25</strong>.</p><ul><li><strong>Term Frequency (TF):</strong> How often a term appears in a document.</li><li><strong>Inverse Document Frequency (IDF):</strong> How rare or unique the term is across all documents.</li></ul><p>The higher the combined score, the <strong>more relevant</strong> the document is to your query.</p><h3>4. Scalability &amp; Fault Tolerance</h3><p>Elasticsearch is designed for <strong>horizontal scalability</strong> — meaning you can simply <strong>add more nodes</strong> to handle larger datasets or higher traffic.</p><p>If one node fails, <strong>replica shards</strong> automatically take over, ensuring <strong>data availability</strong> and <strong>system reliability</strong> at all times.</p><h3>Quick Recap</h3><p><strong>Component Description Document: </strong>Basic unit of data (JSON)</p><p><strong>Index: </strong>Logical collection of documents</p><p><strong>Cluster: </strong>Group of nodes working together</p><p><strong>Node: </strong>Individual Elasticsearch instance</p><p><strong>Shard: </strong>Subdivision of an index</p><p><strong>Replica: </strong>Backup copy of a shard.</p><h3>Conclusion</h3><p><strong>Elasticsearch</strong> isn’t just a search engine — it’s a <strong>real-time data powerhouse</strong>.<br> From <strong>application monitoring</strong> and <strong>e-commerce search</strong> to <strong>big data analytics</strong>, it empowers developers and analysts to make data <strong>truly searchable and actionable</strong>.</p><p>If your app or business deals with <strong>large-scale data</strong> and you need <strong>instant answers</strong>, then <strong>Elasticsearch is not just an option — it’s a necessity.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34252de8d6f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VoNR: The Future of Voice Calling on 5G]]></title>
            <link>https://medium.com/@rajrsharma2004/vonr-the-future-of-voice-calling-on-5g-9b904dd326a0?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b904dd326a0</guid>
            <category><![CDATA[volte]]></category>
            <category><![CDATA[telecommunication]]></category>
            <category><![CDATA[4g]]></category>
            <category><![CDATA[5g-technology]]></category>
            <category><![CDATA[vonr]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Sat, 13 Sep 2025 14:44:06 GMT</pubDate>
            <atom:updated>2025-09-13T14:44:06.295Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve observed closely, some smartphones no longer switch from <strong>5G to 4G</strong> when making calls. That’s because they’re using a new technology called <strong>VoNR</strong> instead of VoLTE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*TsBTNoLcK4CGxcl3Rip50g.jpeg" /></figure><h3>What is VoNR?</h3><p><strong>VoNR (Voice over New Radio)</strong> is a technology that delivers voice calls <strong>natively over <em>5G Standalone (SA)</em> networks</strong>.</p><p>Unlike older standards like 2G, 3G, or VoLTE (4G), VoNR uses the <strong>same 5G infrastructure</strong> for both voice and data. Instead of relying on circuit-switched networks or falling back to LTE, it sends your voice as <strong>data packets over the 5G core</strong> — just like internet data.</p><p>In simple terms: With <strong>VoNR</strong>, both <strong>calling and browsing</strong> happen over 5G, without switching back to 4 G.</p><h3>Why is VoNR Important?</h3><p>The shift to VoNR marks a major milestone for mobile networks. Here’s why it matters:</p><h4>1. Superior Voice Quality</h4><ul><li>Uses advanced codecs like <strong>EVS (Enhanced Voice Services)</strong></li><li>Provides <strong>HD voice</strong> with clearer sound and minimal background noise</li><li>Makes voices sound more natural and lifelike</li></ul><h4>2. Faster Call Setup</h4><ul><li>Calls connect almost instantly thanks to <strong>streamlined 5G signaling</strong></li></ul><h4>3. Improved Efficiency</h4><ul><li>Eliminates the need to switch networks</li><li>Reduces signaling overhead and <strong>saves battery life</strong></li></ul><h4>4. Rich Communication Services (RCS)</h4><ul><li>Supports modern features like <strong>video calls, file sharing, and real-time translation</strong></li></ul><h4>5. IoT Integration</h4><ul><li>Enables <strong>real-time voice control</strong> for smart homes, wearables, and city-wide IoT solutions.</li></ul><h3>The Backbone of VoNR: 5G Standalone</h3><p>VoNR works <strong>only on <em>5G Standalone </em>(SA) networks</strong>.</p><ul><li><strong>5G SA</strong> uses a fully 5G-based <strong>radio access network (RAN)</strong> and <strong>core network (5GC)</strong></li><li>Unlike <strong>5G Non-Standalone (NSA)</strong>, which still depends on LTE, SA is <strong>completely independent</strong> of older technologies.</li></ul><h3>Benefits of 5G Standalone</h3><ul><li><strong>Full 5G Capabilities</strong>: Supports ultra-low latency (URLLC), massive IoT (mMTC), and network slicing</li><li><strong>Scalability</strong>: Dynamic scaling for advanced services like <strong>autonomous vehicles</strong> and <strong>industrial automation</strong></li><li><strong>Massive Device Support</strong>: Can handle <strong>up to 1 million devices per square km</strong></li><li><strong>No 4G fallback needed</strong>: Both calls and data stay entirely on 5G</li></ul><h3>The Future of Calling</h3><p>VoNR isn’t just an upgrade — it’s the <strong>next step in voice communication</strong>. By combining <strong>superior call quality, faster connectivity, and advanced features</strong>, VoNR will redefine how we experience voice services in the 5G era.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b904dd326a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Soft Prompting: Efficient Task Adaptation for LLMs]]></title>
            <link>https://medium.com/@rajrsharma2004/soft-prompting-efficient-task-adaptation-for-llms-fced39d3ba0a?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/fced39d3ba0a</guid>
            <category><![CDATA[soft-prompting]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[soft-prompt]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 17:00:43 GMT</pubDate>
            <atom:updated>2025-09-10T17:00:43.121Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Large Language Models (LLMs) like ChatGPT and Gemini have become integral to our daily lives. I often use these models to get answers to unusual questions. While LLMs excel at general queries, they face limitations when dealing with <strong>task or domain-specific problems</strong>, where the required data may not be part of their training set.</p><p>For example:</p><ul><li>Generating dialect-specific SQL queries</li><li>Solving problems using predefined rules</li></ul><p><strong>Traditional solutions:</strong></p><ol><li><strong>Fine-tuning the LLM</strong> — Effective but resource-intensive, time-consuming, and expensive.</li><li><strong>Hard prompting</strong> — Creating custom text prompts works for a specific model, but may fail if the model changes.</li></ol><p><strong>Solution:</strong> <strong>Soft Prompting</strong> — a form of prompt tuning that inserts learnable embeddings without modifying the model’s weights.</p><h3>What is Soft Prompting?</h3><p>Soft prompting is a machine learning technique where models are guided using <strong>optimized, learnable embeddings</strong> (vectors) rather than explicit, human-readable text. This allows LLMs to:</p><ul><li>Adapt to new tasks efficiently.</li><li>Preserve general knowledge</li><li>Support multi-task capabilities without full model retraining</li></ul><p>Soft prompts are sequences of vectors that are <strong>prepended or concatenated</strong> with the model’s input embeddings. During training, <strong>only these soft prompt embeddings are updated</strong>, while the base model remains frozen.</p><h3>How Soft Prompting Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFs287r29wlSmDftisdOxQ.png" /></figure><ol><li><strong>Start with a Pre-trained LLM</strong></li></ol><ul><li>Choose a large frozen model (GPT, T5, etc.)</li><li>Base model weights remain unchanged</li></ul><p><strong>2. Add Trainable Prompt Embeddings</strong></p><ul><li>Introduce learnable vectors (“soft prompts”)</li><li>Append them to the input sequence</li></ul><p><strong>3. Training Phase (Prompt Tuning)</strong></p><ul><li>Optimize only the soft prompt embeddings.</li><li>Model parameters remain frozen.</li><li>Prompts are aligned with specific tasks</li></ul><p><strong>4. Store Optimized Prompts</strong></p><ul><li>Each task gets its own trained soft prompt vectors.</li><li>Base LLM is shared across tasks</li></ul><p><strong>5. Inference Phase</strong></p><ul><li>Select the soft prompt corresponding to the desired task.</li><li>Append a soft prompt to input</li><li>Frozen LLM generates task-specific output</li></ul><p><strong>6. Outcome</strong></p><ul><li>Efficient multi-task usage</li><li>No need to fine-tune the full LLM</li><li>Low storage and computational cost</li></ul><h3>Benefits</h3><ul><li><strong>Resource efficient:</strong> Only soft prompt embeddings are trained, saving time and cost</li><li><strong>Knowledge retention:</strong> Base model weights remain frozen, preserving general capabilities</li><li><strong>Versatile:</strong> Quickly adapt model behavior using small, task-specific vectors</li></ul><h3>Limitations</h3><ul><li><strong>Lack of interpretability:</strong> Soft prompts are not human-readable, making debugging harder</li><li><strong>Not ideal for transparency-critical tasks:</strong> Manual hard prompts may be preferred when explicit control is required</li></ul><h3>Conclusion</h3><p>Soft prompting is a powerful technique that allows large language models to efficiently adapt to new tasks without full model retraining. By training only small, task-specific embeddings, it reduces computational cost, preserves the base model’s knowledge, and enables versatile multi-task performance. While it has limitations in interpretability and transparency, soft prompting offers a practical, resource-efficient alternative to fine-tuning and manual hard prompts, making it an essential tool for customizing LLM behavior in a scalable way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fced39d3ba0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Virtual keyword in C++]]></title>
            <link>https://medium.com/@rajrsharma2004/virtual-keyword-in-c-14df9bebda8c?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/14df9bebda8c</guid>
            <category><![CDATA[cpp-programming]]></category>
            <category><![CDATA[virtual-function]]></category>
            <category><![CDATA[runtime-polymorphism]]></category>
            <category><![CDATA[virtual-inheritance]]></category>
            <category><![CDATA[diamond-problem]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 13:12:07 GMT</pubDate>
            <atom:updated>2025-09-06T13:12:07.153Z</atom:updated>
            <content:encoded><![CDATA[<p>In C++, the virtual <strong>keyword</strong> is a powerful feature of object-oriented programming. It plays a key role in enabling <strong>flexibility, reusability, and correctness</strong> in complex class hierarchies. Depending on where it is applied, virtual can serve two distinct purposes:</p><ol><li><strong>With functions</strong>, it enables <strong>runtime polymorphism</strong> through dynamic dispatch. (<em>Virtual function</em>)</li><li><strong>With base classes</strong>, it helps resolve ambiguity in multiple inheritance by ensuring that only one shared instance of the base class exists. (Virtual Inheritance)</li></ol><p>This dual nature makes virtual one of the most important keywords for writing efficient, maintainable, and unambiguous C++ code.</p><h3>Virtual Function</h3><p>Virtual functions are member functions of a base class in C++. Virtual functions are used to achieve runtime polymorphism (i.e., it is decided at runtime which function to execute). Virtual functions help derived classes override the virtual functions of the base class.</p><p><strong>Key Uses:</strong></p><ol><li><strong>Runtime Polymorphism</strong> — Enables late binding so the correct function is called for an object at runtime.</li><li><strong>Code Reusability</strong> — Base class references/pointers can work with multiple derived classes without changing code.</li><li><strong>Extensibility</strong> — New classes can be added without modifying existing client code.</li><li><strong>Abstraction</strong> — Often used in designing interfaces and abstract classes (when combined with pure virtual functions).</li></ol><p>Example:</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br><br>class Shape {<br>public:<br>    virtual void draw() {  // virtual function<br>        cout &lt;&lt; &quot;Drawing a generic shape&quot; &lt;&lt; endl;<br>    }<br>};<br><br>class Circle: public Shape {<br>public:<br>    void draw() override {<br>        cout &lt;&lt; &quot;Drawing a Circle&quot; &lt;&lt; endl;<br>    }<br>};<br><br>class Rectangle: public Shape {<br>public:<br>    void draw() override {<br>        cout &lt;&lt; &quot;Drawing a Rectangle&quot; &lt;&lt; endl;<br>    }<br>};<br><br>int main() {<br>    Shape* s1 = new Circle();<br>    Shape* s2 = new Rectangle();<br><br>    s1-&gt;draw();  // Output: Drawing a Circle<br>    s2-&gt;draw();  // Output: Drawing a Rectangle<br><br>    delete s1;<br>    delete s2;<br>}</pre><p>In the above example, we can see that there is a class named Shape, which has a virtual function called <em>draw()</em>. Two classes, <em>Circle </em>and <em>Rectangle</em>, extend this <em>Shape </em>class. Child classes (<em>Circle </em>and <em>Rectangle</em>) override the draw function in the Parent class(<em>Shape</em>).</p><p>Here, when we call the <em>draw</em> function from a function pointer, the compiler decides at runtime which <em>draw </em>function to call.</p><h3>Virtual Inheritance</h3><p>In C++, multiple inheritance leads to the diamond problem; one solution to this problem is the use of<strong> virtual inheritance</strong>.</p><p>When a class is inherited through multiple paths, without using <strong>virtual inheritance</strong>, each path creates its <strong>own copy</strong> of the base class. Virtual inheritance ensures that only <strong>one shared copy</strong> of the base class is present, avoiding <strong>ambiguity and redundancy</strong>.</p><p>Let’s take an example:</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br><br>class Base {<br>public:<br>    void display() {<br>        cout &lt;&lt; &quot;Base class function&quot; &lt;&lt; endl;<br>    }<br>};<br><br>class A: public Base {};<br>class B: public Base {};<br>class Derived: public A, public B {};<br><br>int main() {<br>    Derived d;<br>    d.display(); // give the error<br>}</pre><p>In the above example, we can observe that <em>Base </em>has a function <em>display()</em>, and this base class <em>Base </em>is inherited by classes <em>A </em>and <em>B</em>. Class <em>Derived </em>inherits both class <em>A </em>and class <em>B</em>. This situation leads to the <strong><em>diamond problem</em></strong>.</p><p>Because when we try to call the <em>display </em>function from the derived class, the compiler has two options: from Parent class <em>A </em>or from Parent class <em>B</em>. Both of these classes inherit from the <em>Base </em>class, which contains the <em>Display </em>function, and both have an instance of the <em>Base</em> class; hence, the compiler gets confused.</p><p>This is the problem of <strong><em>ambiguity</em></strong>, and it is solved by <strong>virtual inheritance.</strong></p><pre>#include &lt;iostream&gt;<br>using namespace std;<br><br>class Base {<br>public:<br>    void display() {<br>        cout &lt;&lt; &quot;Base class function&quot; &lt;&lt; endl;<br>    }<br>};<br><br>class A: virtual public Base {};<br>class B: virtual public Base {};<br>class Derived: public A, public B {};<br><br>int main() {<br>    Derived d;<br>    d.display();  // No ambiguity<br>}</pre><p>Here, the problem of <strong><em>ambiguity</em></strong> is solved, as when we use <strong><em>virtual inheritance</em></strong>, an instance of the <em>Base </em>class is shared among all child classes. From the above example, classes <em>A </em>and <em>B </em>will have only one instance of the <em>Base </em>class; hence, when the Derived class’s object calls the display function, it has only one option.</p><blockquote>In this way, the Virtual keyword can be used in C++, which helps with runtime polymorphism and handling ambiguity.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14df9bebda8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Boot-Up Symphony: Journey from Power Button to Desktop]]></title>
            <link>https://medium.com/@rajrsharma2004/the-boot-up-symphony-journey-from-power-button-to-desktop-650319d6aa88?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/650319d6aa88</guid>
            <category><![CDATA[uefi]]></category>
            <category><![CDATA[os-boot-process]]></category>
            <category><![CDATA[kernal]]></category>
            <category><![CDATA[operating-systems]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 06:43:13 GMT</pubDate>
            <atom:updated>2025-09-03T06:43:13.358Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered what actually happens when you press the power button on your computer or laptop? 🤔</p><p>Those few seconds before your desktop appears are packed with a complex yet fascinating sequence of events. It’s not as simple as “<strong><em>turning on</em></strong>” the machine — your system goes through multiple stages to bring the<strong><em> operating system (OS)</em></strong> to life.</p><p>In fact, from pressing the power button to reaching the desktop, the process can be broken down into <strong>five key stages</strong>:</p><ol><li><strong>Power On</strong></li><li><strong>CPU loads BIOS / UEFI</strong></li><li><strong>BIOS / UEFI runs tests and initializes hardware</strong></li><li><strong>BIOS / UEFI hands over to the Bootloader</strong></li><li><strong>The Bootloader loads the full OS</strong></li></ol><h3>1. Power On</h3><p>When you press the power button, the computer’s <strong>power supply</strong> activates and delivers electricity to key components: the motherboard, CPU, memory, storage devices, and peripherals. This “spark” is what kicks off the entire boot process.</p><h3>2. CPU Loads BIOS or UEFI 🧩</h3><p>The very first program your computer runs is <strong>BIOS</strong> or <strong>UEFI</strong>, stored in firmware on the motherboard.</p><ul><li><strong>BIOS (Basic Input/Output System):</strong> The traditional firmware interface, present in older systems.</li><li><strong>UEFI (Unified Extensible Firmware Interface):</strong> The modern replacement for BIOS, offering more features, better security, and support for larger storage devices.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YT5dKsXACpcZUzsc8ofbYQ.png" /></figure><p>=&gt; Most modern PCs use <strong>UEFI</strong>, though the purpose of both is the same: to initialize hardware and prepare the system for the operating system.</p><h3>3. BIOS / UEFI Runs Tests and Initializes Hardware 🛠️</h3><p>This is where your system ensures everything is working properly. Key steps include:</p><ol><li><strong>Power-On Self-Test (POST):</strong></li></ol><ul><li>Checks hardware components like CPU, RAM, GPU, storage, and keyboard.</li><li>If something is faulty (e.g., bad RAM), the process halts and you may hear error beeps or see diagnostic messages.</li></ul><p><strong>2. Hardware Initialization:</strong></p><ul><li>Sets up memory controllers, storage controllers, and I/O devices so the OS can use them.</li></ul><p><strong>3. Boot Device Selection:</strong></p><ul><li>Determines which device to boot from (SSD, HDD, USB, or even network boot).</li></ul><p><strong>4. Configuration &amp; Management:</strong></p><p>Provides access to the <strong>BIOS/UEFI Setup Utility</strong>, where users can configure:</p><ul><li>Boot order</li><li>CPU features</li><li>Secure Boot, TPM, and virtualization</li><li>Power management settings</li></ul><p><strong>5. Runtime Services (UEFI only):</strong></p><ul><li>Unlike BIOS, UEFI continues to provide services even after the OS has started — for example, managing secure boot keys or firmware updates.</li></ul><h3>4. BIOS / UEFI Hands Over to the Bootloader 🚀</h3><p>Once the hardware is ready, the firmware passes control to the <strong>bootloader</strong>:</p><ul><li>In <strong>BIOS-based systems</strong>, the bootloader is located in the <strong>Master Boot Record (MBR)</strong> at the very start of the disk.</li><li>In <strong>UEFI-based systems</strong>, the bootloader resides in a dedicated <strong>EFI System Partition (ESP)</strong>.</li></ul><h4>Responsibilities of the Bootloader:</h4><ul><li>Find the operating system kernel on the disk.</li><li>Load the kernel into memory.</li><li>Start executing the kernel code.</li></ul><p>Common bootloaders include:</p><ul><li><strong>Windows Boot Manager (bootmgr.exe)</strong></li><li><strong>GRUB</strong> (for Linux)</li><li><strong>Boot.efi</strong> (for macOS)</li></ul><h3>5. The Bootloader Loads the Full OS</h3><p>Finally, the operating system comes to life:</p><ul><li>The <strong>kernel</strong> initializes system services, drivers, and core processes.</li><li>The <strong>user interface</strong> (like Windows Desktop, macOS Finder, or Linux Desktop Environment) loads.</li><li>Within seconds, your computer is ready for you to use. 🎉</li></ul><h3>Final Thoughts</h3><p>From the instant you press the power button to the moment your desktop greets you, your computer has completed a <strong>precisely orchestrated sequence</strong> involving firmware, hardware checks, bootloaders, and the OS itself.</p><p>So next time you power up your machine, remember those few seconds are nothing short of a <strong>boot-up symphony</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=650319d6aa88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolution of Programming]]></title>
            <link>https://medium.com/@rajrsharma2004/evolution-of-programming-d64e861c7529?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d64e861c7529</guid>
            <category><![CDATA[assembly-language]]></category>
            <category><![CDATA[high-level-language]]></category>
            <category><![CDATA[evolution]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[oop]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Sun, 31 Aug 2025 01:55:53 GMT</pubDate>
            <atom:updated>2025-08-31T01:55:53.354Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s digital era, our world is powered by computer programs. These programs have become increasingly smart and efficient, but this progress did not happen overnight — it is the result of over a century of innovation and contributions from countless pioneers.</p><p>In this article, I explore the fascinating journey of how programming languages have evolved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sgyGwYpTfmAPWVONto-wA.png" /></figure><h3><strong>The Evolution of Programming Languages Across Six Eras</strong></h3><ol><li><strong>The Pioneer Era</strong> (1800s — 1940s): This era laid the groundwork for later software development by envisioning programmable machines and formalizing the idea of instructions as algorithms</li><li><strong>Machine Code Era</strong> (1940s — 1950s): In this era, programming was done using binary codes 0s and 1s.</li><li><strong>Assembly Language Era</strong> (1950s — 1960s): This era marks the transition from binary machine code to a human-readable, symbolic programming language.</li><li><strong>High-Level Language Era</strong> (1960s — 1980s): This era marks a significant leap in programming history, where programming shifted from binary code and assembly code toward more abstract, human-readable code.</li><li><strong>Object-oriented Programming Era</strong> (1980s — 1990s): This era fundamentally changed how software was designed and implemented by organizing code around objects.</li><li><strong>Scripting/Web &amp;Modern Era</strong> (1990s — present): This era is characterized by the rise of web technologies, scripting languages, rapid application development, and the continuous emergence of languages designed for modern computing needs, such as mobile, cloud, and AI</li></ol><h3>Machine Code Era</h3><p>The Machine Code Era refers to the earliest phase of computer programming during the 1940s and 1950s, when programming was done directly in binary, using sequences of 0s and 1s that the hardware’s central processing unit (CPU) could execute.</p><p>C<strong>haracteristics of Machine Code</strong></p><ul><li>Comprised entirely of binary digits (bits), representing primitive operations such as arithmetic, data transfer, and control flow commands.</li><li>Each instruction corresponded to a sequence of bits that told the processor what operation to perform and where in memory to fetch or store data.</li><li>Programming in machine code required intimate knowledge of the hardware’s instruction set and memory organization.</li><li>Due to its complexity, machine code programming was error-prone, mentally exhausting, and time-consuming.</li></ul><h3>Assembly Language Era</h3><p>The Assembly Language Era represents the transition from raw machine code to a more human-readable, symbolic way of programming computers, typically spanning the 1950s through the 1960s.</p><p><strong>Key Features</strong></p><ul><li>Mnemonic Representation: Assembly uses mnemonic codes (e.g., MOV, ADD, SUB) for instructions and labels for memory addresses, making programs less prone to errors and more readable than machine code.</li><li>Hardware Specificity: Each assembly language was closely tied to the hardware architecture, as instructions mapped directly to processor commands.</li><li>Control and Efficiency: Assembly grants direct access to hardware resources, enabling precise manipulation of memory, registers, and I/O.</li></ul><h3>High-Level Language Era</h3><p>The High-Level Language Era marks a significant leap in programming history, beginning in the mid-1950s, when programming shifted from hardware-focused machine and assembly code toward more abstract, human-readable languages. These languages empowered programmers to focus on problem-solving rather than low-level hardware details.</p><p><strong>Features and Innovations</strong></p><ul><li>High-level languages use English-like syntax, mathematical expressions, and control structures (loops, conditionals), significantly improving readability and writability.</li><li>These languages introduced compilers and interpreters, tools that translated human-readable code into machine code, bridging the gap between the programmer and the hardware.</li><li>Portability: Unlike machine or assembly code, high-level programs can be written in a more hardware-agnostic way, facilitating code reuse across different systems with appropriate compilers.</li><li>The era saw the development of structured programming, promoting clarity and process modularization with functions, procedures, and blocks, influencing later languages like C and Pascal.</li></ul><p><strong>Programming languages</strong>: FORTRAN (1957), COBOL (1959), LISP (1958), BASIC (1964), C, Pascal, etc.</p><h3>Object-oriented Programming Era</h3><p>The Object-Oriented Programming (OOP) Era began in the 1960s and gained prominence through the 1980s and 1990s, fundamentally changing how software was designed and implemented by organizing code around “objects” — entities that combine data and behavior.</p><p><strong>Key Characteristics of OOP</strong></p><ul><li>Encapsulation: Combining data and methods that operate on that data into objects that hide internal details from the outside.</li><li>Inheritance: A Mechanism for creating new classes based on existing ones, promoting code reuse.</li><li>Polymorphism: Ability to treat different classes through a common interface, enabling flexibility.</li><li>Modularity: Facilitates easier maintenance and scalability by partitioning programs into interacting objects.</li></ul><p><strong>Mainstream Adoption</strong></p><ul><li>C++ emerged in the 1980s, developed by Bjarne Stroustrup as an extension of the C language with object-oriented features. C++ combined the power of low-level C programming with high-level object-oriented design, introducing classes, inheritance, polymorphism, and encapsulation.</li><li>Objective-C also appeared, combining Smalltalk-style messaging with C, becoming widely used in Apple software development.</li><li>In the 1990s, Java, designed by James Gosling and his team at Sun Microsystems, became highly popular by offering platform independence, security, and an easy-to-use object-oriented model aimed at Internet-centric applications.</li><li>Other languages like Python, Ada, and C# incorporated and popularized OOP principles.</li></ul><h3>Scripting/Web &amp;Modern Era</h3><p>The Scripting/Web &amp; Modern Era of programming languages began in the 1990s and continues today, characterized by the rise of web technologies, scripting languages, rapid application development, and the continuous emergence of languages designed for modern computing needs such as mobile, cloud, and AI.</p><p><strong>Characteristics of the Era</strong></p><ul><li>Emphasis on programmer productivity, rapid development, and ease of maintenance.</li><li>Integration of multiple programming paradigms: object-oriented, functional, procedural, and event-driven programming.</li><li>Expanded use of garbage collection, dynamic typing, and powerful standard libraries.</li><li>Strong community and open-source development fueling rapid language evolution and ecosystem growth.</li></ul><p><strong>Rise of Web and Scripting Languages (1990s)</strong></p><ul><li>The rapid adoption of the Internet in the mid-1990s created a demand for new languages focused on web development.</li><li>JavaScript (developed by Brendan Eich in 1995) emerged as the language for client-side web scripting, enabling interactive and dynamic websites integrated directly into browsers like Netscape Navigator.</li><li>Server-side scripting languages such as PHP (1995) and Perl (1987) facilitated web application development, handling database interaction and server logic.</li><li>Simplified and dynamic languages like Python (1991) and Ruby (1995) gained popularity for their ease of use, power, and productivity, often used both on the web and in general programming.</li></ul><p><strong>Modern Language Development (2000s–Present)</strong></p><ul><li>The popularity of mobile and cloud technologies led to languages designed to support these environments efficiently:</li><li>Java became widely used for enterprise and Android mobile applications.</li><li>C# (2000) was created by Microsoft to combine the power of C++ and Visual Basic for the .NET framework.</li><li>Swift (2014) by Apple replaced Objective-C as a modern, safe, and fast language for iOS and macOS development.</li><li>Kotlin (2011) gained prominence as an alternative for Android development, focusing on conciseness and safety.</li><li>Languages like TypeScript (2012) were developed to address shortcomings in JavaScript by adding static typing and other language features for improved developer experience and maintainability.</li><li>Other newer languages such as Go, Rust, Scala, and Dart emerged to meet diverse needs in system programming, concurrency, data science, and cross-platform development.</li></ul><h3>Conclusion</h3><p>The evolution of programming languages reflects humanity’s journey of innovation — transforming abstract ideas into powerful tools that drive our digital world. Programming has moved from being a highly specialized, hardware-bound activity to an accessible, creative discipline that powers everything from mobile apps to artificial intelligence. As technology continues to advance, programming languages will keep evolving, adapting to new domains like quantum computing, cloud-native systems, and intelligent automation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d64e861c7529" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Garbage Collector ]]></title>
            <link>https://medium.com/@rajrsharma2004/garbage-collector-860cb9e05142?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/860cb9e05142</guid>
            <category><![CDATA[garbage-collection]]></category>
            <category><![CDATA[reference-counting]]></category>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[mark-and-sweep]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Wed, 27 Aug 2025 04:49:24 GMT</pubDate>
            <atom:updated>2025-08-27T05:16:12.060Z</atom:updated>
            <content:encoded><![CDATA[<p>If you know C++, you might have used dynamic memory allocation, which involves creating objects dynamically at runtime. In C++, it is the programmer’s responsibility to free the memory once the object is no longer needed; otherwise, it will waste RAM and slow down the application.</p><p>But in languages like Java and Python, we create objects without manually freeing the memory allocated to them. Does that mean we are wasting memory? Not really!</p><p>That’s where the <strong>Garbage Collector (GC)</strong> comes into play. The purpose of the Garbage Collector is to free unused memory automatically. This allows developers to focus on writing core logic instead of worrying about memory management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9WIKnPhgmuAncvQO65vq-A.png" /></figure><p>When we create an object dynamically at runtime in any programming language, it is usually allocated in the <strong>Heap</strong>. In larger applications, the number of objects can grow significantly, and if unused objects are not cleared, the application may soon run out of RAM. That’s why programming languages like Java and Python include a Garbage Collector to automatically remove unused objects from the Heap.</p><h3>There are usually two types of threads involved:</h3><ul><li><strong>Mutable thread</strong>: Executes the program, allocates memory, modifies objects, etc.</li><li><strong>Collector thread</strong>: Performs garbage collection. It runs periodically and removes unused objects.</li></ul><p>When the collector thread runs, execution of other threads is usually paused. The garbage collector checks references to objects, and if no references exist, the object is removed from the Heap.</p><h3>Garbage Collection Algorithms:</h3><h4>1. Reference Counting</h4><p>The <strong>reference count</strong> tracks how many references exist for an object.</p><pre>class A {}<br>class B {}<br>class Test {<br>  public static void main(String[] args) {<br>    A a = new A();   // reference count = 1<br>    B b = new B();   // reference count = 1<br>    B c = b;         // reference count of b = 2<br>    a = null;        // reference count of a = 0 (deleted)<br>    b = null;        // reference count of b = 1<br>  }<br>}</pre><p>Whenever an object is referenced, its reference count increases by 1. When dereferenced (a = null), the count decreases by 1. When the count drops to 0, the object is deleted.</p><p><strong>Drawback</strong>: Reference counting fails with <strong>circular references</strong>.</p><p>Example:</p><pre>class A { B ref; }<br>class B { A ref; }<br>class Test {<br>  public static void main(String[] args) {<br>    A a = new A();   // reference count = 1<br>    B b = new B();   // reference count = 1<br>    a.ref = b;       // reference count of b = 2<br>    b.ref = a;       // reference count of a = 2<br>    a = null;        // reference count of a = 1<br>    b = null;        // reference count of b = 1<br>  }<br>}</pre><p>Here, both objects reference each other, so their reference counts never reach 0, even though they are no longer used.</p><h4>2. Mark &amp; Sweep</h4><p>To solve the problem of circular references, the <strong>Mark &amp; Sweep algorithm</strong> is used.</p><p>The mark and sweep algorithm is a fundamental garbage collection technique that helps automatically reclaim memory for objects that are no longer reachable by a program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*89yA32oZUeNIq6oUF-ArMw.png" /></figure><p><strong>Phases of Mark &amp; Sweep</strong>:</p><ol><li><strong>Root Identification</strong> — Create a list of root nodes (stack variables, static fields, CPU registers). For now, let’s suppose there is a function <em>getRoots()</em> that returns a list of all.</li><li><strong>Mark Phase</strong> — Mark all root nodes and recursively mark all objects reachable from them.</li><li><strong>Sweep Phase</strong> — Traverse the heap: if an object is not marked, deallocate it; if it is marked, unmark it for the next cycle.</li></ol><pre>//marking phase<br>function markRoot(){<br>  roots = getRoots();<br>  for(root in roots){<br>    root.is_marked = true;<br>    list.add(root);<br>    mark(root); // it will mark all nodes reachable from root<br>  }<br>}<br><br>function sweep(){<br>  nodes = getNodes(); // assume that getNodes() returns lise of objects present in heap<br>  for( node in nodes ){<br>    if(node.is_marked != true){<br>      remove(node);<br>    }else{<br>      node.is_marked = false; //reset for next garbage collector cycle<br>    }<br>  }<br>}</pre><p>Modern environments often use a <strong>generational garbage collection approach</strong>, where objects are divided into generations (young, old) for more efficient memory management.</p><h3>Conclusion</h3><p>The Garbage Collector is a powerful feature of modern programming languages like Java and Python, designed to simplify memory management. Instead of manually freeing memory, the GC automatically identifies and removes unused objects, preventing memory leaks and improving application efficiency. While simple algorithms like reference counting work in some cases, advanced algorithms like <strong>Mark &amp; Sweep</strong> (and its modern variations) ensure reliable memory cleanup, even in complex scenarios with circular references. Ultimately, garbage collection allows developers to focus more on solving real-world problems while ensuring that memory is managed safely and efficiently in the background.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=860cb9e05142" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding SOLID Principles]]></title>
            <link>https://medium.com/@rajrsharma2004/understanding-solid-principles-25be4ca3603b?source=rss-2df28e8a03fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/25be4ca3603b</guid>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[liskov-substitution]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Raj R. Sharma]]></dc:creator>
            <pubDate>Sun, 17 Aug 2025 19:58:53 GMT</pubDate>
            <atom:updated>2025-08-17T19:59:49.966Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are even remotely related to software development, you might have heard of the <strong>SOLID principles</strong>. These principles provide guidelines to help us design software that is <strong>loosely coupled, scalable, and easy to maintain</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOpX1gMeLQcKgh0UpvbtJw.png" /></figure><p><strong>SOLID</strong> is an acronym that stands for:</p><ul><li><strong>S</strong> — Single Responsibility Principle</li><li><strong>O</strong> — Open/Closed Principle</li><li><strong>L</strong> — Liskov Substitution Principle</li><li><strong>I</strong> — Interface Segregation Principle</li><li><strong>D</strong> — Dependency Inversion Principle</li></ul><p>Let’s go through each of them with simple examples.</p><h3>1. Single Responsibility Principle (SRP)</h3><p>The <strong><em>Single Responsibility Principle</em></strong> states that a class should have <strong>only one reason to change</strong>. In other words, each class should handle a single responsibility.</p><p><strong>Example:</strong><br> Imagine an organization where one person handles <strong>operations, marketing, accounting, and finance</strong>. This might work when the organization is small, but as it grows, things quickly become messy and unmanageable.</p><p>Now consider a scenario where each role is handled by a different person — one for operations, another for accounting, someone else for finance, etc. In this case, the organization can scale smoothly.</p><p>Similarly, in software design, breaking down responsibilities into smaller, focused classes makes the system more maintainable and easier to extend.</p><h3>2. Open/Closed Principle (OCP)</h3><p>This principle states that <strong>software entities (classes, interfaces, modules)</strong> should be:</p><ul><li><strong>Open for extension</strong> → You should be able to add new functionality.</li><li><strong>Closed for modification</strong> → You should not have to modify existing code.</li></ul><p><strong>Example: </strong>Suppose we have a Payment class with a method makePayment(). Instead of directly modifying this method to support new payment types, we should extend the class and override the behavior.</p><p><em>This ensures that existing functionality remains untouched, while new features can be added seamlessly.</em></p><h3>3. Liskov Substitution Principle (LSP)</h3><p>The <strong><em>Liskov Substitution Principle</em> </strong>says that <strong>objects of a child class should be able to replace objects of the parent class without breaking the system</strong>.</p><p><strong>Example:</strong><br> If we have a Bird class and a child class Sparrow that extends it, we should be able to use a Sparrow object wherever a Bird object is expected — without causing unexpected behavior.</p><p><em>This ensures that inheritance in OOP preserves the correctness of the program.</em></p><h3>4. Interface Segregation Principle (ISP)</h3><p>The <strong><em>Interface Segregation Principle</em></strong> states that <strong>clients should not be forced to implement methods they don’t need</strong>.</p><p><strong>Example:</strong><br> Suppose we design a Car interface with methods like drive(), brake(), start(), and ignition(). At first, it seems fine. But not all classes that implement Car may need the ignition() method. That function is specific to the <strong>Engine</strong>, not the Car itself.</p><p>A better approach is to split the interface into smaller, more specific ones (e.g., Drivable, IgnitionSystem, etc.).</p><p><strong><em>Note: </em></strong><em>It’s better to have multiple small, client-specific interfaces than one large, general-purpose one.</em></p><h3>5. Dependency Inversion Principle (DIP)</h3><p>The <strong><em>Dependency Inversion Principle</em></strong> suggests that:</p><ul><li><strong>High-level modules</strong> should not depend on <strong>low-level modules</strong>.</li><li>Both should depend on <strong>abstractions</strong>.</li></ul><p><em>This helps in reducing tight coupling between classes.</em></p><p><strong>Example in Java:</strong></p><pre>class V8 implements Engine {<br>    @Override<br>    public void ignition() {<br>        System.out.println(&quot;Ignition Started!&quot;);<br>    }<br>}<br>class Car {<br>    private Engine engine;<br>    public Car(Engine e) {<br>        this.engine = e;<br>    }<br>}<br>public class Test {<br>    public static void main(String[] args) {<br>        V8 v = new V8();<br>        Car c = new Car(v); // Car depends on abstraction (Engine), not concrete V8<br>    }<br>}</pre><p>Here, the Car class does not depend directly on V8. Instead, it depends on the abstract Engine interface. This makes it easy to replace V8 with any other engine implementation without changing the Car class.</p><h3>Conclusion</h3><p>The <strong>SOLID principles</strong> are not just theoretical concepts — they are practical guidelines that help us write clean, extensible, and maintainable code.</p><ul><li><strong>SRP</strong> → <em>One class, one responsibility.</em></li><li><strong>OCP</strong> → <em>Extend behavior without modifying existing code.</em></li><li><strong>LSP</strong> → <em>Subclasses should be usable as their parent class.</em></li><li><strong>ISP</strong> → <em>Prefer many small interfaces over one large one.</em></li><li><strong>DIP</strong> → <em>Depend on abstractions, not concrete implementations.</em></li></ul><p>By following <strong><em>SOLID</em></strong>, we design software systems that scale gracefully, adapt to change, and remain easy to manage in the long run.</p><h3>| Keep Building…</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25be4ca3603b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>