<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alex Ricciardi</title>
    <description>The latest articles on DEV Community by Alex Ricciardi (@alex_ricciardi).</description>
    <link>https://dev.to/alex_ricciardi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2518403%2Fd134944a-ebf5-4d92-8dd9-1a52c726e153.png</url>
      <title>DEV Community: Alex Ricciardi</title>
      <link>https://dev.to/alex_ricciardi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alex_ricciardi"/>
    <language>en</language>
    <item>
      <title>A UML Use-Case Analysis of an Online Shopping System: Actors, Use Cases, and Relationships</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Wed, 16 Apr 2025 00:11:38 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/a-uml-use-case-analysis-of-an-online-shopping-system-actors-use-cases-and-relationships-4ioh</link>
      <guid>https://dev.to/alex_ricciardi/a-uml-use-case-analysis-of-an-online-shopping-system-actors-use-cases-and-relationships-4ioh</guid>
      <description>&lt;p&gt;This article explores the application of Unified Modeling Language (UML) Use-Case Diagrams in designing an online shopping system, detailing the essential components like actors, use cases, and their relationships. It demonstrates how these diagrams capture functional requirements and illustrates typical user interactions with examples of main and alternative flows in use case documentation.&lt;/p&gt;




&lt;p&gt;Unified Modeling Language (UML) Use-Case Diagrams are used early within the UML-base Development (Dolques et al, 2012). In Software Development (SD), they model the behavior of a system helping to capture the functional requirements of the system (IBM, 2023). They are structured around the concept of actors and use cases, the diagrams illustrate the interactions and relationships between them within a system, with the primary goal to describe the system’s functionality (Helm n.d). What the system does. This essay explores an online shopping scenario by providing a UML Use-Case Diagram of a hypothetical online shopping system, analyzing its actors, use cases, and relationships, and providing two use case documentation examples describing flow and alternative flow steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UML Use-Case Diagrams Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the context of Software Engineering (SE), UML Use-Cases Digrams are part of the early stage of SD, and they play an important role in the software modeling of the Problem Space or Model of Process Space (MOPS). MOPS models “what” the business problem is and users are to understand and model the system or application requirements (Ricciardi, 2025). Use case modeling behind the identification of actors. An actor can be an individual or external/internal systems that interact with the system to fulfill a goal (Unhelkar, 2018 a). These are the main actors who benefit from the system — for example, The other components of a UML Use-Case Diagram are use cases and relationships. Use cases are illustrations of “what” a system does; however, they do not illustrate “how” the system does it. Relationships illustrate the interactions between actors, between use cases, and between actors and use cases. These relationships can be divided into four categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Association relationships — illustrations of direct interactions between actors and use cases or between use cases.&lt;/li&gt;
&lt;li&gt;Include relationships — illustrations of interactions where use cases include the functionalities of other use cases.&lt;/li&gt;
&lt;li&gt;Extend relationships — illustrations of interactions where use cases are extended by other use cases under certain conditions.&lt;/li&gt;
&lt;li&gt;Generalization relationships — illustrations of interactions where use cases are generalized versions of other use cases or actors are generalized versions of other actors. This interaction can be defined as a parent-child relationship where the parent is the generalized version of a child.
(Ricciardi, 2025, p. 2)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the next page sets Figure 2. It is a possible Use-Case Diagram for an online shopping scenario. It illustrates the actors, use cases, and their relationships within the online shopping system. The actors are depicted by a stick figure with a design starting with “A” followed by a number and name description. Use cases are depicted as an eclipse container with a design starting with “UC” followed by a number and name description. Relationships are depicted with lines and arrows with their name designation between “&amp;lt;&amp;lt; &amp;gt;&amp;gt;” if they represent an extend or include relationships, see Figure 1 for an illustration of them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Examples of Actors, Use Cases, and Relationships&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnbx3urark5w1vodte0k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flnbx3urark5w1vodte0k.png" alt="Examples of Actors, Use Cases, and Relationships" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Online Shopping System Use Case Diagram&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsr2cpbfiznxdj791ywnp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsr2cpbfiznxdj791ywnp.png" alt="Online Shopping System Use Case Diagram" width="800" height="904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Online Shopping System Analysis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before crafting a USE-Case Diagram for the online shopping scenario, it is important to identify the actors.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use case modeling begins with the identification and documentation of users or actors” The main purpose of developing a software solution is to provide for the needs of these users. The actor also indicates how the system will be used (hence the term use cases). Actors provide the core starting point for the rest of modeling, design, and development in a software project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(Unhelkar, 2018 a, p. 73).&lt;/p&gt;

&lt;p&gt;Actors can be internal or external to the system, primary actors are the ones for whom the system is built, while secondary actors support the system to help primary actors to achieve their goals (Unhelkar, 2018). Direct actors interact with the system directly through an interface, for example, while indirect actors do not interact with the system interface but may receive output/date/goods from the system. Finally, abstract actors are generalizations of actors that can model the behavior of other actors, while concrete actors inherit from abstract actors. See Table 1 for a description of the actors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Online Shopping System Actors&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fls8a3uqhtvk9ozzsr5fs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fls8a3uqhtvk9ozzsr5fs.png" alt="Online Shopping System Actors Table" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Online Shopping System Use Cases&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfutc1mlg8rec4mqt8nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpfutc1mlg8rec4mqt8nh.png" alt="Online Shopping System Use Cases Table" width="800" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use case documentation can help identify relationships. There are three main types of relationships:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Actor-to-actor is always a generalization relationship or inheritance relationship.&lt;/li&gt;
&lt;li&gt;Actor to use case, called an association, is the relationship between an actor and a use case, also called communication as it can represent a communication between the actor and the system.&lt;/li&gt;
&lt;li&gt;Use case to use case are relationships relationships between two use cases that are defined by three specific types: include, extend, and inherit (generalization) relationships. These relationships were defined in the UML Use-Case Diagrams Overview section of this paper.
(Unhelkar, 2018 b)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The table below, Table 3, describes the relationships within the online shopping system diagram.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Online Shopping System Relationships&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnoxpvsnclj3bdbaadoh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnoxpvsnclj3bdbaadoh.png" alt="Online Shopping System Relationships" width="800" height="891"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples of Flows and Alternative Flows&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In use case documentation, flows (sometimes called “Main Flows” or “Basic Flows”) describe the happy path or the ideal flow (ProcessMaker, 2024). They document the usual or expected sequence of steps while Alternative Flows document exceptions, error conditions, or optional paths. Below are two examples of use case documentation describing the flows (main and alternative) for key use cases:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: UC03–Checkout&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main (Basic) Flow&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Review Cart Items - The system displays items, quantities, and prices from UC02-Cart.&lt;/li&gt;
&lt;li&gt;Confirm Order Details - The Customer checks shipping address, billing address, and any taxes or fees.&lt;/li&gt;
&lt;li&gt;Proceed to Payment - The system transitions to UC04-MakePayment, where the Customer will choose payment options.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Alternative Flows&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A1: Cart Empty
If the cart is empty, the system notifies the Customer and redirects them to UC01-BrowseProducts.&lt;/li&gt;
&lt;li&gt;A2: Session Timeout
If the session expires during checkout, the system prompts the Customer to log in again via UC08-Login or create a new account if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example: UC04–MakePayment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main (Basic) Flow&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select PaymentMethod - The system includes UC12-PaymentMethod, prompting the Customer to choose or enter credit card/billing details.&lt;/li&gt;
&lt;li&gt;Verify Payment - The system calls UC06-VerifyPayment, which sends the payment request to A05-PaymentGateway.&lt;/li&gt;
&lt;li&gt;Complete Payment - On successful authorization, the system finalizes the order, linking back to UC10-ManageOrder or concluding the checkout process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Alternative Flows&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A1: Promotional Code
The Customer opts to use UC05-ApplyPromotionCode (&amp;lt;&amp;gt;).
If valid, the system recalculates the total; if invalid, it notifies the Customer.&lt;/li&gt;
&lt;li&gt;A2: Payment Declined
The gateway returns a “declined” response.
The system offers the Customer a chance to retry or choose a different payment method (UC12).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the seek of paper length, only two key use case documentation have been provided. However, the diagram illustrates several more use cases that could have been documented to provide examples of Main Flow and Alternative Flow scenarios. It is important to notice that “Use-Case Diagrams do not show any flow or dependencies in the system. They only provide a high-level picture of the system and have no features to represent the sequence of actions and alternative actions” (Unhelkar, 2018 b, p. 105)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UML Use-Case Diagrams are a powerful tool for modeling the functional requirements of a system. In Software Development (SD), they are used early within the modeling process to capture the behavior and the functionality of a system. The primary components of a Use-Case Diagram are actors, use cases, and the relationships between them. The main goal of the components is to describe what the system does. For instance, the Online Shopping System Use-Case Diagram illustrates how actors, use cases, and their relationships capture the functional requirements of an online shopping system, defining what the system does. Additionaly, the two use case documentation examples illustrate samples of Main Flows and Alternative Flows describing how actors use specific use cases. In essence, the UML Use-Case Diagram illustrates “what” the system does, while the use case documentation describes “how” users may interact with specific system functionalities.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Dolques, X., Huchard, M., Nebut, C., &amp;amp; Reitz, P. (2012). &lt;em&gt;Fixing Generalization Defects in UML Use Case Diagrams.&lt;/em&gt; Fundamenta Informaticae, 115(4), 327–356. &lt;a href="https://doi-org.csuglobal.idm.oclc.org/10.3233/fi-2012-658cv" rel="noopener noreferrer"&gt;https://doi-org.csuglobal.idm.oclc.org/10.3233/fi-2012-658cv&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Helm, J. (n.d.). Business use-case model. &lt;em&gt;Rational unified process.&lt;/em&gt; Fall 2023 SWEN 5135 Configuration Management course. University of Houston at Clear Lake. &lt;a href="https://sceweb.uhcl.edu/helm/RUP_Folder/RationalUnifiedProcess/process/modguide/md_bucm.htm" rel="noopener noreferrer"&gt;https://sceweb.uhcl.edu/helm/RUP_Folder/RationalUnifiedProcess/process/modguide/md_bucm.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;IBM documentation (2023, September 21). Use-case diagrams. &lt;em&gt;IBM Rational Software Architect documentation&lt;/em&gt;. IBM. &lt;a href="https://www.ibm.com/docs/en/rational-soft-arch/9.7.0?topic=diagrams-use-case" rel="noopener noreferrer"&gt;https://www.ibm.com/docs/en/rational-soft-arch/9.7.0?topic=diagrams-use-case&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ProcessMaker. (2024, August 20). &lt;em&gt;What is a happy path?&lt;/em&gt; ProcessMaker. &lt;a href="https://www.processmaker.com/blog/what-is-a-happy-path/" rel="noopener noreferrer"&gt;https://www.processmaker.com/blog/what-is-a-happy-path/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ricciardi, A. S. (2025, January 2). U_ML Diagrams: A Guide for Software Engineers_. Level up Coding — Medium. &lt;a href="https://medium.com/gitconnected/uml-diagrams-a-guide-for-software-engineers-71220ffb775f" rel="noopener noreferrer"&gt;https://medium.com/gitconnected/uml-diagrams-a-guide-for-software-engineers-71220ffb775f&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018 a). Chapter 5 — Use case models-4: Actors and use cases. &lt;em&gt;Software engineering with UML&lt;/em&gt;. CRC Press. ISBN 9781138297432&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018 b). Chapter 6 — Use case models-2: Use case diagrams and requirements modeling. &lt;em&gt;Software engineering with UML&lt;/em&gt;. CRC Press. ISBN 9781138297432&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/a-uml-use-case-analysis-of-an-online-shopping-system-actors-use-cases-and-relationships-453380317ac8" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium - &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on January 12, 2025&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>uml</category>
      <category>programming</category>
    </item>
    <item>
      <title>IP Address Allocation in a Small Class C Network</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Tue, 15 Apr 2025 23:52:11 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/ip-address-allocation-in-a-small-class-c-network-3nha</link>
      <guid>https://dev.to/alex_ricciardi/ip-address-allocation-in-a-small-class-c-network-3nha</guid>
      <description>&lt;p&gt;This article provides a step-by-step guide to allocating IPv4 addresses within a small business network using a Class C subnet. It covers key concepts like subnet masks, networks, and broadcast addresses. It also provides an example of an IP addressing scheme for devices like servers, printers, and VoIP phones.&lt;/p&gt;




&lt;p&gt;Regardless of the size of a network, proper IP address allocation is crucial for the efficiency and security of a network. This article examines a scenario where a network administrator needs to assign IPv4 addresses within a small Class C network (192.168.1.0/24 with a subnet mask of 255.255.255.0, providing 254 usable addresses). The network comprises 100 nodes, including four servers (a domain controller, a replica, a data server, and a web server), a network printer, and a VoIP phone system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overview of the network&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is important before assigning IP addresses to devices to understand the purpose of each device and a plan for IP address allocation. This section analyses the provided Class C network scheme.&lt;/p&gt;

&lt;p&gt;Subnet Mask: 255.255.255.0 (or /24) — This is the classful subnet mask for a Class C network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;IP Address class&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flvjcankyrkmwq6g7nrvw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flvjcankyrkmwq6g7nrvw.png" alt="IP Address class Table" width="800" height="356"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Lesson 5: IPv4 and IPv6 addresses. CompTIA Network+ Pearson N10–007 (Course &amp;amp; Labs) ” by uCertify (2019).&lt;/p&gt;

&lt;p&gt;Network Address: 192.168.1.0 — This is a private C class network see the table below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Private IP Networks&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyi0lkac169nedx2ep39d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyi0lkac169nedx2ep39d.png" alt="Private IP Networks Table" width="800" height="320"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Lesson 5: IPv4 and IPv6 addresses. CompTIA Network+ Pearson N10–007 (Course &amp;amp; Labs) ” by uCertify (2019).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host IP Addresses&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total Possible IP Addresses:&lt;/strong&gt;&lt;br&gt;
The /24 subnet mask represents the first 24 bits of the IP address that are used to identify the network, the last 8 bits (32 total bits — 24 network bits = 8 host bits) are used to identify the host IP addresses.&lt;br&gt;
With 8 bits, you can have 28 (2 to the power of 8) or 256 IP address combinations.&lt;br&gt;
Therefore, there are 256 possible IP addresses within the 192.168.1.0/24 network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reserved Addresses (Network and Broadcast):&lt;/strong&gt;&lt;br&gt;
Network Address: the first possible address is reserved for the network address. It has all the bits set to 0. For this example, it is 192.168.1.0.&lt;br&gt;
Broadcast Address: The last possible address is reserved for the directed broadcast address. This address has all bits set to 1. For this example, it is 192.168.1.255.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host Usable IP Addresses:&lt;/strong&gt;&lt;br&gt;
Since the network address and the broadcast address are reserved, they cannot be assigned to hosts.&lt;br&gt;
Therefore, the number of usable host IP addresses is 256–2 = 254.&lt;br&gt;
To calculate the total possible host IP addresses the following formula is used:&lt;br&gt;
2ʰ-2&lt;br&gt;
where h is the number of host bits in a subnet mask, for example, is:&lt;br&gt;
2⁸–2 = 256–2 = 254&lt;br&gt;
See the table below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Usable Host IP Addresses&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvl42i6nr3fuypm08jaly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvl42i6nr3fuypm08jaly.png" alt="Usable Host IP Addresses Table" width="536" height="280"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Lesson 5: IPv4 and IPv6 addresses. CompTIA Network+ Pearson N10–007 (Course &amp;amp; Labs) ” by uCertify (2019).&lt;/p&gt;

&lt;p&gt;Number of Devices 100 nodes (4 servers, 1 printer, 1 VoIP system — assuming multiple phones, and the rest are workstations).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In summary&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network: 192.168.1.0/24&lt;/li&gt;
&lt;li&gt;Total IP Addresses: 256&lt;/li&gt;
&lt;li&gt;Network Address: 192.168.1.0&lt;/li&gt;
&lt;li&gt;Broadcast Address: 192.168.1.255&lt;/li&gt;
&lt;li&gt;Usable IP Addresses: 254 (from 192.168.1.1 to 192.168.1.254)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Specific Device IP Address Requirements&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This section examines possible solutions to specific devices’ IP Address requirements and proposed IP addressing schemes, by considering the device types and their roles within the network. The network needs to support servers, printers, a VoIP system, workstations, and mobile devices.&lt;/p&gt;

&lt;p&gt;Servers typically require static IP addresses; this allows consistent access, enhances security, and simplifies management. It is especially important for the domain controller, which needs a fixed address for clients to connect reliably.&lt;/p&gt;

&lt;p&gt;Printers can use dynamic IP addresses, however assigning a static IP address to the printer that has mobile printing capability ensures that mobile devices can consistently locate and connect to it.&lt;/p&gt;

&lt;p&gt;VoIP Phone Systems require a set range of IP addresses to function correctly, for security reasons; it is also important that the allocated range is large enough to accommodate the number of phones and potential scaling. Workstations, laptops, and mobile devices typically use dynamic IP addresses. This allows devices to automatically receive IP addresses from a DHCP server, providing flexibility to the user and reducing network administrative overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Devises IP address Scheme&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that the device IP address requirements have been defined, the device IP address scheme can be set by diving the network range into logical pools:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Network infrastructure devices&lt;/strong&gt; (e.g., Router, Firewall, Default Gateway)&lt;br&gt;
192.168.1.1–192.168.1.9 (9 devices)&lt;br&gt;
These addresses are reserved for network infrastructure devices such as the default gateway (for example, 192.168.1.1) or a firewall device.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Servers *&lt;/em&gt;(Domain Controller, Replica, Data Server, Web Server)&lt;br&gt;
192.168.1.10–192.168.1.14 (5 devices)&lt;br&gt;
Static IP addresses are assigned to the servers.&lt;br&gt;
Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Domain Controller: 192.168.1.10&lt;/li&gt;
&lt;li&gt;Replica DC: 192.168.1.11&lt;/li&gt;
&lt;li&gt;Data Server: 192.168.1.12&lt;/li&gt;
&lt;li&gt;Web Server: 192.168.1.13&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Network Printer(s)&lt;/strong&gt;&lt;br&gt;
192.168.1.15–192.168.1.17 (3 devices)&lt;br&gt;
Static IP addresses to the printer and future printers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VoIP phones&lt;/strong&gt;&lt;br&gt;
192.168.1.18–192.168.1.39 (22 devices)&lt;br&gt;
This pool is used for VoIP phones.&lt;br&gt;
DHCP Pool (Dynamic Addresses for Workstations, Laptops, Mobile Phones, etc.)&lt;br&gt;
192.168.1.40–192.168.1.200 (161 devices)&lt;br&gt;
It allows devices to receive addresses automatically, and the range can be adjusted in the DHCP server’s configuration. This covers the 100 hosts and adds 61 extra addresses for mobile devices and scaling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reserved for scaling&lt;/strong&gt;&lt;br&gt;
192.168.1.201–192.168.1.254 (54 devices)&lt;br&gt;
Keep a block of addresses for future needs and scaling.&lt;/p&gt;

&lt;p&gt;To summarize, this post explored the allocation of IP addresses within a small Class C network: 192.168.1.0/24 network. By understanding the scheme of the network, including its subnet mask, total and usable IP addresses, and the specific requirements of different devices, an IP addressing scheme was developed to accommodate the needs of the different types of devices and meet the requirements set by the given scenario.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;uCertify. (2019). Lesson 5: IPv4 and IPv6 addresses. CompTIA Network+ Pearson N10–007 (Course &amp;amp; Labs) [Computer software]. uCertify LLC. ISBN: 9781616910327&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://levelup.gitconnected.com/ip-address-allocation-in-a-small-class-c-network-bdb37bd1ba79" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium - &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on January 5, 2025&lt;/p&gt;

</description>
      <category>tcpip</category>
      <category>informationtechnology</category>
    </item>
    <item>
      <title>TCP/IP Open Port Scanning: Open Ports, Hidden Dangers</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Tue, 15 Apr 2025 23:39:14 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/tcpip-open-port-scanning-open-ports-hidden-dangers-5bej</link>
      <guid>https://dev.to/alex_ricciardi/tcpip-open-port-scanning-open-ports-hidden-dangers-5bej</guid>
      <description>&lt;p&gt;The article explores TCP/IP port scanning by considering its potential benefits and drawbacks. It emphasizes the importance of balancing proactive vulnerability identification with the potential impact on network performance and security systems.&lt;/p&gt;




&lt;p&gt;TCP/IP ports are used by devices and applications on a network to communicate. In other words, they act as a gateway for devices, programs, and networks to broadcast information and communicate (Kolaric, 2024). However, as communication gateways, their open nature makes them vulnerable to exploitation by malicious actors. One potential solution to mitigate this risk is to regularly scan open ports. This post examines the efficiency and feasibility of scanning open TCP/IP ports, that is whether it helps secure them or creates more problems than it solves.&lt;/p&gt;

&lt;p&gt;Before exploring port scanning, it is important to understand why TCP/IP ports are vulnerable in the first place. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unsecured (legacy) services, protocols, or ports such as 21 (FTP), 23 (Telnet), 110 (POP3), 143 (IMAP), and 161 (SNMPv1 and SNMPv2) are vulnerable because the protocols using these ports do not provide authentication, integrity, or confidentiality (cjs6891, n.d.).&lt;/li&gt;
&lt;li&gt;Attackers often target default ports, that is ports used by services with default configurations such as databases like SQL Server and MySQL (ports 1433, 1434, and 3306), as well as services such as SSH (port 22), and HTTP (port 80). These ports are targeted because they are well-known and widely used as default ports for databases, services, and some applications.&lt;/li&gt;
&lt;li&gt;Even secure protocols such as HTTPS (port 443) are vulnerable to attacks like cross-site scripting (XSS) and SQL injections, which exploit weaknesses that are part of web applications (Techa, 2024).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Attackers use various approaches to exploit open TCP/IP ports’ vulnerabilities. Methods such as credential brute-forcing (repeatedly trying to login with different login credentials), spoofing and credential sniffing (impersonating legitimate users to intercept and steal sensitive information), exploiting application vulnerabilities (listening on open ports to gain control of systems or steal data), and denial-of-service (DOS) (flooding open ports with traffic, overwhelming a system) (Murphy, 2023).&lt;/p&gt;

&lt;p&gt;With so many potential threats targeting open TCP/IP ports, a potential proactive solution to mitigate this risk is TCP/IP port scanning. TCP/IP port scanning is a technique, a software, that runs a port scan on a network or server to identify which ports are open and listening (receiving information) as well as revealing the location or presence of network security devices, like firewalls (Paloalto, n.d.). This technique is also called fingerprinting. Fingerprinting can help identify open ports and the services running on them, revealing potential suspicious activities. For example, multiple unauthorized access or login attempts and the presence of unknown services. Port scanning can be used to verify that security devices are in place, functioning correctly, and that only authorized ports are open. It can also map active hosts and those hosts to their IP addresses revealing unknown IP addresses and active hosts, as well as detecting unauthorized changes to the network configuration. Therefore, port scanning can be used as a proactive security tool for identifying and addressing security vulnerabilities within a network.&lt;/p&gt;

&lt;p&gt;However, if used too aggressively port scanning can interfere with another security system such as Intrusion Detection Systems (IDS) triggering unwanted security alerts. It can also impact network performance by consuming network bandwidth and resources. Thus, it is essential to balance the use of port scanning with the appropriate frequency and scope of the scans. It is also essential to use the appropriate tools and techniques that are best suited to the specific characteristics of the network. Below is a table describing some of those tools and techniques.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Tools and Techniques for Port Scanning&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxf0kxrki2r8gaqf4y3ig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxf0kxrki2r8gaqf4y3ig.png" alt="Tools and Techniques for Port Scanning" width="800" height="669"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: Data from NMAP (n.d) and Kost (2024).&lt;/p&gt;

&lt;p&gt;To summarize, TCP/IP port scanning is a proactive technique for assessing and improving network security. However, if used too aggressively port scanning can interfere with security systems and impact network performance. Therefore, it is essential to define the appropriate scope and frequency of scans and to select the right tools and techniques that are best suited to the specific characteristics of the network. When used properly port scanning can play a role in mitigating the risks associated with open TCP/IP ports and strengthening the overall security of a network.&lt;/p&gt;




&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;cjs6891 (n.d.). &lt;em&gt;Cisco CCNA Cyber Ops SECFND 210–250, Section 3: Understanding Common TCP/IP Attacks&lt;/em&gt;. E17_blog. GitHub. &lt;a href="https://cjs6891.github.io/el7_blog/texts/cisco-ccna-cyber-ops-secfnd-3/#:%7E:text=Examples%20of%20insecure%20services%2C%20protocols,authenticity%2C%20integrity%2C%20and%20confidentiality" rel="noopener noreferrer"&gt;https://cjs6891.github.io/el7_blog/texts/cisco-ccna-cyber-ops-secfnd-3/#:~:text=Examples%20of%20insecure%20services%2C%20protocols,authenticity%2C%20integrity%2C%20and%20confidentiality&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Kolaric, D. (2024, June 5). &lt;em&gt;Identifying secure and unsecured ports and how to secure them.&lt;/em&gt; All About Security. &lt;a href="https://www.all-about-security.de/identifying-secure-and-unsecured-ports-and-how-to-secure-them/" rel="noopener noreferrer"&gt;https://www.all-about-security.de/identifying-secure-and-unsecured-ports-and-how-to-secure-them/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kost, E. (2024, November 18). Top 5 Free Open Port Check Tools in 2024. UpGuard. &lt;a href="https://www.upguard.com/blog/best-open-port-scanners" rel="noopener noreferrer"&gt;https://www.upguard.com/blog/best-open-port-scanners&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Murphy, D. (2023, December 11). &lt;em&gt;Open Port Vulnerabilities: How to Secure Open Ports&lt;/em&gt;. Lepide Blog. &lt;a href="https://www.lepide.com/blog/how-to-secure-open-ports-from-vulnerabilities/" rel="noopener noreferrer"&gt;https://www.lepide.com/blog/how-to-secure-open-ports-from-vulnerabilities/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NMAP Org. (n.d). &lt;em&gt;TCP SYN (Stealth) Scan (-sS) | Nmap Network Scanning&lt;/em&gt;. NMAP Org.&lt;a href="https://nmap.org/book/synscan.html#:%7E:text=TCP%20SYN%20(Stealth)%20Scan%20(,it%20never%20completes%20TCP%20connections" rel="noopener noreferrer"&gt;https://nmap.org/book/synscan.html#:~:text=TCP%20SYN%20(Stealth)%20Scan%20(,it%20never%20completes%20TCP%20connections&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paloalto (n.d.). &lt;em&gt;What is a Port Scan? Palo Alto Networks&lt;/em&gt;. &lt;a href="https://www.paloaltonetworks.com/cyberpedia/what-is-a-port-scan#:%7E:text=Running%20a%20port%20scan%20on,revealing%20the%20presence%20of%20security&amp;amp;text=Port%20scanning%20plays%20a%20crucial,can%20signal%20potential%20security%20vulnerabilities" rel="noopener noreferrer"&gt;https://www.paloaltonetworks.com/cyberpedia/what-is-a-port-scan#:~:text=Running%20a%20port%20scan%20on,revealing%20the%20presence%20of%20security&amp;amp;text=Port%20scanning%20plays%20a%20crucial,can%20signal%20potential%20security%20vulnerabilities&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Schrader, D. (2024, September 23). &lt;em&gt;Identifying common open port vulnerabilities in your network&lt;/em&gt;. Netwrix. &lt;a href="https://blog.netwrix.com/open-ports-vulnerability-list" rel="noopener noreferrer"&gt;https://blog.netwrix.com/open-ports-vulnerability-list&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Techa, M. (2024, November 11). &lt;em&gt;Understanding common ports used in networks for TCP and UDP usage&lt;/em&gt;. Netwrix. &lt;a href="https://blog.netwrix.com/common-ports" rel="noopener noreferrer"&gt;https://blog.netwrix.com/common-ports&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/tcp-ip-open-port-scanning-open-ports-hidden-dangers-f8324cae833e" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium - &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on January 5, 2025&lt;/p&gt;

</description>
      <category>tcpip</category>
      <category>informationtechnology</category>
    </item>
    <item>
      <title>UML Diagrams: A Guide for Software Engineers</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Tue, 15 Apr 2025 23:30:50 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/uml-diagrams-a-guide-for-software-engineers-21be</link>
      <guid>https://dev.to/alex_ricciardi/uml-diagrams-a-guide-for-software-engineers-21be</guid>
      <description>&lt;p&gt;This article provides an overview of Unified Modeling Language (UML) diagrams, their types, and their applications in software engineering. It covers their types, applications, and use in software engineering and explains how UML diagrams help software developers visualize, design, and document complex systems.&lt;/p&gt;




&lt;p&gt;In Software Engendering (SE), Unified Modeling Language (UML) diagrams are essential tools for communicating ideas and understanding systems. UML diagrams are integral to SE because they present a suite of modeling artifacts that are a globally accepted standard for SE (Unhelkar, 2018 a). In other words, they provide a standard visual language for representing the structure, behavior, and interactions within software systems (Tim, 2024). Furthermore, these diagrams are organized within distinct modeling spaces (MOPS, MOSS, and MOAS) that guide their application to specific aspects of the software development process (Unhelkar, 2018b). They help software developer teams to plan, design, and communicate with stakeholders. UML version 2.5 defines 14 types of diagrams, use case, activity, package, class, profile, sequence, communication, interaction overview, object, state machine, composite structure, component, deployment, and timing diagrams. The table below provides a brief description of each diagram.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;UML Diagrams&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjapy4bridvarzabeoqlv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjapy4bridvarzabeoqlv.png" alt="UML Diagrams" width="800" height="914"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: Data from “Chapter 2 — Review of 14 Unified Modeling Language Diagrams” by Unhelkar (2018 a). Modify.&lt;/p&gt;

&lt;p&gt;As shown in Table 1, there are two main categories of UML diagrams, structural and behavioral.A structural diagram illustrates the way a system is organized/structured whereas a behavioral diagram illustrates the flow of activity, actions, or interactions (behaviors) within the system (Unhelkar, 2018 a).A diagram can represent either a static or dynamic view of a system. Static diagrams illustrate the structure of a system at a specific point in time, whereas dynamic diagrams capture the system’s changes over a period of time or during execution, emphasizing its time-dependent aspects.&lt;/p&gt;

&lt;p&gt;The diagram below categorizes the diagrams into structural and behavioral groups and adds the interaction subgroup to the behavioral category. An interaction diagram shows interactions between the components of a system, and it can also depict how a system as a whole interacts with external entities (Dwivedi, 2019).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;UML Diagrams Diagram&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fplnod2k7ima35j0lboxc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fplnod2k7ima35j0lboxc.png" alt="UML Diagrams Diagram" width="800" height="363"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Unified Modeling Language (UML) Diagrams” by GeeksforGeeks (2024).&lt;/p&gt;

&lt;p&gt;Each UML diagram plays a role in modeling different areas of a software system. These areas can be divided into three categories called modeling spaces with each diagram responsible for modeling within those spaces (Unhelkar, 2018 b). The three modeling spaces are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Model of Process Space (MOPS) or Problem Space: It models “what” the business problem or user is. MOPS’ goal is to understand and model the business requirements.&lt;/li&gt;
&lt;li&gt;Model of Solution Space (MOSS): It models “how” the solution of the problem will be implemented. MOSS’ goal is to represent the system’s structure, behavior, and interactions using diagrams like class diagrams, sequence diagrams, and object diagrams.&lt;/li&gt;
&lt;li&gt;Model of Architectural Space (MOAS): It models the “big picture” and the overall technical environment. MOAS’ goals are to define architectural constraints, manage the project, and ensure quality.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These spaces are crucial for organizing and structuring the software development process, without them the use of UML can degenerate into incorrect or excessive modeling (Unhelkar, 2018 b).The figure below illustrates how the three models relate to each other, to the different actors, and to the software development process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Modeling Spaces&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma498uxer96pnujpj24a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma498uxer96pnujpj24a.png" alt="Modeling Space" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each UML diagram has varying levels of importance within the different modeling spaces. The table below maps each diagram to each modeling space, assigning up to 5 ‘&lt;em&gt;’ to show the diagram’s level of importance within a mapped space, with 5 ‘&lt;/em&gt;’ being the highest level of importance (Utmost Importance).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Importance of each UML Diagram to Respective Modeling Space (with 5 * for Utmost Importance to That Particular Space)&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjyvhxmn3vj996g6a82ef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjyvhxmn3vj996g6a82ef.png" alt="Importance of each UML Diagram to Respective Modeling Space (with 5 * for Utmost Importance to That Particular Space)" width="800" height="650"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Software Projects and Modeling Spaces: Package Diagrams. Software Engineering with UML,” Table 3.2, by Unhelkar (2018 b).&lt;/p&gt;

&lt;p&gt;For example, in the Model of Solution Space (MOSS), the three most important diagrams are the class, sequence, and composite structure diagrams. Where each diagram plays a different role in modeling the solution:&lt;/p&gt;

&lt;p&gt;Class diagrams illustrate detailed designs and programming constructs. They can also model relational database tables. Class diagrams define the system’s structure, showing the classes, their attributes, methods, and the relationships between them.&lt;br&gt;
Sequence diagrams illustrate detailed models of interactions within the system. They depict the dynamic exchange of messages between objects over time.&lt;br&gt;
Composite structure diagrams illustrate the internal structure of a classifier (like a class or component), that is the functionality of a group of objects and components, including their interfaces and realizations. It is only a UML diagram used to model the physical components of a system or business.&lt;br&gt;
(Unhelkar, 2018 b)&lt;/p&gt;

&lt;p&gt;For example, let’s explore the composite structure diagrams of a simple item class. See the figure below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Item Class Composite Structure Diagram&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyslefc7d7vvk5a7c2zrw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyslefc7d7vvk5a7c2zrw.png" alt="Item Class Composite Structure Diagram" width="800" height="385"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: Te item class provides an interface for the website component of the project, allowing the website to access and display item information such as name, price, and availability. The figure below provides a basic illustration of the components that can be found in a UML composite structure diagram.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Basic Composite Structure Diagram Components&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbwa1qthsvo6kkkvnevy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbwa1qthsvo6kkkvnevy.png" alt="Basic Composite Structure Diagram Components" width="800" height="527"&gt;&lt;/a&gt;&lt;br&gt;
Note: From “Composite Structure Diagram” by Udacity (2015)&lt;/p&gt;

&lt;p&gt;To summarize, UML diagrams are essential for communicating ideas and understanding systems. The 14 UML diagram types are categorized as either structural or behavioral and can represent either a static or dynamic view of a system. Additionally, these diagrams within modeling spaces — MOPS, MOSS, and MOAS — have varying levels of importance. Thus, selecting the most relevant diagrams for each stage of the software development lifecycle is essential. As shown in the example of the Item Class Composite Structure Diagram is an application of UML within the appropriate modeling space (MOSS in this case). Ultimately, the strategic use of UML diagrams throughout the software development lifecycle is essential to avoid incorrect or excessive modeling, as they guide, and empower software engineers to create representations of problems, solutions, structures, interactions, and relationships within complex systems.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dwivedi, N. (2019, September 9). &lt;em&gt;Type of UML models. Software Design: Modeling with UML&lt;/em&gt; [Video]. LinkedIn Learning. &lt;a href="https://www.linkedin.com/learning/software-design-modeling-with-uml/types-of-uml-models?u=2245842" rel="noopener noreferrer"&gt;https://www.linkedin.com/learning/software-design-modeling-with-uml/types-of-uml-models?u=2245842&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GeeksforGeeks (2024, October 23). &lt;em&gt;Unified Modeling Language (UML) diagrams.&lt;/em&gt; GeeksforGeeks. &lt;a href="https://www.geeksforgeeks.org/unified-modeling-language-uml-introduction/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/unified-modeling-language-uml-introduction/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tim. (2024, November 5). &lt;em&gt;Top 7 most common UML diagram types for software architecture&lt;/em&gt;. Icepanel. &lt;a href="https://icepanel.io/blog/2024-11-05-top-7-most-common-UML-diagram-types" rel="noopener noreferrer"&gt;https://icepanel.io/blog/2024-11-05-top-7-most-common-UML-diagram-types&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Udacity (2015, February 23). &lt;em&gt;Composite structure diagram&lt;/em&gt; [Video]. YouTube. &lt;a href="https://www.youtube.com/watch?v=pJyuKhD86Ro" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=pJyuKhD86Ro&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018 a). Chapter 2 — Review of 14 Unified Modeling Language diagrams. &lt;em&gt;Software engineering with UML&lt;/em&gt;. CRC Press. ISBN 9781138297432&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018 b). Chapter 3 — Software projects and modeling spaces: Package diagrams. &lt;em&gt;Software engineering with UML&lt;/em&gt;. CRC Press. ISBN 9781138297432&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/uml-diagrams-a-guide-for-software-engineers-71220ffb775f" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on January 2, 2025&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>uml</category>
      <category>programming</category>
    </item>
    <item>
      <title>UML Use Case Diagrams: A Restaurant System Case Study</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Sun, 09 Feb 2025 03:48:51 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/uml-use-case-diagrams-a-restaurant-system-case-study-4f8n</link>
      <guid>https://dev.to/alex_ricciardi/uml-use-case-diagrams-a-restaurant-system-case-study-4f8n</guid>
      <description>&lt;p&gt;This article uses a restaurant customer service system to illustrate how business use-case diagrams can effectively model business processes, including interactions between actors and use cases. It demonstrates how Unified Modeling Language (UML) use-case diagrams capture software requirements and discusses their advantages and limitations in Software Development (SD).&lt;/p&gt;




&lt;p&gt;Business use-case diagrams are used to model and illustrate interactions between business actors and processes within businesses. Their primary purpose is to describe how a business is used by its customers and partners (Helm n.d.). In Software Development (SD), use case diagrams are used to capture a system’s requirements which is essential in the early stage of SD. This article explores the business use case of a generic restaurant, more specifically the restaurant customer service system by providing a Unified Modeling Language (UML) business use-case diagram and, based on the diagram, offers a critical analysis of the business actors and business interactions. Additionally, it provides a list of advantages and limitations of UML use-cases diagrams in SD.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Definition of Use-Case Diagrams&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A use-case diagram illustrates the behavior of systems helping to capture the working requirements of those systems (IBM, 2023). In other words, the diagram describes the high-level functionality and the main scope of systems. Use-case diagrams also identify the interactions between systems use cases and their actors. Actors and use cases can be defined as follows:&lt;/p&gt;

&lt;p&gt;Actors can be people, organizations, or external or internal systems that interact with the business. Use cases can be specific functionalities or services that the business provides to the actors and other use cases.&lt;/p&gt;

&lt;p&gt;Furthermore, use cases can be divided into base use cases, which represent the core functionalities of the systems (can be modified by other use cases), and additional use cases are supplemental functionalities that can modify other use cases. Additional use cases can also be defined as supplemental functionalities that can modify other use cases.&lt;/p&gt;

&lt;p&gt;In UML use-case diagrams, the interactions between use cases are defined as relationships that can be divided into four categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Association relationships are illustrations of direct interactions between actors and use cases or between use cases.&lt;/li&gt;
&lt;li&gt;Include relationships are illustrations of interactions where use cases include the functionalities of other use cases.&lt;/li&gt;
&lt;li&gt;Extend relationships are illustrations of interactions where use cases are extended by other use cases under certain conditions.&lt;/li&gt;
&lt;li&gt;Generalization relationships are illustrations of interactions where use cases are generalized versions of other use cases or actors are generalized versions of other actors. It is a parent-child relationship where the parent is the generalized version of a child.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Helm, n.d)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Restaurant Customer Service System Diagram&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqgvobip1yivjhn31jcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqgvobip1yivjhn31jcc.png" alt="Restaurant Customer Service System Diagram" width="800" height="881"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Critical Analysis of the Business Actors and Business Interactions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The restaurant customer service system is one of several systems that are part of a restaurant; other systems are, for example, inventory management, accounting, and kitchen. Thus the restaurant customer service system represents one functionality of a restaurant organization. It is a process that involves external actors such as dine-in customers and takeaway customers, and internal actors such as servers, bussers, hosts, service managers, and cooks. Use cases include placing an order, making a payment, and preparing food. Relationships within the system include associations, includes, and extends. Additionally, the use case customer service system model showcased in this essay is based on a model that can be built upon.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;&lt;br&gt;
Business use cases can be divided into base cases and additional cases; however, they can also be further categorized into three categories which are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Business processes the commercially important activities (Helm n.d.).&lt;/li&gt;
&lt;li&gt;Supporting activities that are not commercially important, but have to be performed.&lt;/li&gt;
&lt;li&gt;Management activities are a type of work that affects how the other business use cases are managed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The table below, Table 1, summarizes the use cases within the restaurant customer service system, categorizing them into business processes, supporting activities, and management activities&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Use Cases Table&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgx7oskg2mulkat3gwi7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgx7oskg2mulkat3gwi7.png" alt="Use Cases Table" width="800" height="765"&gt;&lt;/a&gt;&lt;br&gt;
As shown in the table above core business processes like customer service, fulfilling orders, and payment highlight the core functionalities of the business. Supporting activities such as order handling, credit card or cash payment processing, and handling special requests are important functions for the smooth operation of the restaurant and for customer satisfaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Actors&lt;/strong&gt;&lt;br&gt;
Business actors can represent individuals, organizations, and other businesses that interact with the business. Furthermore, actors who interact with the business but are not part of the business use case system are categorized as external actors, and actors who are an integral part of the use case system are categorized as internal actors. The table below, Table 2, summarizes the internal and external actors that interact with the restaurant customer service system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Actors Table&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fep7pmhfkeqbhdstuzuj0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fep7pmhfkeqbhdstuzuj0.png" alt="Actors Table" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the table above, the interactions between external actors, customers, and internal actors like servers, bussers, and cooks are essential for the successful operation of the restaurant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relationships&lt;/strong&gt;&lt;br&gt;
Several relationships between actors and use cases, as well as user cases with other use cases and actors with other actors, are involved in the overall functionality of the restaurant customer service system. The relationships have been defined earlier in this essay. However, the generalization relationship can be defined further. It is a relationship that can be described as parent-child inheritance relationship and it can be divided into two categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use case generalization a relationship is where the properties of a parent use case or generalized use case, usually a base use case, are inherited by a specialized child use case.&lt;/li&gt;
&lt;li&gt;Actor generalization is a relationship where the properties of a parent actor or generalized actor are inherited by a specialized child a actors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The table below, Table 3, summarizes the different relationships involved in the overall functionality of the restaurant customer service system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Relationships Table&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7nytcv3d3abc3clhd49l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7nytcv3d3abc3clhd49l.png" alt="Relationships Table" width="800" height="1075"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the table above, relationships between actors and use cases, as well as user cases with other use cases and actors with other actors, demonstrate how complex interactions within the restaurant customer service system are. Additionally, these relationships showcase how the different components contribute to the overall functionality of the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Cases Advantages and Limitations in Software Development&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The use case model, as illustrated in the restaurant customer service system example, is a powerful tool that can be used to model and visually represent interactions between business actors and processes within businesses or systems. In SD, more specifically at the early stage of development, UML use-case diagrams are used to capture system requirements (actors, use cases, and relationships) defining the “What” a system should do. However, they struggle to capture and illustrate “How” these requirements should be implemented. The “what” and the “How” distinctions illustrate the advantages and limitations of the use-case model in SD. The following sections list the main advantages and limitations of the model in SD.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;&lt;br&gt;
Actors and use case components of a UML use-case diagram provide a user-centric approach when modeling a system’s requirements. This helps ensure that the correct system is developed by capturing the requirements from a user perspective (Firesmith, n.d). In addition to providing a user-centric approach they also provide the following advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use cases and actors are easy to recognize and their descriptions are written in natural language making it easy to understand and providing an excellent way to communicate with customers and users (Firesmith, n.d.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following list is from “Chapter 5 — Use Case Models-1: Actors and Use Cases. Software engineering with UML” (Unhelkar, 2018 b, p. 92):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use cases help the business analyst to document requirements in a commonly accepted format in the problem space of the project.&lt;br&gt;
The actor, through the use cases, specifies the suite of interactions with the system.&lt;br&gt;
Use cases capture the functional aspects of the system. More specifically, they capture the business processes carried out in the system. They are usually developed by domain experts and business analysts, resulting in the effective documentation of functionalities.&lt;br&gt;
Since use cases document the complete functionality of a system, no separate functional requirements document is needed (although additional operational and interface requirements or additional details such as the referenced material may be available or placed in a separate document).&lt;br&gt;
Use cases facilitate tracing of requirements. By providing well-organized documentation on the requirements, a use case provides a trace for a particular requirement throughout the system. This is especially helpful in creating and executing acceptance tests by users.&lt;br&gt;
Use cases can help in the creation of prototypes. Developers can select a use case and produce a proof-of-concept prototype of the system that will validate system requirements.&lt;br&gt;
Documentation of a use case provides a means for creating activity diagrams. The documentation of the flow within the use case can also be influenced and improved by the activity diagram(s) drawn for a use case.&lt;br&gt;
Specifications and documentation of use cases also provide a rich source of information for the identification of business entities. These business entities can be put together in a suite of class diagrams — providing vital information in the model of the problem space.&lt;br&gt;
Use cases can also provide a starting point for sequence diagrams — based on the scenarios (or instances of behavior) documented within a use case.&lt;br&gt;
Use cases are the basis for test case development.&lt;br&gt;
Use cases aid in requirement mapping: matching a requirement to a software feature to the approved test case&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Limitations&lt;/strong&gt;&lt;br&gt;
However, UML use cases also have some limitations. By primarily focusing on a system’s requirements, they may not capture non-functional requirements. In other words, while they capture well what the system should do, they do not demonstrate well how the system should do it. Non-functional requirements, such as performance, security, and usability are often not documented in use cases.&lt;br&gt;
In addition to not capturing non-functional requirements properly, UML use cases experience the following limitations.&lt;br&gt;
The following list is from “Chapter 5 — Use Case Models-1: Actors and Use Cases. Software engineering with UML” (Unhelkar, 2018 b, p. 92):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use case documentation is not standardized. This leads to confusion and debates on what makes up a good use case. Most projects proceed on the basis of a template (see previous discussion).&lt;br&gt;
Use cases are not object-oriented in nature. Therefore, they are not an ideal mechanism to model design-level constructs in the solution space (where object orientation plays an important role).&lt;br&gt;
Use cases do not have a granularity standard. Therefore, sometimes use cases are written as huge descriptive documents, resulting in the inability of modelers to capitalize on the reusable and organizational aspect of use case modeling. Alternatively, too brief a description will result in a large number of miniscule use cases — making them less comprehensible and manageable.&lt;br&gt;
Use cases do not provide a good basis for coding. Their documentation provides a foundation for subsequent modeling, but not for code generation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
Business use case diagrams are used to model and visually represent interactions between business actors and processes within businesses or systems. As shown by the critical analysis of the restaurant customer service system the use cases, actors, and their relationships give a deep insight into the processes, interactions, and dependencies within the restaurant customer service operations. Thus, business use case diagrams are a great tool for stakeholders to gain a deep understanding of the business or a system, identify potential issues, and make informed decisions about system design and development. Additionaly, UML use-case diagrams, with their actors, use cases, and relationships, provide a user-centric approach to capturing a system’s requirements which is essential in the early stage of Software Development. They excel at illustrating and capturing the “what” a system should do. However, they are not efficient at capturing and illustrating the “How” these requirements should be implemented. More specifically, they struggle to capture non-functional requirements, and they do not provide a good basis for coding generation.&lt;/p&gt;




&lt;p&gt;Firesmith D., G. (n.d.). &lt;em&gt;Use Cases: the pros and cons&lt;/em&gt;. Knowledge Systems Corporation. &lt;a href="https://www.cs.hmc.edu/%7Emike/courses/mike121/readings/reqsModeling/firesmith.htm" rel="noopener noreferrer"&gt;https://www.cs.hmc.edu/~mike/courses/mike121/readings/reqsModeling/firesmith.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Helm, J. (n.d.). Business use-case model. &lt;em&gt;Rational unified process&lt;/em&gt;. Fall 2023 SWEN 5135 Configuration Management course. University of Houston at Clear Lake. &lt;a href="https://sceweb.uhcl.edu/helm/RUP_Folder/RationalUnifiedProcess/process/modguide/md_bucm.htm" rel="noopener noreferrer"&gt;https://sceweb.uhcl.edu/helm/RUP_Folder/RationalUnifiedProcess/process/modguide/md_bucm.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;IBM documentation (2023, September 21). Use-case diagrams. &lt;em&gt;IBM Rational Software Architect documentation&lt;/em&gt;. IBM. &lt;a href="https://www.ibm.com/docs/en/rational-soft-arch/9.7.0?topic=diagrams-use-case" rel="noopener noreferrer"&gt;https://www.ibm.com/docs/en/rational-soft-arch/9.7.0?topic=diagrams-use-case&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018 a). Chapter 6 — Use case models-2: Use case diagrams and requirements modeling. &lt;em&gt;Software engineering with UML&lt;/em&gt;. CRC Press. ISBN 9781138297432&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018 b). Chapter 5 — Use case models-1: Actors and use cases. &lt;em&gt;Software engineering with UML&lt;/em&gt;. CRC Press. ISBN 9781138297432&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/uml-use-case-diagrams-a-restaurant-system-case-study-4f2d2a3f3541" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on November 22, 2024&lt;/p&gt;

</description>
      <category>uml</category>
      <category>softwaredevelopment</category>
      <category>softwareengineering</category>
      <category>softwaredesign</category>
    </item>
    <item>
      <title>OSI Model, TCP/IP Framework, and Network Topologies Explain</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Sun, 09 Feb 2025 03:34:07 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/osi-model-tcpip-framework-and-network-topologies-explain-1p5n</link>
      <guid>https://dev.to/alex_ricciardi/osi-model-tcpip-framework-and-network-topologies-explain-1p5n</guid>
      <description>&lt;p&gt;This article provides a detailed explanation of the OSI model and its seven layers. It also explores the TCP/IP model, compares it to the OSI framework, and examines network topologies, their characteristics, advantages, and applications.&lt;/p&gt;




&lt;p&gt;In networking, the Open Systems Interconnection (OSI) model is a standardized reference framework that describes how data flows in networks or how networked devices communicate with each other. In 1977 the International Organization for Standardization (ISO) developed OSI to standardize the interoperability of multivendor communications systems into one cohesive model (uCertify, 2019 a). The OSI Model is a reference model, it is not a reverence model (Wallace, 2020). In other words, the model does not need to be revered as a framework where every network component or device must neatly fit. However, it can be used as a tool to explain and understand where different network components or devices reside. This makes the model very useful for diagnosing and fixing network issues as it helps isolate problems within its different layers.&lt;/p&gt;

&lt;p&gt;The OSI model is composed of seven layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Layer 1: The physical layer&lt;/li&gt;
&lt;li&gt;Layer 2: The data link layer&lt;/li&gt;
&lt;li&gt;Layer 3: The network layer&lt;/li&gt;
&lt;li&gt;Layer 4: The transport layer&lt;/li&gt;
&lt;li&gt;Layer 5: The session layer&lt;/li&gt;
&lt;li&gt;Layer 6: The presentation layer&lt;/li&gt;
&lt;li&gt;Layer 7: The application layer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that the application layer is the last in the OSI queue, as it is the closest to the user. However, graphically the layers are usually represented as a stack, bottom-up, as illustrated in Figure 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;OSI Layers&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjv537mkxzsnx1qht2dmo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjv537mkxzsnx1qht2dmo.png" alt="OSI Layers" width="349" height="560"&gt;&lt;/a&gt;&lt;br&gt;
Note: From “The OSI reference model. CompTIA Network+ Pearson N10–007”, Figure 2.2, by uCertify. (2019 a).&lt;/p&gt;

&lt;p&gt;Each layer represents a different network functionality as shown in Figure 2.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;OSI vs. TCP/IP&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde5lg20ab8mtnhhf5c2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde5lg20ab8mtnhhf5c2z.png" alt="OSI vs. TCP/IP" width="800" height="700"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Objective 1.01 Explain, compare, and contrast the OSI layers” by vWannabe (n.d.).&lt;/p&gt;

&lt;p&gt;In Figure 2, the OSI stack is compared to the TCP/IP stack model, which is a reference model based on the TCP/IP protocol suite. The TCP/IP model is used to describe communications on the Internet and simplifies the OSI layers into four categories which are Network Interface (Network access layer), Internet (Internet layer), Transport (Host-to-Host layer), and Application (Process/Application layer) see Figure 3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;OSI and TCP/IP&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2w4yoq7yetmklxrfmt8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2w4yoq7yetmklxrfmt8.png" alt="OSI and TCP/IP" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “The OSI reference model. CompTIA Network+ Pearson N10–007”, Figure 2.15, by uCertify. (2019 a).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The TCP/IP layers map to the OSI layers as follows:&lt;/li&gt;
&lt;li&gt;Network Interface: Combines the physical and data link layers of the OSI model.&lt;/li&gt;
&lt;li&gt;Internet: Corresponds to the network layer of the OSI model.&lt;/li&gt;
&lt;li&gt;Transport: Maps directly to the transport layer of the OSI model.&lt;/li&gt;
&lt;li&gt;Application: Consolidates the session, presentation, and application layers of the OSI model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As shown above, for me, the OSI model is a great tool for understanding network systems and diagnosing issues. When connected to the TCP/IP model, it provides practical insights into troubleshooting and understanding Internet systems, which is where most of today’s networks operate.&lt;/p&gt;

&lt;p&gt;Another important concept to understand is network topology. Topology classifies the arrangement of devices and connections within a network, either physically (physical topology) or logically (logical topology). Below is an illustration of the most common topologies:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Network Topologies&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93p77qae243qubhsju6p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93p77qae243qubhsju6p.png" alt="Network Topologies" width="800" height="367"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Lesson 1: Computer Network Fundamentals. CompTIA Network+ Pearson N10–007,“ various Figures, by uCertify (2019 b). Modify.&lt;/p&gt;

&lt;p&gt;The table below describes the characteristics, advantages, and limitations of various topologies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Network Topologies&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi154ubvtnuule5ld113n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi154ubvtnuule5ld113n.png" alt="Network Topologies Table" width="800" height="785"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: Data from “Lesson 1: Computer Network Fundamentals. CompTIA Network+ Pearson N10–007“ by uCertify (2019 b).&lt;/p&gt;

&lt;p&gt;As shown in Table 1, each topology has its pros and cons depending on the needs, budget, and future goals of a business. One topology may be more suitable than another. Below, Table 2 is a comparison between Star and Generic Mesh Topologies, that showcases their advantages, disadvantages, and the types of business applications or use cases they are best-suited for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Comparison of Star and Generic Mesh Topologies&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv00wb5wbbh3ae2dke81x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv00wb5wbbh3ae2dke81x.png" alt="Comparison of Star and Generic Mesh Topologies" width="800" height="612"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: Data from “Lesson 1: Computer Network Fundamentals. CompTIA Network+ Pearson N10–007“ by uCertify (2019 b).&lt;/p&gt;

&lt;p&gt;As shown in Table 2 a star topology is better suited for Small-to-medium businesses due to its low cost as mesh topology is better suited for large enterprise networks, data centers, and IoT networks that require fault tolerance.&lt;/p&gt;

&lt;p&gt;To summarize, the OSI model is a foundational framework for understanding network communication and diagnosing connection issues. It is particularly helpful when used in conjunction with the TCP/IP model to troubleshoot and understand modern Internet systems. Additionally, network topology helps to define the structure of networks by setting the arrangement of devices and connections, both physically and logically, enabling businesses to select the most suitable configuration based on their specific needs and goals.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;uCertify. (2019 a). Lesson 2: The OSI reference model._ CompTIA Network+ Pearson N10–007 (Course &amp;amp; Labs) _[Computer software]. uCertify LLC. ISBN: 9781616910327&lt;/p&gt;

&lt;p&gt;uCertify. (2019 b). Lesson 1: Computer Network Fundamentals. &lt;em&gt;CompTIA Network+ Pearson N10–007 (Course &amp;amp; Labs)&lt;/em&gt; [Computer software]. uCertify LLC. ISBN: 9781616910327&lt;/p&gt;

&lt;p&gt;vWannabe (n.d.). &lt;em&gt;Objective 1.01 Explain, compare, and contrast the OSI layers.&lt;/em&gt; vWannabe.com. &lt;a href="https://vwannabe.com/2013/07/29/objective-1-01-explain-compare-and-contrast-the-osi-layers/" rel="noopener noreferrer"&gt;https://vwannabe.com/2013/07/29/objective-1-01-explain-compare-and-contrast-the-osi-layers/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wallace, K. (2020, December 11). &lt;em&gt;Networking foundations: Networking basics&lt;/em&gt; [Video]. LinkedIn Learning. Retrieved from: &lt;a href="https://www.linkedin.com/learning/networking-foundations-networking-basics/a-high-level-look-at-a-network?autoSkip=true&amp;amp;resume=false&amp;amp;u=2245842" rel="noopener noreferrer"&gt;https://www.linkedin.com/learning/networking-foundations-networking-basics/a-high-level-look-at-a-network?autoSkip=true&amp;amp;resume=false&amp;amp;u=2245842&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/osi-model-tcp-ip-framework-and-network-topologies-explain-3be12a6c3738" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on December 15, 2024&lt;/p&gt;

</description>
      <category>tcpip</category>
      <category>informationtechnology</category>
      <category>networking</category>
      <category>network</category>
    </item>
    <item>
      <title>The Relationship Between Software Modeling and Software Development</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Sun, 09 Feb 2025 03:21:20 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/the-relationship-between-software-modeling-and-software-development-4065</link>
      <guid>https://dev.to/alex_ricciardi/the-relationship-between-software-modeling-and-software-development-4065</guid>
      <description>&lt;p&gt;This article explores the relationship between Software Modeling (SM) and Software Development (SD) within Software Engineering. It examines how SM, through techniques like UML diagrams, supports and enhances the SD process by improving communication, reducing errors, and providing essential documentation.&lt;/p&gt;




&lt;p&gt;Software Engineering (SE) is the art of engineering high-quality software solutions. The Object Oriented (OO) approach, Software Development (SD) process, and Software Modeling (SM) are components of SE. This article explores these components, more specifically the relationship between SD and SM. How through this relationship software developer teams build systems that are efficient, robust, and provide high-quality software solutions to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software Engineering&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, let’s define Software Engineering. “The goal of SE is to produce robust, high-quality software solutions that provide value to users. Achieving this goal requires the precision of engineering combined with the subtlety of art” (Unhelkar, 2018, p.1). SE involves a wide range of functions, activities, and tasks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Project management, business analysis, financial management, regulatory and compliance management, risk management, and service management functions.&lt;/li&gt;
&lt;li&gt;Functions are SE teams’ responsibilities or disciplines that often span the entire software development lifecycle.&lt;/li&gt;
&lt;li&gt;Development processes, requirements modeling, usability design, operational performance, security, quality assurance, quality control, and release management activities.&lt;/li&gt;
&lt;li&gt;Activities are SE actions taken during certain stages of the software development, they are often performed repeatedly in functions or processes.&lt;/li&gt;
&lt;li&gt;Tasks are small SE’s actions taken during certain functions or processes. They are often individual steps necessary to perform a specific activity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Unhelkar, 2018)&lt;/p&gt;

&lt;p&gt;As shown above, SE is a complex process that can be decomposed into four components which are essential to learn and to adopt SE. These components are fundamentals or object-oriented, modeling (UML standard), process (SDLC, Agile), and experience (case studies and team-based project work).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;The Four Essential Components to Adopt Software Engineering&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9wx6ikaika6k8es387w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9wx6ikaika6k8es387w.png" alt="The Four Essential Components to Adopt Software Engineering" width="506" height="341"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Software Engineering Fundamentals with Object Orientation. Software Engineering with UML” by Unhelkar (2018, p.2).&lt;/p&gt;

&lt;p&gt;Below is a brief definition of each component:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object Oriented (OO)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Object Oriented is the concept of object orientation based on Object Oriented Programming (OOP) languages such as Java and Python. OO is composed of six fundamentals (encapsulation, inheritance, polymorphism, abstraction, composition, and association) that help in creating classes and programs that process and manipulate data and objects.&lt;/p&gt;

&lt;p&gt;These OO fundamentals are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classification (grouping)&lt;/li&gt;
&lt;li&gt;Abstraction (representing)&lt;/li&gt;
&lt;li&gt;Encapsulation (modularizing)&lt;/li&gt;
&lt;li&gt;Association (relating)&lt;/li&gt;
&lt;li&gt;Inheritance (generalizing)&lt;/li&gt;
&lt;li&gt;Polymorphism (executing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Unhelkar, 2018, p.5)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software Modeling (SM)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Software Modeling is a project modeling standard based on the Unified Modeling Language (UML) that is used the create diagrams to improve communication and participation from all project stakeholders. This also improves the quality of the software, reduces errors, and encourages easy acceptance of the solution by users. UML’s purpose in SE is modeling, developing, and maintaining software.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Purpose of Unified Modeling Language in Software Engineering&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7gob8spoqzu7yb2ksnsb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7gob8spoqzu7yb2ksnsb.png" alt="Purpose of Unified Modeling Language in Software Engineering" width="509" height="456"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Software Engineering Fundamentals with Object Orientation. Software Engineering with UML” by Unhelkar (2018, p.13).&lt;/p&gt;

&lt;p&gt;UML in modeling purpose modeling, developing, and maintaining software can be listed as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visualizing: The primary purpose of the UML is to visualize the software requirements, processes, solution design, and architecture.&lt;/li&gt;
&lt;li&gt;Specifying: UML is used to facilitate the specification of modeling artifacts. For example, a UML class diagram can specify/describe the attributes and methods of a class, along with their relationships.&lt;/li&gt;
&lt;li&gt;Constructing: UML is used for software construction because it can be easily translated into code (e.g., C++, Java).&lt;/li&gt;
&lt;li&gt;Documenting: UML diagrams can be used as detailed documentation for requirements, architecture, design, project plans, tests, and prototypes.&lt;/li&gt;
&lt;li&gt;Maintaining: UML diagrams are an ongoing aid for the maintenance of software systems. Additionally, they provide a visual representation of a project’s existing system, architecture, and IT design. This allows the developer to identify the correct places to implement changes and understand the effect of their changes on the software functionalities and behaviors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Unhelkar, 2018)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Process or Software Development (SD)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Process or Software Development is the process that defines activities and phases, as well as providing directions to the different teams of designers and developers throughout the Software Development Lifecycle (SDLC). Methodologies, such as Waterfall and Agile are used to guide and give structure to the development process. Additionally, they help the development teams to complete projects in an efficient manner, meet standards, and meet user requirements. The waterfall methodological approach is linear and plan-driven whereas the Agile methodological approach is more flexible and adaptive.&lt;/p&gt;

&lt;p&gt;These approaches are usually structured around 5 key components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requirements gathering and analysis&lt;/li&gt;
&lt;li&gt;Design and architecture&lt;/li&gt;
&lt;li&gt;Coding and implementation&lt;/li&gt;
&lt;li&gt;Testing and quality assurance&lt;/li&gt;
&lt;li&gt;Deployment and maintenance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Institute of Data, 2023, p.2)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experience&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Experience or case studies and team-based project work is the process of learning a project’s best approaches and solutions through experimenting with UML and object-oriented fundamentals. “Experience in creating UML models, especially in a team environment, is a must for learning the art of SE” (Unhelkar, 2018, p.2)&lt;/p&gt;

&lt;p&gt;How Software Modeling Supports Software Development&lt;/p&gt;

&lt;p&gt;As described above, SD and SM are components of SE playing different roles in SDLC. The difference between SD and SM resides in SD being the methodological process that guides the creation and development of software, and SM being the representation of the software’s architecture and functionality through diagrams based on UML. SM’s primary role is to support SD by providing a visual representation of the project, reducing errors and scope creep, as well as providing documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Project visualization: UML diagrams, especially case diagrams, allow stakeholders to visualize program functionality and behaviors at a high level (Fenn, 2017). This helps teams to focus on where they need more requirements, details, and analysis. It supports the SM phase of requirements gathering and analysis.&lt;/li&gt;
&lt;li&gt;Reducing errors and scope creep: Software modeling can provide a clear model of the project by serving as a reference for the project requirements, minimizing errors, misunderstandings, and scope creep, particularly during the early stages of the software development process (Fenn, 2017). Scope creep is expanding or adding to the project requirements or objectives beyond the original scope. It supports the SM phase of design and architecture.&lt;/li&gt;
&lt;li&gt;Providing documentation: UML diagrams can serve as living documentation for the project, describing the project functionality and behaviors as it is developed and after deployment. This documentation can help with decision-making for functionality/behavior implementation and maintenance of the software. It supports the SM phases of “coding and implementation” and “deployment and maintenance.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By applying the concept listed above SM helps the SD process to create efficient, robust, high-quality software solutions that provide value to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UML Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The following is a UML Class diagram of a simple banking manager Java program that utilizes the swing library, a graphical user interface (GUI) library. The program manages bank accounts and checking accounts with various functionalities such as creating accounts, attaching checking accounts, depositing and withdrawing funds, and viewing account balances.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In UML, class diagrams are one of six types of structural diagrams. Class diagrams are fundamental to the object modeling process and model the static structure of a system. Depending on the complexity of a system, you can use a single class diagram to model an entire system, or you can use several class diagrams to model the components of a system. Class diagrams are the blueprints of your system or subsystem. You can use class diagrams to model the objects that make up the system, to display the relationships between the objects, and to describe what those objects do and the services that they provide.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(IBM, 2021)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;UML Class Diagram Example&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2thmvuo5frx50gzsfkt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2thmvuo5frx50gzsfkt1.png" alt="UML Class Diagram Example" width="790" height="1732"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note&lt;/em&gt;: From “Module-4: Portfolio Milestone” By Ricciardi (2024, p.5)&lt;/p&gt;

&lt;p&gt;To summarize, SE is the art of engineering high-quality software solutions through OO, SD, and SM. SM helps the SD process by providing clear visual representations of system requirements and architecture, reducing errors, minimizing scope creep, improving communication among stakeholders, and serving as living documentation throughout the software development lifecycle.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fenn, B. (2017, October). &lt;em&gt;UML in agile development&lt;/em&gt;. Control Engineering, 64(10), 48. &lt;a href="https://csuglobal.idm.oclc.org/login?qurl=https%3A%2F%2Fwww.proquest.com%2Ftrade-journals%2Fuml-agile-development%2Fdocview%2F2130716718%2Fse-2%3Faccountid%3D38569" rel="noopener noreferrer"&gt;https://csuglobal.idm.oclc.org/login?qurl=https%3A%2F%2Fwww.proquest.com%2Ftrade-journals%2Fuml-agile-development%2Fdocview%2F2130716718%2Fse-2%3Faccountid%3D38569&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;IBM (2021, May 5) &lt;em&gt;Rational Software Modeler 7.5.5&lt;/em&gt;. IBM. &lt;a href="https://www.ibm.com/docs/en/rsm/7.5.0?topic=structure-class-diagrams" rel="noopener noreferrer"&gt;https://www.ibm.com/docs/en/rsm/7.5.0?topic=structure-class-diagrams&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Institute of Data (2023, September 5). &lt;em&gt;Understanding software process models: What they are and how they work.&lt;/em&gt; Institute of Data. &lt;a href="https://www.institutedata.com/us/blog/understand-software-process-models/" rel="noopener noreferrer"&gt;https://www.institutedata.com/us/blog/understand-software-process-models/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ricciardi, A. (2024, July 7). &lt;em&gt;Module-4: Portfolio Milestone.&lt;/em&gt; CSC372: Programming 2. Depart of Computer Science. Colorado State University Global. &lt;a href="https://github.com/Omegapy/My-Academics-Portfolio/blob/main/Programming-2-CSC372/Module-4%20Portfolio%20Milestone/Module-4%20Portfolio%20Milestone.pdf" rel="noopener noreferrer"&gt;https://github.com/Omegapy/My-Academics-Portfolio/blob/main/Programming-2-CSC372/Module-4%20Portfolio%20Milestone/Module-4%20Portfolio%20Milestone.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unhelkar, B. (2018). Software engineering fundamentals with object orientation. &lt;em&gt;Software engineering with UML.&lt;/em&gt; CRC Press. ISBN 9781138297432&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://levelup.gitconnected.com/the-relationship-between-software-modeling-and-software-development-e5b5d4f0b121" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on December 12, 2024&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>softwaredevelopment</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>The Role of Probability in Decision-Making: A Blackjack Case Study</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Sun, 09 Feb 2025 03:07:23 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/the-role-of-probability-in-decision-making-a-blackjack-case-study-2e5c</link>
      <guid>https://dev.to/alex_ricciardi/the-role-of-probability-in-decision-making-a-blackjack-case-study-2e5c</guid>
      <description>&lt;p&gt;Uncertainty, by definition, is a nebulous concept; it encapsulates the unknowns and ambiguities. Probability plays a crucial role in quantifying uncertainty, helping establish degrees of belief –percentages– in the likelihood of an outcome or outcomes in a given scenario or set of scenarios. This paper explores the concept of probability by applying it to a easy to understand example involving the game of Blackjack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Probability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Probability is the likelihood of something happening. It can also be defined as a mathematical method used to study randomness. In other words, probability is a mathematical method that deals with the chance of an event occurring (Illowsky et al., 2020). This section describes some of the fundamental concepts of probability. Starting with the concept of sample space, often donated Ω. It is the set of all possible outcomes from a scenario or a set of scenarios. An event denoted E or ω is a subset of the sample space, it consists of one outcome or multiple outcomes. In probability theory, the probability of a specific possible outcome donated P(E), from the sample space is a value between 0 and 1, inclusive (Russell &amp;amp;Norvig, 2021). With a ‘0’ probability meaning the outcome will never occur, a ‘1’ probability meaning the outcome will always occur, and a value between ‘0’ and ‘1’ meaning the likelihood of the outcome, the higher values the greater likelihood. This can be formulated as follows:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F63pgotbrpdt3q7v63b0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F63pgotbrpdt3q7v63b0r.png" alt="Equation of probabilities version-1" width="560" height="118"&gt;&lt;/a&gt;&lt;br&gt;
and&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5dneoeabdkbz0phgqv5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5dneoeabdkbz0phgqv5.png" alt="Equation of probabilities version-2" width="560" height="117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The probability method comes with a set of rules, proprieties, laws, and theorems that are fundamental principles used for computing the likelihood of events occurring. Below is a list of some of these rules, proprieties, principles, and theorems:&lt;/p&gt;

&lt;p&gt;A and B are events.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Addition rule&lt;/strong&gt;: Computes the probability of either one of two events from occurring (Data Science Discovery, n.d.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For mutually exclusive events (events that cannot occur simultaneously):&lt;br&gt;
P(A ∪ B) = P(A ∨ B) = P(A) + P(B)&lt;br&gt;
For non-mutually exclusive events:&lt;br&gt;
P(A ∪ B) = P(A ∨ B) = P(A) + P(B) — P(A ∧ B)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiplication rule: Computes “the joint probability of multiple events occurring together using known probabilities of those events individually” (Foster, n.d., p.1).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For independent events (the occurrence of one does not affect the other):&lt;br&gt;
P(A ∩ B) = P(A ∧ B) = P(A) ∙ P(B)&lt;br&gt;
For dependent events:(the occurrence of one does affect the other)&lt;br&gt;
P(A ∩ B) = P(A ∧ B) = P(A) ⋅ P(B|A)&lt;br&gt;
P(B|A): conditional probability (see below).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complement rule&lt;/strong&gt;: “The complement of an event is the probability that the event does not occur” (Elberly College of Science, n,d., Section 2.1.3.2.4).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;P(¬A) = 1 — P(A)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Conditional probability&lt;/strong&gt;: It is the probability of an event occurring given that another event has already occurred. The probability of A given B:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qpl7c5prhm5xlgn7ord.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qpl7c5prhm5xlgn7ord.png" alt="Conditional probability equation" width="245" height="78"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Bayes’ Theorem&lt;/strong&gt;: Computes the reverse of the conditional probability. It updates the probability of an outcome based on new evidence. It can also be defined as&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2qj0iv30muf5olsc43c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2qj0iv30muf5olsc43c.png" alt="The Bayes’ Theorem equation" width="304" height="72"&gt;&lt;/a&gt;&lt;br&gt;
Where:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;P(A) is the prior probability of an event A.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;P(B) is the probability of an event B.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;P(B|A) is the probability of an event B occurring given that A has occurred.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;P(A|B) is the probability of an event A occurring given that B has occurred.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Dziak, 2024)&lt;/p&gt;

&lt;p&gt;These rules, proprieties, principles, and theorems provide a range of tools to solve probabilistic problems in simple scenarios such as rolling dice and card games like Blackjack.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blackjack Scenario&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s explore a Blackjack scenario when the dealer is showing a 10. In Blackjack, specific rules dictate when to take a hit or stand, especially when the dealer is showing a 10, that is the house hand is showing a 10. Suppose a single deck is in play, and four cards are already dealt. If you have a 10 and a 7 visible, and the dealer shows a 10, let’s calculate the probability that the dealer’s hidden card is an 8, 9, or a face card, and why it makes sense to hit on a 16 but to stand on a 17.&lt;/p&gt;

&lt;p&gt;In this Blackjack scenario, the concepts of dependency and conditional probability play an essential role in calculating the probabilities. Two events are said to be dependent if the outcome of one event affects the probability of the other. In this scenario, the events are dependent because the cards are drawn without replacement being placed. This means that each card dealt to the player or the house hands changes the composition of the deck and thus affects the probabilities of future events.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyses of the Scenario&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that the probability methods have been established let’s analyze the problem in more detail. In blackjack, the goal of a player is to finish the game with a higher hand than that of the house, without exceeding 21, as going over 21 is known as ‘busting’ and it is an automatic loss (Master Traditional Games, n.d.). The face cards have a value of 10 and Ace can either be treated as 1 or 11 with the player choosing the value. The player and the house can either hit or stand, the player or players go first, and after all the players stand the house goes next. Note that all players are playing against the house, not each other, and if the house’s hand matches a player’s hand it results in a draw between the player and the house. A standard deck of cards has 52 cards. The player’s hand has a 10 and a 7, totaling 17. The house has a 10 as the dealer up-card, and a fourth card is on the table, the dealer hole-card. Therefore 3 card values are known and 52 – 3 = 49 cards are unknown. The scenario calls to calculate the probability of the house’s other card, the dealer hole-card, being an 8, 9, or face card, as any of those cards would give to house a better hand than the player. A standard deck has 4 8s, 4 9s, 4 Jacks, 4 Queens, and 4 Kings. Mathematically, this can be translated to:&lt;/p&gt;

&lt;p&gt;4(8s) + 4(9s) + 4(Jacks) + 4(Queens) + 4(Kings) = 20 house favorable cards.&lt;/p&gt;

&lt;p&gt;This means that from a set of 49 unknown cards 20 of those cards are favorable to the house. Thus, the probability that the house’s other card, the dealer hole-card, is one of the house’s favorable cards is:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2anyjk9bn0gfuu96sho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2anyjk9bn0gfuu96sho.png" alt="House Fav. Cards Equation V1" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This means that the probability of the house having a better hand than the player is 40.82% when considering only the 8, 9, or face cards as the possible cards on the table.&lt;/p&gt;

&lt;p&gt;On a side note, the Ace card was not considered in this scenario, and an Ace can be treated as a 1 or 11. If the dealer hole card is Ace then the house’s hand would be 10 + 11 = 21, Blackjack. A card deck has 4 Aces, additionally, the 2 remaining 10 cards were also not considered in this scenario, this changes the number of house favorable cards to&lt;br&gt;
20 + 4(Aces) + 2(10) = 26 and the probability to:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue0btd5qej0qs1sh73l3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue0btd5qej0qs1sh73l3.png" alt="House Fav. Cards Equation V2" width="560" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This considerably improves the probability of the house having a better hand than the player from 40.82% to 53.06%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why It Makes Sense to Hit on a 16 but Stand on a 17?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The scenario claims that it makes sense to hit on a 16 but to stand on a 17; if the house will stand on a 17 and above. Let’s explore the scenario where the player has a hand of 16. If the player decides to hit, they can improve their hand by drawing a 1 (Ace), 2, 3, 4, or 5, that is a total of 5 types of cards out of a set of 13 types of cards (Ace through King) are favorable to the player with a hand of 16. Note that this calculation is not based on the number of cards in a deck but on the number of types of cards found in a deck, 13, rather than the total number of cards left in the deck, as the specific card composition of the player’s hand of 16 is unknown. Therefore, the probability of the player hitting a favorable type of card is:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z5zpf0lrvgrj1w95q89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z5zpf0lrvgrj1w95q89.png" alt="Player-16 equation" width="800" height="64"&gt;&lt;/a&gt;&lt;br&gt;
Thus, if the house’s hand is a 17 and above, it makes sense for the player to hit as they have an approximately 38.46% chance to draw a favorable card. If the player does not hit, they will automatically lose since the house has a better hand.&lt;/p&gt;

&lt;p&gt;Now let’s explore the scenario where the player has a hand of 17. If the player decides to stand, they can improve their hand by drawing a 1 (Ace), 2, 3, or 4, a total of 4 types of cards out of set of 13 types of cards are favorable to the player with a hand of 17. Therefore, the probability of the player hitting a favorable card is:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6tc5cqim3tb3o61uudne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6tc5cqim3tb3o61uudne.png" alt="Player-17 equation" width="800" height="66"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Probability plays a crucial role in quantifying uncertainty; it helps establish the likelihood of an outcome or outcomes in a given scenario or set of scenarios. This paper explored the concept of probability, by applying its principles to a practical example, the game of Blackjack. This simple example shows how powerful the concept of probability can be; by demonstrating how probability can be used to evaluate risks, calculate potential outcomes, and make strategic choices. Probability as a tool for making decisions, can be apply not only in games but also in various real-world situations where uncertainty is a factor.&lt;/p&gt;




&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;Data Science Discovery (n.d.). Multi-event probability: Addition rule. University of Illinois at&lt;/p&gt;

&lt;p&gt;Urbana-Champaign (UIUC). &lt;a href="https://discovery.cs.illinois.edu/learn/Prediction-and-Probability/Multi-event-Probability-Addition-Rule/#Addition-Rule-Formula" rel="noopener noreferrer"&gt;https://discovery.cs.illinois.edu/learn/Prediction-and-Probability/Multi-event-Probability-Addition-Rule/#Addition-Rule-Formula&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dziak M. Bayes’ theorem. Salem Press Encyclopedia of Science. 2024. Accessed November 18, 2024. &lt;a href="https://search.ebscohost.com/login.aspx?direct=true&amp;amp;AuthType=ip,uid&amp;amp;db=ers&amp;amp;AN=89142582&amp;amp;site=eds-live" rel="noopener noreferrer"&gt;https://search.ebscohost.com/login.aspx?direct=true&amp;amp;AuthType=ip,uid&amp;amp;db=ers&amp;amp;AN=89142582&amp;amp;site=eds-live&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Elberly College of Science (n.d.). 2: Describing data, part 1. STAT 200: Elementary statistics. Department of Statistics, PennState Elberly College of Science. &lt;a href="https://online.stat.psu.edu/stat200/lesson/2/2.1/2.1.3/2.1.3.2/2.1.3.2.4" rel="noopener noreferrer"&gt;https://online.stat.psu.edu/stat200/lesson/2/2.1/2.1.3/2.1.3.2/2.1.3.2.4&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Foster, J. (n.d.). &lt;em&gt;Multiplication rule for calculating probabilities&lt;/em&gt;. Statistics By Jim. &lt;a href="https://statisticsbyjim.com/probability/multiplication-rule-calculating-probabilities/" rel="noopener noreferrer"&gt;https://statisticsbyjim.com/probability/multiplication-rule-calculating-probabilities/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Illowsky, B., Dean, S., Birmajer, D., Blount, B., Einsohn, M., Helmreich, J., Kenyon, L., Lee, S., &amp;amp; Taub J. (2020, March 27) 1.1 Definitions of statistics, probability, and key terms. &lt;em&gt;Statistics&lt;/em&gt;. OpenStax. &lt;a href="https://openstax.org/books/statistics/pages/preface" rel="noopener noreferrer"&gt;https://openstax.org/books/statistics/pages/preface&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Master Traditional Games (n.d.) &lt;em&gt;The rules of Blackjack, Master of the Games&lt;/em&gt;. &lt;a href="https://www.mastersofgames.com/rules/blackjack-rules.htm?srsltid=AfmBOoojETz5j0oD9X_OW-mIYhepbOfCZm3sH6Z4o2klRDmMLHYO6s5m" rel="noopener noreferrer"&gt;https://www.mastersofgames.com/rules/blackjack-rules.htm?srsltid=AfmBOoojETz5j0oD9X_OW-mIYhepbOfCZm3sH6Z4o2klRDmMLHYO6s5m&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Russell, S. &amp;amp; Norvig, P. (2021). 12.2 Basic probability notation. &lt;em&gt;Artificial intelligence: A modern approach&lt;/em&gt;. 4th edition. Pearson Education, Inc. ISBN: 9780134610993; eISBN: 9780134671932.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/the-role-of-probability-in-decision-making-a-blackjack-case-study-00f30e77d07c" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on November 29, 2024&lt;/p&gt;

</description>
      <category>probabilities</category>
      <category>ai</category>
      <category>decisionmaking</category>
    </item>
    <item>
      <title>Taxonomy and Frames in Programming Languages: A Hierarchical Approach to Knowledge Representation</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Mon, 27 Jan 2025 04:51:16 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/taxonomy-and-frames-in-programming-languages-a-hierarchical-approach-to-knowledge-representation-4p8n</link>
      <guid>https://dev.to/alex_ricciardi/taxonomy-and-frames-in-programming-languages-a-hierarchical-approach-to-knowledge-representation-4p8n</guid>
      <description>&lt;p&gt;This article examines the application of taxonomy and frames in programming languages, focusing on Python and Java. It demonstrates how hierarchical taxonomies and frame-based representations organize and define relationships, properties, and attributes, providing a comprehensive approach to knowledge representation in computer science.&lt;/p&gt;




&lt;p&gt;Taxonomy in computer science is the act of classifying and organizing concepts. For example, in software engineering, it is used to classify software testing techniques, model-based testing approaches, and static code analysis tools (Novak et al., 2010). In data management, it is used to organize metadata and categorize-manage data assets (Knight, 2021). In Artificial Intelligence it is used to guide models to recognize patterns in data sets.&lt;/p&gt;

&lt;p&gt;Taxonomy can also be defined as the act of organizing knowledge within a domain by using a controlled vocabulary to make it easier to find related information (Knight, 2021), and it must:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Follow a hierarchic format and provide names for each object in relation to other objects.&lt;/li&gt;
&lt;li&gt;May also capture the membership properties of each object in relation to other objects.&lt;/li&gt;
&lt;li&gt;Have specific rules used to classify or categorize any object in a domain. These rules must be complete, consistent, and unambiguous.&lt;/li&gt;
&lt;li&gt;Apply rigor in specification, ensuring any newly discovered object must fit into one and only one category or object.
-Inherit all the properties of the class above it but can also have additional properties.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Knight, 2021, p.1).&lt;/p&gt;

&lt;p&gt;In this paper, taxonomic knowledge and frames are implemented in the domain of Programming Languages, focusing on Python. “A frame is a data structure that can represent the knowledge in a semantic net” (Colorado State University Global, n.d., p.2). To implement the taxonomic knowledge the paper follows three steps using first-order logic. The steps are Subset Information, Set Membership of Entities, and Properties of Sets and Entities. Then, the paper uses a tree-like structure to show how subcategories relate to parent categories. Additionally, it demonstrates how the hierarchical taxonomic structure interacts with frames, by illustrating how attributes and properties are defined in the Python frame and they align with the broader taxonomic categories. Finally, it explains how the combination of taxonomic relationships and frames provides a comprehensive representation of knowledge.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Three Steps to Implement Taxonomic Knowledge
&lt;/h3&gt;

&lt;p&gt;Note that the programming languages Java and Python are used as examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;— Step 1: Subset Information&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this step to represent the subcategory, first-order logic is used.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1. Subcategory Relationships:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Compiled Languages and Interpreted Languages:&lt;br&gt;
&lt;code&gt;∀x High_Level_Compiled_Language(x) ⇒ Compiled_Language(x)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;∀x Scripting_Language(x) ⇒ Interpreted_Language(x)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Programming Languages:&lt;br&gt;
&lt;code&gt;∀x Compiled_Language(x) ⇒ Programming_Language(x)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;∀x Interpreted_Language(x) ⇒ Programming_Language(x)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Specific Languages:&lt;br&gt;
&lt;code&gt;∀x Java(x) ⇒ High_Level_Compiled_Language(x)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;∀x Python(x) ⇒ Scripting_Language(x)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Additional Subcategories:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Functional Languages and Logic Programming Languages:&lt;br&gt;
&lt;code&gt;∀x Functional_Language(x) ⇒ Programming_Language(x)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;∀x Logic_Programming_Language(x) ⇒ Programming_Language(x)&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;— &lt;strong&gt;Step 2: Set Membership of Entities&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this step, the category membership of specific languages is represented.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Instances of Programming Languages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java SE 23:&lt;/li&gt;
&lt;li&gt;Java(JavaSE23)&lt;/li&gt;
&lt;li&gt;Python 3.13:&lt;/li&gt;
&lt;li&gt;Python(Python3_13)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other Programming Languages (more examples):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;C(C23)&lt;/li&gt;
&lt;li&gt;Haskell(Haskell2010)&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;— Step 3: Properties of Sets and Entities&lt;/strong&gt;&lt;br&gt;
In this step, the properties of the categories and language program are represented.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1. Properties of Programming Languages:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All Programming Languages have Syntax and are used for Software Development:&lt;br&gt;
&lt;code&gt;∀x Programming_Language(x) ⇒ Has_Syntax(x)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;∀x Programming_Language(x) ⇒ Used_For(x,”Software_Development”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Properties of Compiled and Interpreted Languages:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Compiled Languages have Execution Model ‘Compiled’:&lt;br&gt;
&lt;code&gt;∀x Compiled_Language(x) ⇒ Execution_Model(x,”Compiled”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Interpreted Languages have Execution Model ‘Interpreted’:&lt;br&gt;
&lt;code&gt;∀x Interpreted_Language(x) ⇒ Execution_Model(x,”Interpreted”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Properties of Specific Languages:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Java has Static Typing Discipline:&lt;br&gt;
&lt;code&gt;∀x Java(x) ⇒ Typing_Discipline(x,”Static”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Python has Dynamic Typing Discipline:&lt;br&gt;
&lt;code&gt;∀x Python(x) ⇒ Typing_Discipline(x,”Dynamic”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Java Supports Paradigm ‘Object-Oriented’:&lt;br&gt;
&lt;code&gt;∀x Java(x) ⇒ Supports_Paradigm(x,”Object-Oriented”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Python Supports Multiple Paradigms:&lt;br&gt;
&lt;code&gt;∀x Python(x) ⇒ Supports_Paradigm(x,”Multi-Paradigm”)&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3.Properties of Entities:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Java SE 23’s Latest Version is 23:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Latest_Version(JavaSE23,”23")&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python 3.13’s Latest Version is 3.13:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Latest_Version(Python3_13,”3.13")&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Hierarchical Taxonomy of Programming Languages
&lt;/h3&gt;

&lt;p&gt;Below is a (text shorter version) tree-like hierarchical structure representing the relationships between different languages in the domain of programming languages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;— Programming Languages:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compiled Language&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;High-Level Compiled Language&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
C&lt;br&gt;
C++&lt;br&gt;
Java&lt;br&gt;
Rust&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Low-Level Compiled Language&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Assembly Language&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Interpreted Language:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Scripting Language&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Python&lt;br&gt;
Ruby&lt;br&gt;
Perl&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Shell Scripting Language&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Bash&lt;br&gt;
PowerShell&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Functional Language&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Pure Functional Language&lt;br&gt;
Haskell&lt;br&gt;
Multi-Paradigm Functional Language&lt;br&gt;
Scala&lt;br&gt;
F#&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Logic Programming Language&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Prolog&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note that some languages, like Python and Java, can be considered both interpreted and compiled languages; however, for the scope of this exercise, they are categorized as interpreted and compiled languages, respectively.&lt;/p&gt;
&lt;h3&gt;
  
  
  Hierarchical Taxonomy Visualization
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Hierarchical Taxonomy of Programming Languages&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqyg7eup77b068a6gmyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqyg7eup77b068a6gmyl.png" alt="Hierarchical Taxonomy of Programming Languages" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Python Frame&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;Python&lt;/span&gt;
    &lt;span class="n"&gt;Instance_Of&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Scripting_Language&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Inherited properties and attributes&lt;/span&gt;
    &lt;span class="n"&gt;Used_For&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Software_Development&lt;/span&gt;
    &lt;span class="n"&gt;Execution_Model&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Interpreted&lt;/span&gt;
    &lt;span class="n"&gt;Syntax&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Easy_To_Use&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Properties and attributes specific to Python&lt;/span&gt;
    &lt;span class="n"&gt;Creator&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Guido&lt;/span&gt; &lt;span class="n"&gt;van&lt;/span&gt; &lt;span class="n"&gt;Rossum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;First_Released&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1991&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Typing_Discipline&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Dynamic&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Strong&lt;/span&gt; &lt;span class="n"&gt;Typing&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Paradigms&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Oriented&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Imperative&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Functional&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Procedural&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Reflective&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;License&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Python&lt;/span&gt; &lt;span class="n"&gt;Software&lt;/span&gt; &lt;span class="n"&gt;Foundation&lt;/span&gt; &lt;span class="n"&gt;License&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Latest_Version&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.13&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Official_Website&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; This is a frame representation of Python’s properties and attributes. An example of an attribute is &lt;code&gt;‘Instance_Of’&lt;/code&gt; and of a property is &lt;code&gt;‘Scripting_Language’&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For comparison, below is a representation of the Java frame.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Java Frame&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;Java&lt;/span&gt;
    &lt;span class="n"&gt;Instance_Of&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;High_Level_Compiled_Language&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Inherited properties and attributes&lt;/span&gt;
    &lt;span class="n"&gt;Used_For&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Software_Development&lt;/span&gt;
    &lt;span class="n"&gt;Debugging&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Friendly&lt;/span&gt;
    &lt;span class="n"&gt;Execution_Model&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Compiled&lt;/span&gt;

    &lt;span class="c1"&gt;// Properties and attributes specific to Java&lt;/span&gt;
    &lt;span class="n"&gt;Creator&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;James&lt;/span&gt; &lt;span class="n"&gt;Gosling&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;First_Released&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1995&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Typing_Discipline&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Static&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Strong&lt;/span&gt; &lt;span class="n"&gt;Typing&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Paradigms&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Oriented&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Class&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;based&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Concurrent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;License&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;GNU&lt;/span&gt; &lt;span class="n"&gt;General&lt;/span&gt; &lt;span class="n"&gt;Public&lt;/span&gt; &lt;span class="n"&gt;License&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="n"&gt;Classpath&lt;/span&gt; &lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Latest_Version&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Official_Website&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;oracle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; This is a frame representation of Java’s properties and attributes.&lt;/p&gt;

&lt;p&gt;A hierarchical taxonomy organizes entities into a tree-like structure. In the Programming Language hierarchical taxonomy, the root class (category representing the domain) or the first node of the tree-like structure is &lt;code&gt;‘Programming Language’&lt;/code&gt;, with all other nodes as subclasses (subcategories) that inherit directly or indirectly from the &lt;code&gt;‘Programming Language’&lt;/code&gt; root class. These relationships can be described as &lt;code&gt;“is an instance of.”&lt;/code&gt; For example, all subclasses show the relation &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Programming Language’&lt;/code&gt; such as &lt;code&gt;‘High-level Compile Language’&lt;/code&gt; &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Compile Language’&lt;/code&gt; &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Programming Language,’&lt;/code&gt; therefore &lt;code&gt;‘High-level Compile Language’&lt;/code&gt; also shows the relationship &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Programming Language’&lt;/code&gt;. This relationship is defined by the concept of inheritance where a subclass inherits the properties and attributes of its parent class and grandparent classes. Note that a subclass can have more than one parent class.&lt;/p&gt;

&lt;p&gt;For example, the parent class &lt;code&gt;‘Compiled_Language’&lt;/code&gt; has a property &lt;code&gt;‘Execution_Model’&lt;/code&gt; with the attribute &lt;code&gt;‘Complied’&lt;/code&gt;, the subclass &lt;code&gt;‘High_Level_Compiled_Language’&lt;/code&gt; and all the languages that are children of it will inherit the property &lt;code&gt;‘Execution_Model’&lt;/code&gt; with the attribute &lt;code&gt;‘Complied’&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;This can be translated into first-order logic as follows:&lt;/p&gt;

&lt;p&gt;A hierarchical taxonomy organizes entities into a tree-like structure. In the Programming Language hierarchical taxonomy, the root class (category representing the domain) or the first node of the tree-like structure is &lt;code&gt;‘Programming Language,’&lt;/code&gt; with all other nodes as subclasses (subcategories) that inherit directly or indirectly from the &lt;code&gt;‘Programming Language’&lt;/code&gt; root class. These relationships can be described as &lt;code&gt;“is an instance of.”&lt;/code&gt; For example, all subclasses show the relation &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Programming Language’&lt;/code&gt; such as &lt;code&gt;‘High-level Compile Language’&lt;/code&gt; &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Compile Language’&lt;/code&gt; &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Programming Language,’&lt;/code&gt; therefore &lt;code&gt;‘High-level Compile Language’&lt;/code&gt; also shows the relationship &lt;code&gt;“is an instance of”&lt;/code&gt; &lt;code&gt;‘Programming Language’&lt;/code&gt;. This relationship is defined by the concept of inheritance where a subclass inherits the properties and attributes of its parent class and grandparent classes. Note that a subclass can have more than one parent class.&lt;/p&gt;

&lt;p&gt;For example, the parent class &lt;code&gt;‘Compiled_Language’&lt;/code&gt; has a property &lt;code&gt;‘Execution_Model’&lt;/code&gt; with the attribute &lt;code&gt;‘Complied’&lt;/code&gt;, the subclass &lt;code&gt;‘High_Level_Compiled_Language’&lt;/code&gt; and all the languages that are children of it will inherit the property &lt;code&gt;‘Execution_Model’&lt;/code&gt; with the attribute &lt;code&gt;‘Complied’&lt;/code&gt;. This can be translated into first-order logic as follows:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;∀x High_Level_Compiled_Language(x) ⇒ Compiled_Language(x) ⇒ Execution_Model(x,”Compiled”)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where &lt;code&gt;‘x’&lt;/code&gt; is the instance of a programming language (e.g. Java SE 23) and &lt;code&gt;‘⇒’&lt;/code&gt; implies.&lt;/p&gt;

&lt;p&gt;When exploring the Python frame we can see that one of its attributes is &lt;code&gt;‘Instance_Of’&lt;/code&gt; with the property &lt;code&gt;‘Scripting_Language,’&lt;/code&gt; this shows that Python is a subclass of the ‘Scripting_Language’ class, therefore Python inherits all the properties and attributes from &lt;code&gt;‘Scripting_Language’&lt;/code&gt; which are &lt;code&gt;‘Syntax: Easy_To_Use’&lt;/code&gt;, &lt;code&gt;‘Execution_Model: Interpreted’&lt;/code&gt;, and ‘Used_For: Software_Development’. Additionally, the ‘Syntax: Easy_To_Use’ is specific to &lt;code&gt;‘Scripting_Language.’&lt;/code&gt; On the other hand, &lt;code&gt;‘Execution_Model: Interpreted’&lt;/code&gt; and &lt;code&gt;‘Used_For: Software_Development’&lt;/code&gt; are inherited by &lt;code&gt;‘Scripting_Language’&lt;/code&gt; from &lt;code&gt;‘Interprated_Language.’&lt;/code&gt; Furthermore, &lt;code&gt;‘Execution_Model: Interpreted’&lt;/code&gt; is specific to &lt;code&gt;‘Interprated_Language’&lt;/code&gt; which inherits &lt;code&gt;‘Used_For: Software_Development’&lt;/code&gt; from ‘&lt;code&gt;Promming_Language.’&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;This can be translated into first-order logic as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;∀x Python(x) ⇒ Scripting_Language(x) ⇒ Syntax(x,Easy_To_Use)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;∀x Python(x) ⇒ Scripting_Language(x) ⇒ Interprated_Language(x) ⇒ Execution_Model(x,Interpreted)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;∀x Python(x) ⇒ Scripting_Language(x) ⇒ Interprated_Language(x) ⇒ Promming_Language ⇒ Used_For(x,Software_Development)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where &lt;code&gt;‘x’&lt;/code&gt; is the instance of a programming language (e.g. Python 3.13) and &lt;code&gt;‘⇒’&lt;/code&gt; implies.&lt;/p&gt;

&lt;p&gt;The rest of Python’s properties and attributes are specific to it.&lt;/p&gt;

&lt;p&gt;On a side note, in polymorphism, a subclass can modify (override) the attribute’s value of a property inherited from a parent class. For example, a language could inherit &lt;code&gt;‘Syntax: Easy_To_Use’&lt;/code&gt; from &lt;code&gt;‘Scripting_Language’&lt;/code&gt; and modify the attribute &lt;code&gt;‘Easy_To_Use’ to ‘Hard_To_Use.’&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Frame and Hierarchical Taxonomy Interactions Visualization
&lt;/h3&gt;

&lt;p&gt;This section illustrates visually, the interactions between the hierarchical taxonomy and the Java and Python frames.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Frame and Hierarchical Taxonomy Interactions (Java and Python)&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo58ltb0ze73zs7ka3spx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo58ltb0ze73zs7ka3spx.png" alt="Frame and Hierarchical Taxonomy Interactions (Java and Python" width="800" height="555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; The diagram illustrates the interactions between the hierarchical taxonomy and the Java and Python frames. Only the specific properties and attributes of the subclasses are listed in their node containers as the inherited properties and attributes can be listed in their parent class containers nodes. Data adapted from multiple sources: (Epözdemir, 2024; Foster, 2013; Gómez, n.d.; Peter Van Roy, 2008; Saxena, 2024; Startups, 2018; &amp;amp; Wikipedia contributors, 2024)&lt;/p&gt;

&lt;p&gt;As shown in Figure 4, combining hierarchical taxonomic relationships and frames creates a powerful tool for representing knowledge. The hierarchical taxonomy illustrated the relationships between categories; for example, the ‘Scripting Language’ category is a subcategory of the ‘Interpreted Language’ which is a subcategory of the ‘Programming Language’ category making the ‘Scripting Language’ a sub-subcategory of the root category ‘Programming Language’ which represents the domain. Additionally, the implementation of frames into the diagram shows the entities’ properties and attributes and how they get inherited from another category. For example, Python’s specific properties and attributes are listed in its node containers, and its inherited properties and attributes are listed in its parent, grandparent, and great-grandparent class node containers. This creates a robust representation of knowledge that provides depth and clarity allowing users to navigate complex relationships effortlessly.&lt;/p&gt;




&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;Colorado State University Global. (n.d.). &lt;em&gt;Module 4: Knowledge Representation&lt;/em&gt; [Interactive lecture]. Canvas. Retrieved November 1, 2024, from &lt;a href="https://csuglobal.instructure.com/courses/100844/pages/4-dot-2-frames?module_item_id=5183634" rel="noopener noreferrer"&gt;https://csuglobal.instructure.com/courses/100844/pages/4-dot-2-frames?module_item_id=5183634&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Epözdemir, J. (2024, April 10). &lt;em&gt;Programming Language Categories&lt;/em&gt;. Medium. &lt;a href="https://medium.com/@jepozdemir/programming-language-categories-6b786d70e8f7" rel="noopener noreferrer"&gt;https://medium.com/@jepozdemir/programming-language-categories-6b786d70e8f7&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Foster, D. (2013, February 20). &lt;em&gt;Visual Guide to Programming Language Properties&lt;/em&gt;. DaFoster. &lt;a href="https://dafoster.net/articles/2013/02/20/visual-guide-to-programming-language-properties/" rel="noopener noreferrer"&gt;https://dafoster.net/articles/2013/02/20/visual-guide-to-programming-language-properties/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gómez, R. (n.d.). &lt;em&gt;Alphabetical List of Programming Languages • programminglanguages&lt;/em&gt;.info. &lt;a href="https://programminglanguages.info/languages/" rel="noopener noreferrer"&gt;https://programminglanguages.info/languages/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Knight, M. (2021, March 12). What Is Taxonomy? Dataversity. &lt;a href="https://www.dataversity.net/what-is-taxonomy/" rel="noopener noreferrer"&gt;https://www.dataversity.net/what-is-taxonomy/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Novak, J., Krajnc, A., &amp;amp; Žontar, R. (2010, May 1).&lt;em&gt;Taxonomy of static code analysis tools.&lt;/em&gt; IEEE Conference Publication | IEEE Xplore. &lt;a href="https://ieeexplore.ieee.org/document/5533417" rel="noopener noreferrer"&gt;https://ieeexplore.ieee.org/document/5533417&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Peter Van Roy. (2008). &lt;em&gt;The principal programming paradigms.&lt;/em&gt; &lt;a href="https://webperso.info.ucl.ac.be/%7Epvr/paradigmsDIAGRAMeng108.pdf" rel="noopener noreferrer"&gt;https://webperso.info.ucl.ac.be/~pvr/paradigmsDIAGRAMeng108.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Saxena, C. (2024, October 17). &lt;em&gt;Top Programming Languages 2025: By Type and Comparison.&lt;/em&gt; ISHIR | Software Development India. &lt;a href="https://www.ishir.com/blog/36749/top-75-programming-languages-in-2021-comparison-and-by-type.htm" rel="noopener noreferrer"&gt;https://www.ishir.com/blog/36749/top-75-programming-languages-in-2021-comparison-and-by-type.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Startups, A. (2018, June 20). &lt;em&gt;Choosing the Right Programming Language for Your Startup.&lt;/em&gt; Medium. &lt;a href="https://medium.com/aws-activate-startup-blog/choosing-the-right-programming-language-for-your-startup-b454be3ed5e2" rel="noopener noreferrer"&gt;https://medium.com/aws-activate-startup-blog/choosing-the-right-programming-language-for-your-startup-b454be3ed5e2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wikipedia contributors. (2024, November 3). &lt;em&gt;List of programming languages by type.&lt;/em&gt; Wikipedia. &lt;a href="https://en.wikipedia.org/wiki/List_of_programming_languages_by_type" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/List_of_programming_languages_by_type&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/codex/taxonomy-and-frames-in-programming-languages-a-hierarchical-approach-to-knowledge-representation-a2d521cb2415" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://medium.com/codex" rel="noopener noreferrer"&gt;Codex&lt;/a&gt; on November 28, 2024.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>computerscience</category>
      <category>taxonomy</category>
    </item>
    <item>
      <title>Minimizing Variable Scope in Java: Best Practices for Secure and Efficient Code</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Mon, 27 Jan 2025 03:37:01 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/minimizing-variable-scope-in-java-best-practices-for-secure-and-efficient-code-5dc0</link>
      <guid>https://dev.to/alex_ricciardi/minimizing-variable-scope-in-java-best-practices-for-secure-and-efficient-code-5dc0</guid>
      <description>&lt;p&gt;This article explains the importance of minimizing variable scope in Java to enhance code readability, maintainability, and security. It highlights Java’s object-oriented approach, contrasts it with languages like C++, and provides examples of best practices, including encapsulation and controlled access through methods.&lt;/p&gt;




&lt;p&gt;In Java, the scope of a variable is the part of a program where the variable can be accessed (Mahrsee, 2024). The scope can be a Class scope, method scope, or block scope. Java does not have global variables like C++ does; global variables are variables that can be accessed from anywhere in the program. In other words, the variables have a global scope.&lt;/p&gt;

&lt;p&gt;Java inherently minimizes scope by encapsulating everything in classes. Java is a strictly object-oriented programming (OOP) language rather than a procedural one like C. On the other hand, C++ supports both paradigms, OPP and procedural programming. Anyhow, scope minimization is an approach with the goal of improved readability, better maintainability, and reduced chance of errors (Carter, 2021). DCL53-J. SEI CERT Oracle Coding Standard for Java (CMU, n.d.) recommends minimizing the scope of variables to: “avoid common programming errors, improves code readability by connecting the declaration and actual use of a variable, and improves maintainability because unused variables are more easily detected and removed. It may also allow objects to be recovered by the garbage collector more quickly, and it prevents violations of DCL51-J. Do not shadow or obscure identifiers in subscopes.“&lt;/p&gt;

&lt;p&gt;Minimizing the scope of a variable also adds a layer of security, as the variable is restricted to the context where it is needed. This reduces access, manipulation, or misuse by other parts of the program, limiting possible vulnerabilities. For example, in Java, declaring a class variable ‘private’ would restrict its scope within the class, preventing other classes from directly modifying or accessing it. However, if the variable needs to be accessed or modified, it can only be done through controlled methods, such as getters or setters, which encapsulate the variable or return a copy of it; additionally, they can implement an extra layer or validation or logic that ensures that the variable is properly utilized.&lt;/p&gt;

&lt;p&gt;Below is an example of how to apply scope minimization in Java can look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Employee&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Private class variables to restrict access&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Constructor&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Employee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Getter for name (read-only access)&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getName&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Getter and setter for salary with validation&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;getSalary&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setSalary&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; 
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;IllegalArgumentException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Salary must be greater than 0."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Method to provide an increment with controlled logic&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;applyBonus&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;percentage&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;IllegalArgumentException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bonus percentage must be between 0 and 20."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Display employee details&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;printDetails&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Name: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Salary: $"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

         &lt;span class="c1"&gt;// Create an Employee object&lt;/span&gt;
        &lt;span class="nc"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;emp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Employee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Alice"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Initial Salary:"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;emp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;printDetails&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

        &lt;span class="c1"&gt;// Modify Salary&lt;/span&gt;
        &lt;span class="n"&gt;emp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setSalary&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;55000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; 
        &lt;span class="n"&gt;emp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;applyBonus&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;     
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"\nUpdated Salary:"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;emp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;printDetails&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

        &lt;span class="c1"&gt;// Attempting to set an invalid salary&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"\nInvalid salary (-10000):"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;emp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setSalary&lt;/span&gt;&lt;span class="o"&gt;(-&lt;/span&gt;&lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IllegalArgumentException&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getMessage&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Outputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Name: Alice
Salary: $50000.0

Updated Salary:
Name: Alice
Salary: $60500.0

Invalid salary (-10000):
Salary must be greater than 0.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To summarize, minimizing variable scope in Java code improves code readability, maintainability, and security by restricting access to where variables are needed most. Java is strictly object-oriented programming (OOP) language implying that it encapsulates data and variables within classes. This approach not only prevents unintended interactions and vulnerabilities but also aligns with best practices for efficient and secure programming.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Carter, K. (2021, February 10). &lt;em&gt;Effective Java: Minimize The Scope of Local Variables.&lt;/em&gt; DEV Community. &lt;a href="https://dev.to/kylec32/effective-java-minimize-the-scope-of-local-variables-3e87"&gt;https://dev.to/kylec32/effective-java-minimize-the-scope-of-local-variables-3e87&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CMU — Software Engineering Institute (n.d.) DCL53-J. Minimize the scope of variables.&lt;br&gt;
&lt;em&gt;SEI CERT Oracle coding standard for Java&lt;/em&gt;. Carnegie Mellon University. Software Engineering Institute.&lt;/p&gt;

&lt;p&gt;Mahrsee, R. (2024, May 13). &lt;em&gt;Scope of variables in Java&lt;/em&gt;. GeeksforGeeks. &lt;a href="https://www.geeksforgeeks.org/variable-scope-in-java/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/variable-scope-in-java/&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://levelup.gitconnected.com/minimizing-variable-scope-in-java-best-practices-for-secure-and-efficient-code-25fe02efae28" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on November 22, 2024.&lt;/p&gt;

</description>
      <category>java</category>
      <category>coding</category>
      <category>programming</category>
      <category>scope</category>
    </item>
    <item>
      <title>Searching vs. Sorting in Java: Key Differences and Applications</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Thu, 16 Jan 2025 01:58:18 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/searching-vs-sorting-in-java-key-differences-and-applications-3fh4</link>
      <guid>https://dev.to/alex_ricciardi/searching-vs-sorting-in-java-key-differences-and-applications-3fh4</guid>
      <description>&lt;p&gt;This article describes the differences between searching and sorting algorithms in Java, their distinct purposes, methodologies, and time complexities. It includes practical examples and implementations, such as Merge Sort for organizing data and Binary Search for efficient retrieval, demonstrating their roles in solving real-world problems.&lt;/p&gt;




&lt;p&gt;In Java, understanding searching and sorting algorithms and how they differ from each other, is crucial for the correct functionality of the application and for effectively managing data. While searching focuses on locating specific data within a collection, sorting rearranges data. This article explores their differences in purpose, methodology, and applications, by providing examples.&lt;/p&gt;

&lt;p&gt;The major differences between searching and sorting in Java lie in their purposes and outputs, as well as their efficiencies and time complexities. Please Table 1 for a detailed comparison.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Searching vs Sorting in Java&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90uzlfbg4zsa3wuitwib.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90uzlfbg4zsa3wuitwib.png" alt="Searching vs Sorting in Java Table" width="800" height="905"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choosing between different searching or sorting algorithms often depends on the purpose or output wanted and the specific requirements of your application, such as the size of the dataset, and whether the data is already sorted.&lt;/p&gt;

&lt;p&gt;The following table, Table 2, gives examples of pseudocode and time complexity for several searches and sort algorithms:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Runtime Complexities for Various Pseudocode Examples&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjoiycvtz40et8ukwne89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjoiycvtz40et8ukwne89.png" alt="Runtime Complexities for Various Pseudocode Examples Table" width="784" height="1608"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note:&lt;/em&gt; In Java without using the Comparable Interface the code above would only be viable for primitive types. From Programming in Java with ZyLabs, 18.3 O notation, Figure 18.3.2 by Lysecky, R., &amp;amp; Lizarraga, A. (2022).&lt;/p&gt;

&lt;p&gt;An example of a sort algorithm is the merge sort, which has the divide-and-conquer approach, it recursively divides a data array into smaller subarrays and sorts those subarrays, then merges the subarrays together to create a sorted array (GeeksforGeeks, 2020a).An example of a search algorithm is the binary search; which operates on a pre-sorted array by repeatedly dividing the search interval in half until the target element is found or determined to be absent (GeeksforGeeks, 2020b).&lt;/p&gt;

&lt;p&gt;The example below sorts using merge sort an ArrayList of book objects by year of publication then searches the sorted list using binary:&lt;br&gt;
Book.java&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * Book object with a title and publication year. This class implements
 * Comparable to allow sorting based on the publication year.
 * 
 * @author Alexander Ricciardi
 * @version 1.0
 * @date 07/14/2024
 */&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Comparable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Constructs a new Book object.
     *
     * @param title The title of the book.
     * @param year  The year the book was published.
     */&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;year&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Compares this book with another book based on the publication year.
     *
     * @param other The book to compare with.
     * @return A negative integer, zero, or a positive integer as this book is less
     *         than, equal to, or greater than the specified book.
     */&lt;/span&gt;
    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;compareTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compare&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;year&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;year&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Returns a string representation of the book.
     *
     * @return A string in the format "title (year)".
     */&lt;/span&gt;
    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" ("&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;")"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;BookSortingSearching.java&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.ArrayList&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.Arrays&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.Scanner&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Sorts and search a list of books. It implements merge sort for sorting and
 * binary search for searching.
 * 
 * @author Alexander Ricciardi
 * @version 1.0
 * @date 07/14/2024
 */&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BookSortingSearching&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * The main method that demonstrates sorting and searching on a list of books.
     *
     * @param args Command line arguments (not used).
     */&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Initialize the list of books&lt;/span&gt;
    &lt;span class="nc"&gt;ArrayList&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;
        &lt;span class="nc"&gt;Arrays&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asList&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"To Kill a Mockingbird"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1960&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; 
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"1984"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1949&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The Great Gatsby"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1925&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"One Hundred Years of Solitude"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1967&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The Catcher in the Rye"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1951&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; 
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Brave New World"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1932&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The Hobbit"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1937&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; 
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The Lord of the Rings"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1954&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Pride and Prejudice"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1813&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; 
                     &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Book&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Animal Farm"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1945&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                 &lt;span class="o"&gt;));&lt;/span&gt;

    &lt;span class="c1"&gt;// Print the original list&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Original list:"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forEach&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Sort the books using merge sort&lt;/span&gt;
    &lt;span class="n"&gt;mergeSort&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Print the sorted list&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"\nSorted list by year:"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forEach&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Perform binary search based on user input&lt;/span&gt;
    &lt;span class="nc"&gt;Scanner&lt;/span&gt; &lt;span class="n"&gt;scn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Scanner&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;in&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;print&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"\nEnter a year to search for: "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;searchYear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;nextInt&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;binarySearch&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;searchYear&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Book found: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"No book found for the year "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;searchYear&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;scn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Sorts the given list of books using the merge sort algorithm.
     *
     * @param books The list of books to sort.
     * @param left  The starting index of the subarray to sort.
     * @param right The ending index of the subarray to sort.
     */&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;mergeSort&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ArrayList&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;mergeSort&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Sort left half&lt;/span&gt;
        &lt;span class="n"&gt;mergeSort&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Sort right half&lt;/span&gt;
        &lt;span class="n"&gt;merge&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Merge the sorted halves&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Merges two sorted subarrays of the books list.
     *
     * @param books The list of books containing the subarrays to merge.
     * @param left  The starting index of the left subarray.
     * @param mid   The ending index of the left subarray.
     * @param right The ending index of the right subarray.
     */&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;merge&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ArrayList&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Create temporary arrays&lt;/span&gt;
    &lt;span class="nc"&gt;ArrayList&lt;/span&gt; &lt;span class="n"&gt;leftList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;subList&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
    &lt;span class="nc"&gt;ArrayList&lt;/span&gt; &lt;span class="n"&gt;rightList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;subList&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;

    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Merge the two lists&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;leftList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;rightList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;leftList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;compareTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rightList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++,&lt;/span&gt; &lt;span class="n"&gt;leftList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++));&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++,&lt;/span&gt; &lt;span class="n"&gt;rightList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++));&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Copy remaining elements of leftList, if any&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;leftList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++,&lt;/span&gt; &lt;span class="n"&gt;leftList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++));&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Copy remaining elements of rightList, if any&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;rightList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++,&lt;/span&gt; &lt;span class="n"&gt;rightList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++));&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * Performs a binary search on the sorted list of books to find a book by its
     * publication year.
     *
     * @param books The sorted list of books to search.
     * @param year  The publication year to search for.
     * @return The index of the book if found, -1 otherwise.
     */&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;binarySearch&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ArrayList&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;year&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Book found&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;year&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Search in the right half&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Search in the left half&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Book not found&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;To Kill a Mockingbird (1960)
1984 (1949)
The Great Gatsby (1925)
One Hundred Years of Solitude (1967)
The Catcher in the Rye (1951)
Brave New World (1932)
The Hobbit (1937)
The Lord of the Rings (1954)
Pride and Prejudice (1813)
Animal Farm (1945)

Sorted list by year:
Pride and Prejudice (1813)
The Great Gatsby (1925)
Brave New World (1932)
The Hobbit (1937)
Animal Farm (1945)
1984 (1949)
The Catcher in the Rye (1951)
The Lord of the Rings (1954)
To Kill a Mockingbird (1960)
One Hundred Years of Solitude (1967)

Enter a year to search for: 1951
Book found: The Catcher in the Rye (1951)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In other words, merge sort is efficient for sorting large sets of data due to its complexity of &lt;em&gt;O(n log(n))&lt;/em&gt;, while binary search with its targeted approach to search is better suited for machine learning applications, such as those for training neural networks or finding the optimal hyperparameters for a model.&lt;/p&gt;

&lt;p&gt;In summary, searching and sorting algorithms have interconnected roles in programming but serve different purposes. Sorting algorithms like Merge Sort organize the data, allowing searching methods such as Binary Search to be more efficient. Together, these algorithms are indispensable for solving real-world problems, from data analysis to application development.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GeeksforGeeks. (2020a, November 18). &lt;em&gt;Merge sort&lt;/em&gt;. GeeksforGeeks &lt;a href="https://www.geeksforgeeks.org/merge-sort/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/merge-sort/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GeeksforGeeks. (2020b, February 3). &lt;em&gt;Binary search&lt;/em&gt;. GeeksforGeeks. &lt;a href="https://www.geeksforgeeks.org/binary-search/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/binary-search/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lysecky, R., &amp;amp; Lizarraga, A. (2022)._ Programming in Java with ZyLabs_[ Table]. Zyante, Inc.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/gitconnected/searching-vs-sorting-in-java-key-differences-and-applications-6440b1bb916b" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://levelup.gitconnected.com/" rel="noopener noreferrer"&gt;Level UP Coding&lt;/a&gt; on November 22, 2024.&lt;/p&gt;

</description>
      <category>java</category>
      <category>algorithms</category>
      <category>coding</category>
      <category>programming</category>
    </item>
    <item>
      <title>Bayes’ Theorem: Risk Prediction and AI in The Insurance Sector</title>
      <dc:creator>Alex Ricciardi</dc:creator>
      <pubDate>Thu, 16 Jan 2025 01:48:26 +0000</pubDate>
      <link>https://dev.to/alex_ricciardi/bayes-theorem-risk-prediction-and-ai-in-the-insurance-sector-3fba</link>
      <guid>https://dev.to/alex_ricciardi/bayes-theorem-risk-prediction-and-ai-in-the-insurance-sector-3fba</guid>
      <description>&lt;p&gt;The article explains Bayes’ Theorem as a mathematical formula used to update probabilities based on new evidence, illustrating its applications in risk prediction for insurance companies. It highlights the theorem’s integration into AI systems to enhance decision-making while addressing potential biases, privacy, and security concerns.&lt;/p&gt;




&lt;p&gt;In probability theory, Bayes’ Theorem, also known as Bayes’ Rule or Bayes’ Law, is a mathematical formula that updates the probability of a hypothesis based on new evidence. In statistics, it is a way to revise or update existing predictions or theories based on new or additional evidence (Hayes, 2024), In other words, it is a mathematical formula for determining conditional probability. A conditional probability is the likelihood of an outcome occurring based on a previous outcome that occurred under similar circumstances. Thus, Bayes’ Theorem can also be defined as a mathematical property that allows conditional probability to be expressed in terms of the inverse of the conditional (Data Science Discovery, n.d.).&lt;/p&gt;

&lt;p&gt;The Bayes’ Theorem formula:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbk2s4tdjo1c55ons5nwq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbk2s4tdjo1c55ons5nwq.png" alt="The Bayes’ Theorem formula" width="560" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;P(A)&lt;/em&gt; is the prior probability of an event A.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;P(B)&lt;/em&gt; is the probability of an event B.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;P(B|A)&lt;/em&gt; is the probability of an event B occurring given that A has occurred.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;P(A|B)&lt;/em&gt; is the probability of an event A occurring given that B has occurred.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore, the Bayes’ Theorem computes the reverse of the conditional probability. That is the probability of a cause A given an effect B, &lt;em&gt;P(A|B)&lt;/em&gt;, when the overall probability of the cause, &lt;em&gt;P(A)&lt;/em&gt;, the probability of the effect, &lt;em&gt;P(B)&lt;/em&gt;, and the probability of the effect occurring given that the cause has occurred, P(B|A) are known.&lt;/p&gt;

&lt;p&gt;Note:&lt;br&gt;
&lt;em&gt;P(B) = P(B∣A) P(A) + P(B∣¬A) P(¬A)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;P(B∣¬A)&lt;/em&gt; — the probability of event B occurring given that ¬A event has occurred&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;P(B∣A)&lt;/em&gt; — the probability of event B occurring given that A event has occurred&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Taylor, 2023)&lt;/p&gt;

&lt;p&gt;Another way to formulate Bayes’ Theorem is to base it on a hypothesis context:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9j34x9gnhmc1851w58j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9j34x9gnhmc1851w58j.png" alt="formulate Bayes’ Theorem" width="560" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;H&lt;/em&gt;: The hypothesis&lt;br&gt;
(e.g., a person has a certain disease)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;E&lt;/em&gt;: Evidence&lt;br&gt;
(e.g., the person tests positive in a diagnostic test)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;P(H)&lt;/em&gt;: Prior probability is the known probability about the hypothesis or the initial belief about the hypothesis, that is the beliefs before observing the evidence.&lt;br&gt;
(e.g., the probability someone has a specific disease before considering specific symptoms or test results)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;P(E)&lt;/em&gt;: Marginal probability is the probability of observing the evidence under all possible scenarios. It may be thought of as an unconditional probability, or it is not conditioned on another event (Albright, n.d.).&lt;br&gt;
&lt;em&gt;P(E) = P(E∣H) P(H) + P(E∣¬H) P(¬H)&lt;/em&gt;&lt;br&gt;
(e.g., the probability that a diagnostic test would show a positive result, whether or not the person actually has the disease).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;P(E∣H)&lt;/em&gt;: Likelihood is the probability of observing the evidence.&lt;br&gt;
(e.g., a positive test result) given that the hypothesis is true. In other words, it is the likelihood of E being true based on H being true.&lt;br&gt;
(e.g., the likelihood of a positive test result being accurate, knowing that the person has the disease; note that medical tests are not 100% accurate, false positive)&lt;br&gt;
On the other hand, P(H∣E) is the likelihood of H being true based on E being true.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;P(H∣E)&lt;/em&gt;: The posterior probability is the updated probability of the hypothesis given the observed evidence.&lt;br&gt;
(e.g., the probability that the person actually has the disease, given that they tested positive)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The formulated Bayes’ Theorem above can be used to assess risks by calculating the likelihood of an event, such as accidents, illnesses, or natural disasters. This information is very valuable for an insurance company, enabling it to better understand and predict potential risks.&lt;/p&gt;

&lt;p&gt;The steps below describe how the theorem can be applied to predict the risk of a person developing a disease:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Prior Knowledge:&lt;/strong&gt;&lt;br&gt;
Establish the disease hypothesis, such as the probability someone has a specific disease before considering specific symptoms or test results, then collect relevant data and compute the prior probability P(H) from it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
If 5 in 1,000 people in the general population have the disease, therefore the prior is 0.005.&lt;br&gt;
&lt;em&gt;P(H) = 0.005&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Incorporate the Evidence:&lt;/strong&gt;&lt;br&gt;
Incorporate evidence such as a positive result from a diagnostic test. That is the Likelihood, P(E∣H). That is the likelihood of a positive test result being accurate, knowing that the person has the disease.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
The test is accurate 96% of the time.&lt;br&gt;
&lt;em&gt;P(E∣H) = 0.96&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Account for False Positives:&lt;/strong&gt;&lt;br&gt;
Compute The marginal probability &lt;em&gt;P(E)&lt;/em&gt;. That is the probability that a diagnostic test would show a positive result, whether or not the person actually has the disease.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;True Positives &lt;em&gt;P(E∣H)P(H)&lt;/em&gt;, the test correctly identifies the disease.&lt;/li&gt;
&lt;li&gt;False Positives &lt;em&gt;P(E∣¬H)P(¬H)&lt;/em&gt;, the test incorrectly identifies the disease.
Then
&lt;em&gt;P(E) = P(E∣H) P(H) + P(E∣¬H) P(¬H)&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;em&gt;P(E∣¬H) = 0.04 (4% false positive rate)&lt;br&gt;
P(¬H) = 1 − P(H) =0.995&lt;br&gt;
P(¬H) = 0.995.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P(E) = P(E∣H) P(H) +P(E∣¬H) P(¬H) = (0.96)( 0.005) +( 0.04)(0.995)&lt;br&gt;
P(E)= 0.0048 + 0.0398 = 0.0446&lt;br&gt;
P(E) = 0.0446&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 - Compute the Posterior:&lt;/strong&gt;&lt;br&gt;
Use Bayes’ Theorem to update the probability based on the evidence. That is the probability that the person actually has the disease, given that they tested positive.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdkqilj2waj1upbafl2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdkqilj2waj1upbafl2m.png" alt="Compute the Posterior" width="317" height="75"&gt;&lt;/a&gt;&lt;br&gt;
For example:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwedgnwsf6nmvu9k8wmz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwedgnwsf6nmvu9k8wmz7.png" alt="Compute the Posterior Example" width="363" height="74"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;P(H∣E) ≈ 0.1076&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thus, even though the test is 96% accurate the posterior probability &lt;em&gt;P(H∣E)&lt;/em&gt; is equal to &lt;em&gt;10.76%&lt;/em&gt;. This is due to &lt;em&gt;P(H)&lt;/em&gt; being only &lt;em&gt;0.5%&lt;/em&gt; (5 in 1,000 people in the general population have the disease). In other words, a person having a positive test result increases the person’s probability of having the disease from &lt;em&gt;0.5%&lt;/em&gt; to about &lt;em&gt;10.76%&lt;/em&gt;; however, it is still more likely that the person does not have the disease. For the insurance, it means that it needs to consider both test accuracy, &lt;em&gt;P(E∣H) = 0.96&lt;/em&gt;, and disease prevalence, &lt;em&gt;P(H)&lt;/em&gt;, to not overestimate risks, as risks are low even with a positive test, and to set insurance premiums that represent a fair and accurate assessment of the probability of a person having the diseases.&lt;/p&gt;

&lt;p&gt;As shown from the example above, the Bayes’ Theorem is a powerful tool that provides more accurate predictions than solely relying on simple probabilities or data alone.&lt;/p&gt;

&lt;p&gt;An Artificial Intelligence (AI) Bayes’ Theorem implementation can transform and enhance the insurance company’s decision-making processes by providing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More accurate predictions of risks, such as accidents, illnesses, or natural disasters real-time data processing.&lt;/li&gt;
&lt;li&gt;More personalized and refined prediction-based individual-level data.&lt;/li&gt;
&lt;li&gt;By analyzing vast amounts of data.- By automating systems streamlining claims processing and fraud detection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, a Bayes’ Theorem AI may invertedly create biases. Additionally, by using vast personal and private amounts of data such as medical history and financial information the AI system introduces privacy and security concerns, as well as data regulatory compliance challenges. These potential issues need to be carefully considered when using such systems.&lt;/p&gt;

&lt;p&gt;To summarize, Bayes’ Theorem is a mathematical formula that updates the probability of a hypothesis based on new evidence providing a way to incorporate prior knowledge and observed data in real time into predictions. It is a powerful tool that provides more accurate predictions than solely relying on simple probabilities or data alone and when implemented in an AI model can transform and enhance the insurance company’s decision-making processes.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Albright, E. (n.d.). &lt;em&gt;Probability: Joint, marginal and conditional probabilities&lt;/em&gt;. ENV710 Statistics Review. Nicholas School of the Environment | Duke University. &lt;a href="https://sites.nicholas.duke.edu/statsreview/jmc/" rel="noopener noreferrer"&gt;https://sites.nicholas.duke.edu/statsreview/jmc/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data Science Discovery (n.d.). &lt;em&gt;Bayes’ theorem&lt;/em&gt;. University of Illinois at Urbana-Champaign (UIUC). &lt;a href="https://discovery.cs.illinois.edu/learn/Prediction-and-Probability/Bayes-Theorem/" rel="noopener noreferrer"&gt;https://discovery.cs.illinois.edu/learn/Prediction-and-Probability/Bayes-Theorem/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hayes, A. (2024, March 30)._ Bayes’ theorem: What it is, the formula, and examples_. Investopedia. &lt;a href="https://www.investopedia.com/terms/b/bayes-theorem.asp" rel="noopener noreferrer"&gt;https://www.investopedia.com/terms/b/bayes-theorem.asp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Taylor, S. (2023, November 21). &lt;em&gt;Bayes’ Theorem&lt;/em&gt;. Corporate Finance Institute. &lt;a href="https://corporatefinanceinstitute.com/resources/data-science/bayes-theorem/" rel="noopener noreferrer"&gt;https://corporatefinanceinstitute.com/resources/data-science/bayes-theorem/&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://medium.com/codex/bayes-theorem-risk-prediction-and-ai-in-the-insurance-sector-0d90133cf32a" rel="noopener noreferrer"&gt;Alex.omegapy&lt;/a&gt; on Medium by &lt;a href="https://medium.com/codex" rel="noopener noreferrer"&gt;CodeX&lt;/a&gt; on November 14, 2024.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>algorithms</category>
      <category>bayestheorem</category>
    </item>
  </channel>
</rss>
