<?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 Dulmi Hettiarachci on Medium]]></title>
        <description><![CDATA[Stories by Dulmi Hettiarachci on Medium]]></description>
        <link>https://medium.com/@hasardulmi?source=rss-0aa2de5f7559------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*643kDKRrAxLhLP4KmBulUA.jpeg</url>
            <title>Stories by Dulmi Hettiarachci on Medium</title>
            <link>https://medium.com/@hasardulmi?source=rss-0aa2de5f7559------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:20:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hasardulmi/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[A Beginner’s Guide to Black Box, White Box, and Experience-Based Testing]]></title>
            <link>https://medium.com/@hasardulmi/a-beginners-guide-to-black-box-white-box-and-experience-based-testing-9af436506600?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/9af436506600</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Sun, 16 Nov 2025 16:36:10 GMT</pubDate>
            <atom:updated>2025-11-16T16:36:10.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rOfCjY0j2UUiRMO8rhE_A.png" /><figcaption>Generate the image from Gemini AI</figcaption></figure><p>Testing is an important part of software development because it helps us make sure that the system works the way users expect. To test effectively, QA testers use different <em>test techniques</em>. These techniques guide how tests are designed and help us find defects early.</p><p>In this article, we will look at three main types of test techniques:</p><p><strong>✅ Black Box Testing<br>✅ White Box Testing<br>✅ Experience-Based Testing</strong></p><p>Let’s discuss each one in simple</p><h3><strong>🔶 Black Box Testing</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_eRIWdPJRN78532TsXmg8w.png" /><figcaption>Generate the image from Gemini AI</figcaption></figure><p>Black box testing focuses on the <em>functionality</em> of the software.<br> The tester does <strong>not</strong> look at the internal code.<br> You simply give an input → check output → confirm behavior.</p><p>Imagine you have a login page.<br>You enter a username and password.<br>You don’t care how the code checks the credentials internally.<br>You only check whether the login is successful or not.</p><p>This is black box testing.</p><h4>Black Box Testing Techniques</h4><p><strong>1️⃣ Equivalence Partitioning (EP)</strong></p><p>You divide inputs into groups (partitions) where each group behaves the same.</p><p><strong>🔷 Example:</strong><br> Password length must be <strong>6 to 12 characters</strong>.<br>Group 1: Less than 6 → Invalid<br>Group 2: Between 6–12 → Valid<br>Group 3: More than 12 → Invalid</p><p>Instead of testing all possible lengths, you pick <strong>one test</strong> from each group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2aOTYG3XTjW8BfruGnCzVg.png" /><figcaption>Generate the image from Gemini AI</figcaption></figure><p><strong>2️⃣ Boundary Value Analysis (BVA)</strong></p><p>Errors often occur at boundaries.<br> So you test at the edge values.</p><p><strong>🔷 Example:</strong> same password rule (6–12 characters)</p><p>Boundary values:<br>5 (just below)<br>6 (lower boundary)<br>12 (upper boundary)<br>13 (just above)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-tsY0GfJWOYRTdJSRyrhyQ.png" /><figcaption>Generate the image from Gemini AI</figcaption></figure><p><strong>3️⃣ Decision Table Testing</strong></p><p>Used when the output depends on <strong>multiple conditions</strong>.</p><p><strong>🔷 Example:</strong><br> Discount rules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_u3czUjRDm_I5r8wJy7f7g.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p>You test each combination.<br> This helps you catch missing logic in complex rules.</p><p><strong>4️⃣ State Transition Testing</strong></p><p>Used when the system’s behavior depends on states and transitions.</p><p><strong>🔷 Example: ATM card</strong></p><p><strong>State 1:</strong> Card inserted<br><strong>State 2:</strong> PIN entered<br><strong>State 3:</strong> Access granted</p><p>If a user enters the wrong PIN 3 times → move to <strong>Blocked state</strong>.<br> Your tests check whether the system moves between states correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PvamnyG2OS0BnAlTl-SGfA.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><h3><strong>🔶 White Box Testing</strong></h3><p>White box testing focuses on the <strong>internal logic and structure</strong> of the code.<br> Testers need some knowledge of how the code works.</p><p>You are testing a function that calculates discounts.</p><p>🔷You look inside the code to check:</p><p>❔Did all lines run?<br>❔Did all conditions run?<br>❔Did the loop execute as expected?</p><p>White box testing ensures that the internal paths are correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2kw9eka--edU02_cr33HiQ.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><h4><strong>White Box Testing Techniques</strong></h4><p><strong>1️⃣ Statement Testing</strong></p><p>You test to make sure <strong>every line of code</strong> executes at least once.</p><p><strong>🔷 Example:</strong><br> If a function has 10 lines, your tests must trigger all lines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DpIg3vua_QD32_G6evIIuA.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>2️⃣ Branch Testing</strong></p><p>You test all possible decision branches.</p><p><strong>🔷 Example:</strong></p><pre>if age &gt; 18:<br>    allow access<br>else:<br>    deny access</pre><p>You must test both:</p><p>age &gt; 18<br>age &lt;= 18</p><p>This ensures both branches work correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JlCnG58UvaX2tXjbAgV6gA.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>🔷 Value of White Box Testing</strong></p><p>✅ Prevent software failures<br>Finding code issues early avoids crashes.</p><p>✅ Improve software reliability<br> More paths tested → more confidence in quality.</p><p>✅ Catch hidden errors<br> Some defects never appear from UI testing but are visible in code logic.</p><p><strong>🔷 Why White Box Testing Matters</strong></p><p>Identify areas to optimize<br>Bad loops or slow logic can be improved.</p><p>✅ Eliminate dead code<br>Code that never runs = unnecessary = reduce maintenance cost.</p><p>✅ Improve performance<br>Better code structure → faster system → happier users.</p><h3>🔶 Experience-Based Test Techniques</h3><p>These techniques depend on the tester’s <strong>knowledge, intuition, and past experience</strong>.<br> They are very useful when documents are unclear or time is limited.</p><p>Let’s look at the main types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McvLsNhwZzc4PRjaT2ETWw.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><ol><li><strong>1️⃣ Error Guessing<br></strong>Testers use past experience to guess where bugs may appear.</li></ol><p><strong>🔷 How error guessing works:</strong></p><p>Think about <strong>common problem areas<br></strong>Apply your <strong>knowledge of past failures<br></strong>Predict the risky areas</p><p>🔷 Works well with error-prone features like:<br>✅ <strong>Date formats<br>✅ User inputs<br>✅ Edge cases</strong> (ex: negative values, blank fields, long strings)</p><p><strong>🔷 Example:</strong><br> You know that many apps fail when entering special characters →<br> So you try: @#$%123 in the username field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WIbOuo1BBiwZixI6fGxQ8w.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>2️⃣ Exploratory Testing</strong></p><p>This is testing without a strict script.<br> You explore the app freely and learn as you go.</p><p>🔷 Characteristics:</p><p>✅ Testing and test design happen <strong>at the same time<br>✅ </strong>You navigate the system like a real user<br>✅ You adjust based on what you discover<br>✅ Works well in fast-changing environments</p><p><strong>🔷 Example:</strong><br> Testing a new shopping app by clicking around, trying different flows, and discovering unexpected issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D1M3eBz5rNPkDXIXEAGudg.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>3️⃣ Checklist-Based Testing</strong></p><p>You use a prepared checklist to guide your testing.</p><p>🔷 What it includes:</p><p>✅ Important functionalities<br>✅ Risky areas<br>✅ Items that must not be missed</p><p>✅ It is structured but still allows you to be flexible.</p><p><strong>🔷 Example checklist items:</strong></p><p>✅ Login works with valid and invalid details<br>✅ Search returns correct results<br>✅ Buttons respond properly<br>✅ Error messages are correct</p><p>This technique helps maintain <strong>consistency</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fsMKCsoeYX7ZC7O7LTPHw.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p>Thank you for reading till the end! My article is now complete, and I truly hope it helped you understand these test techniques more clearly. If you have any suggestions, ideas, or anything you’d like me to improve or add, please feel free to share them in the comments. Your feedback means a lot!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9af436506600" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Foundations of Software Testing]]></title>
            <link>https://medium.com/@hasardulmi/foundations-of-software-testing-8b6a873fb53d?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b6a873fb53d</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Sat, 15 Nov 2025 16:52:40 GMT</pubDate>
            <atom:updated>2025-11-21T00:56:51.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vyvY3tYqfBMRwQ_2zb-Dyg.png" /><figcaption>Generated image from Gemini AI</figcaption></figure><p><strong>1️⃣ What is Testing?</strong><br> Imagine you made a calculator app. You type 2 + 2 and it shows 5 😱<br> <strong>That is a bug! </strong><br>Testing means checking the app again and again to find and fix mistakes BEFORE real people use it.<br>Simple meaning: Testing = Running the app to see if it works correctly.</p><p><strong>2️⃣ Software Testing Life Cycle (STLC)</strong><br> STLC is the step-by-step process followed by testers. It explains how testing should start, how it should run, and how it should end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3MktlEeGjc7fY3pJyB-qmg.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>These are the steps for software testing life cycle :</strong></p><p><strong>✅ Requirement Analysis</strong><br> Testers read and understand the requirements. They identify what needs to be tested.<br>✅ <strong>Test Planning</strong><br> Testers create a plan on <em>how</em> the testing will be done. They decide the scope, tools, time, and resources.<br>✅ <strong>Test Case Development</strong><br> Testers write detailed test cases. These test cases include steps to check each function.<br>✅ <strong>Test Environment Setup</strong><br> The testing environment is prepared. For example, installing the application, setting up databases, or creating test accounts.<br>✅ <strong>Test Execution</strong><br> Testers execute (run) the test cases and note whether each test passes or fails.<br>✅ <strong>Test Closure</strong><br> Testing ends after completing all tests. Testers prepare a summary report and close the cycle.</p><p><strong>3️⃣ Why Testing is Important</strong></p><p>✅Find mistakes early (cheaper to fix) <br>✅Users don’t get angry <br>✅ App doesn’t crash<br>✅ Company saves money<br>✅You feel proud of your work 😊</p><p><strong>4️⃣ Who Does Testing?</strong></p><p><strong>✅ Manual Tester</strong> → Clicks and checks everything by hand<br>✅ <strong>Automation Tester</strong> → Writes code so computer tests automatically<br>✅ <strong>Test Leader</strong> → Guides the testing team<br>✅ <strong>Users (UAT)</strong> → Real people try the app at the end</p><p><strong>5️⃣ What is Testware?</strong></p><p>All the things testers create to do their job:</p><p>✅ Test plans<br>✅ Test cases<br>✅ Test data<br>✅ Bug reports<br>✅ Test scripts<br>✅ Test summary reports</p><p>👉 These are called Testware.</p><p><strong>6️⃣ What is Test Management?</strong></p><p>Organizing testing nicely, so nothing is missed. It means:</p><p>✅ Save and manage test cases<br>✅ Track bugs<br>✅ See daily progress<br>✅ Make reports Common tools: <strong>JIRA</strong></p><p><strong>7️⃣ What is Traceability?<br></strong>Connecting every customer requirement to at least one test case. We use a table called Requirement Traceability Matrix (RTM). This makes sure nothing is forgotten.<br>✅ Every requirement has at least one test case<br>✅ Nothing is missed during testing<br>✅ Results are easy to monitor</p><p><strong>8️⃣ Testing in the Software Development Lifecycle</strong></p><p>Testing is a part of the entire software development process. Different development models involve testing differently.</p><p><strong>🔶 Waterfall Model</strong><br>The waterfall model is a linear, step-by-step process. Each phase must finish before the next one begins. <strong>Testing happens only after development is completed.</strong></p><p><strong>Example:</strong><br> First gather requirements → then design → then develop → then test → then deploy.</p><p>This model is easy to understand but it has a big disadvantage:<br> <strong>If a bug is found late, it is expensive to fix because previous stages cannot easily be changed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZwxgwj5454pkMOiYO2fuA.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>🔶 Agile Model</strong></p><p>In Agile, work is divided into small time periods called <strong>sprints</strong> (usually 1–4 weeks).<br><strong> Testing happens continuously along with development.</strong></p><p>Characteristics of Agile:<br>✅ Testers and developers work closely together<br>✅ Requirements can change anytime<br>✅ Testing starts early<br>✅ Fast feedback<br>✅ Working software is delivered regularly</p><p>Agile is more flexible and widely used today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M2U5vzniV42hn02P3uHvtw.png" /><figcaption>Generate the image from Gemini AI</figcaption></figure><p><strong>9️⃣ Testing Types</strong></p><p><strong>🔶 Functional Testing </strong>(Does it DO the right thing?)</p><p><strong>✅ Unit Testing</strong><br>Testing small individual parts of the application. Usually done by developers.<br><strong>Example:</strong><br> Testing if a function correctly calculates the total bill.</p><p><strong>✅ Integration Testing</strong><br>Testing how two or more modules work together.<br><strong>Example:</strong><br> Testing if the login screen correctly connects with the user database.</p><p><strong>✅ System Testing</strong><br>Testing the entire system as a whole.<br><strong>Example:</strong><br> Testing the full e-commerce website including login, add to cart, payment, etc.</p><p><strong>✅ User Acceptance Testing (UAT)</strong><br>Testing done by end users or clients to check if the system meets their needs.<br><strong>Example:</strong><br> A shop owner checks whether the newly built billing system works as expected.</p><p><strong>✅ Regression Testing</strong><br>Testing to ensure recent changes have not broken existing features.<br><strong>Example:</strong><br> After fixing a bug in the payment page, you test other related pages to make sure nothing else is affected.</p><p><strong>🔶 Non-Functional Testing </strong>(How WELL does it work?)</p><p><strong>✅ Performance Testing</strong><br>Checking how the system performs under load.<br><strong>Example:</strong><br> Testing if a website can handle 1000 users at the same time.</p><p><strong>✅ Security Testing<br></strong>Checking if the system is protected from attacks.<br><strong>Example:</strong><br> Testing whether a user can access another user’s private data.</p><p><strong>✅ Usability Testing</strong><br>Checking how user-friendly the system is.<br><strong>Example:</strong><br> Seeing if a new user can easily find the “Register” button.</p><p><strong>✅ Compliance Testing</strong><br>Checking if the system follows rules and legal guidelines.<br><strong>Example:</strong><br> Ensuring a payment system follows financial regulations.</p><p><strong>✅ Localization Testing</strong><br>Testing how the system behaves in different languages and regions.<br><strong>Example:</strong><br> Checking if the app displays correct Sinhala or Tamil text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a6EnU2JrtbyrIBclE8ATZQ.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p><strong>🔶Static vs Dynamic Testing</strong></p><p><strong>✅ Static Testing</strong><br>Testing without running the code.<br><strong>Examples:</strong><br> Document reviews, code reviews</p><p><strong>✅ Dynamic Testing<br></strong>Testing by running the application.<br><strong>Examples:</strong><br> Manual testing, automation testing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DjxvNHjC0UHC1-gX-GNMg.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p>1️⃣0️⃣ What is a Test Case?</p><p>A small document that says exactly how to test something.</p><p><strong>Components :</strong><br>✅ Test case ID<br>✅ Title<br>✅ Pre-conditions<br>✅ Test steps<br>✅ Expected result<br>✅ Actual result<br>✅ Status (Pass/Fail)</p><p>Let’s see an example test cases for a login page;<br>Here I mention some test cases for this login page in above structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jo79a-lUkVPG2ILOzQM49w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_JTIdJlXU8jKTIfynm5MA.png" /><figcaption>Generated images from Gemini AI</figcaption></figure><p><strong>1️⃣1️⃣ Test Plan<br></strong>A big document that answers:</p><p>✅ What will we test?<br>✅ What we will NOT test?<br>✅ Who will do the work?<br>✅ Which tools and schedule?<br>✅ What can go wrong (risks)?<br>✅ When can we start and finish testing?</p><p><strong>🔶These are the Test Plan Components:</strong><br>✔️ Introduction<br>✔️ Objectives<br>✔️ Scope<br>✔️ Out of Scope<br>✔️ Test Strategy<br>✔️ Resources<br>✔️ Tools<br>✔️ Schedule<br>✔️ Risks<br>✔️ Entry Criteria<br>✔️ Exit Criteria</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E16d7dYE066zS14DI_wY7Q.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p>1️⃣2️⃣ Bug Report (How to Report a Bug Correctly)</p><p>When you find a mistake, write a clear bug report:</p><p>✔️Bug ID<br>✔️Title (short &amp; clear)<br>✔️Steps to reproduce (1, 2, 3…)<br>✔️Actual Result<br>✔️Expected Result<br>✔️Screenshots or video<br>✔️Severity (how bad is it?)<br>✔️Priority (how fast to fix?)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dT50tDibLhlMY8vi6erXVg.png" /><figcaption>Generated the image from Gemini AI</figcaption></figure><p>📝 And that’s a wrap! ✅ My complete guide to software testing for beginners is ready. Got thoughts or questions? Drop them in the comments , I’d love to hear from you. 💝</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b6a873fb53d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Understanding JWT (JSON Web Token)]]></title>
            <link>https://medium.com/@hasardulmi/understanding-jwt-json-web-token-86f7b886b57f?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f7b886b57f</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 17:28:32 GMT</pubDate>
            <atom:updated>2025-10-28T17:28:32.678Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJWUMbBCajUiGmZVyZ280A.png" /><figcaption>Generated from Gemini AI</figcaption></figure><p>Have you ever wondered how websites know <strong>who you are</strong> after you log in even when you move to another page? 🤔 That’s where <strong>JWT </strong>come in!</p><p>💡 What is JWT ?</p><p><strong>JWT</strong> stands for <strong>JSON Web Token</strong>.</p><p>It’s like a <strong>digital ID card</strong> for you on the internet.</p><p>When you log in to a website, the server checks your username and password. If they’re correct, it creates a <strong>JWT </strong>and sends it back to you. Then, every time you visit another page or send a request, your browser includes this token so the server knows it’s still <em>you</em>.</p><p>💡 Why we use it?</p><p>Once you log in and get a JWT, you don’t need to log in again and again. The token proves that you’re already verified.</p><p>For example, When you login using your email and password, the server (backend) checks if it is correct. If correct, it gives you a token. You keep this token and send it the header when making the request (like getting your profile). The server checks the token and say “Yes this user valid” and gives your data.</p><p>In simple words:</p><p>Login → Get a token</p><p>Use token → Get access</p><p>No token → No access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBr1zLINMCQpXceMKTulAQ.png" /><figcaption>Generated from Gemini AI</figcaption></figure><p>JWT (JSON Web Token) is a secure token used to verify a user’s identity between a client (like postman, a mobile app, or front end) and a server (backend).</p><p>It’s basically a string that carries encoded user information, like user ID or email and it is digitally signed. So no one can modify it.</p><p>It’s used to verify that the token has not been changed. It’s generated using a secret key that only the server knows.</p><p>💡 How JWT works</p><ol><li>User login in<br> The user sends a <strong>POST</strong> request (with email and password) to the login endpoint. The server checks the credentials. If they are valid then it creates a JWT using a secret key and sends it back.</li><li>Client stores the token<br>The client (postman, mobile app, front end) saves this token. usually in local storage.</li><li>Client makes a protected request<br>To access a secure route (like profile or dashboard) the client sends the URL endpoint with (bearer) authorization token.</li><li>Server verifies the token<br>The server reads the token. It uses the secret key to verify the signature. If it valid, extracts user infomation (like user ID). Otherwise it is expired.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ETWQdxVUy5RskzYTUhpJow.png" /><figcaption>Generated from Gemini AI</figcaption></figure><p>💡 Why JWT is useful</p><p>✅ <strong>Secure </strong>— Your password isn’t sent every time.<br>✅ <strong>Fast </strong>— No need to check the database again for each request.<br>✅ <strong>Stateless</strong> — The server doesn’t need to remember who you are the token does it.<br>✅ <strong>Widely Used </strong>— Used in APIs, mobile apps, and websites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5kTEkmSccxMN6TKUyu56uA.png" /><figcaption>Generated from Gemini AI</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f7b886b57f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker for Beginners]]></title>
            <link>https://medium.com/@hasardulmi/docker-for-beginners-9152ef6c6adc?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/9152ef6c6adc</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Sun, 19 Oct 2025 14:36:10 GMT</pubDate>
            <atom:updated>2025-10-20T04:53:46.431Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever made something on your computer that worked perfectly, but when you tried it on another computer, it didn’t work at all? That’s a common problem for many people who build apps.<br> Docker is a tool that helps you fix that problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*GUVzssBqiHcPR6xdU5O0uQ.png" /><figcaption>Download from Docker’s official media resources</figcaption></figure><h3>🧠 What is Docker?</h3><p>Docker helps you <strong>build, run, and share apps easily</strong>.</p><p>Think of it like this; imagine you’re baking a cake. It comes out great in your kitchen, but when you try baking it at a friend’s house, it doesn’t taste the same. Maybe the oven or ingredients are different.</p><p>Docker gives your app its own <strong>portable kitchen </strong>with the same tools and ingredients every time. That means your app will work the same no matter where you run it , on your computer, your friend’s, or a cloud server.</p><h3>🧩 Why Should You Use Docker?</h3><p>Every computer is a bit different ; some have older software, different settings, or other problems that make apps behave differently.</p><p>Docker solves this by <strong>putting your app and everything it needs into one box</strong> called a <strong>container</strong>.<br> This way, your app always works the same, anywhere you run it.</p><p>No more “It worked on my computer!” moments.</p><p>අපි සාමන්‍යයෙන් code එකක් වෙනත් server එකකට දාගන්න ඕනෙ නම් අපි ඒක git repository එකක් විදියට හෝ zip file එකක් විදියට වෙනත් server එකක්ට හෝ device එකක්ට share කරන්නෙ. ඒත් සමහර විට අපිට වෙනත් device එකක්ට ඒ code එකම හරියට work කරන්නෙ නැති වෙන්න පුලුවන්. හේතුව ඒ device එකේ settings වෙනස් වීම හෝ වෙනත් හේතුවක් වෙන්න පුලුවන්. එතකොට අපිට ආයෙ මුල ඉදන්ම code එක test කරලා bugs fix කරන්න වෙන්න පුලුවන්. මේක ටිකක් විතර කරදර වැඩක්නෙ..😥 ඒ නිසා අපිට මේ කරදර ටික නැති කරගෙන ලේසියෙන්ම codes share කරගන්න docker use කරන්න පුලුවන්.🤗 docker වලින් code එක image එකක් විදියට හදලා ලේසියෙන්ම වෙනත් device එකක deploy කරන්න පුලුවන්. ❤️🔥 ඒක වෙන්නෙ කෝමද කියලා පහලින් බලමු..❤</p><h3>🧱 Important Docker Terms</h3><p><strong>📦 Container:</strong><br> A container is a small box that holds your app and everything it needs like its tools and ingredients. Containers are small, fast, and easy to start.</p><p><strong>🧾 Image:</strong><br> An image is like a photo or plan of your app. You can use one image to make many containers.</p><p><strong>📜 Dockerfile:</strong><br> A Dockerfile is a simple text file that tells Docker how to build your image. It’s like giving Docker step-by-step instructions to prepare your app.</p><p><strong>🌍 Docker Hub:</strong><br> This is like an online store for Docker images. You can find ready-made images for apps like MySQL, Node.js, or WordPress or upload your own for others to use.</p><h3>⚡ How Does Docker Work?</h3><p>Here’s how it all happens:</p><ol><li>You write a <strong>Dockerfile</strong> with steps to build your app.</li><li>Docker uses that file to make an <strong>image</strong>.</li><li>You run that image to create a <strong>container</strong> ; your app in its own box.</li><li>You can share the image and run it on any computer that has Docker installed and it’ll work the same everywhere.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*gPjhXJHBni-dDcKOqogz2w.png" /></figure><h3>🌟 Why Docker is Great for Beginners</h3><p><strong>✅ Always works the same:</strong> Your app runs the same on every computer.</p><p><strong>⌛ Easy setup:</strong> You don’t need to install lots of software, just use Docker images.</p><p><strong>🚀 Fast:</strong> Containers start quickly and don’t use much space.</p><p><strong>🧤 Fun to learn:</strong> You can try small projects and learn by doing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9152ef6c6adc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set up an Inventory Management System A Step-by-Step Guide (React.js + Spring Boot + MySQL)]]></title>
            <link>https://medium.com/@hasardulmi/set-up-an-inventory-management-system-a-step-by-step-guide-react-js-spring-boot-mysql-09e557ed770f?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/09e557ed770f</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 15:53:38 GMT</pubDate>
            <atom:updated>2025-02-11T16:17:11.603Z</atom:updated>
            <content:encoded><![CDATA[<h3>Set up an Inventory Management System for Sarasi Shoe Corner: A Step-by-Step Guide (React.js + Spring Boot + MySQL)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*K_s4dEpoOswCXaga-QCHyA.jpeg" /></figure><p>“I’m excited to share my journey of developing an <strong>Inventory Management System</strong> for Sarasi Shoe Corner. In this article, I’ll walk you through how I set up the project, including the tools, technologies, and steps involved. Whether you’re a beginner this guide will help you understand the process of building a full-stack application using <strong>React.js</strong>, <strong>Spring Boot</strong>, and <strong>MySQL</strong>.”</p><h3>Project Set up</h3><h4>Installing Required Tools</h4><p>To get started, I installed the following tools:</p><p>Node.js (For react.js) :<em> </em><a href="https://nodejs.org/en/download/current"><em>Download Node.js</em></a></p><p>Java Development Kit(JDK) : <a href="https://www.oracle.com/lk/java/technologies/downloads/"><em>Download JDK</em></a></p><p>Spring Boot: Use Spring Initializer to generate the project</p><p>MySQL : <a href="https://dev.mysql.com/downloads/workbench/"><em>Download MySQL</em></a></p><p>IDE: Use IntelliJ IDEA</p><h4>Create the spring Boot Project</h4><p>I used <a href="https://start.spring.io/"><em>Spring Initializer</em></a> to generate the Spring Boot project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1SH4xuWJuoikeOpjiz_lA.png" /></figure><p>Then I choose my project as<em> ‘Maven’</em> , Language is <em>‘Java’</em>, The spring boot version as<em> ‘3.4.2’ </em>. Also Group is ‘<em>com.sarasi’ </em>Artifact is ‘<em>shoe-corner’</em>. And I selected <em>‘Jar’</em> for my Packaging and ‘<em>17’</em> for my Java version. (You can choose another version higher than 17).</p><h4>Adding Dependencies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*ps93La0VLD9bpwE3Fy4m9A.png" /></figure><p>I added the following dependencies to my Spring Boot project:</p><p>‘<strong><em>Spring Web’</em></strong> helps to create web applications and APIs. It allows backend to send and receive data from React frontend.</p><p>‘<strong><em>Spring Data JPA’</em></strong> helps to work with databases easily. We don’t need to write complex SQL queries and it helps save, update, delete and fetch data using simple java methods.</p><p>‘<strong><em>MySQL Driver’</em></strong> helps to connect MySQL database to the spring boot.</p><p>‘<strong><em>Lombok’</em></strong> helps to reduce unnecessary codes. It automatically creates getter, setter and constructor methods for java classes and making the codes shorter.</p><p>These dependencies are listed in the pom.xml file. If the dependencies aren’t downloaded automatically, you can manually download them by running:</p><pre>mvn clean install</pre><h3>REST API Explanation</h3><p>When I am 4using the spring boot for my backend of my project, the spring boot exposes REST API (Representational State Transfer — Application Programming Interface). It is a way for two applications to communicate with each other using the internet. In my project, React.js frontend sends a request to the Spring Boot backend (server) using the REST API. The backend processes the request , fetches the data from MySQL (database) and sends back a response. The frontend displays the received data to the user.</p><p>A REST API uses HTTP methods to communicate between a front end (React) and a backend (Spring Boot + MySQL). There are several HTTP methods such as GET (To retrieve data), POST(To send and create new data), PUT(To Update existing data), DELETE( To Remove data).</p><h3>Configure the Backend</h3><p>In modern software development the organizing cods are very important. Spring Boot is a best example for it. In spring boot we use different layers to organize and manage the codes. Here, this is the layers of my project in spring boot backend.</p><p>Entity Layer : Represents the database tables</p><p>Repository Layer : Handles database operations like fetching and storing data.</p><p>Service Layer:Contains the business logic for processing data.</p><p>Controller Layer :Handles client requests and sends responses.</p><p><strong><em>[Frontend] — -&gt; [Controller] — -&gt; [Service] — -&gt; [Repository] — -&gt; [Database]</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*3kxPm5LNHIoI3IlimgZpEw.png" /></figure><h4>Configure MySQL database</h4><p>After opened my spring boot backend project in my<em> ‘IntelliJ IDEA’</em> I opened the <strong><em>“application.properties”</em></strong> file in src/main/resources. Then I added below code if does not existing the database called<em> ‘sarasi_shoe_corner’ </em>then it should create a database in ‘<em>MySQL’.</em></p><pre>spring.datasource.url=jdbc:mysql://localhost:3306/sarasi_shoe_corner?createDatabaseIfNotExist=true</pre><p>After that I added the username, password, and other codes to connect the database with the spring boot backend.</p><pre>spring.datasource.url=jdbc:mysql://localhost:3306/sarasi_shoe_corner?createDatabaseIfNotExist=true<br>spring.datasource.username=root<br>spring.datasource.password=your_password<br>spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver<br>spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect<br>spring.jpa.hibernate.ddl-auto=update</pre><h4>Creating Entity Classes</h4><p>I created a package named entity to store my entity classes. Each entity class represents a table in the database. For example, here’s my user entity</p><pre>package net.javaguides.ims_backend.entity;<br><br>import jakarta.persistence.*;<br>import lombok.AllArgsConstructor;<br>import lombok.Getter;<br>import lombok.NoArgsConstructor;<br>import lombok.Setter;<br><br>@Getter<br>@Setter<br>@NoArgsConstructor<br>@AllArgsConstructor<br>@Entity<br>@Table(name=&quot;users&quot;)<br><br><br><br>public class user {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long user_id;<br><br>    @Column(name=&quot;username&quot;)<br>    private String username;<br><br>    @Column(name=&quot;password&quot;)<br>    private String password;<br><br>    @Column(name=&quot;email&quot;)<br>    private String email;<br><br>    public void user_id(Long id) {<br>    }<br>}</pre><pre>@Entity //Marks this class as a database entity<br>@Table(name=&quot;users&quot;) // Maps it to the users table<br>@Id @generatedValue(strategy = GenerationType.IDENTITY) //Defines the primary key(auto-incremented)<br>@Column(nullable = false, unique = true) //Ensures that username and email are unique.</pre><h4>Creating Repository Interfaces</h4><p>I created a package named repositary to store repository interfaces. These interfaces extend JpaRepositary and handle database operations. For example, here’s my userRepositary:</p><pre>package net.javaguides.ims_backend.repository;<br><br>import net.javaguides.ims_backend.entity.user;<br>import org.springframework.data.jpa.repository.JpaRepository;<br><br>public interface userRepository extends JpaRepository&lt;user, Long&gt; {<br>    // Custom method to find a user by username<br>    user findByUsername(String username);<br><br>    // Custom method to find a user by email<br>    user findByEmail(String email);<br>}Service Class</pre><h4>Service Layer</h4><p>The service layer contains with business logics and it interacts with the repository layer. For example this is my current userService layer.</p><pre>package net.javaguides.ims_backend.service;<br><br>import net.javaguides.ims_backend.entity.user;<br>import net.javaguides.ims_backend.repository.userRepository;<br>import org.springframework.beans.factory.annotation.Autowired;<br>import org.springframework.stereotype.Service;<br><br>import java.util.List;<br><br>@Service<br>public class userService {<br><br>    @Autowired<br>    private userRepository userRepository;<br><br>    // Get all users<br>    public List&lt;user&gt; getAllUsers() {<br>        return userRepository.findAll();<br>    }<br><br>    // Get user by ID<br>    public user getUserById(Long id) {<br>        return userRepository.findById(id).orElse(null);<br>    }<br><br>    // Create or update a user<br>    public user saveUser(user user) {<br>        return userRepository.save(user);<br>    }<br><br>    // Delete a user by ID<br>    public void deleteUser(Long id) {<br>        userRepository.deleteById(id);<br>    }<br><br>    // Find user by username<br>    public user findByUsername(String username) {<br>        return userRepository.findByUsername(username);<br>    }<br><br>    // Find user by email<br>    public user findByEmail(String email) {<br>        return userRepository.findByEmail(email);<br>    }<br>}</pre><h4>Controller Layer</h4><p>The controller layer handles HTTP requests (GET, POST, PUT, DELETE) and interacts with the service layer. For Example; This is my current userController file.</p><pre>package net.javaguides.ims_backend.controller;<br><br>import net.javaguides.ims_backend.entity.user;<br>import net.javaguides.ims_backend.service.userService;<br>import org.springframework.beans.factory.annotation.Autowired;<br>import org.springframework.http.HttpStatus;<br>import org.springframework.http.ResponseEntity;<br>import org.springframework.web.bind.annotation.*;<br><br>import java.util.List;<br><br>@RestController<br>@RequestMapping(&quot;/api/users&quot;)<br>public class userController {<br><br>    @Autowired<br>    private userService userService;<br><br>    // Get all users<br>    @GetMapping<br>    public ResponseEntity&lt;List&lt;user&gt;&gt; getAllUsers() {<br>        List&lt;user&gt; users = userService.getAllUsers();<br>        return new ResponseEntity&lt;&gt;(users, HttpStatus.OK);<br>    }<br><br>    // Get user by ID<br>    @GetMapping(&quot;/{id}&quot;)<br>    public ResponseEntity&lt;user&gt; getUserById(@PathVariable Long id) {<br>        user user = userService.getUserById(id);<br>        return new ResponseEntity&lt;&gt;(user, HttpStatus.OK);<br>    }<br><br>    // Create a new user<br>    @PostMapping<br>    public ResponseEntity&lt;user&gt; createUser(@RequestBody user user) {<br>        user savedUser = userService.saveUser(user);<br>        return new ResponseEntity&lt;&gt;(savedUser, HttpStatus.CREATED);<br>    }<br><br>    // Update an existing user<br>    @PutMapping(&quot;/{id}&quot;)<br>    public ResponseEntity&lt;user&gt; updateUser(@PathVariable Long id, @RequestBody user user) {<br>        user.user_id(id); // Ensure the ID is set<br>        user updatedUser = userService.saveUser(user);<br>        return new ResponseEntity&lt;&gt;(updatedUser, HttpStatus.OK);<br>    }<br><br>    // Delete a user by ID<br>    @DeleteMapping(&quot;/{id}&quot;)<br>    public ResponseEntity&lt;Void&gt; deleteUser(@PathVariable Long id) {<br>        userService.deleteUser(id);<br>        return new ResponseEntity&lt;&gt;(HttpStatus.NO_CONTENT);<br>    }<br><br>    // Find user by username<br>    @GetMapping(&quot;/username/{username}&quot;)<br>    public ResponseEntity&lt;user&gt; getUserByUsername(@PathVariable String username) {<br>        user user = userService.findByUsername(username);<br>        return new ResponseEntity&lt;&gt;(user, HttpStatus.OK);<br>    }<br><br>    // Find user by email<br>    @GetMapping(&quot;/email/{email}&quot;)<br>    public ResponseEntity&lt;user&gt; getUserByEmail(@PathVariable String email) {<br>        user user = userService.findByEmail(email);<br>        return new ResponseEntity&lt;&gt;(user, HttpStatus.OK);<br>    }<br>}</pre><pre>@RestController // Define this class as a REST API controller<br>@RequestMapping(&quot;/api/users&quot;) // Sets the base URL for user-related APIs.<br><br>Handles HTTP requests<br>@GetMapping - Fetch all users<br>@GetMapping(&quot;/{username}&quot;) - Fetch user by username<br>@PostMapping - Create a new user.<br>@DeleteMapping(&quot;/{id}&quot;) - Delete a user.<br>@PutMapping(&quot;/{id}&quot;) - Update a user.<br></pre><h3>Set up the Frontend</h3><h4>Set up React.js</h4><p>Then I already set up my backend successfully. So now I going to set up my frontend with react.js. For that I ran this commands in my terminal.</p><p>Firstly I ran this command <strong><em>“npx create-react-app sarasi-shoe-corner-frontend” </em></strong>to create the react app for my project as <strong><em>sarasi-shoe-corner</em></strong> for my frontend. Then to navigate the frontend I ran this command. <strong><em>“cd sarasi-shoe-corner-frontend” </em></strong>Now I navigate into the frontend. After that to run the react project I gave this command as <strong><em>“npm start”.</em></strong> Finally to install the dependencies in react project I used this command as <strong><em>“npm install axios react-router-dom bootstrap”</em></strong>. So now I successfully set up my front end also.</p><p>So far, I’ve set up the backend using <strong>Spring Boot</strong> and <strong>MySQL</strong>, and the frontend using <strong>React.js</strong>. In the next article, I’ll talk more about implementing features like inventory management, sales tracking, and reporting. I hope this guide helps you understand the basics of setting up a full-stack application. If you have any questions or suggestions, feel free to leave a comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09e557ed770f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Set Up my New Inventory Management System Project (Part 1)]]></title>
            <link>https://medium.com/@hasardulmi/how-i-set-up-my-new-inventory-management-system-project-part-1-9ec140c7538a?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ec140c7538a</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Sun, 09 Feb 2025 14:01:03 GMT</pubDate>
            <atom:updated>2025-02-09T14:01:03.451Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*cgA9Yu29vDissSCpABEuOg.jpeg" /></figure><h4><strong><em>Setting Up Frontend</em></strong></h4><p>This is my software development project, which I need to develop for my 3rd-year compulsory module at my university. First of all I created a Git repository for this and then cloned it into my Vs code editor. After that to set up the project I created a React app using ‘<strong><em>npx create-react-app frontend’ t</em></strong>o start my frontend project. At that time while I creating my front end I got some errors. The first error was the app required React version 18, but my system had React 19, which caused a conflict. To fix that error I had to manually install React version 18 by using this command. <strong><em>“npm install react@18 react-dom@18 — legacy-peer-deps”</em></strong></p><p>Another error I got was a missing file<strong><em> “web-vitals”. </em></strong>The app displayed an error saying it couldn’t find <strong><em>“web-vitals” </em></strong>file.<strong><em> </em></strong>So to fix that error I had to install it manually by using <strong><em>“npm install web-vitals — save”</em></strong> command. The purpose of the <strong><em>“web-vitals” </em></strong>tool is to help developers make websites faster and better for users.</p><p>Additionally, I received a warning about missing my <strong><em>“Babel setup”</em></strong>. So to fix that I installed it manually by using <strong><em>“npm install — save-dev </em></strong><a href="http://twitter.com/babel/plugin-proposal-private-p"><strong><em>@babel/plugin-proposal-private-p</em></strong></a><strong><em>roperty-in-object” </em></strong>command. The purpose of the Babel is it is a tool that translates modern JavaScript code into an older version that all browsers can understand.</p><p>After fixing those errors then my frontend was running smoothly.</p><p>Through this process, I learned how to fixing dependency problems. If we get some errors due to mismatched package version (like React) and we can fix them by manually installing the correct version.</p><h4>Setting Up Navigation</h4><p>Next, I set up Navigation to move between pages. So I used React Router to enable page navigation by using<strong><em> “npm install react-router-dom”</em></strong> command. Then this allowed me to create multiple pages (like dashboard, login) in my web-site and let users move between them.</p><h4>Installing and Configuring Tailwind CSS</h4><p>After that I checked whether Tailwind CSS was correctly setup for my project. Tailwind CSS is a tool to style my app. It gives me pre-make classes to make my app look nice. To install Tailwind CSS along with PostCSS and Autoprefixer, I ran the following command as <strong><em>“npm install tailwindcss postcss autoprefixer”</em></strong> .</p><p>Tailwind requires proper configuration, so I initialized it using <strong><em>“npx tailwindcss init -p” </em></strong>command. This command generated the necessary configuration files for Tailwind and PostCSS to work smoothly with my project.</p><p>After that I had to create the <strong><em>“postcss.config.js” </em></strong>file. This step was automatically done when I ran the command <strong><em>“npx tailwindcss init -p”</em></strong>. PostCSS is a tool that processes my CSS files. When they are not created automatically you have to create them manually.</p><h4>Adding Tailwind Styles</h4><p>To apply Tailwind’s default styles in my main CSS file <strong><em>(index.css) </em></strong>I made some changes in my<strong><em> index.css </em></strong>file by adding this codes.</p><p><strong><em>@tailwind base;</em></strong></p><p><strong><em>@tailwind components;</em></strong></p><p><strong><em>@tailwind utilities;</em></strong></p><p>In summery what I did is;<strong> I installed React router</strong> to setup pages and navigation, <strong>Installed Tailwind CSS</strong> to style the app using pre-made classes, <strong>Ran a command</strong> to create configuration files for Tailwind and PostCSS and finally <strong>Updated index.css</strong> to link Tailwind’s styles with my app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ec140c7538a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[C]]></title>
            <link>https://medium.com/@hasardulmi/c-8a7a6b7b92a5?source=rss-0aa2de5f7559------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a7a6b7b92a5</guid>
            <dc:creator><![CDATA[Dulmi Hettiarachci]]></dc:creator>
            <pubDate>Sat, 08 Feb 2025 18:36:45 GMT</pubDate>
            <atom:updated>2025-02-11T16:46:49.665Z</atom:updated>
            <content:encoded><![CDATA[<h3>Java Script for Beginners (Part 1)</h3><p>java script is a programming language and commonly used to write logic instead of markup. I hope to give an basic idea about the java script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*Bbbi7RDBTNwfm-5gVuFMsQ.jpeg" /></figure><h3><strong>How to declare a variable</strong></h3><p>Firstly let’s we get an idea about variables of java script. The variables are important concept in programming. A variable points to a specific memory address that stores a value.</p><p>When we declare a variable in java script we should use a keyword as<strong><em> let</em></strong>. For an example; When we want to declare <em>‘hello’ </em>as a variable, we should code it as ,</p><p><strong><em>let hello;</em></strong></p><p>When we declare a variable we should follow some rules, such as; names can be included letters, numbers, special characters and underscore, but we can not contain the spaces. Also we can not declare a variable with a number.</p><p>when we want to assign a value for the variables, we can use <em>assignment operator (</em><strong><em>=) </em></strong><em>.</em> For example; when we want to assign <em>“World”</em> value to the <em>“hello” </em>variable, it can be as,</p><p><strong><em>let hello = “World”;</em></strong></p><p>But we should remember, when we assign a string for the variable we should use <em>single quotes ( ‘ ’ )</em> or<em> double quotes ( “ ” )</em>. Also we should put a <em>semi colon</em> ( ; ) all the end of statements . Note that, strings are immutable, the meaning of that once they are created they can not be changed. But variables can reassign from another values. For example,</p><p><strong><em>let hello = “World”;</em></strong></p><p><strong><em>console.log(hello); // first output</em></strong></p><p><strong><em>hello = “Sea”;</em></strong></p><p><strong><em>console.log(hello); // second output</em></strong></p><p>When run above part of code we can see the<em> </em><strong><em>first output is World</em> </strong>and <strong><em>second output is Sea.</em> </strong>Also when we want to print something in java script we can use <strong><em>console.log(); </em></strong>statement. Not only that, we can reassign a variable from another variable. For an example;</p><p><em>l</em><strong><em>et first_language = “java”;</em></strong></p><p><strong><em>let second_language = “java script”;</em></strong></p><p><strong><em>second_language = first_language;</em></strong></p><p><strong><em>console.log(second_language); // Can output as java.</em></strong></p><p>Then you can get the value as <strong><em>“java”</em></strong> for the<em> </em><strong><em>second_language variable.</em></strong></p><p>Let’s see how we assign a number as a value for the variable. When we assign a number for a variable we don’t use quotes. For example;</p><p><strong><em>let count = 100;</em></strong></p><p>With the number data types, we can do operations like<em> addition(+),</em> <em>subtraction(-), multiplication(*) and division(/)</em> <em>etc.</em> For example;</p><p><strong><em>let count = 10;</em></strong></p><p><strong><em>console.log(count+1); // we can get output as 11.</em></strong></p><h4>Arrays</h4><p>When programming, we have to work with a lot of data. So we have to manage and organize them as necessary. So we use a common data structure as <strong><em>array</em>.</strong> Array is a <em>non-primitive</em> data type. Also it can store many complex data.</p><p>When we using arrays we use <em>square brackets ( [ ] ). </em>For example;</p><p><strong><em>let array = [ ];</em></strong></p><p>We can use numbers called index inside the square brackets. We can represent the position of the value in the array by using indexes. The first index is stating from 0. For example; <strong><em>array[0] .</em></strong></p><p><strong><em>let array = [ ‘first’ , ‘second’, ‘third’ ];</em></strong></p><p><strong><em>console.log(array[0]); // can get output as first.</em></strong></p><p>Arrays are <em>mutable / mutation. </em>Mutable means we can change the values at an index directly. For example;</p><p><strong><em>let array = [ ‘first’, ‘second’, ‘third’];</em></strong></p><p><strong><em>array[1] = 2;</em></strong></p><p><strong><em>console.log(array); // you can see the output as [‘first’, 2, ‘third’];</em></strong></p><p>Let’s consider if we need to know about that what is the array length? So we can use <strong><em>.length </em></strong>property. It returns the number of elements of the array. But if we want to know what is the last index of the array, then we can subtract 1 from the array length. For example;</p><p><strong><em>let array = [‘first’, ‘second’, ‘third’];</em></strong></p><p><strong><em>console.log(array.length); // output is 3</em></strong></p><p><strong><em>console.log(array.length- 1); // output is 2</em></strong></p><p><strong><em>console.log(array[array.length- 1]); // output is third</em></strong></p><p>We can change the values of the variables by using array length. For example;</p><p><strong><em>let array = [‘first’, ‘second’, ‘third’];</em></strong></p><p><strong><em>array[array.length-1] = 3;</em></strong></p><p><strong><em>console.log(array); // output is [‘first’, ‘second’, 3];</em></strong></p><p>A method in Java script is a function. And they are associated with certain values or objects. For example; now we all know about <strong><em>console.log( )</em></strong> and in this, the <strong><em>.log ( )</em></strong> is the <strong><em>method </em></strong>part and the <strong><em>console </em></strong>part is the object.</p><p>By considering arrays, they have their own methods. One of them is<strong> <em>.push()</em> </strong>method. We can use this method to add a value to the end of the array. For example;</p><p><strong><em>let array = [‘first’, ‘second’, ‘third’];</em></strong></p><p><strong><em>array.push(‘fourth’);</em></strong></p><p><strong><em>console.log(array); // output is [‘first’, ‘second’, ‘third’ , ‘fourth’]</em></strong></p><p>The another method of java script is<strong> <em>.pop( ) </em></strong>method. We can use this method to remove the last value from the array. For example;</p><p><strong><em>let array = [‘first’, ‘second’, ‘third’];</em></strong></p><p><strong><em>let popped = array.pop( );</em></strong></p><p><strong><em>console.log(popped); // output is third.</em></strong></p><p><strong><em>console.log(array); // output is [‘first’, ‘second’].</em></strong></p><p>Let’s see what does<strong> <em>.push( )</em> </strong>return? When we return the .push( ) method we can get the new length of the array.</p><p><strong><em>let array = [‘first’, ‘second’, ‘third’];</em></strong></p><p><strong><em>array.push(‘forth’);</em></strong></p><p><strong><em>let pushed= array.push( );</em></strong></p><p><strong><em>console.log(pushed); // output is 4.</em></strong></p><p><strong><em>console.log(array); // output is [‘first’, ‘second’, ‘third’, ‘forth’]</em></strong></p><h3>How to declare a constant</h3><p>Now, we all know about how to declare a variable. Then let’s see how to declare a constant. The special thing of the constant is that we can’t reassign any values of constant. They are only readable. We use the keyword as <strong><em>const</em> </strong>to declare the constants. For Example; if we reassign the <strong><em>const,</em></strong> we can get an error message.</p><p><strong><em>const number = “first”;</em></strong></p><p><strong><em>number = “second”; // output : TypeError: “number” is read-only.</em></strong></p><h3>Loops</h3><h4>for loop</h4><p>sometimes we want to create multiple values. At that time we can create loops to repeat until fulfill the condition. There are many ways to create loops. But Firstly we should consider a basic <strong><em>for</em> </strong>loop. The basic structure of the loop is</p><p><strong><em>for (iterator; condition; iteration) {</em></strong></p><p><strong><em>logic;</em></strong></p><p><strong><em>}</em></strong></p><p>Commonly we use<em> </em><strong><em>i </em></strong>for the iterator. We can assign values for the iterator. For example;</p><p><strong><em>for (let i = 0; condition; iteration) {</em></strong></p><p><strong><em>logic;</em></strong></p><p><strong><em>}</em></strong></p><p>To declare the<em> </em><strong><em>i (iterator)</em></strong><em> </em>we use <strong><em>let</em></strong> before the variable. Also end of the iterator and condition we always should use semicolon but don’t use it at end of the iteration.</p><p>To run the loop we use the condition. It helps to get an idea how many times it should iterate. When the iterator fulfil the condition (if condition is false) then loop is stopped. For example;</p><p><strong><em>for (let i = 0; i&lt;10; iteration) {</em></strong></p><p><strong><em>logic;</em></strong></p><p><strong><em>}</em></strong></p><p>When running above code the loop should be at iterate 10 times. When<strong> <em>‘i’</em></strong> is become 10, the loop will stop.</p><p>If loop runs to next iterate, the iteration should increase or decrease. For example;</p><p><strong><em>for (let i = 0; i&lt;10; i++) {</em></strong></p><p><strong><em>logic;</em></strong></p><p><strong><em>}</em></strong></p><p>the<em> </em><strong><em>i++</em></strong> is similar to the <strong><em>i=i+1</em>.</strong> So it helps to iterate the loop to the next step. For example;</p><p><strong><em>for (let i = 0; i&lt;10; i++) {</em></strong></p><p><strong><em>console.log(i);</em></strong></p><p><strong><em>}</em></strong></p><p>So you can get the 10 outputs as 0,1,2,3,4,5,6,7,8,9 one by one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a7a6b7b92a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>