<?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 Frank C. Ebeledike on Medium]]></title>
        <description><![CDATA[Stories by Frank C. Ebeledike on Medium]]></description>
        <link>https://medium.com/@frankcebeledike?source=rss-f490072cd177------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*n04OU2VcbIzXeHbz</url>
            <title>Stories by Frank C. Ebeledike on Medium</title>
            <link>https://medium.com/@frankcebeledike?source=rss-f490072cd177------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:14:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frankcebeledike/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[CAP Theorem: System Design Tradeoffs for Distributed Systems]]></title>
            <link>https://medium.com/@frankcebeledike/cap-theorem-system-design-tradeoffs-for-distributed-systems-70738134fbb5?source=rss-f490072cd177------2</link>
            <guid isPermaLink="false">https://medium.com/p/70738134fbb5</guid>
            <category><![CDATA[distributed-database]]></category>
            <category><![CDATA[distributed-system-design]]></category>
            <category><![CDATA[cap-theorem]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Frank C. Ebeledike]]></dc:creator>
            <pubDate>Tue, 11 Aug 2026 15:28:30 GMT</pubDate>
            <atom:updated>2026-08-11T18:35:52.397Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>CAP theorem, also known as Brewer’s theorem, states that a distributed system can guarantee at most two out of three properties: <strong>Consistency</strong>, <strong>Availability</strong>, and <strong>Partition Tolerance</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*MnDmwQdpGWFLE_Zy1EpZyw.png" /><figcaption>Image Source: <a href="https://en.wikipedia.org/wiki/CAP_theorem">https://en.wikipedia.org/wiki/CAP_theorem</a></figcaption></figure><p>You’re at the toy store and shop owner says you can take three large toys, however, you only have two hands to carry them out. No matter how much you want all three, one has to go back on the shelf. Distributed systems face the exact same problem, except instead of toys, the three things they’re trying to hold onto are called Consistency, Availability, and Partition Tolerance, and just like your two hands, a system can never quite carry all three at once.</p><p>Before CAP theorem can make sense, a few building blocks need to be in place.</p><p><strong>Distributed system:</strong> A distributed system is a group of nodes or computers that work together to get something done, even though they can be physically separate. These computers communicate over the internet, and the workload is split across them. Large scale systems such as Netflix or Instagram don’t run on one computer. They run on many computers, often in different cities or countries.</p><p><strong>System design:</strong> This is the practice of deciding how software systems should be structured so it can handle real-world demands such as many users, large amounts of data, hardware failures, and network problems. It involves connecting software components together while considering engineering tradeoffs.</p><p><strong>Network partition:</strong> A network partition occurs when nodes in a distributed system lose the ability to talk to each other, even though each node individually is still running fine. It can be caused by a cut cable, a failed network device, or a slow connection. The rule of thumb is simple: in large scale systems, something will eventually go wrong.</p><p>CAP theorem, first put forward by computer scientist Eric Brewer in 2000, says that a distributed data system can only fully guarantee two of these three properties at the same time:</p><ul><li><strong>Consistency (C):</strong> All clients see the same data at the same time. In other words, no matter which machine you ask, you get the same, up to date answer.</li><li><strong>Availability (A):</strong> The system continues to operate, even in the presence of a node failure. This means that every request that reaches a working node gets a response, whether it’s the most recent data or not.</li><li><strong>Partition Tolerance (P):</strong> The system keeps functioning even in the presence of network failure.</li></ul><p>Here is the real tradeoff: <strong>Partition Tolerance</strong> is the one toy you must pick. This is because networks fails, data centers lose connectivity and putting Partition Tolerance back would mean pretending network failures never happen, and no real system gets to make that assumption. So in practice, the real tradeoff is not “which two of three do I want,” it is “when a partition happens, do I favor Consistency or Availability?” This is why CAP theorem is often simplified in modern conversations to a CP versus AP choice.</p><h3><strong>An Example Use-case</strong></h3><p>Imagine an online ticket booking platform selling seats for a concert. There are two nodes: one in New York, one in London, each serving customers in their region. Only one seat is left. Immediately, a network partition occurs between New York and London right as two different customers, one in each city try to buy that last seat at nearly the same moment.</p><p><strong>If the system chooses Consistency (CP), t</strong>he New York node checks with London to confirm the seat is still available before completing the sale. Since the partition means it can’t reach London, it refuses the New York customer’s request rather than risk selling a seat twice. The customer sees an error or a “please try again” message. No one gets accidentally overbooked, but a paying customer is turned away during the outage.</p><p><strong>If the system chooses Availability (AP), </strong>both nodes stay responsive and let their local customer buy the seat, since asking the other side for permission isn’t possible. Both sales go through. When the partition heals, the system discovers two people paid for one seat, and now customer support will have to intervene.</p><p>Neither outcome is “wrong.” They are different tradeoffs for different priorities. A ticketing system for a small concert might choose AP and accommodate the occasional double booking. A banking system moving money between accounts will almost always choose CP, because two people spending the same dollar is not an acceptable outcome.</p><h3><strong>Popular databases and how CAP theorem applies to them</strong></h3><p>Most databases are either CP or AP. Some can be configured to lean one way or the other. Still, each has a dominant design philosophy worth knowing.</p><p><strong>etcd (CP)</strong> etcd is the distributed key-value store that Kubernetes uses to hold its entire cluster state. If a network partition splits an etcd cluster and one side doesn’t have a majority of nodes, that side stops accepting writes entirely rather than risk the cluster state drifting apart.</p><p><strong>Amazon DynamoDB (AP)</strong> DynamoDB defaults to eventual consistency for reads to keep latency low and availability high across regions, but it offers a strongly consistent read option for cases where a team needs the freshest data at the cost of a bit more latency.</p><p><strong>MongoDB (CP)</strong> MongoDB uses a primary/replica model. If the primary becomes unreachable due to a partition, MongoDB will trigger an election to pick a new primary rather than let multiple nodes accept writes independently. During that election window, the system favors correctness over responding instantly, which puts it closer to CP.</p><p><strong>Apache Cassandra (AP)</strong> In Cassandra, any node can accept a read or write, even during a partition, and conflicting versions of data get reconciled later using timestamps or custom logic. Cassandra also lets engineers tune consistency levels per query, so it can behave more like CP when a team truly needs it, but its default posture is AP.</p><p><strong>PostgreSQL (CP)</strong> Traditional relational databases were not built with CAP theorem in mind since they predate it, but when deployed with replication for high availability, most production configurations favor consistency: a write is only confirmed once it is safely replicated, and a broken replica is taken out of rotation rather than allowed to serve outdated data.</p><h3><strong>My final thoughts</strong></h3><p>CAP theorem doesn’t have to be a single decision you make for your entire application. In practice, most large applications are made up of many smaller parts, and each part can make its own choice. If I’m building a large application, I don’t have to pick CP or AP once and force that decision onto every feature. A section that handles something like payments or account balances can run CP, because getting the wrong number there is a real problem. A different section, like activity logs, view counts, or a comments feed, can run AP, because being slightly out of date for a few seconds doesn’t hurt anyone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*Xx7zAnGijzOs4GogkEnApg.png" /><figcaption>CP and AP living side by side in the same system</figcaption></figure><p>This is really how most real systems end up working once they grow past a certain size. You don’t need one philosophy for everything, you need to ask, for each piece of data, whether being wrong for a moment is acceptable or not, and then pick the right tool or configuration for that piece. Combining CP and AP inside the same application isn’t a compromise or a workaround, it’s just good system design.</p><p>The real skill in system design is looking at a specific piece of data, in a specific part of an application, and asking what actually matters more if the network fails right now: being right, or being reachable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70738134fbb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programing Foundations]]></title>
            <link>https://medium.com/@frankcebeledike/programing-foundations-9e311a48aa9e?source=rss-f490072cd177------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e311a48aa9e</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[programing]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[programming-paradigms]]></category>
            <dc:creator><![CDATA[Frank C. Ebeledike]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 08:43:46 GMT</pubDate>
            <atom:updated>2023-06-28T10:39:06.337Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world, where technology is evolving very fast, and has several applications, programming has become an essential skill. Whether you aspire to be a software engineer, a data scientist or simply want to automate a task, understanding the fundamentals of programming is crucial.</p><p>I took a couple of Programming Foundation courses on LinkedIn Learning, under the guidance of the MASL (Microsoft ADC Student League). In this article, I will discuss some of the concepts I learned and also a short introduction to the foundations of programming: Fundamentals, Algorithms, Data Structures, Databases, Object-oriented design, APIs and Web services, Software Testing/QA.</p><h3>Fundamentals</h3><p>Now, what is programming? Programming is the process of converting ideas into instructions that a computer can understand and execute. It’s how we get computers to perform tasks and solve problems. For us to communicate this instruction to the computer we use a programming language. Examples include Java, Python, C#, Kotlin and so on. Each of these languages has its syntax and semantics. For example, here is a program that outputs a message to the user in Python</p><pre>print(&quot;Hello World&quot;)</pre><p>and here is the same thing but using Java</p><pre>System.out.println(&quot;Hello World&quot;)</pre><p>Another important concept in programming is <strong>variable</strong>. A variable is a named memory location. Imagine how you have some colorful marbles — red, blue, and green. Now, you want to keep track of how many marbles of each color you have. So, you create three small cups, and you label them “red,” “blue,” and “green.” These cups represent variables.</p><p>Whenever you find a red marble, you put it in the cup labeled “red.” If you find a blue marble, you put it in the cup labeled “blue,” and so on. The cups help you organize and remember how many marbles of each color you have. In programming, we use variables to store data temporarily. Data are of different types, for example, Name could have a value of “Esther”, age could have a value of 18 and sex could have a value of ‘F’. All these are of different <strong>Data Types</strong>.</p><p>Now, to write code we need an <strong>IDE</strong> (Integrated Development Environment). An IDE is an application software that has all the special tools needed to improve developer productivity to write, test, and execute software.</p><h4>Algorithm</h4><p>Software drives most of the technology today, and software is powered by algorithms. An algorithm is a step-by-step, unambiguous process of solving a problem or performing a particular task. An algorithm can be classified based on complexity such as space complexity and time complexity. Space complexity is the amount of memory used by the algorithm whereas time complexity is the time taken for the algorithm to complete its operation with the given input. Some common algorithms include searching algorithms, sorting algorithms, computational algorithms and collection algorithms.</p><p>Let’s take a look at a search algorithm, for example, linear search. <strong>Linear search </strong>is a simple algorithm that searches for a specific element in a list by iterating through each element until it finds a match. Here is a code snippet</p><pre>def linear_search(array, target):<br>    for index, element in enumerate(array):<br>        if element == target:<br>            return index  # Found the target element at this index<br>    return -1  # Target element not found in the array<br><br>my_array = [4, 2, 9, 1, 7, 5]<br>target_element = 7<br>index = linear_search(my_array, target_element)<br>if index != -1:<br>    print(f&quot;Found {target_element} at index {index}&quot;)<br>else:<br>    print(f&quot;{target_element} not found in the list&quot;)</pre><p>Here we simply loop through each element in the array and if it’s equal to the target element then we return the index. If the target element doesn’t exist in the array, we return <strong>-1</strong>. Linear search has a time complexity of <strong>O(1)</strong> for the best-case scenario and <strong>O(n)</strong> for the worst-case scenario. The space complexity is <strong>O(1)</strong> regardless of the input size.</p><h4>Data Structures</h4><p>In programming, we are always going to be working with different types of data. Data structure helps us organize and manipulate data efficiently. Data structures are essential in programming, as they allow for optimized algorithms and efficient problem-solving. The types of data structure are linear data structure and non-linear data structure.</p><p>In a linear data structure, the elements have a linear relationship with its adjacent element whereas in a non-linear data structure, the data elements are not arranged sequentially. Examples of linear data structures are Arrays, Linked Lists, Stacks, and Queues while non-linear data structures are Trees and Graphs. Each type has its characteristics, advantages, and specific use cases.</p><p>Let’s discuss our first data structure — arrays. An <strong>array</strong> is a data structure that allows you to store a sequence of elements, where each element is accessed using its index. Here is an example using Python</p><p>Here is an example using Python</p><pre># An array of integers<br>numbers = [10, 20, 30, 40, 50]<br><br># Accessing each element using it&#39;s index<br>for i in range(len(numbers)):<br>    print(f&quot;Index: {i}, Value: {numbers[i]}&quot;)</pre><p>A <strong>linked list</strong> is a collection of nodes where each node contains both the data and a reference (pointer) to the next node in the list. The last node points to None or Null indicating the end of the list. In this data structure, the elements are not stored at contiguous locations. Several operations can be performed on a linked list but here I will only focus on inserting, removing and displaying the items in a linked list.</p><pre>class Node:<br>    def __init__(self, data):<br>        self.data = data<br>        self.next = None<br><br>class LinkedList:<br>    def __init__(self):<br>        self.head = None<br>    def is_empty(self):<br>        return self.head is None<br>    def insert(self, data):<br>        new_node = Node(data)<br>        if self.is_empty():<br>            self.head = new_node<br>        else:<br>            current = self.head<br>            while current.next is not None:<br>                current = current.next<br>            current.next = new_node<br>    def remove(self, data):<br>        if self.is_empty():<br>            print(&quot;Linked list is empty.&quot;)<br>            return<br>        if self.head.data == data:<br>            self.head = self.head.next<br>            return<br>        current = self.head<br>        prev = None<br>        while current is not None:<br>            if current.data == data:<br>                prev.next = current.next<br>                return<br>            prev = current<br>            current = current.next<br>        print(f&quot;{data} not found in the linked list.&quot;)<br>    def display(self):<br>        if self.is_empty():<br>            print(&quot;Linked list is empty.&quot;)<br>        else:<br>            current = self.head<br>            while current is not None:<br>                print(current.data, end=&quot; &quot;)<br>                current = current.next<br>            print()<br># Implementation:<br>my_list = LinkedList()<br>my_list.insert(1)<br>my_list.insert(2)<br>my_list.insert(3)<br>my_list.insert(4)<br>my_list.display()<br><br>my_list.remove(2)<br>my_list.display()</pre><p>From the above snippet, each time we insert an item into the list, the item gets added to the end of the list.</p><h4>Databases</h4><p>Databases help us store, manage, and retrieve large amounts of data efficiently. A database is a structure that stores information in an organized, consistent, reliable and searchable way. There are different kinds of databases such as the Relational database, NoSQL databases, Graph databases and so on.</p><p>Let’s focus on the relational database for now. Relational databases store related data in tables with predefined schemas. They use SQL (Structured Query Language) for data manipulation and querying. Examples include MySQL, Oracle Database, PostgreSQL, and Microsoft SQL Server. In a relational database, tables are made up of rows (records) and columns (fields). Each row represents an instance of an entity and columns represent attributes of a given entity. Relational databases are designed to ensure data integrity and consistency by adhering to ACID properties. ACID stands for Atomicity, Consistency, Isolation, and Durability</p><h4>Object Oriented Design (OOD)</h4><p>Good software starts with a design. Before writing a single line of code the first thing to do is plan, analyze, and come up with a design. In doing so, we build software that is durable, testable and maintainable. OOD focuses on organizing and structuring code around objects, which are instances of classes that encapsulate data and behavior. In OOD, we use tools such as UML (Unified Modeling Language) to create models of our object-oriented systems. The design process is as follows</p><ul><li>R<strong>equirements </strong>definition</li><li><strong>Use case</strong> diagrams and <strong>user stories</strong></li><li>Creation of <strong>conceptual model</strong></li><li><strong>Class</strong> diagrams</li><li><strong>Software</strong> development</li></ul><p>The first step in any design process is to gather your requirements. The requirements will contain what the application must do, and maybe how it should do it. In the use case diagram and user stories, the focus is on what the applications must do and how the user will interact with the application. The conceptual model represents important objects and the relationship between them. You can easily spot an object by looking out for nouns in your use case and user stories.</p><p>To create class diagrams, we will use UML. Here we must take note of the OOP principles like encapsulation, abstraction, inheritance and polymorphism. Each class diagram might have a name, attributes and behaviors.</p><p>Finally, we can start writing code. Here we build actual software. We must take note of some software design patterns, and ensure test-driven development and software development principles such as SOLID, DRY, and YAGNI.</p><h4>APIs and Web Services</h4><p>APIs and Web Services allow different devices to communicate over the internet.</p><p>An API (Application Programming Interface) is a set of rules, protocols, and tools that specifies how different software components should interact with each other. A web service is an API that enables communication and data exchange over the internet using standard web protocols. The two types of web services are SOAP (Simple Object Access Protocol) web services and REST (Representational State Transfer) web services.</p><p>Web services support reusability. Also since the data is exchanged using JSON or XML format, this allows for interoperability between several systems. APIs and web services provide authentication, authorization, and data encryption to ensure secure communication between different devices.</p><h4>Software Testing/QA</h4><p>Trying to use a software that doesn’t work can be quite frustrating, that’s why there is a need for proper testing and quality assurance (QA).</p><p>Quality assurance is a systematic process used to determine whether a product meets specifications. It includes activities such as requirement analysis, test planning, test case creation, and identifying and reporting bugs. To maintain quality it’s necessary to iterate and improve on all processes in the software development lifecycle.</p><p>Software testing is the process of evaluating a software system or its components to ensure it meets the requirements. Software testing requires a strategy. A test strategy describes how a software product will be tested so that anyone can read and understand the scope of testing clearly. There are various types of testing a QA engineer might focus on. These are</p><ul><li>Box testing</li><li>Manual testing</li><li>UI automation testing</li><li>Integration testing</li><li>Performance testing</li><li>Security testing</li></ul><p>When a bug is identified in software, the bug must be reported to the development team. This can be done using a <strong>bug reporting system</strong> to assign, view, triage, report and close bugs.</p><h4>Conclusion</h4><p>These topics are the foundations of programming and some of the concepts I learned in the LinkedIn learning courses. Having a good knowledge of each of these topics is enough to help you understand and build scalable and maintainable software. This is only a piece of the iceberg so I didn’t go in-depth to explain most concepts.</p><p>Thumbs up for coming this far. Happy learning📚.</p><h4>References</h4><p><a href="https://www.linkedin.com/learning/programming-foundations-fundamentals-3">https://www.linkedin.com/learning/programming-foundations-fundamentals-3</a></p><p><a href="https://www.linkedin.com/learning/programming-foundations-algorithms?dApp=204528272&amp;leis=MVL">https://www.linkedin.com/learning/programming-foundations-algorithms?dApp=204528272&amp;leis=MVL</a></p><p><a href="https://www.linkedin.com/learning/programming-foundations-data-structures-2/understand-data-structures?dApp=204528272&amp;leis=MVL">https://www.linkedin.com/learning/programming-foundations-data-structures-2/understand-data-structures?dApp=204528272&amp;leis=MVL</a></p><p><a href="https://www.linkedin.com/learning/programming-foundations-databases-2">https://www.linkedin.com/learning/programming-foundations-databases-2</a></p><p><a href="https://www.linkedin.com/learning/programming-foundations-object-oriented-design-3">https://www.linkedin.com/learning/programming-foundations-object-oriented-design-3</a></p><p><a href="https://www.linkedin.com/learning/programming-foundations-apis-and-web-services">https://www.linkedin.com/learning/programming-foundations-apis-and-web-services</a></p><p><a href="https://www.linkedin.com/learning/programming-foundations-software-testing-qa">https://www.linkedin.com/learning/programming-foundations-software-testing-qa</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e311a48aa9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Object Oriented Programming (OOP)]]></title>
            <link>https://medium.com/@frankcebeledike/introduction-to-object-oriented-programming-oop-814b86f29f06?source=rss-f490072cd177------2</link>
            <guid isPermaLink="false">https://medium.com/p/814b86f29f06</guid>
            <category><![CDATA[oop-concepts]]></category>
            <category><![CDATA[computer-programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[object-oriented-program]]></category>
            <dc:creator><![CDATA[Frank C. Ebeledike]]></dc:creator>
            <pubDate>Fri, 28 Apr 2023 15:32:39 GMT</pubDate>
            <atom:updated>2023-04-28T17:04:25.643Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction to Object Oriented Programming (OOP)</p><p><strong>Introduction</strong></p><p>Object Oriented Programming (OOP) is a type of Programming paradigm that centers around the concept of &quot;objects&quot;. You can think of an object as anything. For example, if you look around you, what do you see?. Maybe a chair, a pen or a person, those are objects. An object is a basic unit of a program. It can have an identity, state, and/or behavior. An object represents real-world entities and it is an instance of a class. A class is a blueprint that defines the structure, behavior, and characteristics of an object, serving as a template for its instances. <br>OOP focuses on improving code readability, reusability and maintainability. The are many programing languages today that support OOP, such as Python, Java, Kotlin and so on. In this article, I will be using the Python programming language but the same concepts can be applied to other languages as well.</p><p>Below shows a code snippet for a basic class and it&#39;s corresponding object</p><pre># Define a class called person<br>class Person:<br>    pass<br><br># Create an object of the person class<br>person = Person()</pre><p><strong>Principles of OOP</strong><br>There are four principles of OOP, which form the basis of OOP design. They are Encapsulation, Inheritance, Polymorphism and Abstraction.</p><p><strong>Encapsulation</strong>: This principle involves bundling data and behaviors together into a single unit (the class) and hiding the data from other external entities. This principle ensures that the data is protected from unauthorized access or modification. It does this using access modifiers. Access modifiers help to control the visibility and accessibility of the attributes and methods of an object from outside the class. Examples of access modifiers are public, protected and private.</p><p>For example, In Python, there is no strict enforcement of access modifiers like in some other programming languages. However, we can still achieve encapsulation by convention using underscores to indicate the visibility of attributes and methods.</p><p><strong>Public</strong>: attributes and methods with no underscore prefix can be accessed from anywhere, including outside the class.</p><p><strong>Protected</strong>: attributes and methods with a single underscore prefix can accessed from within the class and its subclasses.</p><p><strong>Private</strong>: attributes and methods with a double underscore prefix can only be accessed from within the class.</p><p>Below shows a code snippet demonstrating encapsulation. The variable height is completely hidden and cannot be accessed outside the Person class</p><pre>class Person:<br>  def __init__(self, name, age, height):<br>    self.name = name        # public attribute<br>    self._age = age         # protected attribute<br>    self.__height = height # private attribute<br><br>  def get_details(self):<br>    return f&quot;{self.name} is {self._age} years old and is {self.__height}ft tall&quot;<br><br>person = Person(&quot;Dominik&quot;, 21, 5)<br>print(person.name)<br>print(person._age)<br># print(person.__height) -&gt; We can&#39;t access this<br>print(person.get_details())</pre><p><strong>Inheritance</strong>: This principle allows new classes to be derived from existing classes, thereby inheriting their attributes and behaviors. A class can inherit from one or more parent classes, and the child class will have the attributes or behaviors of its parent class. A child class can also provide its specific implementation to the methods of the parent class This helps to reduce code duplication, making it easier to maintain and reuse code.</p><p>For example, Let&#39;s create a Student class that inherits from the Person class. We will give the student class an additional attribute “school”. Due to inheritance, we are able access the <em>name </em>and <em>age </em>variable and also call the <em>get_details</em> method even though it wasn’t declared in the Student class.</p><pre>class Student(Person):<br>  def __init__(self, name, age, height, school):<br>    super().__init__(name, age, height)<br>    self.school = school<br><br>student = Student(&quot;Magret&quot;, 29, 6, &quot;Federal University of Technology, Minna&quot;)<br>print(student.name)   # Output: Magret<br>print(student._age)   # Output: 29<br>print(student.get_details())</pre><p><strong>Polymorphism</strong>: This principle allows objects to exist in different types. For example, a person can be a student, an engineer, a doctor or a lawyer. An engineer can even be a father, a CEO and so on. In OOP, this means that you can access objects of different types through the same interface. Each type can provide its own custom implementation of this interface or simply rely on the default implementation.</p><p>To implement this in python, I will create an additional class (Engineer) that inherits from Person class and provides its own implementation of the <em>get_details</em> method. The object student is both a Student and a Person while the object engineer is both an Engineer and a Person. We can call the <em>get_details</em> method for both objects.</p><pre>class Engineer(Person):<br>  def __init__(self, name, age, height, skills):<br>    super().__init__(name, age, height)<br>    self.skills = skills<br><br>  def get_details(self):<br>    return f&quot;{super().get_details()}. {self.name} is also an Engineer with skills in {self.skills}&quot;<br><br><br>student = Student(&quot;Magret&quot;, 29, 6, &quot;Federal University of Technology, Minna&quot;)<br>engineer = Engineer(&quot;David&quot;, 30, 6.5, [&quot;Java&quot;, &quot;C++&quot;, &quot;C#&quot;])<br>print(student.get_details())<br>print(engineer.get_details())</pre><p><strong>Abstraction</strong>: This principle involves hiding the details of the implementation of an object and providing only essential data/information to the outside world. Imagine you want to turn on your PC, you don&#39;t need to know the inner workings of a PC or what happens behind the scene to turn on your PC, you only need to know which button to press to turn on your PC. This is the idea of abstraction in OOP and it helps to reduce complexity and make the code easier to read.</p><p>To implement this in python, let’s add an <em>order_food </em>method to our Student class. It takes a few steps to order food, but for a student using this program, we don’t want to bother them with the steps involved in getting this done. The student only get’s a response of whether the order was successful or not.</p><pre>class Student(Person):<br>  def __init__(self, name, age, height, school):<br>    super().__init__(name, age, height)<br>    self.school = school<br><br>  def order_food(food_name: str):<br>    &quot;&quot;&quot;<br>      Check if the food name is part of the MENU<br>      if true:<br>        Inform the student that the order is in progress<br>        prepare the food<br>        package the food<br>        deliver the food to the student&#39;s dome or hostel<br>      else:<br>        Inform the student that the food is currently not available<br>    &quot;&quot;&quot;<br>    pass<br><br>student = Student(&quot;Magret&quot;, 29, 6, &quot;Federal University of Technology, Minna&quot;)<br>student.order_food()</pre><p><strong>Benefits of OOP</strong></p><ul><li>OOP provides abstraction and polymorphism, which makes the code more flexible as well as easier to read and understand for other developers.</li><li>OOP allows us to break down complex software into smaller modules, making it easier to maintain. Also, changes made to a section of the code won&#39;t affect other parts of the software, reducing the risk of bugs and errors.</li><li>OOP provides Inheritance which enables us to reuse code by creating classes that can be used across different projects and applications. This means that we can avoid duplicating code which saves time and effort.</li></ul><p>In conclusion, OOP is a programming paradigm that ensures modularity, code reuse, and abstraction. It provides a flexible and adaptable structure for building complex software systems.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=814b86f29f06" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>