<?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 Kushana Senadheera on Medium]]></title>
        <description><![CDATA[Stories by Kushana Senadheera on Medium]]></description>
        <link>https://medium.com/@rashmisenadheera98?source=rss-8fc7a11142d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*C_9k0It-fALgugme</url>
            <title>Stories by Kushana Senadheera on Medium</title>
            <link>https://medium.com/@rashmisenadheera98?source=rss-8fc7a11142d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:56:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rashmisenadheera98/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[Building Your First Artificial Neural Network (ANN) Using Python and TensorFlow: A Practical Guide…]]></title>
            <link>https://medium.com/@rashmisenadheera98/building-your-first-artificial-neural-network-ann-using-python-and-tensorflow-a-practical-guide-d8975388007d?source=rss-8fc7a11142d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8975388007d</guid>
            <dc:creator><![CDATA[Kushana Senadheera]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 06:00:51 GMT</pubDate>
            <atom:updated>2026-11-17T06:28:09.279Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Your First Artificial Neural Network (ANN) Using Python and TensorFlow: A Practical Guide with MNIST</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UuFlqMRnzNO_ETLuKDCZvQ.png" /></figure><h3>1. Introduction to Artificial Neural Networks</h3><p>Artificial Neural Networks (ANNs) are machine learning models inspired by the way the human brain processes information. They consist of interconnected processing units called <strong>neurons</strong>, which work together to identify patterns and make predictions from data.</p><h4>1.1 Artificial Neurons</h4><p>A neuron is the basic building block of an ANN. Each neuron receives input values, multiplies them by corresponding weights, adds a bias, and applies an activation function to produce an output.</p><ul><li><strong>Inputs:</strong> Data received by the neuron.</li><li><strong>Weights:</strong> Determine the importance of each input.</li><li><strong>Bias:</strong> Helps adjust the neuron’s output.</li><li><strong>Activation Function:</strong> Determines the final output of the neuron.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*0C_PQJfmufgxFWAIYx3VCQ.png" /></figure><h4>1.2 How Are Neurons Organized in an ANN?</h4><p>An ANN consists of multiple neurons organized into layers. These layers are connected to form a neural network.</p><p>There are three main types of layers:</p><ol><li><strong>Input Layer:</strong> Receives the input data.</li><li><strong>Hidden Layers:</strong> Contain multiple neurons that process information and learn patterns from the data. An ANN can have one or more hidden layers.</li><li><strong>Output Layer:</strong> Produces the final prediction or classification result.</li></ol><p>In a typical fully connected neural network, each neuron in one layer connects to every neuron in the next layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2i7nsNhs2q176RybEaXeUw.png" /></figure><h4>1.3 How Does an ANN Learn?</h4><p>An ANN learns by adjusting its weights and biases during training.</p><p>The basic learning process involves:</p><ol><li><strong>Forward Propagation:</strong> Input data passes through the network to generate a prediction.</li><li><strong>Loss Calculation:</strong> The prediction is compared with the actual result to calculate the error.</li><li><strong>Backpropagation:</strong> The network calculates how to adjust its weights to reduce the error.</li><li><strong>Optimization:</strong> The optimizer updates the weights and biases.</li></ol><p>This process repeats over multiple training iterations, allowing the network to improve its predictions.</p><p>Now that we understand the basic structure and learning process of an ANN, let’s build a simple neural network using Python and TensorFlow.</p><p>Think about how you recognize a handwritten digit. Even if someone writes the number 5 in different handwriting styles, you can usually identify it as 5. An artificial neural network learns to perform a similar task by analyzing examples and identifying patterns in them.</p><p>In this practical, we will build a basic Artificial Neural Network using Python, TensorFlow, and Keras to recognize handwritten digits from 0 to 9.</p><p>By the end of this tutorial, you will understand the basic structure of an ANN, how it learns from data, and how to build and evaluate a simple classification model.</p><h3>2. Understanding the MNIST Dataset</h3><p>Before building our model, let’s understand the dataset we will use.</p><p>The <strong>MNIST dataset</strong> is a well-known dataset commonly used for learning and experimenting with handwritten digit recognition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*WIQPZou4-gS1y95E1ROctg.png" /></figure><p>It contains:</p><ul><li>70,000 handwritten digit images.</li><li>60,000 training images.</li><li>10,000 testing images.</li><li>Ten-digit classes, ranging from 0 to 9.</li><li>Each image has a size of 28 × 28 pixels.</li><li>Images are grayscale, meaning each pixel represents a shade of gray.</li></ul><p>Each image is represented by a collection of pixel values. A pixel value indicates how dark or bright a particular point in an image is.</p><p>For example:</p><ul><li>0 represents black.</li><li>255 represents white.</li><li>Values between 0 and 255 represent different shades of gray.</li></ul><p>Therefore, a 28 × 28 image contains 784 individual pixel values.</p><p>The model uses these numerical values instead of directly understanding the image as a human does.</p><h3>3. Setting Up the Environment</h3><p>We will use Google Colab because it provides a ready-to-use Python environment without requiring a local installation.</p><p>First, import the required libraries.</p><pre>import tensorflow as tf<br>from tensorflow import keras<br>from tensorflow.keras import layers<br>import matplotlib.pyplot as plt<br>import numpy as np</pre><p>Here is what each library does:</p><ul><li><strong>TensorFlow:</strong> Provides tools for building and training machine learning models.</li><li><strong>Keras:</strong> Provides a high-level interface for creating neural networks.</li><li><strong>Matplotlib:</strong> Helps visualize images and training results.</li><li><strong>NumPy:</strong> Supports numerical operations and array manipulation.</li></ul><h3>4. Loading the MNIST Dataset</h3><p>TensorFlow provides the MNIST dataset directly, so we do not need to download and load a separate dataset manually.</p><pre>(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()</pre><p>The dataset is divided into two main parts:</p><ul><li><strong>Training data:</strong> Used by the model to learn patterns.</li><li><strong>Testing data:</strong> Used to evaluate how well the trained model performs on unseen data.</li></ul><p>Let’s check the dimensions.</p><pre>print(&quot;Training images:&quot;, x_train.shape)<br>print(&quot;Training labels:&quot;, y_train.shape)</pre><pre>print(&quot;Testing images:&quot;, x_test.shape)<br>print(&quot;Testing labels:&quot;, y_test.shape)</pre><p>Expected output:</p><pre>Training images: (60000, 28, 28)<br>Training labels: (60000,)<br>Testing images: (10000, 28, 28)<br>Testing labels: (10000,)</pre><p>This means we have 60,000 training images and 10,000 testing images. Each image contains 28 rows and 28 columns of pixel values.</p><h3>5. Exploring and Visualizing the Dataset</h3><p>Before training a model, it is useful to examine the data.</p><p>Let’s display a sample handwritten digit.</p><pre>plt.imshow(x_train[0], cmap=&#39;gray&#39;)<br>plt.title(f&quot;Label: {y_train[0]}&quot;)<br>plt.axis(&#39;off&#39;)<br>plt.show()</pre><p>The imshow() function displays the image, while cmap=&#39;gray&#39; displays it using grayscale colors.</p><p>We can also display multiple images.</p><pre>plt.figure(figsize=(10, 4))</pre><pre>for i in range(10):<br>    plt.subplot(2, 5, i + 1)<br>    plt.imshow(x_train[i], cmap=&#39;gray&#39;)<br>    plt.title(f&quot;Label: {y_train[i]}&quot;)<br>    plt.axis(&#39;off&#39;)</pre><pre>plt.tight_layout()<br>plt.show()</pre><p>This helps us understand the variety of handwriting styles present in the dataset.</p><h3>6. Understanding Image Preprocessing</h3><p>Neural networks generally perform better when input data is appropriately prepared.</p><p>Our MNIST images contain pixel values ranging from 0 to 255. We will normalize these values into a range between 0 and 1.</p><pre>x_train = x_train / 255.0<br>x_test = x_test / 255.0</pre><p>Why do we do this?</p><p>Instead of providing large pixel values such as 150, 200, or 255, we provide smaller decimal values between 0 and 1.</p><p>For example:</p><ul><li>0 becomes 0.0.</li><li>128 becomes approximately 0.502.</li><li>255 becomes 1.0.</li></ul><p>This process is called <strong>normalization</strong>. It helps the neural network train more efficiently and improves numerical stability.</p><p>Notice that we do not normalize the labels because they already represent the correct digit classes (0–9).</p><h3>7. Understanding the Architecture of an ANN</h3><p>Before implementing the model, let’s understand its basic structure.</p><p>A basic feedforward ANN consists of three main types of layers.</p><h3>Input Layer</h3><p>The input layer receives the data.</p><p>In our example, each image has 28 × 28 pixels, giving us 784 pixel values.</p><p>However, the neural network’s Dense layers expect a one-dimensional input. Therefore, we need to convert the 28 × 28 image into a single array containing 784 values.</p><p>We use a layer called Flatten() for this purpose.</p><h3>Hidden Layers</h3><p>Hidden layers are responsible for learning patterns from the input data.</p><p>Each hidden layer contains multiple neurons. A neuron receives input values, applies weights and a bias, and passes the result through an activation function.</p><p>For example, the first hidden layer may contain 128 neurons, while the second contains 64 neurons.</p><p>During training, the network adjusts its weights and biases to learn useful patterns that help distinguish different digits.</p><h3>Output Layer</h3><p>The output layer produces the final prediction.</p><p>Since our task involves recognizing ten different digits (0–9), we use ten output neurons.</p><p>Each neuron represents one digit class.</p><p>For example, the output values indicate how strongly the model associates the input image with each digit.</p><p>We use the <strong>Softmax activation function</strong> to convert the output scores into probability-like values that sum to 1.</p><p>The digit with the highest output value becomes the predicted class.</p><h3>8. Building the ANN Model Using Keras</h3><p>Now let’s implement our neural network.</p><p>We will use the Sequential API provided by Keras.</p><pre>model = keras.Sequential([<br>    layers.Flatten(input_shape=(28, 28)),</pre><pre>    layers.Dense(128, activation=&#39;relu&#39;),</pre><pre>    layers.Dense(64, activation=&#39;relu&#39;),</pre><pre>    layers.Dense(10, activation=&#39;softmax&#39;)<br>])</pre><p>Let’s understand each layer.</p><p><strong>Layer 1: Flatten</strong></p><pre>layers.Flatten(input_shape=(28, 28))</pre><p>Converts each 28 × 28 image into a one-dimensional array containing 784 values.</p><p><strong>Layer 2: First Hidden Layer</strong></p><pre>layers.Dense(128, activation=&#39;relu&#39;)</pre><p>Creates 128 neurons. Each neuron learns patterns by processing the input values.</p><p>The ReLU activation function introduces non-linearity, allowing the network to learn more complex patterns.</p><p>ReLU is defined as:</p><p>f(x) = max(0, x)</p><p>This means negative values become zero, while positive values remain unchanged.</p><p><strong>Layer 3: Second Hidden Layer</strong></p><pre>layers.Dense(64, activation=&#39;relu&#39;)</pre><p>Creates another hidden layer containing 64 neurons.</p><p>This layer receives information from the previous layer and continues learning useful combinations of patterns.</p><p><strong>Layer 4: Output Layer</strong></p><pre>layers.Dense(10, activation=&#39;softmax&#39;)</pre><p>Creates ten neurons, representing the ten possible digit classes.</p><p>Softmax converts the output scores into probability-like values.</p><p>For example, the output might look like this:</p><pre>Digit 0: 0.01<br>Digit 1: 0.02<br>Digit 2: 0.01<br>Digit 3: 0.03<br>Digit 4: 0.01<br>Digit 5: 0.85<br>Digit 6: 0.01<br>Digit 7: 0.02<br>Digit 8: 0.02<br>Digit 9: 0.02</pre><p>Since digit 5 has the highest value, the model predicts the image as 5.</p><h3>9. Understanding Weights and Biases</h3><p>Two important components of a neural network are weights and biases.</p><p><strong>Weights</strong> determine the importance of different input connections. During training, the network adjusts these values to learn useful patterns.</p><p><strong>Biases</strong> are additional trainable values that help the neurons adjust their outputs.</p><p>Think of weights as determining how strongly an input influences a neuron, while bias helps shift the neuron’s activation.</p><p>Initially, the network does not know how to recognize handwritten digits. It starts with initialized weights and biases and gradually updates them during training.</p><h3>10. Compiling the Model</h3><p>After building the architecture, we need to compile the model before training.</p><pre>model.compile(<br>    optimizer=&#39;adam&#39;,<br>    loss=&#39;sparse_categorical_crossentropy&#39;,<br>    metrics=[&#39;accuracy&#39;]<br>)</pre><p>There are three important components here.</p><p><strong>Optimizer — Adam</strong></p><p>The optimizer controls how the model updates its weights and biases during training.</p><p>Adam is a commonly used optimization algorithm that adjusts these values to reduce prediction errors.</p><p><strong>Loss Function — Sparse Categorical Crossentropy</strong></p><p>The loss function measures how far the model’s predictions are from the actual labels.</p><p>We use sparse categorical crossentropy because our target labels are integers from 0 to 9 rather than one-hot encoded vectors.</p><p>The model attempts to minimize this loss during training.</p><p><strong>Metrics — Accuracy</strong></p><p>Accuracy measures the percentage of correctly classified images.</p><p>For example, if the model correctly predicts 900 out of 1,000 images, its accuracy is 90%.</p><h3>11. Training the Neural Network</h3><p>Now comes the learning process.</p><pre>history = model.fit(<br>    x_train,<br>    y_train,<br>    epochs=10,<br>    batch_size=32,<br>    validation_split=0.2<br>)</pre><p>Let’s understand the important parameters.</p><p><strong>Training Data</strong></p><p>x_train contains the input images, and y_train contains their correct digit labels.</p><p>The model uses these pairs to learn the relationship between images and digit classes.</p><p><strong>Epochs = 10</strong></p><p>An epoch represents one complete pass through the training dataset.</p><p>Since we have 60,000 training images, one epoch means the model has processed all 60,000 images once.</p><p>Why do we use multiple epochs?</p><p>Imagine a student preparing for an examination. Studying a topic once may not be enough to understand it properly. Repeated practice helps improve understanding.</p><p>Similarly, a neural network processes the training data multiple times to improve its predictions.</p><p>However, more epochs do not always mean a better model. Training for too long may lead to overfitting.</p><p><strong>Batch Size = 32</strong></p><p>Instead of processing all 60,000 images at once, the model processes smaller groups called batches.</p><p>With a batch size of 32, the model processes 32 images before performing a weight update.</p><p>Therefore, one epoch contains:</p><p>60,000 / 32 = 1,875 batches.</p><p>This makes training more manageable and allows the model to update its parameters gradually.</p><p><strong>Validation Split = 0.2</strong></p><p>The validation split reserves 20% of the training data for validation.</p><p>In our example:</p><ul><li>80% is used for training (48,000 images).</li><li>20% is used for validation (12,000 images).</li></ul><p>The validation data helps us monitor how well the model performs on data that it does not directly learn from during training.</p><p>It is useful for identifying potential overfitting.</p><h3>12. Understanding Training and Validation Graphs</h3><p>During training, Keras records accuracy and loss values for each epoch.</p><p>We can visualize these values to understand how the model learns.</p><h3>Training and Validation Accuracy</h3><pre>plt.plot(history.history[&#39;accuracy&#39;], label=&#39;Training Accuracy&#39;)<br>plt.plot(history.history[&#39;val_accuracy&#39;], label=&#39;Validation Accuracy&#39;)</pre><pre>plt.title(&#39;Training vs Validation Accuracy&#39;)<br>plt.xlabel(&#39;Epochs&#39;)<br>plt.ylabel(&#39;Accuracy&#39;)<br>plt.legend()<br>plt.show()</pre><p>Training accuracy shows how well the model performs on the training data.</p><p>Validation accuracy shows how well it performs on the validation data.</p><p>If both values increase and remain reasonably close, it generally indicates that the model is learning and generalizing well.</p><p>If training accuracy continues increasing while validation accuracy stops improving or decreases, it may indicate overfitting.</p><h3>Training and Validation Loss</h3><pre>plt.plot(history.history[&#39;loss&#39;], label=&#39;Training Loss&#39;)<br>plt.plot(history.history[&#39;val_loss&#39;], label=&#39;Validation Loss&#39;)</pre><pre>plt.title(&#39;Training vs Validation Loss&#39;)<br>plt.xlabel(&#39;Epochs&#39;)<br>plt.ylabel(&#39;Loss&#39;)<br>plt.legend()<br>plt.show()</pre><p>Loss measures the model’s prediction errors.</p><p>Generally, decreasing loss indicates that the model is improving its predictions.</p><p>By observing both accuracy and loss graphs, we can better understand the learning process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*YdlIxpt2rzbgn0lE1gix4A.png" /></figure><h3>13. Evaluating the Model</h3><p>After training, we need to evaluate the model using the testing dataset.</p><p>Remember, the testing data was not used during training or validation.</p><pre>test_loss, test_accuracy = model.evaluate(x_test, y_test)</pre><pre>print(&quot;Test Loss:&quot;, test_loss)<br>print(&quot;Test Accuracy:&quot;, test_accuracy)</pre><p>This gives us an indication of how well the model performs on unseen data.</p><p>For example, if the test accuracy is 97%, it means the model correctly classifies approximately 97 out of every 100 test images.</p><p>The actual result may vary depending on the model configuration and training process.</p><h3>14. Making Predictions</h3><p>Finally, let’s use our trained model to recognize a handwritten digit.</p><pre>predictions = model.predict(x_test)</pre><pre>predicted_label = np.argmax(predictions[0])</pre><pre>actual_label = y_test[0]</pre><pre>print(&quot;Predicted Digit:&quot;, predicted_label)<br>print(&quot;Actual Digit:&quot;, actual_label)</pre><p>The predict() function produces output scores for all ten classes.</p><p>We use np.argmax() to identify the index of the highest output value.</p><p>Since each output position represents a digit from 0 to 9, the index with the highest value becomes our predicted digit.</p><p>Let’s visualize the result.</p><pre>plt.imshow(x_test[0], cmap=&#39;gray&#39;)</pre><pre>plt.title(<br>    f&quot;Predicted: {predicted_label} | Actual: {actual_label}&quot;<br>)</pre><pre>plt.axis(&#39;off&#39;)<br>plt.show()</pre><p>Now we can visually compare the handwritten digit with the model’s prediction.</p><h3>15. Final Thoughts</h3><p>In this practical, we built a basic Artificial Neural Network using TensorFlow and Keras to classify handwritten digits from the MNIST dataset.</p><p>We explored the dataset, performed image normalization, designed a neural network with hidden layers, compiled and trained the model, visualized its learning progress, and evaluated its classification performance.</p><p>More importantly, we explored how neurons, weights, biases, activation functions, epochs, batch sizes, and optimization algorithms work together in an ANN.</p><p>This practical provides a foundation for understanding more advanced neural network architectures, including Deep Neural Networks (DNNs) and Convolutional Neural Networks (CNNs).</p><p>The best way to understand neural networks is not just to study their architecture but to experiment with them, change their configurations, observe the results, and understand why those changes affect performance.</p><p><strong>Keep experimenting, keep learning, and let your first neural network be the beginning of your journey into Deep Learning!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8975388007d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOLID Principles: The Foundation of Scalable and Maintainable Software]]></title>
            <link>https://medium.com/@rashmisenadheera98/solid-principles-the-foundation-of-scalable-and-maintainable-software-b31840d53102?source=rss-8fc7a11142d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b31840d53102</guid>
            <dc:creator><![CDATA[Kushana Senadheera]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 08:33:50 GMT</pubDate>
            <atom:updated>2025-03-16T08:33:50.485Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zhVoCKZ3rKYkHhST.png" /></figure><p>As I step into my internship journey, one of the key lessons I have come across is the importance of writing clean, maintainable, and scalable code. A fundamental concept that plays a crucial role in achieving this is the SOLID principles. These five principles serve as a blueprint for building robust and flexible software systems.</p><h3>What Are SOLID Principles?</h3><p>SOLID is an acronym representing five essential design principles introduced by Robert C. Martin (Uncle Bob). These principles help developers write software that is easier to manage, test, and extend.</p><h3>1. Single Responsibility Principle (SRP)</h3><p>First principle is Single Resposibility. Each class, module, or function should have only one reason to change. In other words, it should focus on a single responsibility. Imagine a restaurant kitchen — one chef handles main dishes, another prepares desserts, and a third makes drinks. If one chef tries to do everything, it leads to chaos. Similarly, an OrderService should only handle order-related tasks, while a UserService should manage user-related operations. This ensures that changes in one area do not inadvertently affect another, leading to better maintainability and debugging.</p><h3>2. Open/Closed Principle (OCP)</h3><p>Second one is Open/Closed Principle.A system should be open for extension but closed for modification. This means that new functionalities should be added without modifying existing code. Think of a mobile phone’s operating system — it allows users to install new apps without altering the core system.</p><p>A real-world software example is a payment system. Suppose an e-commerce platform initially supports credit card payments. Later, if the business decides to add PayPal as another payment method, the right approach is not to modify the existing PaymentProcessor but to create a new PayPalPaymentProcessor class that follows the same structure as the existing payment processors. This way, the system extends functionality without affecting existing payment methods. By using interfaces like IPaymentProcessor, new payment methods can be added seamlessly without modifying the core logic, making the system scalable and resilient to change.</p><h3>3. Liskov Substitution Principle (LSP)</h3><p>Third Principle is Liskov Subtitution principle. Objects of a subclass should be able to replace objects of a superclass without causing errors. Consider a universal remote control — it should work with any TV brand without requiring a different remote for each. Similarly, if a BaseNotification class has methods for sending messages, its subclasses (e.g., EmailNotification, SMSNotification) should be able to replace it without altering the functionality. Violating this principle can lead to unpredictable behavior when working with inherited classes.</p><h3>4. Interface Segregation Principle (ISP)</h3><p>Fourth one is Interface Segeration Principle.Clients should not be forced to depend on interfaces they don’t use. Imagine a hotel buffet where guests can choose between vegetarian and non-vegetarian meals. Forcing a vegetarian guest to select from the non-vegetarian menu is unnecessary. In software, this principle suggests that instead of having one large interface, it should be divided into smaller, more specific interfaces. For example, instead of a single UserInterface with methods for createUser(), deleteUser(), and verifyEmail(), separate interfaces like IUserManagement and IUserVerification make more sense, allowing flexibility and reducing dependencies.</p><h3>5. Dependency Inversion Principle (DIP)</h3><p>Final one is Dependency Inversion Pricniple. High-level modules should not depend on low-level modules; both should depend on abstractions. Consider an electric socket — appliances can be plugged in without worrying about internal wiring. Similarly, instead of directly creating an instance of a database service inside a repository, it’s better to depend on an abstraction like IDatabaseService and inject it using a dependency injection framework. This makes the system more adaptable to future changes, such as switching from SQL to NoSQL databases, without requiring major code modifications.</p><p>Applying SOLID principles leads to cleaner, more maintainable, and scalable software. These principles ensure that code remains modular and adaptable throughout the software lifecycle. One of the best real-world applications of SOLID is Clean Architecture, which separates concerns into distinct layers, making software more flexible and resilient to change. It provides a perfect example of how SOLID principles can be used together to build well-structured applications. In the next article, I will discuss how SOLID principles apply in Clean Architecture, helping developers design even more efficient systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b31840d53102" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Do Data Structures and Algorithms Form the Foundation of Modern Technology?]]></title>
            <link>https://medium.com/@rashmisenadheera98/how-do-data-structures-and-algorithms-form-the-foundation-of-modern-technology-4a83954afd39?source=rss-8fc7a11142d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a83954afd39</guid>
            <dc:creator><![CDATA[Kushana Senadheera]]></dc:creator>
            <pubDate>Wed, 08 Jan 2025 09:17:43 GMT</pubDate>
            <atom:updated>2025-01-08T09:22:50.242Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*IkjrPCejyuHEs3mg-T0P-w.jpeg" /></figure><p>Have you ever wondered how your favorite apps, like Netflix or Instagram, deliver lightning-fast results or suggest exactly what you want to see? The secret lies in something every developer must master: <strong>Data Structures and Algorithms (DSA)</strong>. These aren’t just buzzwords; they are the backbone of efficient programming. Data Structures organize information, while Algorithms solve problems step by step. Together, they form a powerful duo, making software systems smarter, faster, and more reliable.</p><p>Data structures help in organizing data for various tasks such as searching, sorting, and modifying. Common types of data structures include:</p><ul><li><strong>Arrays</strong>: An array is a data structure used to store multiple elements. It is indexed, meaning each element has a specific position (index) in the array. In most programming languages (Python, Java, C), arrays use zero-based indexing, where the first element is accessed at index 0.</li><li><strong>Linked List</strong>: A linked list consists of nodes, each containing data and a pointer (or link) to the next node. One advantage of linked lists is that nodes are not required to be stored contiguously, unlike arrays. Linked lists also allow easier addition or removal of nodes without shifting the rest of the list.</li><li><strong>Trees</strong>: A tree data structure is similar to a linked list but allows each node to have multiple children. This branching structure is useful for representing hierarchical data, such as file systems or organizational charts.</li></ul><p>Below, you’ll find some of the most commonly used algorithms, each playing a crucial role in solving specific types of problems and enhancing the efficiency of software systems.</p><ol><li><strong>Sorting Algorithms</strong>: Sorting is one of the most fundamental topics in DSA. Various sorting algorithms are used depending on the problem’s needs.</li></ol><p>· <strong>Why It’s Important</strong>: Sorting is essential for applications like searching, merging, and data visualization.</p><p>· <strong>Key Sorting Algorithms</strong>: Merge Sort, Quick Sort, Bubble Sort, and Selection Sort.</p><ol><li><strong>Dynamic Programming (DP)</strong>: Dynamic programming is a method for solving complex problems by breaking them down into smaller subproblems and storing their solutions to avoid redundant computations.</li></ol><p>· <strong>Why It’s Important</strong>: DP optimizes problems that would otherwise require excessive computation using recursion.</p><p>· <strong>Key DP Problems</strong>: Knapsack Problem, Longest Common Subsequence, Fibonacci Sequence.</p><ol><li><strong>Graph Algorithms</strong>: Graphs are crucial for solving problems related to networks, routing, and hierarchical data.</li></ol><p>· <strong>Why It’s Important</strong>: Graph algorithms are widely used to model real-world problems, such as social networks, routing, and task scheduling.</p><p>· <strong>Key Graph Algorithms</strong>: Dijkstra’s Algorithm, Depth-First Search (DFS), Breadth-First Search (BFS).</p><p><strong>Applications of DSA in Software Systems</strong></p><p>DSA are used in nearly every software system, ranging from operating systems to web applications. They play key roles in:</p><ul><li><strong>Managing large amounts of data</strong>: For example, in social networks or search engines.</li><li><strong>Scheduling tasks</strong>: Deciding which task a computer should prioritize next.</li><li><strong>Planning routes</strong>: Such as in GPS systems to find the shortest path.</li><li><strong>Optimizing processes</strong>: Arranging tasks for maximum efficiency.</li><li><strong>Solving complex problems</strong>: From logistics (e.g., packing a truck) to machine learning (e.g., training a model).</li></ul><p>In real life, we encounter DSA in many places. For instance, when using Netflix, the platform suggests movies based on your previous interactions. This is where DSA plays a crucial role in efficiently handling large amounts of data and making predictions based on your preferences.</p><p>In conclusion, Data Structures and Algorithms (DSA) are the backbone of efficient problem-solving in both real-world applications and coding interviews. Understanding and mastering these concepts is crucial for developers, as they provide the tools to organize and manipulate data efficiently, ultimately improving the performance of software systems. Whether it’s managing large datasets, optimizing processes, or solving complex problems, DSA is at the heart of it all. Moreover, their significance extends beyond practical applications, playing a vital role in assessing a candidate’s problem-solving abilities during interviews. By honing your skills in DSA, you not only become a better developer but also position yourself for success in the competitive tech industry. Embrace the challenge of learning DSA, and watch how it transforms your ability to think algorithmically and tackle problems with confidence.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a83954afd39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React DOM Simplified: The Key to Building Dynamic Web Apps]]></title>
            <link>https://medium.com/@rashmisenadheera98/react-dom-simplified-the-key-to-building-dynamic-web-apps-93f88b6267de?source=rss-8fc7a11142d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/93f88b6267de</guid>
            <dc:creator><![CDATA[Kushana Senadheera]]></dc:creator>
            <pubDate>Thu, 05 Dec 2024 17:48:44 GMT</pubDate>
            <atom:updated>2024-12-06T01:17:49.546Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FObaeYlTjVLVtKFMCsBKiQ.png" /></figure><p><strong>Understanding the Basics of DOM and React DOM</strong></p><p>The Document Object Model (DOM) is a programming interface that provides a tree like model of the web page. Each of the heading, the paragraph, and the images is an object that JavaScript is capable of manipulating. This structure facilitates the flow of web page construction and alteration dynamically, which is the foundation of the contemporary web development.</p><p><strong>React DOM</strong> on the other hand is a package in React that binds React components to the browser DOM. It allows mounting React components into the DOM and handling their life cycle. Although React makes the process of constructing UI easy by using a declarative and component-based architecture, React DOM interprets these components into updates that the browser’s DOM can easily implement.</p><p>To install React DOM, use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*RaHUItE_sQu4iMWb_Sg4Ow.png" /></figure><p>You can use React DOM to render your app with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*Y9ZWkV5Xwrq1KrorvMGMYw.png" /></figure><p>This code mounts the &lt;App /&gt; component into the HTML element with the id=&quot;root&quot;.</p><p><strong>The Virtual DOM</strong></p><p>Although React DOM is responsible for applying updates to the actual DOM, React has a smart assistant to make the process faster and smoother, which call as Virtual DOM. The Virtual DOM can be thought of as a workspace where React tries out and makes modifications before applying them to the actual DOM.</p><p><strong>How the Virtual DOM Works</strong></p><p>Here’s a simple way to understand it:</p><p>React makes a virtual copy of the DOM in memory, it is small, fast, and is only used for a short time.</p><p>Every time something happens in your app, such as a button click or a form submission, react first updates this copy.</p><p>It then compares the new virtual version with the old one using a smart process known as diffing. This comparison helps to identify what has been altered — right to the last detail.</p><p>Once React knows what has changed, it updates only that part in the real DOM and not the whole page.</p><p><strong>Why all this effort?</strong></p><p>Since the real DOM is slower to manipulate and frequent changes to it can negatively impact your application. By only considering the changes that are needed, React makes things as fast as possible, even in applications that are frequently updating.</p><p><strong>How React DOM and Virtual DOM Interact</strong></p><p>The Virtual DOM can be thought of as the decision maker of the process — it determines the minimal number of changes. React DOM is the hands — it implements the plan by making those changes happen in the real DOM. Combined, they are a great team that will make sure your app is performing optimally and without a hitch regardless of its size.</p><p>React DOM then applies these calculated changes to the real DOM, which makes it update only the parts of the page that require change.</p><p>Combined, they minimize the need for rendering, conserve system resources and provide a smooth experience to the end user.</p><p>The combination of the DOM, React DOM, and the Virtual DOM is a clear example of how smart React is. These tools help to fill the gap between the web page layout and the dynamic requirements of today’s applications, enabling developers to build fast, responsive, and scalable UI. Combined, they transform the process of creating and using web applications, making React an essential tool in the world of web development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93f88b6267de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>