<?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: José María CL</title>
    <description>The latest articles on DEV Community by José María CL (@chema).</description>
    <link>https://dev.to/chema</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%2F105808%2F51b26596-dd65-4377-8eb0-37bfb87637da.jpeg</url>
      <title>DEV Community: José María CL</title>
      <link>https://dev.to/chema</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chema"/>
    <language>en</language>
    <item>
      <title>Cómo comunicarte mejor con tu IA de cabecera</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Sun, 23 Mar 2025 20:47:23 +0000</pubDate>
      <link>https://dev.to/chema/como-comunicarte-mejor-con-tu-ia-de-cabecera-1n8j</link>
      <guid>https://dev.to/chema/como-comunicarte-mejor-con-tu-ia-de-cabecera-1n8j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; Esto no es un post enteramente escrito por mi. Es un texto condensado a partir de las respuestas que me dio Cursor AI mientras conversabamos.&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Hola. Hace unos días decidí experimentar trabajando con Cursor AI y dejando que hiciera la mayor cantidad del trabajo posible sin que yo interviniera más que para dar instrucciones. Muy pronto descubrí 4 cosas:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;El reto de pensar los pasos y soluciones no te lo ahorras, más bien ese se vuelve tu principal responsabilidad.&lt;/li&gt;
&lt;li&gt;La IA hace muy bien el trabajo duro de escritura de código, y es capaz de tomar decisiones bien enfocadas y delimitadas.&lt;/li&gt;
&lt;li&gt;No solo se trata de dar instrucciones, también hay que escuchar&lt;/li&gt;
&lt;li&gt;Nos volvemos un equipo de 2, así que el eje principal es la comunicación. Entre mejor comunicación y claridad tengamos el uno con el otro, ambos somos más conscientes de lo que está pasando.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🤔 ¿Hay a estas alturas una metodología o técnica que nos permita trabajar lo mejor posible con nuestro aliado virtual? La verda, lo desconozco. No he leído artículos "serios" pero sí que he recibido consejos de colegas que ya han estado trabajando de esta manera desde hace algún tiempo. Además, le he pedido al mismo Cursor AI que me diera recomendaciones para hacerme entender mejor. Esto es lo que me ha dicho:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;🤖 Cursor AI:&lt;/strong&gt; Para ayudarme a entender mejor tus requerimientos &lt;br&gt;
y ser más efectivo, te sugiero seguir estas pautas:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Estructura recomendada para las Instrucciones:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Objetivo: [Descripción clara del objetivo]
Contexto: [Información relevante del sistema/componente]
Requisitos: [Lista de requisitos específicos]
Restricciones: [Limitaciones o consideraciones especiales]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Como yo le solicito las cosas al empezar a trabajar en la feature:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Hola. Vamos a crear un endpoint nuevo en el proyecto. 

El objetivo es implementar un nuevo endpoint que cubra el caso de uso de actualización parcial del usuario.

Antes de empezar, analiza el módul "auth" en el que implementé la creación de usuarios. Pon atención al estilo y patrón: 

el controlador de express está en infrastructure/routes. Este se encarga preparar los colaboradores para pasarlos al servicio de aplicación. En application se realiza la de verificación de existencia del usuario, verificación del payload, persistencia de datos a través del userRepository, respuesta del resultado y gestión de errores

Los requisitos son:
&lt;span class="p"&gt;-&lt;/span&gt; Crear endpoint patch /users/:id
&lt;span class="p"&gt;-&lt;/span&gt; Actualización parcial del usuario y su perfil
&lt;span class="p"&gt;-&lt;/span&gt; Mantener los datos existentes no incluidos en el payload
&lt;span class="p"&gt;-&lt;/span&gt; Validar datos&lt;span class="sb"&gt;


&lt;/span&gt;Restricciones:
&lt;span class="p"&gt;-&lt;/span&gt; Realizar los nuevos cambios en el módulo de users
&lt;span class="p"&gt;-&lt;/span&gt; Gestionar errores usando custom exceptions. Agregar nuevas si es necesario o reutilizar las existentes si es apropiado
&lt;span class="p"&gt;-&lt;/span&gt; No intentes corregir errores de eslint
&lt;span class="p"&gt;-&lt;/span&gt; Usa el mismo estilo que se ha usado para el signup y signin

Orden de los cambios:
Primero realiza los cambios nucleares en el repository y finalmente la ruta de express
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A partir de ahí voy haciendo las correcciones, ajustes y siguientes pasos con instrucciones más pequeñas.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ejemplo de una Solicitud Bien Estructurada según Cursor AI (un poco excesivo para mi gusto, pero funciona):
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Objetivo: Implementar endpoint PATCH para actualización parcial de usuarios

Contexto:
&lt;span class="p"&gt;-&lt;/span&gt; Módulo de users
&lt;span class="p"&gt;-&lt;/span&gt; Seguir patrones existentes del módulo de auth
&lt;span class="p"&gt;-&lt;/span&gt; Implementar actualización parcial (PATCH)
&lt;span class="p"&gt;-&lt;/span&gt; Mantener consistencia con la arquitectura actual

Requisitos:
&lt;span class="p"&gt;1.&lt;/span&gt; Endpoint PATCH /users/:id
&lt;span class="p"&gt;2.&lt;/span&gt; Actualización parcial de datos del usuario y su perfil
&lt;span class="p"&gt;3.&lt;/span&gt; Solo el ID es requerido en el payload
&lt;span class="p"&gt;4.&lt;/span&gt; Mantener datos existentes no incluidos en el payload
&lt;span class="p"&gt;5.&lt;/span&gt; Implementar validación de datos
&lt;span class="p"&gt;6.&lt;/span&gt; Seguir el patrón de manejo de errores existente

Estructura de Datos:
Payload esperado (todos los campos son opcionales excepto id):
{
  "id": string,
  "fullName": string,
  "email": string,
  "phone": string,
  "status": "active" | "inactive" | "banned",
  "onlineStatus": "online" | "offline" | "away"
}

Componentes a Modificar/Crear:
&lt;span class="p"&gt;1.&lt;/span&gt; Interface UserRepository:
&lt;span class="p"&gt;   -&lt;/span&gt; Añadir método update(user: User): Promise&lt;span class="nt"&gt;&amp;lt;User&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;
2.&lt;/span&gt; PrismaUserRepository:
&lt;span class="p"&gt;   -&lt;/span&gt; Implementar método update
&lt;span class="p"&gt;   -&lt;/span&gt; Manejar actualización parcial de datos
&lt;span class="p"&gt;   -&lt;/span&gt; Mantener datos existentes
&lt;span class="p"&gt;
3.&lt;/span&gt; Routes:
&lt;span class="p"&gt;   -&lt;/span&gt; Crear endpoint PATCH
&lt;span class="p"&gt;   -&lt;/span&gt; Implementar validación de datos
&lt;span class="p"&gt;   -&lt;/span&gt; Manejar errores
&lt;span class="p"&gt;
4.&lt;/span&gt; Validators:
&lt;span class="p"&gt;   -&lt;/span&gt; Crear schema de validación para actualización parcial

Restricciones:
&lt;span class="p"&gt;-&lt;/span&gt; Mantener la estructura de dominios actual
&lt;span class="p"&gt;-&lt;/span&gt; Seguir el patrón de manejo de errores existente
&lt;span class="p"&gt;-&lt;/span&gt; Validar datos según reglas de negocio
&lt;span class="p"&gt;-&lt;/span&gt; Mantener la consistencia de datos

Consideraciones Técnicas:
&lt;span class="p"&gt;-&lt;/span&gt; Usar el mismo patrón de manejo de errores que auth
&lt;span class="p"&gt;-&lt;/span&gt; Mantener la separación de responsabilidades
&lt;span class="p"&gt;-&lt;/span&gt; Seguir el patrón de validación existente
&lt;span class="p"&gt;-&lt;/span&gt; Implementar logs para debugging

¿Podrías proceder con la implementación siguiendo este orden:
&lt;span class="p"&gt;1.&lt;/span&gt; Interface y Repository
&lt;span class="p"&gt;2.&lt;/span&gt; Validator
&lt;span class="p"&gt;3.&lt;/span&gt; Route
&lt;span class="p"&gt;4.&lt;/span&gt; Tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Esta estructura me ayuda a:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Entender claramente el alcance del cambio&lt;/li&gt;
&lt;li&gt;Identificar los componentes que necesito modificar&lt;/li&gt;
&lt;li&gt;Mantener la consistencia con el código existente&lt;/li&gt;
&lt;li&gt;Seguir el patrón de arquitectura actual&lt;/li&gt;
&lt;li&gt;Implementar la funcionalidad de manera incremental&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Para Describir Cambios o Nuevas Funcionalidades:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Antes: "Quiero que hagas X"&lt;/li&gt;
&lt;li&gt;Mejor: "Necesito implementar X porque [razón] y debe cumplir con [requisitos específicos]"&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Reportar Problemas:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Antes: "No funciona el endpoint"&lt;/li&gt;
&lt;li&gt;Mejor: "El endpoint /api/auth/signin devuelve error 500 cuando [condición específica]"&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Solicitar Mejoras:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Antes: "Hazlo más rápido"&lt;/li&gt;
&lt;li&gt;Mejor: "Necesito optimizar el rendimiento del endpoint X para manejar Y peticiones por segundo"&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Manejar Complejidad:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Dividir las tareas grandes en subtareas&lt;/li&gt;
&lt;li&gt;Especificar el orden de prioridad&lt;/li&gt;
&lt;li&gt;Indicar dependencias entre componentes&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Validar Cambios:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Proporcionar ejemplos de casos de uso&lt;/li&gt;
&lt;li&gt;Especificar el comportamiento esperado&lt;/li&gt;
&lt;li&gt;Indicar cómo probar los cambios&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Contexto Técnico:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Mencionar versiones de dependencias relevantes&lt;/li&gt;
&lt;li&gt;Indicar restricciones de infraestructura&lt;/li&gt;
&lt;li&gt;Especificar patrones de diseño a seguir&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Decisiones de Arquitectura:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Proporcionar contexto del sistema actual&lt;/li&gt;
&lt;li&gt;Mencionar consideraciones de escalabilidad&lt;/li&gt;
&lt;li&gt;Indicar restricciones de rendimiento&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Manejo de Errores:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Describir el comportamiento actual&lt;/li&gt;
&lt;li&gt;Especificar el comportamiento deseado&lt;/li&gt;
&lt;li&gt;Proporcionar logs o ejemplos de error&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Para Testing:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Especificar casos de prueba&lt;/li&gt;
&lt;li&gt;Indicar cobertura esperada&lt;/li&gt;
&lt;li&gt;Mencionar tipos de pruebas necesarias&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ideas finales
&lt;/h2&gt;

&lt;p&gt;Iré actualizando esto según entienda mejor cómo trabajar de esta manera. Son nuevos tiempos. Una nueva manera de hacer las cosas, y deberíamos usar esto a nuestro favor antes de que alguien lo vuelva hacia nuestra contra.&lt;/p&gt;

&lt;p&gt;Si tienes consejos, correcciones y observaciones, por favor compartelas :)&lt;/p&gt;

</description>
      <category>ai</category>
      <category>coding</category>
      <category>programming</category>
      <category>tooling</category>
    </item>
    <item>
      <title>How are you so productive</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Sat, 25 Jan 2025 21:34:31 +0000</pubDate>
      <link>https://dev.to/chema/how-are-you-so-productive-31o7</link>
      <guid>https://dev.to/chema/how-are-you-so-productive-31o7</guid>
      <description></description>
      <category>productivity</category>
    </item>
    <item>
      <title>Cómo usar varias SSH keys para diferentes repositorios de GitHub (o GitLab)</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Mon, 04 Nov 2024 07:36:40 +0000</pubDate>
      <link>https://dev.to/chema/como-usar-varias-ssh-keys-para-diferentes-repositorios-de-github-o-gitlab-e58</link>
      <guid>https://dev.to/chema/como-usar-varias-ssh-keys-para-diferentes-repositorios-de-github-o-gitlab-e58</guid>
      <description>&lt;h1&gt;
  
  
  Introducción
&lt;/h1&gt;

&lt;p&gt;Hola. Hoy veremos algunas configuraciones para trabajar con repositorios de diferentes cuentas de GitHub o GitLab.&lt;/p&gt;

&lt;p&gt;Git y GitHub nos sugieren una configuración global y general que es útil para la gran mayoría de los usuarios:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Instalar Git&lt;/li&gt;
&lt;li&gt;Configurar el name y el email globales para la firma de commits&lt;/li&gt;
&lt;li&gt;Generar keys SSH personales&lt;/li&gt;
&lt;li&gt;Configurar las keys en GitHub&lt;/li&gt;
&lt;li&gt;Clonar el repo con SSH&lt;/li&gt;
&lt;li&gt;Ser felices&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sin embargo, hay un caso más o menos común en el que, ya sea por el trabajo o proyectos personales, tenemos que trabajar con diferentes cuentas de GitHub o GitLab, con diferente usuario o correo en la firma, y desde la misma computadora.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resúmen
&lt;/h2&gt;

&lt;p&gt;El truco es simple. Se trata de algunos ajustes de configuración SSH y de Git:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(SSH) Generar una key SSH diferente  para cada cuenta de GitHub&lt;/li&gt;
&lt;li&gt;(SSH) Crear un archivo de configuración SSH global&lt;/li&gt;
&lt;li&gt;(Git) Configurar el remote origin de cada repositorio&lt;/li&gt;
&lt;li&gt;(Git) Settear el name y el email para cada repositorio&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚠️ Consideraciones
&lt;/h2&gt;

&lt;p&gt;En este post usaremos el remote con &lt;strong&gt;SSH&lt;/strong&gt;. Si ya clonaste el repositorio usando la opción &lt;strong&gt;HTTPS&lt;/strong&gt; dirígete al &lt;strong&gt;final del post&lt;/strong&gt; para cambiar la URL del remote y poder continuar con el tutorial.&lt;/p&gt;

&lt;p&gt;Para verificar qué tipo de clonación escogiste cuando clonaste el repo, lo puedes averiguar llendo a tu repositorio en la terminal y usando el comando &lt;code&gt;git remote -v&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;En este ejemplo podemos ver que en la salida aparece https, lo que significa que tendríamos que cambiar la url para que sea ssh.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Navegar al repositorio&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Documents/work/git-tricks-and-tutorials

&lt;span class="c"&gt;# Mostrar el remote&lt;/span&gt;
git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;span class="c"&gt;# origin    https://github.com/ChemaCLi/git-tricks-and-tutorials.git (fetch)&lt;/span&gt;
&lt;span class="c"&gt;# origin    https://github.com/ChemaCLi/git-tricks-and-tutorials.git (push)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Objetivo del ejercicio
&lt;/h2&gt;

&lt;p&gt;Supongamos que tenemos 2 cuentas de GitHub: Una cuenta personal y una cuenta del trabajo. Lo que haremos es crear una configuración &lt;code&gt;personal&lt;/code&gt; para la cuenta personal, y una configuración &lt;code&gt;work&lt;/code&gt; para la cuenta de nuestro trabajo.&lt;/p&gt;
&lt;h1&gt;
  
  
  1. Generar y preparar las nuevas keys SSH
&lt;/h1&gt;

&lt;p&gt;Lo primero que debemos hacer es navegar a la carpeta &lt;code&gt;.ssh&lt;/code&gt; de nuestra computadora.&lt;/p&gt;

&lt;p&gt;El directorio &lt;code&gt;.ssh&lt;/code&gt; debe estar en la ruta raíz de tu usuario. Si no la puedes ver, asegúrate de que la opción "Ver archivos ocultos" esté habilitada en tu Sistema Operativo (MacOS, Linux o Windows).&lt;/p&gt;

&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%2F8o31j21s3hm8awf3tgel.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%2F8o31j21s3hm8awf3tgel.png" alt="ssh directory example" width="676" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dentro del directorio &lt;code&gt;.ssh&lt;/code&gt; encontrarás los archivos &lt;code&gt;id_rsa&lt;/code&gt; y &lt;code&gt;id_rsa.pub&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Si no existen, revisa la sección de &lt;code&gt;Consideraciones&lt;/code&gt; de este post por favor.&lt;/p&gt;

&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%2Fhagz9q3a8s9mf11x0wic.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%2Fhagz9q3a8s9mf11x0wic.png" alt="list of keys in explorer" width="726" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;En mi caso estas son las keys que uso para mis proyectos personales, así que crearé una carpeta &lt;code&gt;personal&lt;/code&gt; para colocarlas allí, y crearé una carpeta &lt;code&gt;work&lt;/code&gt; para la cuenta del trabajo&lt;/p&gt;

&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%2Fnrtxh1dmkd36zpi35shd.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%2Fnrtxh1dmkd36zpi35shd.png" alt="keys organized in folders" width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lo siguiente será crear una nueva key SSH para el trabajo (usando el email de mi trabajo) con los siguientes comandos:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Navega a la carpeta .ssh/work&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.ssh/work
&lt;span class="c"&gt;# Genera la nueva key allí dentro&lt;/span&gt;
ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"chema@devu.community"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Al presionar &lt;strong&gt;Enter&lt;/strong&gt; nos preguntará qué nombre le queremos dar al archivo. Te sugiero que le pongas el nombre de la empresa de tu trabajo para evitar confusiones. Usaré &lt;strong&gt;"devu"&lt;/strong&gt; en mi caso.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Enter file &lt;span class="k"&gt;in &lt;/span&gt;which to save the key &lt;span class="o"&gt;(&lt;/span&gt;/Users/chema/.ssh/id_rsa&lt;span class="o"&gt;)&lt;/span&gt;: devu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Presiona &lt;strong&gt;Enter&lt;/strong&gt; un par de veces para continuar sin poner una contraseña, o especifica una si lo prefieres.&lt;/p&gt;

&lt;p&gt;Ahora tendrás tus keys ssh organizadas de esta manera:&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%2Fuqsx1l54m08admzt2xml.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%2Fuqsx1l54m08admzt2xml.png" alt="keys organized in folders" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lo siguiente por hacer es agregar la nueva SSH key en tu cuenta de GitHub del trabajo. Si no sabes cómo hacerlo, puedes seguir las instrucciones del &lt;strong&gt;paso 4&lt;/strong&gt; de la guía que escribí en este otro post:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/chema" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F105808%2F51b26596-dd65-4377-8eb0-37bfb87637da.jpeg" alt="chema"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/chema/instalar-y-configurar-git-con-github-en-mac-y-gnulinux-12op" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Cómo instalar y configurar Git y SSH con GitHub en Mac, GNU/Linux o Windows (GitBash)&lt;/h2&gt;
      &lt;h3&gt;José María CL ・ Jan 9 '22&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#git&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#español&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;h1&gt;
  
  
  2. Archivo config SSH
&lt;/h1&gt;

&lt;p&gt;La clave y la magia de todo lo que estamos haciendo recae en gran parte sobre este paso, así que presta atención.&lt;/p&gt;

&lt;p&gt;Crea un archivo de texto plano con el nombre &lt;code&gt;config&lt;/code&gt; dentro de tu carpeta &lt;code&gt;.ssh&lt;/code&gt;. Asegúrate de que no tenga la extensión &lt;code&gt;.txt&lt;/code&gt; o cualquier otra. El nombre del archivo debe ser &lt;code&gt;config&lt;/code&gt; únicamente.&lt;/p&gt;

&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%2Fec8ntc6jxj9ej10ajlz1.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%2Fec8ntc6jxj9ej10ajlz1.png" alt="config file created" width="800" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ahora ábrelo con el editor de texto de tu preferencia (Bloc de notas, Editor, VSCode, Sublime Text, etc.) y escribe este contenido, poniendo el nombre de tu empresa en lugar de &lt;strong&gt;"devu"&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Configuracion de GitHub para mi cuenta Personal
Host github.com-personal
  HostName github.com
  User git
  IdentityFile ~/.ssh/personal/id_rsa

# Configuracion de GitHub para mi trabajo en Devu
Host github.com-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/work/devu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Guarda los cambios y cierra el archivo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Presta mucha atención a este detalle.&lt;/strong&gt; Estamos usando un Host &lt;code&gt;github.com-personal&lt;/code&gt; y un Host &lt;code&gt;github.com-work&lt;/code&gt;. El sufijo &lt;code&gt;-personal&lt;/code&gt; y &lt;code&gt;-work&lt;/code&gt; le servirá a Git para escoger qué keys usar más adelante.&lt;/p&gt;

&lt;p&gt;Además, el &lt;strong&gt;IdentityFile&lt;/strong&gt; de cada configuración debe coincidir con los nombres de las carpetas y keys que creamos.&lt;/p&gt;
&lt;h1&gt;
  
  
  3. Configurar el remote origin del repositorio
&lt;/h1&gt;
&lt;h3&gt;
  
  
  Si vas a clonar/descargar el repo por primera vez
&lt;/h3&gt;

&lt;p&gt;Escribe en la terminal el comando de &lt;code&gt;git clone&lt;/code&gt;, pega la URL de tipo SSH, y modifícala para que el host quede como &lt;strong&gt;github.com-work&lt;/strong&gt; si es un repo de tu cuenta del trabajo, o &lt;strong&gt;github.com-personal&lt;/strong&gt; si es tu repo de la cuenta personal.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github.com-work:ChemaCLi/git-tricks-and-tutorials.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Si ya tienes el repo clonado/descargado
&lt;/h3&gt;

&lt;p&gt;Escribe en la terminal los siguientes comandos para navegar a tu repositorio, verificar la &lt;code&gt;URL&lt;/code&gt; del &lt;code&gt;remote&lt;/code&gt; &lt;code&gt;origin&lt;/code&gt;, y modificarla para que utilice la configuración &lt;code&gt;work&lt;/code&gt; que definimos  en el paso 2.&lt;/p&gt;

&lt;p&gt;Para este ejercicio usaré un repositorio llamado "git-tricks-and-tutorials", y tú deberías usar el repositorio que te interesa configurar.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Navegar al repositorio&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Documents/work/git-tricks-and-tutorials/

&lt;span class="c"&gt;# Verificar el remote origin&lt;/span&gt;
git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;span class="c"&gt;# Aparecerá algo como esto&lt;/span&gt;
&lt;span class="c"&gt;# origin    git@github.com:ChemaCLi/git-tricks-and-tutorials.git (fetch)&lt;/span&gt;
&lt;span class="c"&gt;# origin    git@github.com:ChemaCLi/git-tricks-and-tutorials.git (push)&lt;/span&gt;

&lt;span class="c"&gt;# Modificar la URL para que ahora use el host github.com-work&lt;/span&gt;
git remote set-url origin git@github.com-work:ChemaCLi/git-tricks-and-tutorials.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Ahora verifica la nueva configuración del remote origin de Git.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;span class="c"&gt;# origin    git@github.com-work:ChemaCLi/git-tricks-and-tutorials.git (fetch)&lt;/span&gt;
&lt;span class="c"&gt;# origin    git@github.com-work:ChemaCLi/git-tricks-and-tutorials.git (push)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Y finalmente valida que puedas comunicarte con GitHub haciendo git pull:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull &lt;span class="nt"&gt;--ff&lt;/span&gt;
&lt;span class="c"&gt;# Already up to date.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Si te arroja un error, por favor escríbelo en los comentarios y responderé de inmediato para ayudarte y corregir la guía.&lt;/p&gt;
&lt;h1&gt;
  
  
  4. Settear firma de Git para el repositorio actual
&lt;/h1&gt;

&lt;p&gt;Último paso para detalles finos. Si has logrado llegar hasta aquí, felicidades! solo nos queda un pequeño detalle más para contar con una configuración completa.&lt;/p&gt;

&lt;p&gt;Vamos a hacer que el nombre y el email que aparecen en cada commit sea diferente para nuestro repositorio (en este caso el repo del trabajo)&lt;/p&gt;

&lt;p&gt;Ingresa estos comandos para settear tu firma para el repositorio del trabajo:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config user.email chema@devu.community 
git config user.name ChemaCL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Verifica la configuración con el comando &lt;code&gt;git config --list&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Esta configuración aparecerá hasta abajo&lt;/span&gt;
remote.origin.url&lt;span class="o"&gt;=&lt;/span&gt;git@github.com-work:ChemaCLi/git-tricks-and-tutorials.git
remote.origin.fetch&lt;span class="o"&gt;=&lt;/span&gt;+refs/heads/&lt;span class="k"&gt;*&lt;/span&gt;:refs/remotes/origin/&lt;span class="k"&gt;*&lt;/span&gt;
branch.main.remote&lt;span class="o"&gt;=&lt;/span&gt;origin
branch.main.merge&lt;span class="o"&gt;=&lt;/span&gt;refs/heads/main
user.email&lt;span class="o"&gt;=&lt;/span&gt;chema@devu.community
user.name&lt;span class="o"&gt;=&lt;/span&gt;ChemaCLi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Lo lograste! a partir de ahora cuando hagas &lt;code&gt;pull&lt;/code&gt; o &lt;code&gt;push&lt;/code&gt; usarás la SSH de tu trabajo para el repositorio del trabajo, y firmarás tus commits con los datos de tu trabajo.&lt;/p&gt;

&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%2Fya826let0qobwqpndkeu.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%2Fya826let0qobwqpndkeu.png" alt="Verification of sign" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ahora intenta configurar el remote origin tus repositorios de tu cuenta personal para que usen la ssh de la carpeta &lt;code&gt;personal&lt;/code&gt;. Puedes lograrlo siguiendo el paso 3 de esta guía. También recuerda que debes modificar el remote origin de todos los repositorios que hayas clonado. Pero descuida, solo tienes que hacerlo cuando lo necesites, no vayas a enloquecer.&lt;/p&gt;

&lt;p&gt;Si algo falló, revisa bien tus configuraciones para descargar errores en los nombres de archivos y carpetas.&lt;/p&gt;

&lt;p&gt;Si tienes dudas, correcciones o sugerencias, envía tus comentarios de manera respetuosa y los atenderé en cuanto me sea posible. Éxito!&lt;/p&gt;
&lt;h1&gt;
  
  
  Cambiar de HTTPS a SSH
&lt;/h1&gt;

&lt;p&gt;Lo primero que debes hacer es verificar si ya tienes configurada una key SSH antes de continuar. También tendrás que asegurarte de configurar la key en la cuenta de GitHub del repositorio que estás intentando cambiar.&lt;/p&gt;

&lt;p&gt;Para ello te recomiendo seguir esta otra guía a partir del &lt;strong&gt;paso 3&lt;/strong&gt;:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/chema" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F105808%2F51b26596-dd65-4377-8eb0-37bfb87637da.jpeg" alt="chema"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/chema/instalar-y-configurar-git-con-github-en-mac-y-gnulinux-12op" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Cómo instalar y configurar Git y SSH con GitHub en Mac, GNU/Linux o Windows (GitBash)&lt;/h2&gt;
      &lt;h3&gt;José María CL ・ Jan 9 '22&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#git&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#español&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;Cuando tu key SSH esté configurada en GitHub, lo siguiente es dirigirte a tu repositorio en GitHub, buscar la opción &lt;code&gt;Clone&lt;/code&gt; y copiar la URL ssh.&lt;/p&gt;

&lt;p&gt;En este caso mi URL para trabajar con SSH es esta:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;git&lt;/span&gt;@github.com:ChemaCLi/git-tricks-and-tutorials.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&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%2F80os8wujt8s2w3j84c15.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%2F80os8wujt8s2w3j84c15.png" alt="Example in github of ssh clone" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ahora debes navegar al directorio en donde se encuentre clonado tu repositorio y asignar la nueva URL al remote &lt;code&gt;origin&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote set-url origin git@github.com:ChemaCLi/git-tricks-and-tutorials.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Listo, ya estás usando ssh a partir de ahora. Para verificar la configuración escribe el comando &lt;code&gt;git remote -v&lt;/code&gt; y deberías ver una salida como la siguiente:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;span class="c"&gt;# origin    git@github.com:ChemaCLi/git-tricks-and-tutorials.git (fetch)&lt;/span&gt;
&lt;span class="c"&gt;# origin    git@github.com:ChemaCLi/git-tricks-and-tutorials.git (push)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recuerda que un &lt;code&gt;remote&lt;/code&gt; es simplemente un repositorio remoto con el que te puedes comunicar para sincronizar cambios. Y el &lt;code&gt;remote&lt;/code&gt; llamado &lt;code&gt;origin&lt;/code&gt; es simplemente el &lt;code&gt;remote&lt;/code&gt; principal.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>setup</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Un buen libro para aprender y educar en programación</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Fri, 14 Jun 2024 02:51:23 +0000</pubDate>
      <link>https://dev.to/chema/un-buen-libro-para-aprender-y-educar-en-programacion-20li</link>
      <guid>https://dev.to/chema/un-buen-libro-para-aprender-y-educar-en-programacion-20li</guid>
      <description>&lt;p&gt;Hola. Recientemente he estado dandole forma a contenido educativo para enseñar programación y dar unas mentorías. Y de paso, para recordar y reaprender los fundamentos.&lt;/p&gt;

&lt;p&gt;En un punto me dio por recordar cómo fue que yo empecé a aprender, y cómo fue mi proceso 🤔.&lt;/p&gt;

&lt;p&gt;Definitivamente no fue algo que podamos llamar "straightforward" 😅. Estaba muy confundido y siendo honesto, me aterraban los temas complejos. Muchos de esos temas complicados los evité por años con la esperanza de algún día entenderlos. En general, no sabía qué hacer para aprender a programar 🤷🏻.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Un golpe de suerte
&lt;/h2&gt;

&lt;p&gt;Entre tantas cosas que fui tomando de internet y decifrando en las clases de la ing. en sistemas, un buen día tuve la suerte de ir con unos amigos a una feria del libro en Orizaba (FILO) y encontré un libro llamado &lt;strong&gt;Programación Orientada a Objetos con C++ y Java&lt;/strong&gt; 😀. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fba0myon6wzm9cmmcwzog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fba0myon6wzm9cmmcwzog.png" alt="Cover del libro" width="800" height="1062"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Estaba totalmente sellado y costaba unos 17 dólares (precio de hoy en 2024). Eso era un poco más de lo que disponía semanalmente, pero tenía la esperanza de que mis dudas se aclararían ahí, o al menos tener algo de dirección.&lt;/p&gt;

&lt;h2&gt;
  
  
  🌱 Una eventual y agradable sorpresa
&lt;/h2&gt;

&lt;p&gt;El chiste es que a los pocos días pude conseguir lo suficiente y lo compré. Llegué a casa y me llevé una sorpresa al abrirlo. ¡Traía un CD, que lujo! jaja.&lt;/p&gt;

&lt;p&gt;En realidad la sorpresa fue que el libro no enseñaba a programar directamente como otros recursos pretendían en la época (2016). Este libro más bien tenía la intención de involucrar las disciplinas esenciales de la programación y la ing. de software, para prepararnos como ingenieros de software y no solo como codificadores.&lt;/p&gt;

&lt;h2&gt;
  
  
  🌳 Cómo influyó en mi formación
&lt;/h2&gt;

&lt;p&gt;El nombre completo del libro es &lt;strong&gt;Programación Orientada a Objetos con C++ y Java, un acercamiento interdisciplinario&lt;/strong&gt;, por los autores &lt;strong&gt;Jose Luis Lopez Goytia y Angel Gutierrez Gonzalez&lt;/strong&gt;, profesores en el Instituto Politécnico Nacional (en México es una de las escuelas más importantes.)&lt;/p&gt;

&lt;p&gt;Hoy que lo he recordado, y vuelto a leer en The Internet Archive (porque lo presté y no ha vuelto a mis manos) me doy cuenta de que los capítulos 1-3 me "educaron" bajo su metodología al abordar problemas que necesitan ser resueltos con software.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fl15rbybkt7pj9xxv79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fl15rbybkt7pj9xxv79.png" alt="Screenshot en The Internet Archive" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No me había dado cuenta de que al día de hoy tengo interiorizados varios del los principios que el libro presenta.&lt;/p&gt;

&lt;p&gt;Sin darnos cuenta, el libro funje como un curso profesional en el que aprendemos a crear software metodológica y estratégicamente, llevando a cabo buenas prácticas al analizar, diseñar, codificar y verificar.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧑🏻‍🏫 👩🏻‍💻 ¿Por qué y a quién lo recomiendo?
&lt;/h2&gt;

&lt;p&gt;Este es un libro que personalmente recomiendo para las personas que empiezan la carrera de ing. de software o de sistemas, y a quienes quieren aprender a programar profesionalmente. Para hacer el software de calidad que todos anhelamos y amamos, no basta con ser buen codificador, se necesitan formas, guías y disciplina a las cuáles recurrir cuando la duda de si estamos haciendo bien algo aparece, cuando la "motivación" o la "creatividad" se ausentan un momento.&lt;/p&gt;

&lt;p&gt;Y aún más, este libro lo recomiendo mucho para los docentes que quieren formar profesionales del software. De hecho, este es uno de los enfoques de la obra. Es casi una propueta de Framework para la educación de profesionales del software.&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 🏛️ Leer gratis
&lt;/h2&gt;

&lt;p&gt;Puedes leerlo gratuitamente en The Internet Archive apartandolo por 1hra renovable si te creas una cuenta&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://archive.org/details/programacionorie0000lope/mode/2up" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--MV5Hftfn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://archive.org/services/img/programacionorie0000lope" height="237" class="m-0" width="180"&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://archive.org/details/programacionorie0000lope/mode/2up" rel="noopener noreferrer" class="c-link"&gt;
          Programación orientada a objetos C++ y Java : un acercamiento interdisciplinario : López Goytia, José Luis : Free Download, Borrow, and Streaming : Internet Archive
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          1 online resource (298 pages)
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
        archive.org
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;No olvides compartir tus comentarios, opiniones o dudas en los comentarios :) &lt;/p&gt;

&lt;p&gt;Si conoces o recomiendas otras obras puedes compartirlas también. Yo con gusto las leeré.&lt;/p&gt;

</description>
      <category>books</category>
      <category>programming</category>
      <category>learning</category>
      <category>spanish</category>
    </item>
    <item>
      <title>Happy Programmers' Day!</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Thu, 14 Sep 2023 07:04:46 +0000</pubDate>
      <link>https://dev.to/devu/happy-programmers-day-53cc</link>
      <guid>https://dev.to/devu/happy-programmers-day-53cc</guid>
      <description>&lt;p&gt;El día de hoy (13 de septiembre del 2023) se celebra esta profesión, actividad, hobbie, o estilo de vida.&lt;/p&gt;

&lt;p&gt;Para celebrar nuestro gusto por la programación realizamos unos pósters conmemorativos. Imprímelos, guárdalos, y compartelos!&lt;/p&gt;

&lt;p&gt;Today (September 13, 2023), we celebrate this profession, activity, hobby, or lifestyle.&lt;/p&gt;

&lt;p&gt;To celebrate our love for programming, we have created some commemorative posters. Print them, keep them, and share them!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.devu.space/assets/duck%20light.png"&gt;Full size&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r95Bkc7z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxy60lurhmipkk1eh59h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r95Bkc7z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxy60lurhmipkk1eh59h.png" alt="Rubber duck debugging poster" width="661" height="989"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.devu.space/assets/programmers%20day%201.png"&gt;Full size&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EEQOXT97--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqylqthz3xcl65lif1y3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EEQOXT97--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqylqthz3xcl65lif1y3.png" alt="Heart poster" width="660" height="992"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>programmers</category>
      <category>day</category>
      <category>community</category>
    </item>
    <item>
      <title>How to render card items in sequence after data load is finished like AirBnB?</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Fri, 15 Jul 2022 18:28:32 +0000</pubDate>
      <link>https://dev.to/chema/how-to-render-card-items-in-sequence-after-data-load-is-finished-like-airbnb-39n7</link>
      <guid>https://dev.to/chema/how-to-render-card-items-in-sequence-after-data-load-is-finished-like-airbnb-39n7</guid>
      <description>&lt;p&gt;When in AirBnB you scroll down to load more results I have seen that the cards load their data from start to finish like a dominoes style... like a sweep&lt;/p&gt;

&lt;p&gt;Do you know what that effect is called or how to do something similar?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.airbnb.ca/"&gt;https://www.airbnb.ca/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dtnymnT6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7bifapf8mu14mst27l9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dtnymnT6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7bifapf8mu14mst27l9k.png" alt="Air B and B loading results example" width="880" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>question</category>
      <category>discuss</category>
      <category>css</category>
      <category>ui</category>
    </item>
    <item>
      <title>Dockerize Postgres: How to install Postgres with Docker</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Sun, 01 May 2022 19:25:59 +0000</pubDate>
      <link>https://dev.to/chema/how-to-create-a-dockerized-postgres-db-3hg9</link>
      <guid>https://dev.to/chema/how-to-create-a-dockerized-postgres-db-3hg9</guid>
      <description>&lt;p&gt;Hi. I'm about to take a &lt;a href="https://react-dashboard.cube.dev" rel="noopener noreferrer"&gt;CubeJS tutorial&lt;/a&gt; to create a nice dashboard and it seems that I need a Postgres DB.&lt;/p&gt;

&lt;p&gt;So it's obvious that I have to use docker as usual and I want to share how to install Postgres in Docker because I wish someone had instructed me how to do it and save some time.&lt;/p&gt;

&lt;p&gt;I will show you 2 ways to do it: the very simple way (single line command), and the most common and accepted way (using &lt;code&gt;docker-compose.yml&lt;/code&gt; file).&lt;/p&gt;

&lt;p&gt;One thing you have to know is that the container will be installed in the path you currently are, so I suggest you to create a directory for your project and create the container there.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install it with the command line
&lt;/h2&gt;

&lt;p&gt;Use the command below to install the postgres "image". You should customize it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;❯ docker run &lt;span class="nt"&gt;-p&lt;/span&gt; 127.0.0.1:5442:5432/tcp  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mysuperpassword &lt;span class="nt"&gt;--name&lt;/span&gt; postgres_cube &lt;span class="nt"&gt;-d&lt;/span&gt; postgres:12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you ran that command, your terminal will show you something like the code below. This is the container ID which means it's up and running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ 90a63c0aa9b597d63f644ecd178e549f161d12fa84d7a16a47545aaa92087124
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify the container is up and running just run this command and you should see the postgres_cube is Up&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;❯ docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;
CONTAINER ID   IMAGE         COMMAND                  CREATED         STATUS                     PORTS                    NAMES
17a8bca60f6d   postgres:12   &lt;span class="s2"&gt;"docker-entrypoint.s…"&lt;/span&gt;   3 minutes ago   Up 3 minutes               0.0.0.0:5442-&amp;gt;5432/tcp   postgres_cube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Command explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;docker run&lt;/code&gt; command first creates a writeable container layer over the specified image, and then starts it. &lt;a href="https://docs.docker.com/engine/reference/commandline/run/#extended-description" rel="noopener noreferrer"&gt;Read more&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;-p 127.0.0.1:5442:5432/tcp&lt;/code&gt; part specifies the &lt;code&gt;port&lt;/code&gt; option to map the host (the real machine) port to the container port. Put attention on the 5442:5432. In this case I'm specifying that I want to use my machine 5442 port to connect with the container 5432 port (which is the postgres service port living in the container). I'll use the 5442 to connect my DB Client (DBeaver in my case). &lt;a href="https://docs.docker.com/config/containers/container-networking/#published-ports" rel="noopener noreferrer"&gt;Read more about published ports&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;-e POSTGRES_PASSWORD=mysuperpassword&lt;/code&gt; part specifies the &lt;code&gt;environment&lt;/code&gt; &lt;a href="https://docs.docker.com/engine/reference/commandline/run/#options" rel="noopener noreferrer"&gt;variables&lt;/a&gt; that the image can detect. You should read the &lt;strong&gt;postgres&lt;/strong&gt; &lt;a href="https://hub.docker.com/_/postgres" rel="noopener noreferrer"&gt;image docs&lt;/a&gt; to see a complete list but the most common are:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;- &lt;code&gt;POSTGRES_DB&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;- &lt;code&gt;POSTGRES_USER&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;- &lt;code&gt;POSTGRES_PASSWORD&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For postgres the &lt;code&gt;POSTGRES_PASSWORD&lt;/code&gt; is required.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In this case I'm specifying the required &lt;code&gt;POSTGRES_PASSWORD&lt;/code&gt; to set a password. The user by default is "postgres" and the default database is "postgres" and other 2 template databases (as usual).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;--name postgres_cube&lt;/code&gt; specifies a custom name for the container. &lt;code&gt;postgres_cube&lt;/code&gt; in my case. If you don't pass it, docker will use a random name but it's a good idea to give it a name to identify your container when using just a few of them&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;-d&lt;/code&gt; is an &lt;a href="https://docs.docker.com/engine/reference/commandline/run/#options" rel="noopener noreferrer"&gt;option&lt;/a&gt; that allows us to detach our terminal session, which means that we don't need to keep a terminal open while the container is running.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And finally, the &lt;code&gt;postgres:12&lt;/code&gt; is the image (postgres) name and the tag (12). This is useful to install a specific version. If the tag is not specified, you will install the &lt;code&gt;latest&lt;/code&gt; version.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Use a docker-compose file
&lt;/h2&gt;

&lt;p&gt;First step is to create a &lt;code&gt;docker-compose.yml&lt;/code&gt; in your project folder.&lt;/p&gt;

&lt;p&gt;After that, copy, paste and save the content below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3"&lt;/span&gt;

&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;net-cube-tutorial&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;db-cube-tutorial&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;postgres&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:12&lt;/span&gt;
    &lt;span class="na"&gt;hostname&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;
    &lt;span class="na"&gt;container_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres_cube&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_DB&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cube_tutorial&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysuperpassword&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;5442:5432&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;db-cube-tutorial:/var/lib/postgresql/data&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;net-cube-tutorial&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Finally run the command below. Docker will look for the &lt;code&gt;docker-compose.yml&lt;/code&gt; file at the current path automatically, so you don't need to worry about.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;❯ docker-compose up  &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your terminal will output something like the messages bellow, which means everything is fine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Creating network &lt;span class="s2"&gt;"cubejs_net-cube-tutorial"&lt;/span&gt; with the default driver
Creating postgres_cube ... &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify the container is up and running just run this command and you should see the postgres_cube is Up&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;❯ docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;
CONTAINER ID   IMAGE         COMMAND                  CREATED         STATUS                     PORTS                    NAMES
17a8bca60f6d   postgres:12   &lt;span class="s2"&gt;"docker-entrypoint.s…"&lt;/span&gt;   3 minutes ago   Up 3 minutes               0.0.0.0:5442-&amp;gt;5432/tcp   postgres_cube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  File structure explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What does the docker-compose.yml? Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. &lt;a href="https://docs.docker.com/compose/" rel="noopener noreferrer"&gt;Read more about it&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version: "3"&lt;/code&gt; specifies we will use the syntax version 3. &lt;a href="https://docs.docker.com/compose/compose-file/compose-versioning/" rel="noopener noreferrer"&gt;Read more about compose versions&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;networks&lt;/code&gt; lets you to define container internal networks. This is perfect when you need to connect or join multiple services in the same container. &lt;a href="https://docs.docker.com/compose/networking/" rel="noopener noreferrer"&gt;Read more about networking&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;volumes&lt;/code&gt; is the virtual storage for the container if we wan't to keep the data. It's useful to set a name for it because it will let us to reference the services to use it. &lt;a href="https://docs.docker.com/storage/volumes/" rel="noopener noreferrer"&gt;Read more about volumes&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;services&lt;/code&gt; is the list of the services will run on the container. Here we can specify a set of images and its configuration. In this case we only need the postgres service connected to the named container network, using the named storage and map the network port to our host port to be able to connect the DB with an external program outside the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;image&lt;/code&gt; is the image name, in this case we need &lt;code&gt;postgres&lt;/code&gt;. Also we can specify a tag, which is &lt;code&gt;12&lt;/code&gt;. If you don't specify it, it will use the "latest" version.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hostname&lt;/code&gt; lets you assign a name to the service as host in the network. It's useful if we want to allow services to communicate between them. We can use the host name to reference the services at network level.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;restart&lt;/code&gt; specifies the restart policy. &lt;code&gt;unless-stopped&lt;/code&gt; always restart the container if it stops, Similar to &lt;code&gt;always&lt;/code&gt;, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;container_name&lt;/code&gt; allow to set a name for the container so we can easily find it. If you don't give it a name, a randomly generated name will be used.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;environment&lt;/code&gt; is the section where we are able to specify &lt;a href="https://docs.docker.com/compose/environment-variables/" rel="noopener noreferrer"&gt;environment variables&lt;/a&gt; supported by the image. For postgres there is a list you can explore in the &lt;a href="https://hub.docker.com/_/postgres" rel="noopener noreferrer"&gt;docs&lt;/a&gt; but the most common are&lt;/li&gt;
&lt;li&gt;- &lt;code&gt;POSTGRES_DB&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;- &lt;code&gt;POSTGRES_USER&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;- &lt;code&gt;POSTGRES_PASSWORD&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I recommend you to avoid exposing the variable values in the &lt;code&gt;docker-compose.yml&lt;/code&gt;. Instead, you should specify them in a .env file and use it in the &lt;code&gt;docker-compose.yml&lt;/code&gt; in this way&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;.env file: *&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_USER=mypostgresuser
DB_PASSWORD=mysuperpassword
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;docker-compose.yml: *&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;POSTGRES_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${DB_USER}&lt;/span&gt;
   &lt;span class="na"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${DB_PASSWORD}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ports&lt;/code&gt; lets you map your actual machine (the host) to the container network ports. In this case I'm using the port 5442 of my machine to access to the container port 5432 to be able to connect DBeaver to the database directly.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;volumes&lt;/code&gt; here we map the container folder called "data" &lt;code&gt;(/var/lib/postgresql/data)&lt;/code&gt; to be accesible from the root of our volume named &lt;code&gt;db-cube-tutorial&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;networks&lt;/code&gt; allow us to connect our service to the specified container network.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bonus: Connect a DB client (DBeaver) to our DB
&lt;/h2&gt;

&lt;p&gt;I'll use thee DBeaver program to easily use my DB, but you can use whatever you want.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new connection with your own settings:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fl3mnza01fjx288mne2r1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fl3mnza01fjx288mne2r1.png" alt="New DBeaver Connection Setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Test the connection&lt;br&gt;
&lt;a href="https://media.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%2Fppkubmsqdj3m251c4b8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fppkubmsqdj3m251c4b8k.png" alt="Connection Test Result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enjoy
&lt;img src="https://media.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%2F0ggy6nkvmstryt3wvth5.png" alt="DBeaver Connected to the DB"&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>docker</category>
      <category>postgres</category>
      <category>tips</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Cómo instalar y configurar Git y SSH con GitHub en Mac, GNU/Linux o Windows (GitBash)</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Sun, 09 Jan 2022 06:13:16 +0000</pubDate>
      <link>https://dev.to/chema/instalar-y-configurar-git-con-github-en-mac-y-gnulinux-12op</link>
      <guid>https://dev.to/chema/instalar-y-configurar-git-con-github-en-mac-y-gnulinux-12op</guid>
      <description>&lt;p&gt;Hola. En este post describo los pasos para instalar y configurar &lt;strong&gt;Git&lt;/strong&gt;, así como ajustarlo para trabajar con &lt;strong&gt;GitHub&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Si usas Windows, instala Git con el instalador gráfico, asegúrate de poner el check para que igual se instale GitBash, reinicia la PC y usa el &lt;code&gt;GitBash&lt;/code&gt; en lugar de la terminal para seguir la guía sin problemas (al menos con pocos).&lt;/p&gt;

&lt;p&gt;Siempre que es posible trato de usar Brew para instalar las aplicaciones que quiero. Es útil para mantener las cosas actualizadas. En &lt;a href="https://dev.to/chema/instalando-zsh-en-mac-2c6b"&gt;este post escribí cómo instalar Homebrew&lt;/a&gt; en el primer paso.&lt;/p&gt;

&lt;p&gt;Si usas alguna distro debian de GNU/Linux, solo usa el comando &lt;code&gt;sudo apt-get install git&lt;/code&gt; en lugar de brew.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Descargar e instalar Git
&lt;/h2&gt;

&lt;p&gt;Para instalar git manualmente podemos ir al sitio oficial de &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;descargas&lt;/a&gt;. Hay instalador para Windows, MacOS y GNU/Linux.&lt;/p&gt;

&lt;p&gt;Instalar con Brew:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ brew &lt;span class="nb"&gt;install &lt;/span&gt;git


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

&lt;/div&gt;

&lt;p&gt;Verifica que Git esté instalado:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ git &lt;span class="nt"&gt;--version&lt;/span&gt;
git version 2.30.1 &lt;span class="o"&gt;(&lt;/span&gt;Apple Git-130&lt;span class="o"&gt;)&lt;/span&gt;


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  2. Configurar Git
&lt;/h2&gt;

&lt;p&gt;Después de verificar que Git está instalado tenemos que configurar las variables globales:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nombre de usuario (&lt;code&gt;user&lt;/code&gt;) que aparecerá como autor de los cambios&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;email&lt;/code&gt; del usuario&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;editor&lt;/code&gt; que queremos usar para escribir los mensajes de los commits y demás cosas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ingresa los siguientes comandos usando tus datos:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"John Doe"&lt;/span&gt;
~ ❯ git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email johndoe@example.com
~ ❯ git config &lt;span class="nt"&gt;--global&lt;/span&gt; core.editor vim


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

&lt;/div&gt;

&lt;p&gt;Esos comandos los puedes volver a ingresar para actualizar las variables. Si en lugar de &lt;code&gt;vim&lt;/code&gt; quieres usar otro editor, ingresa &lt;code&gt;nano&lt;/code&gt;, &lt;code&gt;code&lt;/code&gt; (visual studio code) u otro.&lt;/p&gt;

&lt;p&gt;Verifica las variables:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ git config user.name
John Doe

~ ❯ git config user.email
johndoe@example.com


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

&lt;/div&gt;

&lt;p&gt;También podemos listar todas las variables de la configuración:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ git config &lt;span class="nt"&gt;--list&lt;/span&gt;
credential.helper&lt;span class="o"&gt;=&lt;/span&gt;osxkeychain
user.name&lt;span class="o"&gt;=&lt;/span&gt;John Doe
user.email&lt;span class="o"&gt;=&lt;/span&gt;johndoe@example.com
core.editor&lt;span class="o"&gt;=&lt;/span&gt;vim


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

&lt;/div&gt;

&lt;p&gt;Puedes leer más en los sitios oficiales de Git y de GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/book/es/v2/Inicio---Sobre-el-Control-de-Versiones-Configurando-Git-por-primera-vez" rel="noopener noreferrer"&gt;https://git-scm.com/book/es/v2/Inicio---Sobre-el-Control-de-Versiones-Configurando-Git-por-primera-vez&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git" rel="noopener noreferrer"&gt;https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Generar llaves SSH
&lt;/h2&gt;

&lt;p&gt;Para comunicarse con repositorios remotos como GitHub, GitLab o Azure podemos hacerlo de dos formas: con &lt;code&gt;https&lt;/code&gt; o con &lt;code&gt;ssh&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;En este post describo el método con &lt;code&gt;SSH&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Usar &lt;code&gt;https&lt;/code&gt; es lo más fácil y actualmente es igual de seguro que &lt;code&gt;ssh&lt;/code&gt;. Los leaks o filtraciones dependen de tí realmente.&lt;br&gt;
Yo prefiero &lt;code&gt;ssh&lt;/code&gt; por costumbre y porque no me gusta autenticarme en cada &lt;code&gt;push&lt;/code&gt; o &lt;code&gt;pull&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Si decides ir por la vía de &lt;code&gt;https&lt;/code&gt; tendrás que configurar un &lt;code&gt;GitHub Personal Token&lt;/code&gt; y usarlo para autenticarte. Dejo la &lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token" rel="noopener noreferrer"&gt;guía de GitHub sobre cómo hacerlo&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Verificar si ya existen las llaves SSH:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys" rel="noopener noreferrer"&gt;fuente&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ingresa este comando para listar (&lt;code&gt;ls&lt;/code&gt;) los archivos, especificando que queremos ver todos los archivos (&lt;code&gt;-a&lt;/code&gt;) en forma de lista vertical (&lt;code&gt;-l&lt;/code&gt;) dentro de la carpeta oculta &lt;code&gt;.ssh&lt;/code&gt; que se encuentra en el directorio &lt;code&gt;home&lt;/code&gt; (&lt;code&gt;~/&lt;/code&gt;) del usuario:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt; ~/.ssh


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

&lt;/div&gt;

&lt;p&gt;Si ya tenías las claves te aparecerá algo como esto, en cuyo caso, puedes ir al paso 4:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

total 48
drwx------   7 chema  staff   224 Dec 31 13:09 &lt;span class="nb"&gt;.&lt;/span&gt;
drwxr-x---+ 34 chema  staff  1088 Jan  8 23:00 ..
&lt;span class="nt"&gt;-rw-------&lt;/span&gt;   1 chema  staff  3401 Dec 31 13:10 id_rsa
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt;@  1 chema  staff   755 Dec 31 13:10 id_rsa.pub


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

&lt;/div&gt;

&lt;p&gt;Si no las tienes, te aparecerá algo como esto:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;ls&lt;/span&gt;: /Users/chema/.ssh: No such file or directory


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Generar nuevas claves SSH:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent" rel="noopener noreferrer"&gt;fuente&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Si no tenemos alguna clave SSH tendremos que generar un nuevo par de clave privada y pública, las cuáles se generan juntas:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"johndoe@example.com"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Nos preguntarán el nombre del archivo que tendrá, puedes presionar &lt;code&gt;enter&lt;/code&gt; si quieres usar el nombre por defecto (&lt;code&gt;id_rsa&lt;/code&gt;):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

Enter file &lt;span class="k"&gt;in &lt;/span&gt;which to save the key &lt;span class="o"&gt;(&lt;/span&gt;/Users/chema/.ssh/id_rsa&lt;span class="o"&gt;)&lt;/span&gt;:


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

&lt;/div&gt;

&lt;p&gt;Después nos pedirán especificar una contraseña y confirmarla. Ésta se pedirá cada vez que nos comuniquemos con repositorios remotos con &lt;code&gt;pull&lt;/code&gt;, &lt;code&gt;push&lt;/code&gt; y demás.&lt;br&gt;
También se puede presionar &lt;code&gt;enter&lt;/code&gt; (dos veces para confirmar) si no queremos agregar ninguna.&lt;/p&gt;

&lt;p&gt;Si tienes mucho cuidado con quién y cómo tienen acceso a tu equipo puedes ir sin contraseña). &lt;strong&gt;Cuando introduzcas la contraseña no se verá lo que escribes pero sí está escribiendo&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

Enter passphrase &lt;span class="o"&gt;(&lt;/span&gt;empty &lt;span class="k"&gt;for &lt;/span&gt;no passphrase&lt;span class="o"&gt;)&lt;/span&gt;:
Enter same passphrase again:


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  4. Agregar claves SSH a la cuenta de GitHub
&lt;/h2&gt;

&lt;p&gt;Ve a &lt;a href="https://github.com" rel="noopener noreferrer"&gt;github.com&lt;/a&gt;, &lt;strong&gt;inicia sesión&lt;/strong&gt; o &lt;strong&gt;crea una cuenta&lt;/strong&gt; (no olvides confirmar el email) y busca la opción &lt;code&gt;Settings&lt;/code&gt; que nos llevará a la página de ajustes:&lt;br&gt;
&lt;a href="https://media.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%2F43i78eb33hordb3mmqub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F43i78eb33hordb3mmqub.png" alt="Image description"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Busca la opción de &lt;code&gt;SSH and GPG Keys&lt;/code&gt; en la barra lateral izquierda:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fbqfg1i7mvbocq1hn4rxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fbqfg1i7mvbocq1hn4rxr.png" alt="ssh option"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Selecciona la opción para agregar la clave SSH que abrirá un formulario para que introduzcamos el nombre de nuestra clave SSH (el nombre que gustes) y para que "pegues" la llave pública, es decir, el contenido del archivo &lt;code&gt;id_rsa.pub&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fhij8aokv1rp5k15rj0hq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhij8aokv1rp5k15rj0hq.png" alt="add ssh option"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Para ver y copiar el contenido del archivo &lt;code&gt;id_rsa.pub&lt;/code&gt; tenemos dos opciones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;podemos usar el &lt;code&gt;Finder&lt;/code&gt; de Mac o el buscador que tengamos&lt;/li&gt;
&lt;li&gt;mostrar el contenido en consola y copiarlo&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Con el finder
&lt;/h3&gt;

&lt;p&gt;Accede a la carpeta de tu usuario, presiona &lt;code&gt;Shift&lt;/code&gt; + &lt;code&gt;Cmd&lt;/code&gt; + &lt;code&gt;.&lt;/code&gt;. para mostrar archivos ocultos, busca la carpeta &lt;code&gt;.ssh&lt;/code&gt; y accede. Verás unos archivos como estos:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdjjuhx8n3mh1iryh7pnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdjjuhx8n3mh1iryh7pnv.png" alt="ssh keys in finder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Abre el archivo &lt;code&gt;id_rsa.pub&lt;/code&gt; con el editor de texto de tu preferencia, copia todo el contenido y pégalo en el formulario de &lt;strong&gt;GitHub&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Con la terminal
&lt;/h3&gt;

&lt;p&gt;Escribe lo siguiente para usar el comando &lt;code&gt;cat&lt;/code&gt; (concatenar) el cuál mostrará el contenido en la consola:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ &lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_rsa.pub


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

&lt;/div&gt;

&lt;p&gt;Finalmente copia el texto en consola y pégalo en el formulario de &lt;strong&gt;GitHub&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Clonar un repositorio con SSH
&lt;/h2&gt;

&lt;p&gt;Bien, eso fue todo. Ahora intenta clonar algún repositorio para verificar que las cosas hayan salido bien. Puedes clonar este repo si gustas.&lt;/p&gt;

&lt;p&gt;La primera vez nos advertirán que se guardará la huella (fingerprint) del host remoto como conocido y tendremos que ingresar "yes" para continuar.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

~ ❯ git clone git@github.com:ChemaCLi/git-tricks-and-tutorials.git


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

&lt;/div&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>tutorial</category>
      <category>español</category>
    </item>
    <item>
      <title>Services Layer approach in ReactJS </title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Thu, 30 Dec 2021 01:32:29 +0000</pubDate>
      <link>https://dev.to/chema/services-layer-approach-in-reactjs-1eo2</link>
      <guid>https://dev.to/chema/services-layer-approach-in-reactjs-1eo2</guid>
      <description>&lt;h2&gt;
  
  
  Resume
&lt;/h2&gt;

&lt;p&gt;In this post I want to show you a technique I'm trying to implement in order to decouple the implementation of REST, GraphQL or whatever you use to communicate your frontend with a backend (backend, storage, local files, etc).&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;Hi there. I'm a web developer. I've some experience building apps with old techniques with PHP, Java and .Net C#. So I've saw ugly stuff and other things that makes the programming experience a pain: hard to maintain, hard to debug, hard to scale, hard to test (maybe impossible).&lt;/p&gt;

&lt;p&gt;I've been working with ReactJS since some years ago and I noticed something that caught my attention. Most developers are making the same mistakes we made in the past (me included of course).&lt;/p&gt;

&lt;p&gt;I'm talking about spaghetti code, untestability, and implementation coupling.&lt;/p&gt;

&lt;p&gt;So, well, I know there are some principles we can apply to make things easier (I'm talking of SOLID, DRY, KISS, etc.) and I want to make it better.&lt;/p&gt;

&lt;h2&gt;
  
  
  Services Layer approach
&lt;/h2&gt;

&lt;p&gt;Ok, when we write a react component that will use some service connection we tend to do it in this way for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;OrdersList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setOrders&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setOrders&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ul&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;))}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ul&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It looks fine, didn't? But then if you have more components that implements the same endpoint? what if the endpoint changes? you will have to update it on each component. Also, when you need to add more treatments to the data like mapping or normalization, you will add more code. And finally, if you want to add an unit test you will probably use an axios mock strategy.&lt;/p&gt;

&lt;p&gt;My proposal is to encapsulate the data fetching in a collection of functions (near to be repositories) that receive arguments if necessary and that returns the needed data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ordersService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;getAll&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can use it in this way using dependency injection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// the ordersService is injected (dependencies injection)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;OrdersList&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;ordersService&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setOrders&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;ordersService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;orders&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setOrders&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setLoading&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ul&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;))}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ul&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and with that dependency injection we can easily write a mock  no matter what kind of service we use (rest, graphql, etc) because only the "orders service" knows what is the magic behind&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Loads two orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mockOrdersService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;([{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mock-01&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mock-02&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}])&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getByTestId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;OrdersList&lt;/span&gt; &lt;span class="nx"&gt;ordersService&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;mockOrdersService&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;  &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Right now it seems very simple, and I'm happy for that. But I want you to see more advantages.&lt;/p&gt;

&lt;p&gt;Please think you have to create a new order. You will use a post request, and the backend needs a specific payload.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Extra cheese&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hamburger-01&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="nx"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;01&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;registered_customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;not_registered_customer_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case we can add a new function at the service layer in this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sendOrder&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;not_registered_customer_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;items&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;not_registered_customer_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;registered_customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;customer_id&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ordersService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;sendOrder&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if we need to create the order we just pass the needed arguments and the function will format the data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ordersService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sendOrder&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;01&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;notes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Extra cheese&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;sku&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hamburger-01&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this approach we are decoupling the implementation details, avoiding code repetition, allowing the testability. And just by separating the code concerns.&lt;/p&gt;

&lt;p&gt;Then, I would like to talk about the separation of logic from the UI by using react Hooks and a hook I've designed to work like the graphql &lt;code&gt;useQuery&lt;/code&gt; hook (I love that hook, but causes hard to maintain code)... but I think it's better to wait for your feedback in order to give a better proposal.&lt;/p&gt;

&lt;p&gt;Also, you can give me some feedback about my writing on english. I will appreciate it a lot. Peace! ✌️&lt;/p&gt;

</description>
      <category>react</category>
      <category>architecture</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Instalando ZSH en Mac</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Sat, 04 Dec 2021 07:07:54 +0000</pubDate>
      <link>https://dev.to/chema/instalando-zsh-en-mac-2c6b</link>
      <guid>https://dev.to/chema/instalando-zsh-en-mac-2c6b</guid>
      <description>&lt;p&gt;Hola. En este post describo los pasos que sigo para instalar &lt;code&gt;iTerm&lt;/code&gt;, &lt;code&gt;ZSH&lt;/code&gt;, &lt;code&gt;oh my ZSH&lt;/code&gt; y algunas configuraciones de los temas para la consola. Ojalá te sirvan.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Instalar Homebrew
&lt;/h2&gt;

&lt;p&gt;Sé que podemos instalar todo lo necesario directamente pero Brew nos ayudará a ahorrar algo de tiempo y a mantener nuestros paquetes actualizados.&lt;br&gt;
Visita &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;https://brew.sh/&lt;/a&gt; para seguir las instrucciones más recientes. Los pasos se pueden resumir en:&lt;/p&gt;

&lt;p&gt;Pega este comando para descargar y ejecutar el instalador&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


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

&lt;/div&gt;

&lt;p&gt;Nos solicitará la contraseña de usuario y esperará a que presionemos ENTER para iniciar la descarga.&lt;br&gt;
&lt;strong&gt;Nota:&lt;/strong&gt; Por defecto Brew siempre intenta actualizar todos los paquetes antes de instalar cualquier cosa.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Instalar iTerm2
&lt;/h2&gt;

&lt;p&gt;Esta terminal nos ofrece varias características interesantes que la terminal por defecto no tiene como múltiples pestañas acopladas, hotkeys, autocompletado, búsquedas, detección de errores en los comandos y más. Este es su sitio oficial &lt;a href="https://iterm2.com/index.html" rel="noopener noreferrer"&gt;https://iterm2.com/index.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Para instalarla con Brew&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

brew &lt;span class="nb"&gt;install &lt;/span&gt;iterm2


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  3. Instalar ZSH
&lt;/h2&gt;

&lt;p&gt;Uso ZSH en lugar del Bash por defecto porque nos ofrece la posibilidad de instalar plugins y temas entre otras cosas que facilitan la navegación y detección de errores mientras escribimos. Esta es su web &lt;a href="https://www.zsh.org/" rel="noopener noreferrer"&gt;https://www.zsh.org/&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

brew install zsh


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  4. Instalar Oh My ZSH
&lt;/h2&gt;

&lt;p&gt;Esto es un framework que ayuda a configurar ZSH. Sirve como una capa que nos hace las cosas más sencillas.&lt;br&gt;
&lt;a href="https://ohmyz.sh/" rel="noopener noreferrer"&gt;https://ohmyz.sh/&lt;/a&gt;&lt;br&gt;
No necesitamos usar Brew porque esto no es un programa funcional por sí solo, sino que es un framework con un set de helpers y funcionalidades extra para ZSH.&lt;/p&gt;

&lt;p&gt;Copia y pega esta línea para descargar y ejecutar el archivo de instalación &lt;code&gt;install.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"


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

&lt;/div&gt;

&lt;p&gt;Para verificar que esté instalada podemos checar la versión&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

zsh --version


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  5. Instalar el tema Powerlevel10k
&lt;/h2&gt;

&lt;p&gt;Es un tema popular. Tiene buen aspecto y nos brinda un configuración que a la mayoría nos queda bien.&lt;/p&gt;

&lt;p&gt;Este es el repo de GitHub donde está el tema y las instrucciones para instalarlo &lt;a href="https://github.com/romkatv/powerlevel10k#installation" rel="noopener noreferrer"&gt;https://github.com/romkatv/powerlevel10k#installation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Descárgalo para Oh My ZSH&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k


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

&lt;/div&gt;

&lt;p&gt;Busca el archivo de configuración de &lt;code&gt;.zshrc&lt;/code&gt; que está en tu directorio Home. Es un archivo oculto, así que si no lo ves tendrás que presionar &lt;code&gt;cmd&lt;/code&gt; + &lt;code&gt;shift&lt;/code&gt; + &lt;code&gt;.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Cuando lo encuentres ábrelo con tu editor de texto plano preferido, busca la línea que dice &lt;code&gt;ZSH_THEME="robbyrussell"&lt;/code&gt;, coméntala y agrega lo siguiente para reemplazarla:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

# ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"


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

&lt;/div&gt;

&lt;p&gt;Guarda los cambios y cierra la terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Configurar Powerlevel10k
&lt;/h3&gt;

&lt;p&gt;Después de cerrar la terminal, abre iTerm2. Verás algo similar a esto:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fwibugpoav40gmb46m9r1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fwibugpoav40gmb46m9r1.png" alt="Wizard de configuración"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ingresa &lt;code&gt;y&lt;/code&gt; si quieres instalar la fuente recomendada, &lt;code&gt;n&lt;/code&gt; si no quieres. Después reinicia la terminal.&lt;/p&gt;

&lt;p&gt;Cuando la vuelvas a abrir se mostrará un Wizard para hacer algunas calibraciones. Esto sirve para que detecte la codificación correcta del texto y no muestre símbolos raros.&lt;/p&gt;

&lt;p&gt;Al terminar la calibración te preguntará qué estilo prefieres. Yo escogeré &lt;code&gt;Lean&lt;/code&gt; porque no me gustan tantos colores:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6yw2016qr3377becpyl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6yw2016qr3377becpyl0.png" alt="Estilo del prompt de Powerlevel10k"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;En los siguientes pasos escogeré Unicode, 256 colores, que no me muestre la hora, ver el "prompt" en la misma línea, segmentos compactos, muchos íconos, conciso, no habilitaré el prompt fluído, y habilitaré el prompt instantáneo porque no me gusta que se va lag al abrir al terminal. &lt;a href="https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt" rel="noopener noreferrer"&gt;(leer más)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finalmente aplica los cambios en la configuración. Verás algo similar a esto de acuerdo a la configuración que hayas escogido:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F1grlt94sxpfnc5lt1dhr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F1grlt94sxpfnc5lt1dhr.png" alt="Pantalla final del Wizard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Esto es todo por ahora. En siguientes entradas agregaré cómo personalizar más ZSH y iTerm con unos plugins y un par de configuraciones. &lt;/p&gt;

</description>
      <category>zsh</category>
      <category>mac</category>
      <category>ohmyszh</category>
      <category>setup</category>
    </item>
    <item>
      <title>Java Programming Handbook</title>
      <dc:creator>José María CL</dc:creator>
      <pubDate>Sun, 14 Mar 2021 17:26:03 +0000</pubDate>
      <link>https://dev.to/chema/programming-handbook-for-java-hg1</link>
      <guid>https://dev.to/chema/programming-handbook-for-java-hg1</guid>
      <description>&lt;p&gt;This post is part of the Object Oriented Programming Notes series I'm still writing. It's intended to be a quick handbook for people who need or want a language overview and see how to write some code.&lt;/p&gt;

&lt;p&gt;There is a running example at the end of the post.&lt;/p&gt;

&lt;p&gt;If you need a full amazing Java tutorial/course/guide, please visit this page I found while I was studying about access modifiers:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://tutorials.jenkov.com/java/index.html"&gt;http://tutorials.jenkov.com/java/index.html&lt;/a&gt; 🚀&lt;/p&gt;

&lt;p&gt;You won't find how to install anything or how to setup you development environment here by the moment,  but you can test code using &lt;a href="//replit.com"&gt;replit.com&lt;/a&gt; to start coding Java online ;)&lt;/p&gt;

&lt;h2&gt;
  
  
  ☕ Java Overview
&lt;/h2&gt;

&lt;p&gt;In this section you will find some information about the Java language. But if you want a deeper understanding, please read the &lt;strong&gt;&lt;em&gt;Thinking in Java&lt;/em&gt;&lt;/strong&gt; book by &lt;strong&gt;Bruce Eckel&lt;/strong&gt; if you already know some programming basics.&lt;/p&gt;

&lt;h3&gt;
  
  
  📓 What is Java?
&lt;/h3&gt;

&lt;p&gt;Java is a &lt;strong&gt;&lt;em&gt;Programming Language&lt;/em&gt;&lt;/strong&gt; designed to allow programming under the &lt;strong&gt;&lt;em&gt;Object Orientation Paradigm&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Like any other language, it &lt;strong&gt;offers a set of special words and some rules&lt;/strong&gt; to form logic sentences that others can understand. The main goal of the &lt;em&gt;Programming Language&lt;/em&gt; is &lt;strong&gt;to allow you to write sentences the  computer can understand in order to perform actions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can write a group of instructions to create processes, then create a group of processes to create programs, and then create a group of programs to create a system.&lt;/p&gt;

&lt;p&gt;There are some words for a specific usage. These words are known as &lt;strong&gt;&lt;em&gt;reserved words&lt;/em&gt;&lt;/strong&gt;. Also, there are two main set of rules: the &lt;strong&gt;&lt;em&gt;syntax&lt;/em&gt;&lt;/strong&gt; and the &lt;strong&gt;&lt;em&gt;semantics&lt;/em&gt;&lt;/strong&gt;. The syntax defines how to write sentences in the right way, and the semantics defines the structure of the code in the right way so the computer can understand your instructions.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤖 Strongly typed language
&lt;/h3&gt;

&lt;p&gt;Java is a strongly typed language. This means that Java needs you to define the type of every data you declare.&lt;/p&gt;

&lt;p&gt;Because the way a computer works is by &lt;strong&gt;reading data from memory&lt;/strong&gt; (from Hard Disk or RAM) to use it in processes running in the &lt;strong&gt;CPU&lt;/strong&gt;, we need to separate a place in the memory for every variable and temporary data to ensure our program works fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every data type has a size&lt;/strong&gt; in bits (physical slots in memory).  So, when we declare the data type of a variable, for example, we are telling the computer to &lt;strong&gt;ensure the right space&lt;/strong&gt; to store our data in memory to avoid errors like insufficient memory space.&lt;/p&gt;

&lt;p&gt;There is a set of &lt;strong&gt;data types&lt;/strong&gt;: numbers, strings of characters (text), single characters, booleans (true or false), objects (data structures), etc.&lt;/p&gt;

&lt;p&gt;You can read more about strong and weak typed languages &lt;a href="https://medium.com/android-news/magic-lies-here-statically-typed-vs-dynamically-typed-languages-d151c7f95e2b#:~:text=Strongly%20typed%20languages,typed%2C%20and%20so%20is%20Java."&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔮 The magic
&lt;/h3&gt;

&lt;p&gt;One more thing. The computer just understands binary instructions (0 and 1, the &lt;strong&gt;&lt;em&gt;machine language&lt;/em&gt;&lt;/strong&gt;). This is called &lt;strong&gt;&lt;em&gt;low level&lt;/em&gt;&lt;/strong&gt; language. Low is near to the machine language, and hight is near to human language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Java is a &lt;em&gt;hight level&lt;/em&gt; language&lt;/strong&gt;, so we need to translate our hight level instructions to low level instructions. Fortunately, there's a program that do the dirty job. &lt;/p&gt;

&lt;p&gt;This program is called &lt;strong&gt;&lt;em&gt;"compiler"&lt;/em&gt;&lt;/strong&gt;. It &lt;strong&gt;translates a hight level language to  low level language&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;There exists another programs called  &lt;strong&gt;&lt;em&gt;"transpilers"&lt;/em&gt;&lt;/strong&gt; which translates a language to other language in the same level.&lt;/p&gt;

&lt;p&gt;However, in this case &lt;strong&gt;we need a "compiler"&lt;/strong&gt; to &lt;strong&gt;compile&lt;/strong&gt; (translate to low level) our &lt;strong&gt;Java code&lt;/strong&gt; to machine language.&lt;/p&gt;

&lt;p&gt;The compilers and the transpilers have internal mechanisms which allows to &lt;strong&gt;check&lt;/strong&gt; if the code &lt;strong&gt;syntax&lt;/strong&gt; is ok and it respects the &lt;strong&gt;semantic rules&lt;/strong&gt;. So, the compiler won't leave to compile or run code with syntax and semantic errors. But remember, you can write code with logic errors with well written instructions.&lt;/p&gt;

&lt;h1&gt;
  
  
  👩‍💻 Writing Code
&lt;/h1&gt;

&lt;p&gt;In this section you will find a reference about the basics to write Java code. Feel free to re-visit it when you need to.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comments
&lt;/h3&gt;

&lt;p&gt;Comments are a way to &lt;strong&gt;write things in the code that will be ignored&lt;/strong&gt; by the computer. Comments don't have any functionality.&lt;/p&gt;

&lt;p&gt;It's recommended to &lt;strong&gt;write comments&lt;/strong&gt; to explain something about the code &lt;strong&gt;if necessary&lt;/strong&gt;. Usually, we use comments to &lt;em&gt;"document"&lt;/em&gt; the code, to help other programmers to quickly understand a process, or to explain certain specific concepts that are not common.&lt;/p&gt;

&lt;p&gt;When you are learning is ok to write many comments to add notes, but when you are working on a more serious project you should &lt;strong&gt;avoid to abuse of this resource&lt;/strong&gt;. To avoid unnecessary comments try to write the code as simple and understandable as possible. If you want to know more, google about clean code and good practices.&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;/**
 * ✅ This is a multiline comment
 * so you can write a very long comment.
 * This format is used to document your code.
 */&lt;/span&gt;

&lt;span class="cm"&gt;/* ✅
This is a valid  multiline
comment
*/&lt;/span&gt;

&lt;span class="cm"&gt;/* ✅ as well as this one*/&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ This is an inline comment. You can't use multiline&lt;/span&gt;
&lt;span class="n"&gt;because&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="n"&gt;won&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;interpreted&lt;/span&gt; &lt;span class="n"&gt;as&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;comment&lt;/span&gt; &lt;span class="err"&gt;❌&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Semi-colon and Curly braces
&lt;/h3&gt;

&lt;p&gt;This is the semicolon symbol &lt;code&gt;;&lt;/code&gt;, and these are the curly braces &lt;code&gt;{}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Semicolons&lt;/strong&gt; are used to &lt;strong&gt;specify the end of an instruction&lt;/strong&gt;,  and &lt;strong&gt;curly braces&lt;/strong&gt; are used to &lt;strong&gt;specify an scope&lt;/strong&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  Semicolon usage examples:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ✅ method execution ends until the semi-colon appears&lt;/span&gt;
&lt;span class="n"&gt;sendAnEmail&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hey@well.com"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ declaration ends until the semi-colon appears&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;thisWillStoreMyDogName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Pulgas"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * ❌ In this line I forget to write a semicolon after "Florencio"
 * so the Java compiler will understand that these two lines are the same
 * instruction, so the instruction:
 *  
 * String myFishName = "Florencio"String myDogAge = 4;
 *
 * doesn't make sense to the compiler and will be marked
 * as an error
 */&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myFishName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Florencio"&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myDogAge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;;&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;sendAnEmail&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;email&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ✅ return statement ends until semi-colon appears&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Message sent to: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;email&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="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;sendAnSMS&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;phone&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ❌ Java will read the sentence as:&lt;/span&gt;
  &lt;span class="c1"&gt;// return "Message sent to: " + phone }&lt;/span&gt;
  &lt;span class="c1"&gt;// so it doesn't make sense to the compiler&lt;/span&gt;
  &lt;span class="c1"&gt;// if a curly brace } appears at the end of a return&lt;/span&gt;
  &lt;span class="c1"&gt;// statement. So don't forget the semicolons never!&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Message sent to: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

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

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Curly-braces&lt;/strong&gt; also wrap your pieces of code to allow to reuse your logic and to create named processes called &lt;strong&gt;methods&lt;/strong&gt;. You will use &lt;code&gt;{}&lt;/code&gt; to write the definition of your classes and methods inside, and for some statements like loops and comparisons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;{}&lt;/code&gt; defines a scope&lt;/strong&gt;, so you can access to anything that is &lt;strong&gt;inside&lt;/strong&gt; the &lt;code&gt;{}&lt;/code&gt;, but if there is something out, you won't be able to access to it.&lt;/p&gt;
&lt;h4&gt;
  
  
  Curly braces usage examples:
&lt;/h4&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;Cellphone&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// your class scope starts here&lt;/span&gt;

  &lt;span class="c1"&gt;// ✅ These variable will be available for all the methods &lt;/span&gt;
  &lt;span class="c1"&gt;// inside the class curly braces {}&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myCatName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Bigotes"&lt;/span&gt;&lt;span class="o"&gt;;&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;getCatName&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 scope starts here&lt;/span&gt;
    &lt;span class="c1"&gt;// ✅ You can access to the variable at class level from the &lt;/span&gt;
    &lt;span class="c1"&gt;// method using the special word `this` only if the&lt;/span&gt;
    &lt;span class="c1"&gt;// method is under the class scope defined by the class &lt;/span&gt;
    &lt;span class="c1"&gt;// curly braces&lt;/span&gt;
    &lt;span class="k"&gt;return&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;myCatName&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 scope ends here&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;getDogName&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 scope starts here&lt;/span&gt;
    &lt;span class="c1"&gt;// ✅ You can access to the variables inside the {} of the method&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myDogName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Pulgas"&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;myDogName&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 scope ends here&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;getMyDogName&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 scope starts here&lt;/span&gt;
    &lt;span class="c1"&gt;// ❌ This method will cause an error because it doesn't know &lt;/span&gt;
    &lt;span class="c1"&gt;// about the variables of other methods that are out of&lt;/span&gt;
    &lt;span class="c1"&gt;// its scope&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;myDocName&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 scope ends here&lt;/span&gt;


&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// class scope ends here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Types
&lt;/h3&gt;

&lt;p&gt;Java is a &lt;strong&gt;strongly typed language&lt;/strong&gt;. We need to specify data types to tell Java what kind of values we are working with. Thanks to this, the values are more predictable and it's possible to ensure the memory space to store our data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analogy&lt;/strong&gt;: If I tell you that the variable &lt;code&gt;x&lt;/code&gt; stores a number, and the variable &lt;code&gt;y&lt;/code&gt; stores another number, when we sum &lt;code&gt;x + y&lt;/code&gt; we  can infer that the result will be a number. But if you don't know what kind of data the variable &lt;code&gt;y&lt;/code&gt; stores, you won't be able to know if it's even possible to sum it with &lt;code&gt;x&lt;/code&gt;. The Java compiler has the same problem, so it needs our help to specify the data type of the variables.&lt;/p&gt;

&lt;p&gt;I'll copy and paste some examples from &lt;code&gt;w3schools.com&lt;/code&gt;, but you should read more about &lt;a href="https://www.w3schools.com/java/java_data_types.asp"&gt;here&lt;/a&gt;.&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;myNum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;             &lt;span class="c1"&gt;// Integer (whole number)&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;myFloatNum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;5.99f&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Floating point number&lt;/span&gt;
&lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;myLetter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sc"&gt;'A'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;       &lt;span class="c1"&gt;// Character&lt;/span&gt;
&lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;myBool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// Boolean&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"A text"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// String&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Access modifiers
&lt;/h3&gt;

&lt;p&gt;Remember that Java is an &lt;strong&gt;Object Oriented Programming Language&lt;/strong&gt;. One of the main concepts of the OOP is &lt;strong&gt;encapsulation&lt;/strong&gt;. The access modifiers are a Java feature that allows us to encapsulate objects  behaviors (methods) and data (variables).&lt;/p&gt;

&lt;p&gt;Very basically, the &lt;strong&gt;access modifiers are key words that specify the visibility&lt;/strong&gt; (exposition or availability are good terms too) of variables and methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: the variables and methods of a class are know as members of a class.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;public&lt;/code&gt;: Makes members available outside the class. Can be inherited to  the sub-classes  (inheritance is another key concept of OOP) and outside the package.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;private&lt;/code&gt;: Makes members available only inside the class. The members cannot be inherited to the "subclasses", and are not available from outside the package.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;protected&lt;/code&gt;: Makes members available only inside the package of the class, and for subclasses even if the subclass is outside the package.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;default&lt;/code&gt;: Makes the class members accessible at package level only. Subclasses can inherit protected members only if it's inside the package.
&lt;/li&gt;
&lt;/ul&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;MyPublicClass&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// This variable is accesible inside the class  only.&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="n"&gt;myDogName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Pulgas"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// This method is accesible from the outside of the class and package&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;getFirstLetterOfMyDogName&lt;/span&gt;&lt;span class="o"&gt;()&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;letter&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;myDogName&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;substring&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&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;return&lt;/span&gt; &lt;span class="nf"&gt;formatText&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;letter&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * This method is for internal usage in the class only.
   * We don't want others to know what we are doing here.
   */&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;formatText&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;text&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="s"&gt;"Your dog's name first letter is: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toUpperCase&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * This method is accessible at package level
   * or available to sub-classes
   */&lt;/span&gt;
  &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;sayHello&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;"No, I will say goodbye!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * This method has a default access modifier, so
   * it will be available at package level only,
   * and for subclasses inside the package.
   */&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;sayHello&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;"Goodbye!"&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;Let's see what happens when we try to access to the class variables and methods:&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="c1"&gt;// First of all, lets create an object based on the MyPublicClass&lt;/span&gt;
&lt;span class="nc"&gt;MyPublicClass&lt;/span&gt; &lt;span class="n"&gt;objectInstance&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;MyPublicClass&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Now that the object exists, lets execute this public method&lt;/span&gt;
&lt;span class="n"&gt;objectInstance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getFirstLetterOfMyDogName&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// It works fine because the method is public, so we can access from the outside&lt;/span&gt;

&lt;span class="c1"&gt;// ❌ But this method execution is not possible because the method&lt;/span&gt;
&lt;span class="c1"&gt;// is privated and it's not available for external usage&lt;/span&gt;
&lt;span class="n"&gt;objectInstance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;formatText&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// ❌ Trying to access to a private class variable isn't possible either&lt;/span&gt;
&lt;span class="n"&gt;objectInstance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myDogName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I found &lt;a href="http://tutorials.jenkov.com/java/access-modifiers.html"&gt;this great page&lt;/a&gt;. You can check it out for a deeper explanation.&lt;/p&gt;
&lt;h3&gt;
  
  
  Variables
&lt;/h3&gt;

&lt;p&gt;Variables allow you to store data temporary in the computer memory. They are very useful to make operations. You can set them values over and over again.&lt;/p&gt;

&lt;p&gt;Creating a variable is known as &lt;strong&gt;variable declaration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can declare variables inside a &lt;strong&gt;&lt;em&gt;"class"&lt;/em&gt;&lt;/strong&gt; or inside a &lt;strong&gt;&lt;em&gt;"method"&lt;/em&gt;&lt;/strong&gt;. When the method is finished or the class instance is collected by the &lt;strong&gt;&lt;em&gt;Java Garbage Collector&lt;/em&gt;&lt;/strong&gt; (a Java mechanism to remove useless stuff from the memory) the variable will be removed from memory and you won't be able to use it anymore. &lt;/p&gt;

&lt;p&gt;This is &lt;strong&gt;the way to declare a variable&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;[type] [variableName] = [value];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Variables declared at &lt;strong&gt;Class level&lt;/strong&gt; must have an access modifie):&lt;br&gt;
&lt;code&gt;[visibility] [type] [variableName] = [value];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The variable names must be in &lt;em&gt;camelCase&lt;/em&gt; which is a style by &lt;strong&gt;&lt;em&gt;convention&lt;/em&gt;&lt;/strong&gt; (a convention is a style everybody follow).&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="c1"&gt;// ✅ Declare a variable without an initial value.&lt;/span&gt;
&lt;span class="c1"&gt;// You can't use it until you set it a value&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ You can declare many variables in a single line&lt;/span&gt;
&lt;span class="c1"&gt;// if all them are of the same type&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;website&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ You can set a value to the variable in this way&lt;/span&gt;
&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// the "=" is called assignation operator&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Declare a variable with an initial value&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="s"&gt;"unknown user"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ You can set a new value later&lt;/span&gt;
&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Sara"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// You must set compatible types&lt;/span&gt;
&lt;span class="c1"&gt;// ✅ This is valid&lt;/span&gt;
&lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;isAnAdult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ❌ But this is not valid because "nop" is a String&lt;/span&gt;
&lt;span class="c1"&gt;// and isAnAdult was declared as a boolean type variable&lt;/span&gt;
&lt;span class="n"&gt;isAnAdult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"nop"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Class level variables are declared in this way&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Unknown"&lt;/span&gt;&lt;span class="o"&gt;;&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;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Pulgas"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;myCat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Bigotes"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Methods
&lt;/h3&gt;

&lt;p&gt;A method is a &lt;strong&gt;code structure that allows you to wrap some instructions as a single process&lt;/strong&gt; you can execute whenever&lt;br&gt;
you want and all the times you want. Methods will perform your awesome instructions when you execute them. Until that, they will be sleeping (inactive).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is the way to execute a method:&lt;/strong&gt;  &lt;code&gt;doSomething();&lt;/code&gt; . As you can see, you only have to write the method name followed by two parenthesis &lt;code&gt;()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A method is a bit more complex than a variable because it can do more: &lt;strong&gt;it performs the instructions you write inside it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A method &lt;strong&gt;can receive&lt;/strong&gt; many &lt;strong&gt;values&lt;/strong&gt; (or no one), &lt;strong&gt;and return values&lt;/strong&gt; (or nothing).&lt;/p&gt;

&lt;p&gt;This is the way to &lt;strong&gt;send values&lt;/strong&gt; to the method: &lt;br&gt;
&lt;code&gt;doSomething("with this text");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the way to &lt;strong&gt;receive values&lt;/strong&gt; from a method:&lt;br&gt;
&lt;code&gt;String receivedValue = giveMeAValue();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The values that the method can receive are called &lt;strong&gt;"parameters"&lt;/strong&gt;   or &lt;strong&gt;"arguments"&lt;/strong&gt; (params and args in short). You &lt;strong&gt;must specify the type of each arg&lt;/strong&gt;. Also, you &lt;strong&gt;must specify the type of the value you will return&lt;/strong&gt; (use void if you won't return anything).&lt;/p&gt;

&lt;p&gt;You can execute a method from inside another method, so you are able to have multiple simple methods to do an specific task and combine them to create a more complex process.&lt;/p&gt;

&lt;p&gt;This is the structure to declare a method:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[access modifier] [return value type] [methodName]([args]) {
  ...method definition
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Let's see some examples:&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="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;doNothing&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// ✅ nothing will happens when you execute this method&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ This method don't return anything so we declare it as void&lt;/span&gt;
&lt;span class="c1"&gt;// Also, this method doesn't receive any arg, so we keep the () empty&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;saySomethingNice&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// your instructions go here..&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;"Hi there! You are a nice person!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * ✅ This method will return a text with the planet name
 * so we specify String as the return type.
 * Also, this method doesn't receive any arg, so we keep the () empty
 */&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;giveMeThePlanetName&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="s"&gt;"Earth"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * ❌ This method will throw an error because the method
 * return type is specified as void, so the Java compiler
 * won't allow to return anything, but you are trying to
 * return something
 */&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;giveMeTheCountryName&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="s"&gt;"I don't know"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * ✅ This method will return a number with the result of a sum
 * so we specify int as the return type.
 * Also, this method receives two args, both int numbers
 */&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;sumTwoNumbers&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;numberA&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;numberB&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numberA&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;numberB&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;result&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * ❌ This method will throw an error because the method
 * return type is specified as int, so the Java compiler
 * expects a compatible return value, but you are not returning anything
 */&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;giveMeThisPostYear&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;/**
 * ✅ You can combine methods
 */&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;sum1and3&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;myResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sumTwoNumbers&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="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
   &lt;span class="c1"&gt;// System.out.println method writes a text in the console&lt;/span&gt;
   &lt;span class="c1"&gt;// you can see a running example in the Classes section&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;"This is the result: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;myResult&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;h3&gt;
  
  
  The if - else Conditional Statements
&lt;/h3&gt;

&lt;p&gt;These &lt;strong&gt;utilities&lt;/strong&gt; are very useful to validate data and to define processes that have different behavior depending on a condition. E. g. if you are building a login to allow and block access to the platform, you will need to validate if the user and password are correct. If yes, allow to access. If not, deny the access.&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="c1"&gt;// ✅ This is the common way to use the if-else statements&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// the condition was fullfilled&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="c1"&gt;// the condition specified in the if was not fullfilled&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// ❌ You can't use only the else statement alone because it depends on the if statement defined rules&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ But you can use only the if&lt;/span&gt;
&lt;span class="k"&gt;if&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="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;4&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;"Mathematics are 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;// ✅ You can omit the curly braces {} if you only have one line per statement&lt;/span&gt;
&lt;span class="k"&gt;if&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;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&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;"1 is less than 8"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;else&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;"1 is not less than 8, it could be equals or bigger"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;


&lt;span class="cm"&gt;/**
 * ❌ Java compiler will detect an error here because se second System.out,println
 * is not part of the if statement and then it finds the else statement after something that is not
 * an if statement
 */&lt;/span&gt;
&lt;span class="k"&gt;if&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;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&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;"1 is less than 8"&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;"isn't ok?"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;else&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;"1 is not less than 8, it could be equals or bigger"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ You can fix it in this way&lt;/span&gt;
&lt;span class="k"&gt;if&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;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&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;"1 is less than 8"&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;"isn't ok?"&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="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;"1 is not less than 8, it could be equals or bigger"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Classes
&lt;/h3&gt;

&lt;p&gt;This is the more complex part. This is a &lt;strong&gt;key feature of the Java Object Orientation implementation&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A class is a data structure that wraps a set of functionalities as methods (behavior) and data as variables (state).&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;You can think about classes as a &lt;strong&gt;blueprint&lt;/strong&gt; that allows you to define an object.&lt;/p&gt;

&lt;p&gt;Supose we are creating a bot for telegram or facebook messenger to allow some users in a group to randomly choose a place to get a good time after work. How to program it? Where to start?&lt;/p&gt;

&lt;p&gt;Well, first of all we have to &lt;strong&gt;think what entities are really important&lt;/strong&gt;. In this case, the two main entities are the User and the Bot.&lt;/p&gt;

&lt;p&gt;Nice, looks not very complicated. Let's &lt;strong&gt;model&lt;/strong&gt; the Bot, let's make the &lt;strong&gt;Bot blueprint&lt;/strong&gt; (Bot class).&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="c1"&gt;// The first step is to declare our blueprint (our class).&lt;/span&gt;
&lt;span class="c1"&gt;// In Java, all the classes name must be in PascalCase, the first letter must be capital&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;Bot&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;Ok, now, our Bot needs some data to do some actions. Let's add some configuration data:&lt;/p&gt;

&lt;p&gt;We want to allow to the group admin user to configure the day of the week and the hour, and allow to the rest of the users to propose a place the bot will choose from.&lt;/p&gt;

&lt;p&gt;So, we have to declare the variables to store the &lt;strong&gt;object data&lt;/strong&gt;, which &lt;strong&gt;is know as object state&lt;/strong&gt;:&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;Bot&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="cm"&gt;/**
   * These variables are private because are for internal usage
   * we don't want and don't need to make them accesible.
   * Remember to expose just the very needed and useful data
   * and functionalities.
   */&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;botName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// can store a single string: "Mr Bot"&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;proposedPlaces&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;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&lt;/span&gt; &lt;span class="c1"&gt;// can store a group of texts: ["Beerhole", "Sam's Bar and Wine", "Super Taco"]&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;dayOfWeek&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// can store a single string: "Friday"&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;hour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// can store a single string: "5:00pm"&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Nice! Now we have variables to store our data when the Bot is created.&lt;/p&gt;

&lt;p&gt;Next step is to &lt;strong&gt;define the behavior&lt;/strong&gt;. So, what do we need? I think we need to create a functionality to configure the Bot name, set the day and hour, save the proposed places, and randomly choose a place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There is a special method which allows us to do something when the object is created&lt;/strong&gt;. This method &lt;strong&gt;is called constructor&lt;/strong&gt; because it's executed while the object construction process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How an object looks like?&lt;/strong&gt;  How do we create it? you might ask. Well, we create an object based on the class that defines it. To do so, we will write &lt;strong&gt;something like this&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Bot ourSuperBot = new Bot();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The above line is declaring a &lt;strong&gt;variable of type Bot&lt;/strong&gt; that &lt;strong&gt;will contain a new object  instance&lt;/strong&gt; of the Bot class (Bot type), which means that it's an object created and loaded in the memory of your computer based on the Bot class.&lt;/p&gt;

&lt;p&gt;In other  words, the Bot &lt;strong&gt;it's alive now!&lt;/strong&gt;  and we refer to it as &lt;code&gt;ourSuperBot&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can create many objects based in the same class, and everyone will have different data. For example, you can create a bunch of bots of type Bot:&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="nc"&gt;Bot&lt;/span&gt; &lt;span class="n"&gt;ourSuperBot&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;Bot&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="nc"&gt;Bot&lt;/span&gt; &lt;span class="n"&gt;superBotBrother&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;Bot&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="nc"&gt;Bot&lt;/span&gt; &lt;span class="n"&gt;kevinBot&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;Bot&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I wanted to show you that in advance because I want you to understand how the constructor method works.&lt;/p&gt;

&lt;p&gt;Check out this part with attention: &lt;code&gt;Bot();&lt;/code&gt;. It looks like a &lt;strong&gt;method&lt;/strong&gt;, right? Well, in fact, it is. When we create a new object instance of a given class we can pass data through the parenthesis &lt;code&gt;()&lt;/code&gt;, and this data will be received and handled by the &lt;strong&gt;constructor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Ok, let's go back to our Bot project to see the constructor in action. &lt;/p&gt;

&lt;p&gt;We want to configure our Bot &lt;strong&gt;approaching the constructor&lt;/strong&gt;. The only configuration will be the Bot name, the day, and the time.&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;Bot&lt;/span&gt; &lt;span class="o"&gt;{&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;botName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;proposedPlaces&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;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&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;dayOfWeek&lt;/span&gt;&lt;span class="o"&gt;;&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;hour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// This is the constructor. The constructor must have the&lt;/span&gt;
  &lt;span class="c1"&gt;// class name and must be public. Also, it has not a return type &lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Bot&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;botName&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;dayOfWeek&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;hour&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// the word "this" allows you to access to variables at class level&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;botName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;botName&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;dayOfWeek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dayOfWeek&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;hour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hour&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;Great! Now we can configure the Bot when we create the new object instance in this way:&lt;br&gt;
&lt;code&gt;Bot ourSuperBot = new Bot("Mr Bot", "friday", "5:20pm");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we need to create a method to save the proposed places:&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;Bot&lt;/span&gt; &lt;span class="o"&gt;{&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;botName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;proposedPlaces&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;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&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;dayOfWeek&lt;/span&gt;&lt;span class="o"&gt;;&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;hour&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="nf"&gt;Bot&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;botName&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;dayOfWeek&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;hour&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;botName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;botName&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;dayOfWeek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dayOfWeek&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;hour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Must be public to allow to use it when the object &lt;/span&gt;
  &lt;span class="c1"&gt;// instance is created. We don't need to return any value&lt;/span&gt;
  &lt;span class="c1"&gt;// so we declare it as void. We need to receive the place&lt;/span&gt;
  &lt;span class="c1"&gt;// as an string, and save it in the global variable&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;proposeAPlace&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;place&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// the add() method allows to add an item at the end of the list&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;proposedPlaces&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;place&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;Lets add a method to get the randomly choosed place by the Bot:&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;Bot&lt;/span&gt; &lt;span class="o"&gt;{&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;botName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;proposedPlaces&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;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&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;dayOfWeek&lt;/span&gt;&lt;span class="o"&gt;;&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;hour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

 &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Bot&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;botName&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;dayOfWeek&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;hour&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;botName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;botName&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;dayOfWeek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dayOfWeek&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;hour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hour&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;proposeAPlace&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;place&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;proposedPlaces&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;place&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * We need to return a string (the randomly choosed place)
   * so we declare the method return type as String.
   * We don't need to receive anything so we don't specify 
   * anything in the params. And that's all.
   */&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;chooseAPlace&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Random&lt;/span&gt; &lt;span class="n"&gt;rand&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;Random&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// this is an special object of Java to make random things&lt;/span&gt;
    &lt;span class="k"&gt;return&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;proposedPlaces&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;rand&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="n"&gt;proposedPlaces&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The method &lt;code&gt;chooseAPlace()&lt;/code&gt;will return just the name of a random place, but we want to decorate it with a nice message like &lt;code&gt;"Hi! This is Mr Bot. The winner this week is: Sam's Bar and Wine. Schedule this date to meet your friends: friday 5:20pm"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To do so, we need to add a new method to decorate the text before returning it, but this method will be for internal usage only, so should be private to avoid the users from using it.&lt;/p&gt;

&lt;p&gt;It will receive a String (the place) via args, decorate the received String, and return it decorated.&lt;/p&gt;
&lt;h4&gt;
  
  
  Step 1: Declare the &lt;code&gt;private&lt;/code&gt; method
&lt;/h4&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;Bot&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

  &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="c1"&gt;// this means that there are more code above but we don't want to write it again in this piece of example code&lt;/span&gt;

  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;decorateText&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;textToDecorate&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;decoratedText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"The winner this week is: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;textToDecorate&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;decoratedText&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;h4&gt;
  
  
  Step 2: Use our new &lt;code&gt;private&lt;/code&gt;  method
&lt;/h4&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;Bot&lt;/span&gt; &lt;span class="o"&gt;{&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;botName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;proposedPlaces&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;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;();&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;dayOfWeek&lt;/span&gt;&lt;span class="o"&gt;;&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;hour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Bot&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;botName&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;dayOfWeek&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;hour&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;botName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;botName&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;dayOfWeek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dayOfWeek&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;hour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hour&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;proposeAPlace&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;place&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;proposedPlaces&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;place&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/**
   * We need to update our method to implement the new
   * decorateText method in order to decorate the text before 
   * returning the choosed place;
   */&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;chooseAPlace&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Random&lt;/span&gt; &lt;span class="n"&gt;rand&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;Random&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

    &lt;span class="cm"&gt;/**
     * All the proposed places are stored in proposedPlaces
     * global variable.
     * proposedPlaces is a list of elements, each element has 
     * a number that defines its position (0, 1, 2, 3) 
     * starting from 0.
     * To select a place from the list, we need to specify 
     * its position number.
     * To randomly select a number, we will use the "rand" 
     * object instance to access to a method called 
     * "nextInt()".
     * We need to tell the "nextInt()" what is the maximum 
     * number of options (if you set 4, the method will 
     * choose a number between 0 and 4).
     * The maximum number of options is the number of items
     * in our proposedPlaces list.
     * To get the number of items in proposedPlaces, we use
     * the size() method which returns an Integer number with
     * the count of items in the list.
     */&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;countOfPlaces&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;proposedPlaces&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;randomPlacePosition&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rand&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="n"&gt;countOfPlaces&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;choosedPlace&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;proposedPlaces&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;randomPlacePosition&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;decoratedText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;decoratedText&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;choosedPlace&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;decoratedText&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;decorateText&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;textToDecorate&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;decoratedText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hi! This is "&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;botName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;". The winner this week is: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;textToDecorate&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;". Schedule this date to meet your friends: "&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;dayOfWeek&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="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hour&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;decoratedText&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;We are done! Now, we can use our bot in this way:&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="c1"&gt;// ✅ Create a bot instance and configure it&lt;/span&gt;
&lt;span class="c1"&gt;// Remember that the args we are passing through will be received by the constructor method&lt;/span&gt;
&lt;span class="nc"&gt;Bot&lt;/span&gt; &lt;span class="n"&gt;ourSuperBot&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;Bot&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Mr Bot"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"friday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"5:20pm"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Execute the proposeAPlace method as many times you need&lt;/span&gt;
&lt;span class="n"&gt;ourSuperBot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;proposeAPlace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Beerhole"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Peter propose "Beerhole"&lt;/span&gt;
&lt;span class="n"&gt;ourSuperBot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;proposeAPlace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sam's Bar and Wine"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Sara propose "Sam's Bar and Wine"&lt;/span&gt;
&lt;span class="n"&gt;ourSuperBot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;proposeAPlace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Super Taco"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// and you propose "Super Taco"&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Finally, we ask the ourSuperBot object to randomly choose &lt;/span&gt;
&lt;span class="c1"&gt;// a place and store it in a new String type variable.&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;choosedPlace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ourSuperBot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;chooseAPlace&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If you try yo access to private members the Java will compiler stop you and throw an error:&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="c1"&gt;// ❌ Will throw an error because decorateText is for internal class usage only (private)&lt;/span&gt;
&lt;span class="n"&gt;ourSuperBot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;decorateText&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Empanadas Juanita"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// ❌ Will throw an error because proposedPlaces is for internal class usage only (private)&lt;/span&gt;
&lt;span class="n"&gt;ourSuperBot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;proposedPlaces&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Great! You can see this code in action thanks to replit.com which allows us to edit and run Java online. Click on the Green Button to re-run the code and see how the place changes randomly.&lt;/p&gt;


&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@chemah/JavaExample?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;



&lt;p&gt;I hope this post was helpful for you. I know there are some redundant parts. I did so because repetition while learning helps me to remember. Sorry for that. If you have any question or feedback, feel free to leave a comment. I will read you as soon as possible to improve the post.&lt;/p&gt;

&lt;p&gt;I'm writing it in Spanish too para la banda que habla español so when I finish I will update this post to add some illustrations. &lt;strong&gt;&lt;em&gt;Thanks for reading!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>java</category>
      <category>learn</category>
      <category>handbook</category>
    </item>
  </channel>
</rss>
