<?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>Forem: jocimar-dev</title>
    <description>The latest articles on Forem by jocimar-dev (@jocimardev).</description>
    <link>https://forem.com/jocimardev</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%2F537391%2Fcb7ae930-ca4c-4888-a457-a9f701a5877c.jpeg</url>
      <title>Forem: jocimar-dev</title>
      <link>https://forem.com/jocimardev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jocimardev"/>
    <language>en</language>
    <item>
      <title>It's easier to understand technology concepts with playful comparisons.</title>
      <dc:creator>jocimar-dev</dc:creator>
      <pubDate>Thu, 25 May 2023 14:03:02 +0000</pubDate>
      <link>https://forem.com/jocimardev/its-easier-to-understand-technology-concepts-with-playful-comparisons-19jl</link>
      <guid>https://forem.com/jocimardev/its-easier-to-understand-technology-concepts-with-playful-comparisons-19jl</guid>
      <description>&lt;p&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%2Fpqy503kppyaq16gn05wh.jpeg" 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%2Fpqy503kppyaq16gn05wh.jpeg" alt="Image description" width="700" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I managed to better understand the technology concepts when I started to abstract and make comparisons with subjects that I have clear in my mind and the solutions that I need to implement.&lt;/p&gt;

&lt;p&gt;For example, to understand hexagonal architecture I did the following exercise:&lt;/p&gt;

&lt;p&gt;Let's imagine that we are building a secret club, right in the style of comic book stories. The structure of Hexagonal Architecture could be seen like this:&lt;/p&gt;

&lt;p&gt;Club Core (Domain/Business Logic): This is where the magic happens. This is the headquarters of our superhero league, where all major decisions and strategies are made.&lt;/p&gt;

&lt;p&gt;Club Manager (Application): This is the guy who coordinates everything. He doesn't decide the strategies, but he makes things happen. He's kind of like Alfred to Batman - he's not there to fight the villains, but without him, Batman would be lost.&lt;/p&gt;

&lt;p&gt;Club Headquarters (Infrastructure): This is the Batcave, the Stark Industries building, the place that keeps everything running. Here you find the tools, the computers, the vehicles... everything our heroes need to get the job done.&lt;/p&gt;

&lt;p&gt;Now, the coolest thing about this Hexagonal Architecture are the "ports" and "adapters". Let's call them "secret doors" and passports.&lt;/p&gt;

&lt;p&gt;The Secret Doors (Ports) are like the secret entrances and exits we have in the club. They are invisible to the outside world and can only be accessed using the correct passports.&lt;/p&gt;

&lt;p&gt;The Passports (Adapters) are like special keys that allow our superheroes (and only them!) to use the secret doors. They are the guarantee that our superhero league will not be discovered by the outside world.&lt;/p&gt;

&lt;p&gt;So, this is how Hexagonal Architecture works - a secret superhero club that keeps evil away! (I know it's silly but didactic).&lt;/p&gt;

&lt;p&gt;I hope this explanation has made Hexagonal Architecture a little cooler for you!&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.linkedin.com/posts/jocimar-neres_architecture-hexagon-java-activity-7067503276987940865-wnVx?utm_source=share&amp;amp;amp%3Butm_medium=member_desktop" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.licdn.com%2Fdms%2Fimage%2Fv2%2FD4D22AQFaIKeU3jpL8Q%2Ffeedshare-shrink_2048_1536%2Ffeedshare-shrink_2048_1536%2F0%2F1685024088231%3Fe%3D2147483647%26v%3Dbeta%26t%3D7nGIQc8QkJs1YQ1TqRZxHnBCJL8vc1gd1XB4FiOAEoM" height="1000" class="m-0" width="700"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.linkedin.com/posts/jocimar-neres_architecture-hexagon-java-activity-7067503276987940865-wnVx?utm_source=share&amp;amp;amp%3Butm_medium=member_desktop" rel="noopener noreferrer" class="c-link"&gt;
          Jocimar Neres on LinkedIn: #architecture #hexagon #java #kotlin
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          É mais fácil entender conceitos de tecnologia com comparativos lúdicos.

Eu consegui entender melhor os conceitos de tecnologia quando passei a abstrair e…
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Faero-v1%2Fsc%2Fh%2Fal2o9zrvru7aqj8e1x2rzsrca" width="800" height="400"&gt;
        linkedin.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Null Safety - Kotlin</title>
      <dc:creator>jocimar-dev</dc:creator>
      <pubDate>Tue, 06 Dec 2022 03:01:58 +0000</pubDate>
      <link>https://forem.com/jocimardev/null-safety-kotlin-h1m</link>
      <guid>https://forem.com/jocimardev/null-safety-kotlin-h1m</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Um dos contratempos mais comuns em muitas linguagens de programação, como o &lt;a href="https://www.java.com/pt-BR/" rel="noopener noreferrer"&gt;Java&lt;/a&gt;, é que acessar um membro de uma referência nula resultará em uma exceção de referência nula. Em Java, isso seria o equivalente a um &lt;a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html" rel="noopener noreferrer"&gt;NullPointerException &lt;/a&gt;ou NPE para abreviar.&lt;br&gt;
O sistema de tipos do &lt;a href="https://kotlinlang.org/" rel="noopener noreferrer"&gt;Kotlin &lt;/a&gt;visa eliminar NullPointerException do nosso código.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Kotlin fornece operadores Safe call(?.) , Elvis(?:), Not-null assertion(!!) para trabalhar em tipos anuláveis.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Safe Call(?.)&lt;br&gt;
Você pode usar o operador de chamada segura (?.) se não quiser lançar uma NullPointerException ao tentar acessar a referência anulável "safeCall"&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;val safeCall: String? = null
println(safeCall?.length)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Retorna null se for anulável e não lançará NullPointerException&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Elvis Operator(?:)&lt;br&gt;
Quando temos uma referência anulável da variável "valor", podemos dizer “se 'valor' não for nulo, use-o, caso contrário, use algum valor não nulo”:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;val valor: Int =
    if (valorVariavel != null) valorVariavel.length
    else -1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O código acima pode ser expresso com o Elvis Operator, escrito ?:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;valorVariavel?.length ?: -1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Se a expressão à esquerda de ?: não for nula, o Elvis Operator a retorna, caso contrário, retorna a expressão à direita. Observe que a expressão do lado direito é avaliada somente se o lado esquerdo for nulo&lt;/p&gt;

&lt;p&gt;Outro exemplo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fun foo(node: Node): String? {
    val parent = node.getParent() ?: return null
    val name = node.getName() ?: throw IllegalArgumentException("Exceção lançada")

    parent.getParent()?.getName()?.length

    return name
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Not-null assertion operator(!!)&lt;br&gt;
No caso abaixo, se a variável "pergunta" for nula, ocorrerá através da exceção de ponteiro nulo. Você pode usar (!!) se quiser lançar explicitamente uma exceção se o tipo for anulável.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;val pergunta: String? = null
pergunta!!.toInt()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>deno</category>
      <category>python</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
