<?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 Bensoltane Mohammed Amine on Medium]]></title>
        <description><![CDATA[Stories by Bensoltane Mohammed Amine on Medium]]></description>
        <link>https://medium.com/@bensoltane.mohammed.amine?source=rss-e593ff7a558a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*STQMuXFMUoK3wpcMiRDGVw.jpeg</url>
            <title>Stories by Bensoltane Mohammed Amine on Medium</title>
            <link>https://medium.com/@bensoltane.mohammed.amine?source=rss-e593ff7a558a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:55:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bensoltane.mohammed.amine/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[Rules and Principles that I advise every Python developer to learn in order to write clean code]]></title>
            <link>https://medium.com/@bensoltane.mohammed.amine/rules-and-principles-that-i-advise-every-python-developer-to-learn-in-order-to-write-clean-code-636dd1921f96?source=rss-e593ff7a558a------2</link>
            <guid isPermaLink="false">https://medium.com/p/636dd1921f96</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[Bensoltane Mohammed Amine]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 21:57:17 GMT</pubDate>
            <atom:updated>2023-01-17T21:57:17.493Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DPI9X7VFY2-syjFXVAJNiQ.png" /><figcaption>Clean Code</figcaption></figure><p>If you’ve already read over your code and it took you more than 2 minutes to understand the logic, it’s time to refactor it. If it takes you longer than 2 minutes to understand your code, imagine how long it would take your co-workers to understand it.</p><p>In this article, we will talk about clean code, its benefits, different rules and principles on how to write clean code.</p><h3><strong>What is clean code ?</strong></h3><p>Bjarne Stroustrup, inventor of the C++ programming language, once said: “<em>I like my code to be elegant and efficient. The logic should be straightforward to make it hard for bugs to hide, the dependencies minimal to ease maintenance, error handling complete according to an articulated strategy, and performance close to optimal so as not to tempt people to make the code messy with unprincipled optimizations. Clean code does one thing well</em>.”</p><p>From this, we conclude that the clean code is :</p><ul><li><strong>Easy to read;</strong></li><li><strong>Easy to debug;</strong></li><li><strong>Focused : </strong>each function, class or module must do one thing;</li><li><strong>Easy to maintain;</strong></li><li><strong>Highly performant.</strong></li></ul><h3>Rules for writing clean code in Python</h3><ol><li><strong>Naming conventions :</strong></li></ol><p>Naming conventions is one of the most useful and important aspects of writing clean code. When naming variables, functions, classes, etc, use meaningful names that are intention-revealing.</p><ul><li>Class names should be CamelCase (MyClass);</li><li>Variable names should be snake_case and all lowercase (first_name);</li><li>Function names should be snake_case and all lowercase (quick_sort());</li><li>Constants should be snake_case and all uppercase (PI = 3.14159);</li><li>Modules should have short, snake_case names and all lowercase (numpy);</li><li>Single quotes and double quotes are treated the same (just pick one and be consistent).</li></ul><p><strong>2. Comments conventions :</strong></p><p>Comments should :</p><ul><li>not contradict the code;</li><li>be complete sentences;</li><li>have a space after the # sign with the first word capitalized.</li></ul><p><strong>3. Line formatting :</strong></p><ul><li>Indent using 4 spaces (spaces are preferred over tabs);</li><li>Lines should not be longer than 79 characters;</li><li>Avoid multiple statements on the same line;</li><li>Top-level function and class definitions are surrounded with two blank lines;</li><li>Method definitions inside a class are surrounded by a single blank line;</li><li>Imports should be on separate lines.</li></ul><h3>Clean Code Principles</h3><p>There are plenty of clean code principles you can apply when writing better code. The most important are :</p><ol><li><strong>Don’t repeat yourself (DRY):</strong></li></ol><p>This is one of the simplest coding principles. Its only rule is that code should not be duplicated. Instead of duplicating lines, find an algorithm that uses iteration. DRY code is easily maintainable.</p><p>The opposite of DRY is WET (We Enjoy Typing). Code is WET when there are unnecessary repetitions in the code.</p><p>WET code :</p><pre><br>username = getUserName()<br>password= getPassword()<br>user = { username, password}<br>client.post(user)<br><br><br>username = getUserName()<br>password= getPassword()<br>user = { username, password}<br>client.get(user)</pre><p>DRY code :</p><pre>def getUser():<br>  return {<br>    &quot;user&quot;:getUserName(),<br>    &quot;password&quot;:getPassword(),<br>  }<br><br><br>client.post(getUser())<br><br>client.get(getUser())</pre><p><strong>2. Keep It Simple, Stupid (KISS) :</strong></p><p>Is one of the oldest principles of clean code. You should avoid making your code unnecessarily complex because a task can always be executed in different languages and formulated using different commands. So programmers who follow the KISS principle should always ask themselves if there is a simpler way to solve a particular problem.</p><p><strong>3. You Aren’t Gonna Need It (YAGNI):</strong></p><p>Is a practice in software development which states that features should only be added when required. It helps avoid spending time on features that may not be used, the main features of a program are better developed and less total time is spent on each release.</p><p><strong>4. Readability over conciseness :</strong></p><p>Code needs to work and be understood by the machine executing it. However, other developers also need to be able to understand the code, especially if you are working on a project with multiple people. That is why the readability of code is always more important than its conciseness when it comes to software development. There is no point in writing concise code if other developers cannot understand it.</p><h3>Conclusion</h3><p>Writing clean code is difficult. It takes time and experience to master it. You should always try to stay consistent and write simple code that is easy for other developers to understand.</p><p>I hope you learned something new. If you still have questions, I’ll be happy to answer them in the comments below. Follow me if you’re interested in what I share.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=636dd1921f96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What every software developer should know about Memory Management to write efficient code]]></title>
            <link>https://medium.com/@bensoltane.mohammed.amine/what-every-software-developer-should-know-about-memory-management-to-write-efficient-code-9940c224d41?source=rss-e593ff7a558a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9940c224d41</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[memory-management]]></category>
            <dc:creator><![CDATA[Bensoltane Mohammed Amine]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 20:44:36 GMT</pubDate>
            <atom:updated>2023-01-14T20:44:36.760Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*rreEETh8GJZWWoGXk1AYsw.png" /></figure><p>Understanding <strong>Memory allocation</strong> is important to any software developer for <strong>writing efficient code</strong>. Memory allocation can be defined as <strong>allocating a block of space in the computer</strong> memory to a program. In Python memory allocation and deallocation method is automatic so that the user does not have to do manual garbage collection.</p><h3>Memory Allocation</h3><p>There are two parts of memory:</p><ol><li><strong>Stack memory</strong></li></ol><p><strong>2. Heap memory</strong></p><p>The methods/method calls and the references are stored in <strong>stack memory</strong> and all the values objects are stored in a <strong>private heap memory</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*u9Sahpb8fsvRFnMuVrNP0A.png" /><figcaption>Stack and Heap Memory</figcaption></figure><h3>How memory is managed in Python</h3><p>The Python memory manager handles the essential work of memory management and lets us focus on the coding.</p><p>Python uses two strategies for memory allocation:</p><ol><li><strong>Reference counting</strong></li></ol><p><strong>2. Garbage collection</strong></p><h3>Reference Counting</h3><p>Is a simple technique in which objects are deallocated when there is no reference to them in a program.</p><p>Prior to Python version 2.0, the <strong>Python interpreter</strong> only used reference counting for memory management. Reference counting works by <strong><em>counting the number of times an object is referenced</em></strong>. When references to an object are removed, the reference count for an object is decremented. When the reference count becomes zero, the object is deallocated.</p><p>Example :</p><pre># 9 is an object and b is a refernce to that object<br>b = 9<br> <br># Reference count of object 9 becomes 0 when the b reference another object 4<br>b = 4</pre><p>The literal value 9 is an object. The reference count of object 9 is incremented to 1 in line 1. In line 2 its reference count becomes zero as it is dereferenced.</p><h3>Garbage Collection</h3><p>Unfortunately, classical reference counting has a fundamental problem — it cannot detect reference cycles. A reference cycle occurs when one or more objects are referencing each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*VYfuCssiLPCkylH_Tk-C2w.png" /><figcaption>Reference cycle</figcaption></figure><p>Reference cycles can only occur in container objects (i.e., in objects that can contain other objects), such as lists, dictionaries, classes, tuples.</p><p>The <strong>Garbage Collector</strong> will be responsible for <strong>detecting circular references</strong> that are not yet in use and will <strong>clean them to avoid memory leaks.</strong></p><p>By default, the garbage collector is enabled, but it can be controlled programmatically using the <strong><em>gc module</em></strong>. You can also disable it if you are sure that your code does not create circular references (but be careful!), otherwise you will end up with a memory leak.</p><p>The <strong>Garbage collector</strong> is to be run periodically and it has to identify the circular reference, which requires a lot of computer power.</p><p>I hope you learned something new. If you still have questions, I’ll be happy to answer them in the comments below. Follow me if you’re interested in what I share.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9940c224d41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 10 interview questions in Python that I recommend you prepare in 2023]]></title>
            <link>https://medium.com/@bensoltane.mohammed.amine/top-10-interview-questions-in-python-that-i-recommend-you-prepare-in-2023-438c9780f9a2?source=rss-e593ff7a558a------2</link>
            <guid isPermaLink="false">https://medium.com/p/438c9780f9a2</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Bensoltane Mohammed Amine]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 16:26:49 GMT</pubDate>
            <atom:updated>2023-01-13T16:26:49.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NpvLls8u4LJqGMhPrfbAkQ.png" /><figcaption>Python</figcaption></figure><h3>Introduction</h3><p><strong><em>Python</em></strong> was developed by <strong>Guido van Rossum</strong> and was released first on February 20, 1991. It is one of the <strong>most widely-used</strong> and loved programming languages. It is also a <strong>free and open-source language</strong> with very simple and clean syntax. Python also supports object-oriented programming and is most commonly used to perform general-purpose programming.</p><h3>Python Certification</h3><p><strong>Python certification</strong> is the most wanted skill in the field of programming. In this Python interview questions story, I am going to present you the most frequently asked questions in Python interviews to prepare for the year 2023.</p><h3>Top 10 interview questions and answers</h3><p><strong>Q1. What are the key features of Python?</strong></p><ul><li>Python is an <strong>interpreted language</strong>. That means that, unlike languages like C and its variants, Python does not need to be compiled before it is run.</li><li>Python is well suited to <strong>object orientated programming</strong> in that it allows the definition of classes along with composition and inheritance.</li><li>Python is <strong>dynamically typed</strong>, this means that you don’t need to state the types of variables when you declare them or anything like that. You can do things like y=0 and then y=&quot;string&quot; without error.</li><li>Python finds <strong>use in many fields : </strong>web applications, automation, scientific modeling, big data applications and many more.</li></ul><p><strong>Q2. What does it mean that python is an interpreted language? Explain.</strong></p><p>An interpreted language is any programming language which is not in machine-level code before runtime. Therefore, Python is an interpreted language.</p><p><strong>Q3. What are the benefits of using Python?</strong></p><p>The benefits of using python are :</p><ol><li><strong>Easy to use :</strong> Python is a high-level programming language that is easy to use, read, write and learn.</li><li><strong>Extensive support for libraries :</strong> Python has vast libraries that contain almost any function needed. It also further provides the facility to import other packages using Python Package Manager(pip).</li><li><strong>Interpreted language</strong>– Since python is interpreted language, it executes the code line by line and stops if an error occurs in any line.</li><li><strong>Dynamically typed</strong>– the developer does not assign data types to variables at the time of coding. It automatically gets assigned during execution.</li><li>The data structures used in python are user friendly.</li></ol><p><strong>Q4. What is the difference between list and tuples in Python?</strong></p><ol><li>Lists are :</li></ol><ul><li>Are mutable i.e they can be edited.</li><li>Are slower than tuples.</li><li>Syntax: list_1 = [10, ‘Chelsea’, 20]</li></ul><p>2. Tuples are :</p><ul><li>Are immutable (tuples are lists which can’t be edited).</li><li>Are faster than list.</li><li>Syntax: tuple_1 = (10, ‘Chelsea’ , 20)</li></ul><p><strong>Q5. What are Python namespaces?</strong></p><p>A python namespace is a collection of currently defined symbolic names along with information about the object (variables and functions) that each name references. You can think of a namespace as a <strong>dictionary</strong> in which the <strong>keys are the object names</strong> and the <strong>values are the objects themselves</strong>. Each key-value pair maps a name to its corresponding object.</p><p>There 4 types of namespace in python :</p><ul><li><strong>Built-in namespace :</strong> These namespaces contain all the built-in objects in python and are available whenever python is running.</li><li><strong>Global namespace :</strong> These are namespaces for all the objects created at the level of the main program.</li><li><strong>Enclosing namespaces :</strong> These namespaces are at the higher level or outer function.</li><li><strong>Local namespaces :</strong> These namespaces are at the local or inner function.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*62gm0TfYM4LwnpQ214qUUQ.png" /><figcaption>Python Namespaces</figcaption></figure><p><strong>Q6. What is the difference between .py and .pyc files?</strong></p><p>The .py files are the <strong>python source code files</strong>. While the .pyc files contain the <strong>bytecode of the python files</strong>. .pyc files are created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files which helps by saving time.</p><p><strong>Q7. How is memory managed in Python?</strong></p><p>Memory is managed in Python as follows:</p><ol><li>Memory management in python is managed by <strong><em>Python private heap space</em></strong>. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.</li><li>The allocation of heap space for Python objects is done by Python’s memory manager.</li><li>Python also has an inbuilt garbage collector, which recycles all the unused memory and so that it can be made available to the heap space.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*u9Sahpb8fsvRFnMuVrNP0A.png" /><figcaption>Python Memory Management</figcaption></figure><p><strong>Q8. What is PYTHONPATH?</strong></p><p><strong>PYTHONPATH </strong>is a special environment variable that provides guidance to the Python interpreter about <strong>where to find various libraries and applications</strong>.</p><p><strong>Q9. What are local variables and global variables in Python?</strong></p><ol><li><em>Global Variables:</em></li></ol><p>Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the program.</p><p><em>2. Local Variables:</em></p><p>Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*81sYRPeu0wwExhfLzci5eQ.png" /><figcaption>Global and Local Variables</figcaption></figure><p><strong>Q10. Does python support multiple inheritance?</strong></p><p>Multiple inheritance means that a class can be derived from more than one parent classes. Python does support multiple inheritance, unlike Java.</p><p>I hope you found this article useful. For more posts on the Python programming language and other computer technologies, follow me to receive new articles I add.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=438c9780f9a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Six (06) Visual Studio Code extensions I advise all python developers to use]]></title>
            <link>https://medium.com/@bensoltane.mohammed.amine/the-six-06-visual-studio-code-extensions-i-advise-all-python-developers-to-use-271d1b9b5114?source=rss-e593ff7a558a------2</link>
            <guid isPermaLink="false">https://medium.com/p/271d1b9b5114</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[vscode-extension]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Bensoltane Mohammed Amine]]></dc:creator>
            <pubDate>Sun, 08 Jan 2023 23:46:57 GMT</pubDate>
            <atom:updated>2023-01-08T23:46:57.168Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*bcW_dl53C68XjqO9Yr6-Xw.png" /></figure><p>In this article, I want to make it easy for you to find the most suitable VS Python code extensions for your needs.</p><p>But first, let’s recap what is VS code and Python.</p><h3>Visual Studio Code (VS Code) :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*csa5pmsQ7VvJnDzpyC5TCQ.png" /><figcaption>VS Code</figcaption></figure><p>Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It’s is an open-source and cross-platform source-code editor<strong>.</strong> It was ranked the most popular development tool in the Stack Overflow 2021.</p><h3>Python :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NpvLls8u4LJqGMhPrfbAkQ.png" /><figcaption>Python</figcaption></figure><p>Python is one of the top computer languages used by developers worldwide for creating a variety of programs, from simple applications to scientific applications.</p><p>Now, let’s have a look at the six (06) best Python VS Code that I recommend for all Python developers to ease their life working with Python through VS code.</p><ol><li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python"><strong><em>Python</em></strong></a><strong><em> :</em></strong></li></ol><p>The VScode Python extension from Microsoft is a fully free, feature-rich Python extension. VScode suggests automatically this extension when you start creating a .py file. Its IntelliSense feature allows useful features like code autocompletion, navigation and syntax checking.</p><p>Once you set it up, the <a href="https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance">Pylance </a>extension, which offers rich language support, and the Jupyter extension for using Jupyter notebooks will be installed automatically.</p><p><strong><em>2. </em></strong><a href="https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments"><strong><em>Better Comments</em></strong></a><strong><em> :</em></strong></p><p>The comments are crucial for any code as they help developers to better understand the code. The Better Comments extension is a little different from the others. It focuses entirely on <strong>creating more user-friendly and readable comments</strong> for your Python code. Using this extension, you can <strong>organize your comments and improve the clarity of the code</strong>. You can use several categories and colors to classify your annotations, for example, Alerts, Queries, TODOs and Highlights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*RuCV55vJaMeB-tdZG6M3jA.png" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments"><strong><em>Better Comments</em></strong></a></figcaption></figure><p><strong><em>3. </em></strong><a href="https://marketplace.visualstudio.com/items?itemName=KevinRose.vsc-python-indent"><strong><em>Python Indent</em></strong></a><strong><em> :</em></strong></p><p>When developing with Python, having the correct indentation is crucial, but sometimes it’s hard to keep adding closing brackets. The Python indentation extension helps you <strong>maintain correct Python indentation</strong> in VScode.</p><p>The extension automatically <strong>adds closing brackets</strong> by simply pressing the Tab key, which can speed up coding and save a lot of your valuable time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*LLHtYcRCMi2JMnUqfbh9VQ.gif" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=KevinRose.vsc-python-indent"><strong><em>Python Indent</em></strong></a></figcaption></figure><p><strong><em>4. </em></strong><a href="https://www.tabnine.com/install/vscode"><strong><em>TabNine</em></strong></a><strong><em> :</em></strong></p><p>TabNine is an open-source AI assistant that <strong>provides code completion suggestions</strong> based on the current context and the history of your previous commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*GTZrwe50H9sy-AEA9yc3Hg.gif" /><figcaption><a href="https://www.tabnine.com/install/vscode"><strong><em>TabNine</em></strong></a></figcaption></figure><p>5. <a href="https://pypi.org/project/pylint/">Pylint</a> :</p><p>It is an extension that helps developers to <strong>find errors</strong> in their Python files. <strong>It analyzes the source code </strong>and looks for programming errors such as syntax errors, etc. It also <strong>checks for style issues</strong> like lines too long or too short.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*lrYGQk3-oNipRKO7ObJLVA.gif" /><figcaption><a href="https://pypi.org/project/pylint/">Pylint</a></figcaption></figure><p><strong><em>6. </em></strong><a href="https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter"><strong><em>Python Test Explorer</em></strong></a><strong><em> :</em></strong></p><p>When developing an application, <strong>testing is a must to preserve the code quality</strong>, and you will have to use different types of test frameworks. Python Test Explorer extension lets you execute <a href="https://docs.python.org/3/library/unittest.html#module-unittest">Unittest</a>, <a href="https://docs.pytest.org/en/latest/">Pytest</a>, or <a href="https://testplan.readthedocs.io/">Testplan</a> tests in VScode. There are several intuitive features of this free extension.</p><p>It allows to run tests on saving files in a workspace. To enable autorun, right-click on a test suite and select “Enable autorun”. After that, any changes to files in a workspace will re-execute tests when files are saved. See the example below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*jy8FZmDGAGT4LHoJvo9MVw.gif" /><figcaption><a href="https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter"><strong><em>Python Test Explorer</em></strong></a></figcaption></figure><p>Happy coding ; see you next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=271d1b9b5114" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL vs NoSQL database: what are the main differences? and when to use one or the other?]]></title>
            <link>https://medium.com/@bensoltane.mohammed.amine/sql-vs-nosql-database-what-are-the-main-differences-and-when-to-use-one-or-the-other-d6f0badb03f4?source=rss-e593ff7a558a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6f0badb03f4</guid>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Bensoltane Mohammed Amine]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 09:44:48 GMT</pubDate>
            <atom:updated>2023-01-07T09:44:48.750Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*Ye2-JXH9Yt0U6ph31EA55g.png" /><figcaption>SQL vs NoSQL</figcaption></figure><p>Data is important and without it, computers and even the Internet would be a rather uninteresting place. Today, there is a vast amount of data in the world, and it is almost impossible to manage this data without proper databases.</p><p>In this article, we will answer some important questions about sql and nosql databases, as well as what type of database you should use, when and why ?</p><p>we will cover:</p><h4><strong>1- What is a database ?</strong></h4><h4><strong>2- What is a Database Management System (DBMS) ?</strong></h4><h4><strong>3- What is a Relational Database ?</strong></h4><h4><strong>4- Structured query language (SQL)</strong></h4><h4><strong>5- What is No-Relational Database ?</strong></h4><h4>6- Good reasons to use or stay with Relational Database?</h4><h3><strong>1-</strong> <strong>What is a Database ?</strong></h3><p>A database is an arranged collection of structured data, stored electronically in a computer which is controlled by a database management system (DBMS).</p><p>The database is structured according to a Database Model, which represents how your data will look.</p><p>For example, you can decide to store your data in tables :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emrjvUc-galAIz7USpQ3MQ.png" /><figcaption><strong>Data stored in a table</strong></figcaption></figure><p>as you can store them in graphs :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*BnZWgBbZXiLnliyP9MAhtw.png" /><figcaption><strong>Data stored in a graph</strong></figcaption></figure><p>Another way to store data is in a document:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*LMFCDLU68MZuq4imBGErWw.png" /><figcaption><strong>Data stored in a document</strong></figcaption></figure><h3><strong>2-</strong> <strong>What is a Database Management System (DBMS)?</strong></h3><p>A database management system (DBMS) is a way for us to communicate with a database (Add, View, Update and Delete), which means it is an interface layer between the data and your fingers on the keyboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*_399yj1AGiaoTFZFNrUSaw.png" /><figcaption><strong>what is a DBMS ?</strong></figcaption></figure><p>There are several DBMS available today such as Oracle RDBMS, Microsoft SQL Server, MySQL, SQLite, PostgreSQL, MongoDB, Neo4j, etc.</p><h3><strong>3-</strong> <strong>What is a Relational Database ?</strong></h3><p>It is the most familiar and consistent database, providing a storage of <strong>linked data tables</strong> that have a <strong>fixed schema</strong>. The structure query language (SQL) is used to manage the data that is stored in a relational database.</p><p>A relational database is made up of tables composed of columns and rows (each row has a unique identifier). These tables can be linked together using the unique row identifier, as shown in the figure below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*-oHytDPqBvctWVpAc2EawA.png" /><figcaption><strong>Example of a relational database schema</strong></figcaption></figure><p><strong>Pros :</strong></p><ul><li>Easy to use and setup ;</li><li>Good at stucture data ;</li><li>High consistency ;</li><li>Universal, compatible with many tools.</li></ul><p><strong>Cons :</strong></p><ul><li>Time consuming to understand and design the structure of the database ;</li><li>Can be difficult to scale (Vertically scalabe).</li></ul><h3><strong>4-</strong> Structured query language (SQL):</h3><p>SQL is a standard language that stands for Structure Query Language. SQL is the heart of the relational database (collection of tables that stores a specific set of structured data.) and is used to create, access and manage databases.</p><p>The SQL is used by :</p><ul><li>Database administrators ;</li><li>Developers writing data integration scripts ;</li><li>Data analysts looking to set up and run analytical queries.</li></ul><p>The most commonly used type of relational database objects is a <strong>table</strong>, which is the structure that contains or references data. Any single table contains records, and each record is stored in a row of the table which is <strong>made up of data rows and columns</strong>.</p><p>Other types of database objects include the following:</p><ul><li>Views are logical representations of data assembled from one or more database tables ;</li><li>Indexes are lookup tables that speed up database lookup functions.</li></ul><h3><strong>5-</strong> <strong>What is No-Relational Database (NoSQL) ?</strong></h3><p>Non-relational databases are sometimes referred to as “NoSQL”, which stands for <strong>Not Only SQL</strong>.</p><p>A non-relational database stores data in a <strong>non-tabular</strong> form, and tends to be more flexible than the traditional, SQL-based, relational database structures.</p><p>Unlike SQL databases, No-SQL databases are key-value stores and are <strong>stored in different partitions</strong>, which makes them <strong>very scalable and flexible</strong>. To find the partition where the data is located, we use the key that represents the primary key of each database element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*J-yuNZ5c7ql0nW6t17a9qg.png" /><figcaption><strong>The way data is stored in a No-SQL database</strong></figcaption></figure><p>The No-SQL database is <strong>schema-less</strong>, which means that the elements of the database do not need to have the same structure, and each element can be completely different as shown in the figure below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZflPxg-8e_upK_zEEQSsA.png" /></figure><p><strong>Pros :</strong></p><ul><li>No investment to design model (schema-less) ;</li><li>In general faster than SQL ;</li><li>Easy to scale (horizontally scalable) ;</li><li>Extreme flexibility.</li></ul><p><strong>Cons :</strong></p><ul><li>Unsuited for interconnected data ;</li><li>Time consuming for complex queries.</li></ul><h3>6- Good reasons to use or stay with Relational Database ?</h3><ul><li>Where consistency is everything ;</li><li>Not working with Big Data ;</li><li>Working with Interconnected Data ;</li><li>Working with complex queries.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6f0badb03f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>