<?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 Dave Allan on Medium]]></title>
        <description><![CDATA[Stories by Dave Allan on Medium]]></description>
        <link>https://medium.com/@dave.allan_50937?source=rss-6c67d81e560b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i5hZFckxHGu2WD6yW6qvpQ.png</url>
            <title>Stories by Dave Allan on Medium</title>
            <link>https://medium.com/@dave.allan_50937?source=rss-6c67d81e560b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:59:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dave.allan_50937/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 Laravel Guide — Inversion of Control]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@dave.allan_50937/a-laravel-guide-inversion-of-control-28836a5dfade?source=rss-6c67d81e560b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*CQAMMXDS42bSwvSJxqoD0Q.jpeg" width="5184"></a></p><p class="medium-feed-snippet">Getting Started with the Popular PHP Framework Part 3</p><p class="medium-feed-link"><a href="https://medium.com/@dave.allan_50937/a-laravel-guide-inversion-of-control-28836a5dfade?source=rss-6c67d81e560b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@dave.allan_50937/a-laravel-guide-inversion-of-control-28836a5dfade?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/28836a5dfade</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[inversion-of-control]]></category>
            <category><![CDATA[laravel-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Sun, 26 May 2024 05:05:49 GMT</pubDate>
            <atom:updated>2024-05-26T17:26:40.425Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide to Laravel 11]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-b50a95b16175?source=rss-6c67d81e560b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*Ea0YktR3UAFrBvAVUirR4A.jpeg" width="5184"></a></p><p class="medium-feed-snippet">Getting Started with the Popular PHP Framework&#xA0;: Part 3</p><p class="medium-feed-link"><a href="https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-b50a95b16175?source=rss-6c67d81e560b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-b50a95b16175?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b50a95b16175</guid>
            <category><![CDATA[laravel-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[artisan]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Wed, 24 Apr 2024 04:01:06 GMT</pubDate>
            <atom:updated>2024-04-24T22:33:11.344Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide to Laravel 11]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-b4eaee63a382?source=rss-6c67d81e560b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*xPTZLlkDUJTL3CJLQNIyDg.jpeg" width="6912"></a></p><p class="medium-feed-snippet">Part 2 &#x2014; Files and Folders</p><p class="medium-feed-link"><a href="https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-b4eaee63a382?source=rss-6c67d81e560b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-b4eaee63a382?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4eaee63a382</guid>
            <category><![CDATA[laravel-developer]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Tue, 16 Apr 2024 04:57:18 GMT</pubDate>
            <atom:updated>2024-04-24T22:33:41.619Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide to Laravel 11]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-dca12f93cecb?source=rss-6c67d81e560b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*xPTZLlkDUJTL3CJLQNIyDg.jpeg" width="6912"></a></p><p class="medium-feed-snippet">Part 1 &#x2014; The Folder Structure</p><p class="medium-feed-link"><a href="https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-dca12f93cecb?source=rss-6c67d81e560b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@dave.allan_50937/a-beginners-guide-to-laravel-11-dca12f93cecb?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dca12f93cecb</guid>
            <category><![CDATA[folder-structure]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[laravel-11]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Sun, 07 Apr 2024 15:57:21 GMT</pubDate>
            <atom:updated>2024-04-24T22:34:27.547Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A guide to building a digital audio workstation (DAW).]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@dave.allan_50937/a-guide-to-building-a-digital-audio-workstation-daw-ee2acefec19b?source=rss-6c67d81e560b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*jqiSbhOFJcUr1VRyNlR3_g.jpeg" width="5184"></a></p><p class="medium-feed-snippet">If you are into building your own check it out&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@dave.allan_50937/a-guide-to-building-a-digital-audio-workstation-daw-ee2acefec19b?source=rss-6c67d81e560b------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@dave.allan_50937/a-guide-to-building-a-digital-audio-workstation-daw-ee2acefec19b?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee2acefec19b</guid>
            <category><![CDATA[custom-built-computers]]></category>
            <category><![CDATA[desktop-computer]]></category>
            <category><![CDATA[digital-audio-workstation]]></category>
            <category><![CDATA[daw]]></category>
            <category><![CDATA[computer-hardware]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Sat, 30 Mar 2024 23:25:00 GMT</pubDate>
            <atom:updated>2024-03-30T23:25:00.393Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Computer Programming for Beginners — A Short Guide Part 6[2024]]]></title>
            <link>https://medium.com/@dave.allan_50937/computer-programming-for-beginners-a-short-guide-part-6-2024-3c413971cfac?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c413971cfac</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[learn-programming-online]]></category>
            <category><![CDATA[php-development]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Thu, 21 Mar 2024 17:02:36 GMT</pubDate>
            <atom:updated>2024-03-21T17:02:36.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>Computer Programming for Beginners — A Short Guide Part 6[2024]</h3><h4>Algorithms</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08m_vP9rS6URujdiHC5qLw.jpeg" /><figcaption>Image created by author using Canva Pro</figcaption></figure><h4>Section 6 — Algorithms</h4><blockquote>Bubble Sort</blockquote><p>Bubble Sort is a simple comparison-based sorting algorithm. It repeatedly steps through the list to be sorted, compares adjacent elements, and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.</p><p>Here’s a simple implementation of Bubble Sort in PHP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2oi37Y8S-MVMgGR9DpwmQ.png" /><figcaption>A simple bubble sort algorithm</figcaption></figure><p>Quick Sort</p><p>Quick Sort is a highly effi cient, divide-and-conquer sorting algorithm. It works by selecting a ‘pivot’ element from the array and partitioning the other elements into two sub-arrays according to whether they are less than or greater than the pivot. The sub-arrays are then sorted recursively. Quick Sort is generally faster than Bubble Sort and is widely used in practice.</p><p>Here’s an implementation of Quick Sort in PHP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LL_qLGjNCHsM0DSPQVRDmg.png" /><figcaption>A simple quicksort algorithm</figcaption></figure><p>These are just basic implementations of Bubble Sort and Quick Sort in PHP. It is good to know how these algorithms work as it will give you a deeper understanding of programming which you may not get from just using built in functions. Of course PHP’s built in sorting functions are well tested and do a great job, so in practice those would be used.</p><h4>Searching</h4><blockquote>Linear Search</blockquote><p>Here’s an example of a simple linear search algorithm implemented in PHP. Linear search is a basic search algorithm that iterates through an array to fi nd a specific element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fx6aONQuOz5AIZ4vvwVGAA.png" /><figcaption>A linear search algorithm.</figcaption></figure><p>In this PHP code, the ‘<em>linearSearch</em>’ function takes an array and a target value to search for. It iterates through the array, comparing each element with the target value. If a match is found, it returns the index of the element; otherwise, it returns -1 to indicate that the target value was not found in the array. The example usage section demonstrates how to use the function to search for a specific element in an array.</p><blockquote>Binary Search</blockquote><p>This function takes a sorted array and a target value as parameters, then performs a binary search to fi nd the index of the target value in the array. If the target value is present, it returns</p><p>the index; otherwise, it returns -1.</p><p>The key to the binary search algorithm is having a sorted array of values to begin with.</p><p>The main advantage of using a sorted array in binary search is that it allows the algorithm to quickly eliminate half of the remaining elements at each step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KW5PD_emIPOk7iOy9ZawCQ.png" /><figcaption>A binary search algorithm.</figcaption></figure><p>A knowledge of algorithms is extremely useful when debugging code, maintaining code and writing your own code. It helps to solidify your understanding of how sorting, searching and other algorithms work under the hood.</p><p>Thanks for following this beginners programming series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c413971cfac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Computer Programming for Beginners — A Short Guide Part 5b[2024]]]></title>
            <link>https://medium.com/@dave.allan_50937/computer-programming-for-beginners-a-short-guide-part-5b-2024-2064ce03208a?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2064ce03208a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[learn-programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[php-development]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Mon, 18 Mar 2024 17:02:30 GMT</pubDate>
            <atom:updated>2024-03-19T21:00:37.359Z</atom:updated>
            <content:encoded><![CDATA[<h3>Computer Programming for Beginners — A Short Guide Part 5b[2024]</h3><h4>Model View Controller Pattern</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prEwvrphvdWOcTnSm2atIA.jpeg" /><figcaption>Image created by author using Canva Pro</figcaption></figure><blockquote>MVC</blockquote><p>The Model-View-Controller (MVC) pattern is a design pattern commonly used in software development to structure the code of an application. It divides the application into three interconnected components, each with its specific role. The MVC pattern aims to enhance the modularity, maintainability, and scalability of code by separating concerns.</p><p>At a basic level here is an explanation of the three components in MVC:</p><h4>1. Model:</h4><p>- The Model represents the application’s data and business logic. It is responsible for managing the data and the rules that govern how the data is accessed and manipulated.</p><p>- In simple terms, the Model is like the brain of the application, handling data storage, retrieval, and any processing that needs to be done on the data.</p><h4>2. View:</h4><p>- The View is responsible for presenting the data to the user and receiving user input. It displays the information provided by the Model and sends user actions (like button clicks) back to the Controller.</p><p>- The View is like the user interface (UI) of the application. It doesn’t perform business logic but rather focuses on how the data is presented to the user.</p><h4>3. Controller:</h4><p>- The Controller acts as an intermediary between the Model and the View. It receives user input from the View, processes it, and updates the Model accordingly. It also retrieves data from the Model and updates the View to reflect any changes.</p><p>- The Controller is like the traffic manager, handling the flow of data between the Model and the View. It contains the application’s logic for responding to user actions.</p><p>The flow of actions in MVC typically follows these steps:</p><p>1. User interacts with the View (e.g., clicks a button).</p><p>2. The View sends the user input to the Controller.</p><p>3. The Controller processes the input, interacts with the Model as needed, and updates the View.</p><p>4. The updated View reflects the changes to the user.</p><p>Here’s a simple analogy:</p><p>- Model: Think of it as the database or a manager who handles the data and business logic.</p><p>- View: Imagine it as the user interface or what the user sees.</p><p>- Controller: Picture it as the traffic cop or coordinator that manages the communication between the Model and the View.</p><p>Applying the MVC pattern helps keep different aspects of your codebase separate and makes it easier to modify or extend your application without affecting other parts. It’s a powerful and widely used pattern in building scalable and maintainable software architectures.</p><blockquote>Singleton</blockquote><p>The Singleton pattern is a design pattern in programming that ensures a class has only one instance and provides a global point of access to that instance. In simpler terms, it restricts the</p><p>instantiation of a class to a single object and provides a way to access that object from any part of the program.</p><p>So at a basic level we have:</p><h4>1. Single Instance:</h4><p>- The Singleton pattern ensures that there is only one instance (object) of a particular class in the entire application.</p><p>- This is useful when exactly one object is needed to coordinate actions across the system, such as managing a global configuration or a central point of control.</p><h4>2. Global Access:</h4><p>- The Singleton provides a global point of access to its instance, allowing other parts of the program to use and interact with that single instance.</p><p>- This is achieved by providing a static method or property that returns the instance of the Singleton class.</p><h4>3. Private Constructor:</h4><p>- To enforce the single instance rule, the Singleton class typically has a private constructor. This means that objects cannot be created directly using the `new` keyword from outside the class.</p><h4>4. Lazy Initialization:</h4><p>- In many implementations, the Singleton instance is created only when it is fi rst requested. This is known as lazy initialization, and it helps optimize resource usage by creating the instance only when needed.</p><p>Here’s a simple example in PHP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5uBwlDSFSPeA2HksLDDXCQ.png" /><figcaption>Singleton Example</figcaption></figure><p>In this example:</p><p>- The `<em>Singleton</em>` class has a private static property ‘$instance’ to hold the single instance.</p><p>- The constructor is private, preventing direct instantiation from outside the class.</p><p>- The ‘<em>getInstance</em>’ method is used to get the Singleton instance. It creates the instance if it doesn’t exist or returns the existing one.</p><p>- The usage shows that both instances obtained are the same, verifying that the Singleton pattern is enforced.</p><p>It’s important to note that while the Singleton pattern can be useful in certain situations, it should be used sparingly, as it introduces a global state and can make code harder to test and maintain.</p><p>In the next and final section we will cover a few important algorithms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2064ce03208a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Computer Programming for Beginners — A Short Guide Part 5[2024] — contd.]]></title>
            <link>https://medium.com/@dave.allan_50937/computer-programming-for-beginners-a-short-guide-part-5-2024-contd-2d7965e9d1f5?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d7965e9d1f5</guid>
            <category><![CDATA[beginner-programmers]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Thu, 14 Mar 2024 17:11:35 GMT</pubDate>
            <atom:updated>2024-03-14T17:11:35.077Z</atom:updated>
            <content:encoded><![CDATA[<h3>Computer Programming for Beginners — A Short Guide Part 5[2024] — contd.</h3><h4>More Fundamental Design Patterns</h4><figure><img alt="Design Patterns Title" src="https://cdn-images-1.medium.com/max/1024/1*GvSY4F-qPo_dPlHNVW2G-A.jpeg" /><figcaption>Image created by author using Canva Pro</figcaption></figure><blockquote>Dry</blockquote><p>In programming, the term “DRY” stands for “Don’t Repeat Yourself.” The DRY principle is a software development concept that encourages developers to avoid duplicating code in different parts of a system. The idea is to foster code reusability, maintainability, and to reduce the risk of errors introduced by inconsistencies in duplicated code.</p><p>The key principles of DRY include:</p><ol><li><strong>Code Reusability</strong></li></ol><p>Instead of duplicating the same or similar code in multiple places, developers are encouraged to encapsulate common functionality in functions, methods, classes, or modules that can be reused across the codebase.</p><p>2. <strong>Maintenance</strong></p><p>Duplicated code can lead to maintenance challenges. When a change is required, developers must remember to update all instances of the duplicated code, which can be error-prone. By following the DRY principle, updates can be made in a single location, reducing the risk of inconsistencies.</p><p>3. <strong>Readability</strong></p><p>DRY code tends to be more readable because it avoids unnecessary redundancy. When a piece of logic is encapsulated in a single place, it becomes easier for developers to understand and reason about the code.</p><p>4. <strong>Scalability</strong></p><p>As a codebase grows, the DRY principle becomes increasingly important. It helps in managing complexity and ensures that common functionality remains consistent throughout the system.</p><p>Here’s a simple example to illustrate the DRY principle:</p><figure><img alt="Dry Example" src="https://cdn-images-1.medium.com/max/1024/1*KUAULu8WCNiQ0whSLAXcSw.png" /><figcaption>DRY Example</figcaption></figure><p>In the example above, the first set of functions is not DRY because the logic for calculating the area is duplicated. The second set of functions is DRY, as it encapsulates the common logic in a single function, making it more maintainable and less error-prone.</p><blockquote>Object Oriented Programming</blockquote><p>Object-oriented programming (OOP) is a programming paradigm that revolves around the concept of “objects.” Objects are instances of classes, and classes are blueprints or templates that define the properties (attributes) and behaviors (methods) that objects of that type can exhibit. Here are some key points about classes:</p><p>1. <strong>Classes and Objects</strong></p><p>- <em>Class</em>: A class is a blueprint or a template that defines the structure and behavior of objects. It encapsulates data (attributes) and the methods (functions) that operate on that data.</p><p>- <em>Object</em>: An object is an instance of a class. It is a concrete realization of the class, with its own unique data and the ability to perform actions defined by the class.</p><p>2. <strong>Encapsulation</strong></p><p>- Encapsulation is the concept of bundling data (attributes) and the methods that operate on the data into a single unit (class). It hides the internal details of how an object works, exposing only what is necessary for external use.</p><p>- Access modifiers like public, private, and protected are used to control the visibility of class members.</p><p>3. <strong>Inheritance</strong></p><p>- Inheritance is a mechanism that allows a class (subclass or child class) to inherit properties and behaviors from another class (superclass or parent class). It promotes code reuse and the creation of a hierarchy of classes.</p><p>- The subclass can extend or override the functionality of the superclass.</p><p>4. <strong>Polymorphism</strong></p><p>- Polymorphism allows objects to be treated as instances of their parent class, enabling code to work with objects of multiple types through a common interface.</p><p>- Method overloading and method overriding are common ways to achieve polymorphism.</p><p>5. <strong>Abstraction</strong></p><p>- Abstraction involves simplifying complex systems by modeling classes based on the essential properties and behaviors they share, while ignoring unnecessary details.</p><p>- Abstract classes and interfaces provide a way to define abstract concepts and establish a contract for derived classes.</p><p>Here’s a simple example in PHP to illustrate the basic concept of inheritance:</p><figure><img alt="Inheritance class example" src="https://cdn-images-1.medium.com/max/1024/1*zsZkdWP-kQ9eXYZ2BcH7gQ.png" /><figcaption>Inheritance Class Example</figcaption></figure><p>So “<em>Vehicle”</em> is a class containing one private property called <em>$speed</em> which is set to ‘0’ when the class is instantiated ( created ). This class contains methods that are common to most vehicles — accelerate, turn left, turn right, move forward, move backward and I am sure more basic methods could be added.</p><p>We then declared a ‘Car’ class which inherits from the ‘Vehicle’ class using PHP’s keyword “<em>extends</em>”.</p><p>This means that the ‘Car’ class will extend or inherit all of the capabilities from the ‘Vehicle’ class when it is created ( instantiated ).</p><p>So now the “<em>Car”</em> object <em>$myCar</em> is able to use all of the public methods within the vehicle class.</p><p>This is a basic introduction to OOP concepts, and as you progress, you will become more comfortable with the basics and move on to more complex topics.</p><p>In the next chapter we will move on to the MVC design pattern.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d7965e9d1f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Computer Programming for Beginners — A Short Guide Part 5[2024]]]></title>
            <link>https://medium.com/@dave.allan_50937/computer-programming-for-beginners-a-short-guide-part-5-2024-5ff05615a03c?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ff05615a03c</guid>
            <category><![CDATA[learn-programming]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[learn-coding]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Mon, 11 Mar 2024 17:06:01 GMT</pubDate>
            <atom:updated>2024-03-11T17:06:01.836Z</atom:updated>
            <content:encoded><![CDATA[<h3>Computer Programming for Beginners — A Short Guide Part 5[2024]</h3><h4>Fundamental Design Patterns</h4><figure><img alt="Design Patterns Title Image" src="https://cdn-images-1.medium.com/max/1024/1*GvSY4F-qPo_dPlHNVW2G-A.jpeg" /><figcaption>Image created by author using Canva Pro</figcaption></figure><blockquote>Imperative</blockquote><p>Imperative programming is a programming paradigm that focuses on describing how a program should achieve a particular result through a sequence of statements that change a program’s state. In imperative programming, the emphasis is on providing step-by-step instructions to the computer on how to perform a task.</p><blockquote>Key characteristics of imperative programming include:</blockquote><ol><li><strong>State Modification</strong></li></ol><p>Programs are structured as a series of statements that explicitly change the program’s state. Variables hold the program’s data, and through statements, the values of these variables are modified over time.</p><p>2. <strong>Control Flow</strong></p><p>Imperative programs use control flow structures such as loops and conditional statements to dictate the order in which statements are executed. This allows for the creation of algorithms that involve decision-making and repetition.</p><p>3. <strong>Procedural Abstraction</strong></p><p>Imperative programming often involves breaking down a program into procedures or functions, which are named blocks of code that can be called and executed in a specific sequence. These procedures encapsulate a set of actions.</p><p>4. <strong>Explicit Execution Order</strong></p><p>The programmer specifies the exact order in which statements are executed. This contrasts with declarative programming paradigms, where the emphasis is on describing the desired outcome without specifying the step-by-step process.</p><p>Languages like C, Java, and Python support imperative programming. While imperative programming provides a clear and direct way to express algorithms and manipulate state, it can sometimes lead to complex and error-prone code, especially as programs grow in size. This has led to the development and popularity of other programming paradigms, such as declarative and object-oriented programming, which offer alternative approaches to structuring code.</p><p>Here’s a simple example of imperative programming in PHP. In this example, we’ll create a basic program that calculates the factorial of a number using an imperative approach:</p><figure><img alt="Imperative Example" src="https://cdn-images-1.medium.com/max/1024/1*w2qtnC6vmA4ZWCwRdSoiqA.png" /><figcaption>Imperative Programming Example</figcaption></figure><p>So, in the above example we have a function `<em>calculateFactorial</em>` which takes a number `$n` and calculates its factorial using a loop. The loop then iterates through the numbers from 1 to `$n`, multiplying them together to calculate the factorial.</p><p>This example illustrates the imperative nature of the code, where we explicitly specify the steps to achieve the desired outcome (calculating the factorial). The state of the program (the `$result` variable) is modified through the loop to achieve the final result.</p><blockquote>Declarative</blockquote><p>Declarative programming is a programming paradigm that focuses on describing the desired outcome or goal without explicitly specifying the step-by-step process to achieve it. In declarative programming, the emphasis is on what should be done rather than how it should be done. This paradigm allows developers to express the logic of a program in a more abstract and concise manner.</p><p>Key characteristics of declarative programming include:</p><ol><li><strong>Expression of Logic</strong></li></ol><p>Declarative programs emphasize expressing the logic or rules that govern a computation, often using high-level abstractions and domain-specific languages.</p><p>2. <strong>Statelessness</strong></p><p>Declarative programming tends to minimize or eliminate the use of mutable state. Instead of modifying variables or data structures directly, the focus is on defining relationships and transformations.</p><p>3. <strong>High-Level Abstractions</strong></p><p>Declarative languages often provide high-level abstractions that allow developers to express complex operations with minimal boilerplate code. This can lead to more readable and maintainable code.</p><p>4. <strong>Automatic Optimization</strong></p><p>Declarative programming languages often allow the runtime system or compiler to optimize the execution of the program based on the provided logic, allowing for potentially more efficient code.</p><p>Now, let’s look at a simple example in PHP that contrasts imperative and declarative styles. Suppose we want to find the sum of squares for an array of numbers:</p><figure><img alt="Declarative Example" src="https://cdn-images-1.medium.com/max/1024/1*i7a8LUrpLuRj6VJd1XqYog.png" /><figcaption>Declarative Example</figcaption></figure><p>In the declarative approach, we use “<em>array_map”</em> to apply the squaring operation to each element of the array and then use “<em>array_sum”</em> to calculate the sum. The focus is on expressing the desired operation rather than specifying the loop and loop counter, as in the imperative approach. This is a simple example, but in more complex scenarios, declarative programming can lead to more concise and expressive code.</p><p>In the next chapter we will continue with some more fundamental design patterns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ff05615a03c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Computer Programming for Beginners — A Short Guide Part 4[2024 Edition]]]></title>
            <link>https://medium.com/@dave.allan_50937/computer-programming-for-beginners-a-short-guide-part-4-2024-edition-9d48e69eee20?source=rss-6c67d81e560b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d48e69eee20</guid>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[learn-coding]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[learn-programming]]></category>
            <dc:creator><![CDATA[Dave Allan]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 17:01:44 GMT</pubDate>
            <atom:updated>2024-03-07T17:01:44.203Z</atom:updated>
            <content:encoded><![CDATA[<h3>Computer Programming for Beginners — A Short Guide Part 4[2024 Edition]</h3><h4>Data and Classes</h4><figure><img alt="Abraham Lake" src="https://cdn-images-1.medium.com/max/1024/1*1qnpfYMGfEtWuEBK160-Qw.jpeg" /><figcaption>Abraham Lake from Vision Quest Trail by author.</figcaption></figure><h4>Section 4 — Data and Classes</h4><p>Data can be found in many forms from simple numbers and letters to more complex structures like tables, which can contain large amounts of raw data. For this data to become useful information, it may have to be processed and cleaned before presenting it to the end user.</p><p>The simple data types in the previous lesson are some ways to use data in a computer program. Many times the data is much more complex for example a persons address may contain several different items such as building number, street name, city, state, zip and country.</p><blockquote>Data Abstraction</blockquote><p>To make working with more complex data a little easier, data abstraction can be used to hide some of the details and to give the programmer a consistent way to handle the data.</p><blockquote>Classes</blockquote><p>Classes are used in this way to hide some of the complexity and also to make the code more reusable. They also form the basis for object oriented programming and are often referred to as objects.</p><p>The following example is a class called Address which holds address information:</p><figure><img alt="Class example" src="https://cdn-images-1.medium.com/max/1024/1*ZawQx8LnMrS8hRPnEg6-Vw.png" /><figcaption>Image by author.</figcaption></figure><p>We could create or instantiate this class using the “new” keyword in PHP and we would have to give the Address constructor all of the address data:</p><pre>$myAddress = new Address(&quot;24&quot;,&quot;Some Street,&quot;Paris&quot;,&quot;Texas&quot;,&quot;90101&quot;,&quot;United States&quot;);</pre><p>Now we have created an object called $myAddress which holds all of our address data which can be accessed like so:</p><pre>$myAddress-&gt;building_number; // which would return &#39;24&#39; in this case.</pre><p>In our example we have also included a method ( or function ) within the class called ‘printAddress’ which has been used to print out the address in the terminal window.</p><p>The above class is very simple and in real life could be much more complex. A class can contain its own methods ( functions ), getters and setters and class variables (properties).</p><p>Using classes we can create our own data types as objects and through inheritance and abstract classes our data can be abstracted.</p><p>Inheritance and abstract classes are topics covered in the next section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d48e69eee20" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>