avatarIsrael Josué Parra Rosales

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

5582

Abstract

alcoholics, for reasons yet obscure, have lost the power of choice in drink. Our so-called will power becomes practically nonexistent. We are unable, at certain times, to bring into our consciousness with sufficient force the memory of the suffering and humiliation of even a week or a month ago. We are without defense against the first drink.</p></blockquote><blockquote id="b97c"><p>~ The Big Book, page 24.</p></blockquote><p id="2733">I mumbled something about doing more therapy sessions to stay in touch with my baseline feelings, but my new sponsor was having none of it.</p><p id="e1c9">‘This isn’t an emotional issue!’ he said, cutting in. ‘This is a memory issue that no amount of therapy you chose to throw money at will solve.’</p><p id="1800">He even suggested that the mental blank spot could be similar to a form of amnesia or dementia that science hasn’t picked up on yet.</p><p id="4ad6">‘But why hasn’t science picked up on it?’ I asked, holding the phone tightly.</p><p id="26fb">‘Probably because this blank spot only happens at certain times. Most of the time, it lays dormant.’ he replied before warning,</p><p id="337a">‘And unfortunately, this dormancy feature gives us an illusion of power. We think we’ve got sobriety now because our memory and willpower function normally again. Until, the condition randomly comes back online, and we relapse, leaving us totally baffled as to why it happened.’</p><p id="a3e9">My new sponsor sighed deeply.</p><p id="f455">‘It’s heartbreaking,’ he said softly. ‘Especially if you’ve relapsed after being multiple years clean. But it is sadly needed to show you that you are genuinely powerless, regardless of how much you desire and want to be sober.’</p><p id="969d">My head was spinning. Every sentence felt like the jolt of an electric cattle prod.</p><p id="8e0a">Later that day, I looked back at my recent relapses. I found no real conscious memory of consequences before any of them.</p><p id="352f">It appeared relapse was happening to me, not by me.</p><blockquote id="8aba"><p>As soon as I regained my ability to think, I went carefully over that evening in Washington. Not only had I been off guard, I had made no fight whatever against the first drink. This time I had not thought of the consequences at all. I had commenced to drink as carelessly as though the cocktails were ginger ale. I now remembered what my alcoholic friends had told me, how they prophesied that if I had an alcoholic mind, the time and place would come — I would drink again. They had said that though I did raise a defense, it would one day give way before some trivial reason for having a drink. Well, just that did happen and more, for what I had learned of alcoholism did not occur to me at all. I knew from that moment that I had an alcoholic mind. I saw that will power and self-knowledge would not help in those strange mental blank spots. I had never been able to understand people who said that a problem had them hopelessly defeated. I knew then. It was a crushing blow.</p></blockquote><blockquote id="93f7"><p>~ The Big Book, page 41.</p></blockquote><figure id="7922"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*n4r4HuNFWSnCD_WU"><figcaption>Photo by <a href="https://unsplash.com/@alicealinari?utm_source=medium&amp;utm_medium=referral">Alice Alinari</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h2 id="287c">A Belief That It Will All Be Alright.</h2><p id="baea">Sadly, the ‘blank spot’ wasn’t all that was happening.</p><p id="7c3e">My new sponsor later explained that something else was happening in my mind, a kind of twisting of my thinking that I couldn’t see either.</p><p id="02a0">This is the other main feature of the relapse condition.</p><p id="da70">The Big Book explains it as follows:</p><blockquote id="f067"><p>But there was always the curious mental phenomenon that parallel with our sound reasoning, there inevitably ran some insanely trivial excuse for taking the first drink. Our sound reasoning failed to hold us in check. The insane idea won out.</p></blockquote><blockquote id="4ad8"><p>~ The Big Book, page 37.</p></blockquote><p id="da58">Anytime the ‘good idea’ of relapsing suddenly popped into my head, part of me would start to minimise the lunacy of this thought.</p><p id="e2c7">I would begin to rationalise this catastrophic idea with excuses and reasons why it would be, in fact, okay to relapse despite being in recovery.</p><p id="432a">No matter how insignificant and non-sensical those reasons were, they quickly became plausible and seemingly rational.</p><p id="6997">At the same time, the urge to want to relapse would start to surge.</p><p id="cdc4">A fear of missing out would relentlessly come crashing in like waves rolling in and out of my consciousness.</p><p id="b225">Thoughts and narratives of why it would be okay this time would dominate my thinking.</p><p id="fe2d">Finally, a tidal wave of justification would smother me into deep unconsciousness.</p><p id="c65b">Convinced of my rationale, I would carry out my plan, only to revert back to type and do everything I said I wouldn’t do, and again, find myself powerless to stop once I started.</p><p id="34a2">This twisted thinking was nothing more than a lie, but I believed the lie and didn’t see the flaw in the logic in light of my track record with partying.</p><p id="888a">To any average person, this kind of thinking and decision-making would be termed irrational, unsound, or even insa

Options

ne.</p><p id="d880">The Big Book calls this thinking an <i>‘obsession to beat the game’</i>.</p><p id="9087">Whether it’s a vague idea that this time it would be different, that I would do it differently and party like a gentleman.</p><p id="b075">Or the well-loved excuse that this will be my last relapse. After this final time, I’ll be done for good. I’ll get on with my life.</p><p id="be67">But, it never was different and that last time never did happen.</p><p id="149d">My new sponsor would remind me often,</p><p id="a62b" type="7">‘You aren’t changing your mind when you’ve decided to give in and party; your mind has been changed for you.’</p><h2 id="4c19">It Centers In Our Minds</h2><p id="f0e7">Of course, there is a body element for the addict.</p><p id="86b6">Naturally, as a consequence of the constant extreme usage of powerfully addictive substances and processes that are designed by their very nature to make you want more and more, addicts have developed a sky-high tolerance.</p><p id="2d70">But there’s this annihilation approach to our acting out and using once we start, which the Big Book describes as the <i>‘phenomenon of craving’</i>.</p><p id="01c2">In the Doctor’s opinion in the Big Book, Dr. Silkworth calls the phenomenon of craving an ‘allergy’, but my new sponsor wasn’t too keen on that idea.</p><p id="10af" type="7">‘If it’s an allergy, then why doesn’t the phenomenon of craving happen every time?’</p><p id="ae75">Regardless of whether it is an allergy, the body part becomes irrelevant, as most people with a severe peanut allergy don’t tend to keep repeating the total lost cause of trying to have another peanut to see if they will react differently.</p><p id="2e48">They don’t touch or go anywhere near peanuts because they remember how terrible it was last time.</p><p id="436a">Once or twice is enough.</p><p id="3796">Not so with the real addict because of the first two features of the disease; they will not only be back gorging on peanuts, but they will eventually take up residence in a peanut factory.</p><blockquote id="e3f6"><p>There is a complete failure of the kind of defence that keeps one from putting his hand on a hot stove. The alcoholic may say to himself in the most casual way, “It won’t burn me this time, so here’s how!” Or perhaps he doesn’t think at all.</p></blockquote><blockquote id="d5e6"><p>~ The Big Book, page 24.</p></blockquote><p id="5cb9">That’s why the Big Book says the real problem ‘centers in our mind’, not our bodies.</p><p id="22d4">‘What will happen now,’ my new sponsor forewarned, ‘as the relapses get worse, the time between them will get shorter and shorter.’</p><p id="6f0b">This condition is progressive.</p><p id="e8f1">Therefore, the blanking and twisting will naturally grow in scope and reach until you can no longer differentiate the true from the false.</p><h2 id="869b">Turning To Something Else</h2><p id="922a">If you believe in the disease concept of addiction, that this is a disease, a fatal illness precisely like any other life-threatening condition, then you have it for life.</p><p id="a2d8">There is <b>nothing </b>you can do to change that.</p><p id="d5f6">If you constantly can’t remember why or how you relapsed despite your honest desire not to.</p><p id="9aaf">Or if you continually relapse, believing some trivial reason or silly excuse to relapse while dismissing the genuine consequences, then you are a real addict.</p><p id="a47a">You have this relapse condition.</p><p id="840d">You <b>crossed a threshold </b>where, at certain times, your inability to use reasoning and rational thinking won’t even register for you.</p><p id="d8c6">The tragic truth is that once that threshold has been crossed, you have <b>no choice</b> but to relapse.</p><p id="0564">A compromised part of your brain will always fire the thought of using or acting out. That will never change. It’s wired like that for life.</p><p id="5fb0">There is no cure.</p><p id="fcca">Even this information won’t save you, as at certain times, you won’t be able to recall any of it when it matters.</p><p id="7fc5">So, let go of trying to change that.</p><p id="59f9">Let go of any old ideas around fighting it and instead get out of the way and <b>trust in something else</b>.</p><p id="b722">After all, that’s all you’ve got.</p><p id="5065">There’s nothing you or anyone else can do to stop this relapse condition.</p><p id="d1dd">But there’s everything you can do about everything else.</p><p id="5e51">There’s everything you can do about building a <b>spiritual dimension</b> to your life, by giving back, helping others, living in genuine faith and trusting in something greater than you.</p><p id="3096">There’s everything you can do to improve your awareness and intuition, raise your consciousness and develop another part of your brain.</p><p id="7598">And let this part of your brain grow bigger and stronger than that addictive part so that it can embrace and look after that compromised part.</p><p id="d2e3">Just like a bigger and wiser older sibling can care for and comfort a much younger upset sibling by giving that stressed child a big hug.</p><p id="da93">There’s everything you can do about deciding to take on a new attitude, direction, and way of life that will keep this condition dormant one day at a time.</p><p id="e415">If this article speaks to you, please follow, share and subscribe to me for more.</p><p id="fc50">Click <a href="https://twitter.com/TheDarrenJames">here</a> to follow me on <a href="https://twitter.com/TheDarrenJames">X</a>.</p></article></body>

Chapter 8 “ Documenting our APIs — Introduction to OpenAPI”

Building our first Webservice with Go (Part 5)

The following list is the previous chapters of this series:

I recommend you take a look at the previous chapters if you have not read them yet. That will help you to get more knowledge in this wonderful world of “Microservices architecture”.

Structure

In this chapter, the following topics will be covered:

  • Introduction to OpenAPI — Documenting our APIs
  • Advantages of using Open API
  • Document our APIs

Introduction

This chapter introduces one of the powerful technologies named OpenAPI which is commonly used in web development since it contributes to the important part of the microservices documentation more specialized in documenting the APIs definitions.

In this chapter will be mentioned the description of what OpenAPI is, how to create OpenAPI documentation, the advantages of using OpenAPI, and more.

By definition, we can find on its official website that OpenApi “The OpenAPI Specification is a specification language for HTTP APIs that provides a standardized means to define your API to others. You can quickly discover how an API works, configure infrastructure, generate client code, and create test cases for your APIs. Read more about how you can get control of your APIs now, understand the full API lifecycle, and communicate with developer communities inside and outside your organization”. You can find more information on the OpenAPI official website https://www.openapis.org/.

In other words, OpenAPI, formerly known as Swagger, is an open-source specification for describing and documenting “Application Programming Interfaces”. It is a valuable tool for API developers and providers as it enables the description of an API that is accessible via HTTP or HTTP-like protocols, helping to standardize and document consistently, making the API easier for other developers to understand and use.

Another feature is to provide a standard and understandable way to define the structure of a web API, including endpoints, allowed HTTP methods, parameters, expected responses, and other relevant information. These specifications are defined in either JSON or YAML format, allowing developers to describe how to interact with their API in a precise and detailed manner. In addition, it facilitates the automatic generation of interactive documentation and the creation of client libraries for different programming languages.

Advantages of using OpenAPI

When we implement OpenAPI as part of our software solution we are taking advantage of the significant advantages offered by this technology, which will facilitate the integration, the consumption of APIs, and the understanding of the APIs defined in our microservices. Listed below are the main benefits offered by OpenAPI.

Facilitates integration

OpenAPI provides a detailed description of the APIs, this simplifies integration into third-party applications, as developers can easily understand how to interact with the APIs and what to expect from the responses. This feature helps speed up the integration process in our development.

A contract between the provider and the consumer

OpenAPI serves as a clear and concise contract between the API provider and the API consumers. This improves collaboration between development teams and helps reduce misunderstandings related to API specifications.

Easier validation and testing

With the implementation of OpenAPI in our projects, it is possible to carry out validations and automatic tests in the API. This helps to catch bugs and potential problems at an early stage of development.

Encourages standardization

OpenAPI promotes the standardization of APIs, which facilitates interoperability between different services and applications. Consistent standards improve the experience of whoever is going to implement the APIs exposed in the service.

Reduces dependency between teams

When dedicated teams develop microservices and their APIs, OpenAPI provides exceptional support as it explains the documentation of the APIs in detail so that the developers who implement it do not have to be in constant communication to resolve doubts related to the operation of the API.

Facilitates API adoption and growth

By providing clear and structured documentation, OpenAPI makes it easier for other developers to adopt and implement the API in their projects. This can increase the popularity and growth of the API.

Documenting our APIs using OpenAPI

To write our OpenAPI document usually use a file with JSON or YAML types, commonly called openapi.json or openapi.yaml. The OpenAPI documentation could be constituted by the ROOT file and if there are too many APIs it can be split into multiple JSON or YAML files, for clarity.

This topic very briefly describes these two formats and compares them and we are going to see a little example.

OpenAPI YAML example:

The following block shows how a YAML file to define an OpenAPI documentation looks. In this example, the POST and GET APIs are related to products for the e-commerce application that we are using as an example.

openapi: 3.0.0
info:
  version: 1.0.0
  title: E-commerce Product API

tags:
  - name: Product Operations
    description: Endpoints related to product management

paths:
  /products:
    post:
      summary: Add a new product
      description: Allows adding a new product to the system
      operationId: addProduct
      tags:
        - Product Operations
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                price:
                  type: number
                  format: double
                quantity:
                  type: integer
              required:
                - name
                - price
                - quantity
            example:
              name: "T-Shirt"
              price: 19.99
              quantity: 100
      responses:
        '200':
          description: Product added successfully
        '400':
          description: Invalid product data

  /products/{id}:
    get:
      summary: Get a product by ID
      description: Retrieves an existing product from the system based on its ID
      operationId: getProductByID
      tags:
        - Product Operations
      parameters:
        - name: id
          in: path
          description: ID of the product to retrieve
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Product retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  price:
                    type: number
                    format: double
                  quantity:
                    type: integer
              example:
                id: "123456"
                name: "T-Shirt"
                price: 19.99
                quantity: 100
        '404':
          description: Product not found

OpenAPI JSON example:

The following shows how a JSON file to define OpenAPI documentation looks. In this example, we define the POST and GET APIs related to products for the e-commerce application that we are using as an example.

{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "E-commerce API",
    "description": "This is an example API for an e-commerce service."
  },
  "tags": [
    {
      "name": "Product Operations",
      "description": "Endpoints related to product management"
    }
  ],
  "paths": {
    "/products": {
      "post": {
        "summary": "Add a new product",
        "description": "Allows adding a new product to the system",
        "operationId": "addProduct",
        "tags": ["Product Operations"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "price": {
                    "type": "number",
                    "format": "double"
                  },
                  "quantity": {
                    "type": "integer"
                  }
                },
                "required": ["name", "price", "quantity"]
              },
              "example": {
                "name": "T-Shirt",
                "price": 19.99,
                "quantity": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Product added successfully"
          },
          "400": {
            "description": "Invalid product data"
          }
        }
      }
    },
    "/products/{id}": {
      "get": {
        "summary": "Get a product by ID",
        "description": "Retrieves an existing product from the system based on its ID",
        "operationId": "getProductByID",
        "tags": ["Product Operations"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "ID of the product to retrieve",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "price": {
                      "type": "number",
                      "format": "double"
                    },
                    "quantity": {
                      "type": "integer"
                    }
                  },
                  "example": {
                    "id": "123456",
                    "name": "T-Shirt",
                    "price": 19.99,
                    "quantity": 100
                  }
                }
              }
            }
          },
          "404": {
            "description": "Product not found"
          }
        }
      }
    }
  }
}

While both formats are valid for defining OpenAPI files, is important to mention the YAML format is more readable compared to the JSON file, which is the primary reason for its widespread adoption in OpenAPI solutions. YAML has become more popular due to its readability and ease of use, resulting in increased productivity and clearer code understanding for developers. However, it is essential to note that the choice between YAML and JSON depends on the specific preferences and requirements of the project at hand.

Below are additional comparisons between using YAML and JSON to define OpenAPI files:

  • Concise Syntax YAML employs a more concise and less repetitive syntax than JSON, making it easier to write and read for developers.
  • Comments YAML supports comments, allowing developers to add notes and explanations within the file, enhancing understanding and maintainability of the code.
  • Hierarchical Structure YAML utilizes a hierarchical structure based on indentation, providing a clearer and more natural organization of information compared to JSON’s nested structure.
  • No Need for Quoted to define Keys In YAML, keys do not require quotes, reducing the number of characters and improving readability compared to JSON, where keys must be quoted.
  • Support for Data Types YAML offers broader support for different data types, such as dates and regular expressions, making it more suitable for describing complex information compared to JSON.
  • Inheritance Support YAML supports inheritance, enabling the definition of templates and their extension at various points in the file, facilitating code reuse and structuring of complex files.

Retaking the files analyzed before, If we copy and paste the content of those files YAML or JSON in the online swagger editor ‘https://editor.swagger.io/’ we can review and validate if our description is correct. The output is the same for both options the only difference is the format used to write the documentation.

Using the Swagger Editor allows us to ensure the accuracy of our API descriptions, regardless of the chosen format, YAML or JSON. The editor streamlines the validation process, ensuring that our documentation adheres to the OpenAPI specifications and is visually represented in a user-friendly manner.

The following images show visual the result of OpenAPI:

Figure 2.5 shows how the APIs could be grouped by the related model or domain. In the example, the POST and GET products are part of Product Operations.

Figure 2.5: OpenAPI Product Operation Group

Figures 2.6 and 2.7 show the API details, In that view, could be seen the API specs, the path, query params, the request body, the response body, and the possible status codes. In addition, in that view, the API can be tested.

Figure 2.6: OpenAPI. API POST definition details

Figures 2.7 show the API details, In that view, could be seen the API specs, the path, query params, the request body, the response body, and the possible status codes. In addition, in that view, the API can be tested.

Figure 2.7: OpenAPI. API GET definition details.

Conclusion

Remember, OpenAPI is one of the most popular technologies for documenting APIs, as it plays a crucial role in API design and development, providing a standardized and efficient way to describe, document, and consume APIs, which improves collaboration, quality of code, interoperability, and API adoption in the development community.

Next readings …

Wait for Chapter 9 “Building a Microservice With Go”.

https://readmedium.com/chapter-9-building-a-microservice-with-go-124edb3845c7

Software Development
Software Engineering
Computer Science
Software Architecture
Programming Languages
Recommended from ReadMedium