<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sergio Mesa on Medium]]></title>
        <description><![CDATA[Stories by Sergio Mesa on Medium]]></description>
        <link>https://medium.com/@mesasergio?source=rss-eac38cf217e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oLmEffBuFdl_TTcsCcQlDQ.jpeg</url>
            <title>Stories by Sergio Mesa on Medium</title>
            <link>https://medium.com/@mesasergio?source=rss-eac38cf217e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 10:21:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mesasergio/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Are you a developer? Think AI is coming for your job? Think again.]]></title>
            <link>https://medium.com/@mesasergio/are-you-a-developer-think-ai-is-coming-for-your-job-think-again-dd69a5160d3d?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd69a5160d3d</guid>
            <category><![CDATA[future]]></category>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Mon, 20 Oct 2025 19:00:54 GMT</pubDate>
            <atom:updated>2025-10-20T19:00:54.103Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*4Hju8UxKtqQibtF9" /></figure><p>The conversation around AI in the software development world has been loaded with anxiety. Every new model, every impressive demo, seems to fuel the narrative that software engineers are an endangered species.</p><p>But what if I told you that narrative is wrong? What if the data doesn’t just fail to support that idea, but actually points in the complete opposite direction?</p><p>The reality is, AI isn’t coming for your job. It’s coming to supercharge it. And you, as a developer, aren’t the victim of this revolution. You’re its most important customer.</p><p><strong>Follow the token trail: You’re the top consumer, not the product.</strong></p><p>When we look at who is actually consuming high-volume AI services from companies like OpenAI, Google, and Anthropic, a clear pattern emerges: the tech sector is the undisputed leader.</p><p>An analysis of Anthropic’s API usage, for example, reveals that a staggering 44% of traffic is dedicated to computer and mathematical tasks — primarily coding. It’s not the financial sector, not healthcare, not marketing. It’s developers.</p><p>Think about what this means. The bulk of the incredibly expensive AI infrastructure being built isn’t being used to replace programmers, but to <em>serve</em> them. Every time you use a code assistant, debug an error with an LLM’s help, or generate documentation, you are driving the demand that justifies this multi-billion dollar market.</p><p><strong>Follow the money: The biggest investments are aimed at you.</strong></p><p>The investment figures in AI are astronomical, with projections exceeding $200 billion from big tech by the end of 2025. But where is that money going? A significant portion is being funneled into creating tools <em>for</em> developers.</p><p>Companies like Microsoft (with GitHub Copilot on Azure OpenAI), Google (with Vertex AI), and Anthropic (with Claude) aren’t investing billions to shrink their customer base. They are competing fiercely to create the best coding assistant, the most efficient platform, and the smartest debugger. And who is the end-user for these products? You are.</p><p>The results of these investments are already tangible and are being measured in productivity:</p><ul><li><strong>Palo Alto Networks</strong> increased feature development velocity by 20–30% using Claude.</li><li>Junior developers at that same company completed integration tasks 70% faster, cutting onboarding time from months to weeks.</li><li>Engineering teams at companies like <strong>TELUS</strong> are reporting a 30% improvement in code delivery speed.</li></ul><p>These companies aren’t laying off 30% of their engineers. They are empowering their teams to be 30% faster, more efficient, and capable of tackling more complex problems. AI isn’t a replacement; it’s a force multiplier.</p><p><strong>The future isn’t “AI vs. Developer,” it’s “Developer <em>with</em> AI.”</strong></p><p>AI is becoming the most powerful tool in a developer’s arsenal. It handles the repetitive, time-consuming tasks — writing boilerplate code, generating unit tests, drafting documentation — freeing you up to focus on what truly matters: system architecture, complex business logic, and creative problem-solving.</p><p>The fear of replacement is understandable, but the data tells a story of empowerment. The AI industry is investing its capital and its computing power in you.</p><p>So the next time you hear that AI is going to eliminate programming jobs, remember this: you are the biggest customer, the target market for the largest investments, and the primary beneficiary of this technology.</p><p>The question isn’t whether AI will take your job, but how well you’ll learn to use your powerful new tool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd69a5160d3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No-code, Low-code, and vibe coding: Long-term solution or trap?]]></title>
            <link>https://medium.com/@mesasergio/no-code-low-code-and-vibe-coding-long-term-solution-or-trap-d05e1fb2fd28?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d05e1fb2fd28</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Fri, 17 Oct 2025 23:10:37 GMT</pubDate>
            <atom:updated>2025-10-17T23:10:37.987Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*FxcRLmi47ef0fVERqG5Epw@2x.jpeg" /></figure><p>My personal opinion on using no-code, low-code tools, or what I (and many others) call “vibe coding” for product creation is clear and well-defined:</p><blockquote>They are excellent for prototypes, idea validation, and MVPs (minimum viable products), but they are rarely the optimal solution for “real” and robust products that need to grow and evolve in the long term.</blockquote><p>At first glance, the promise is tempting: build something functional quickly, without the need for a deep technical team or with an apparently lower initial investment. However, this convenience often comes with a hidden and significant cost that manifests in several critical areas.</p><h3><strong>Scalability: A Quickly Reached Ceiling</strong></h3><p>When building a real product, scalability is not optional; it is a fundamental requirement. No-code and low-code platforms usually work well for a limited number of users, transactions, or data volumes. However, when the product gains traction and demand grows exponentially, these tools show their limitations. The underlying architecture, often encapsulated and opaque, is not designed to handle massive loads or unexpected spikes. Performance optimization becomes nearly impossible without access to the source code or the ability to fine-tune the infrastructure. This can lead to slow response times, service outages, and ultimately a poor user experience that hinders growth.</p><h3>Ability to Change and Maintain: Rigidity in a Dynamic World</h3><p>The market and user needs are constantly evolving, which means a digital product must be inherently adaptable. This is where no-code/low-code solutions falter badly. The capacity for change – meaning the ability to modify, add complex new functionalities, or seamlessly integrate third-party systems – is very limited. You are confined to the platform’s predefined “blocks” and logic. When you need a very specific functionality or a unique integration not available in the catalog, you hit a wall. Maintenance also becomes complicated; platform updates can break existing functionalities, and debugging complex problems is a nightmare without control over the code. This leads to what we call “vendor lock-in,” where dependency on the provider becomes so strong that migrating to a more suitable solution is a monumental and costly task.</p><h3>Architecture: Lack of Control and Visibility</h3><p>A real product requires a well-thought-out architecture, designed for efficiency, resilience, and security. No-code/low-code tools hide architectural complexity, which is good for initial speed but terrible for control. You lack visibility into how data is managed, how the backend communicates, or how optimized database queries are. You cannot choose the specific technologies that best fit your needs, nor implement advanced design patterns or microservices that ensure robustness and scalability. This lack of control translates into a fragile foundation that, as the product grows in complexity and functionality, becomes unsustainable and prone to systemic failures.</p><h3>Security: A Latent Risk</h3><p>Security is paramount for any real product handling user data or sensitive transactions. Although no-code/low-code platform providers invest in platform-level security, granular control over your application’s security policies is limited. You cannot implement your own custom security layers, perform thorough code audits, or ensure compliance with specific industry regulations (GDPR, HIPAA, etc.) with the same depth as a custom-coded solution. The risks of inherent platform vulnerabilities, which are outside your control, can be catastrophic. The opaque architecture also makes it difficult to proactively identify and mitigate potential attack vectors specific to your application.</p><h3>Costs: More Expensive in the Short and Long Term</h3><p>The common perception is that no-code/low-code is cheaper in the short term. It is true that the initial development time may be lower. However, this “advantage” is often an illusion. These platforms’ pricing models can become very expensive as usage, users, or data volume increase. Monthly or annual subscription costs, along with additional fees for premium features or integrations, can quickly surpass the cost of developing and maintaining a custom solution. Moreover, when the product hits its scalability, performance, or functionality limits, the need for “re-platforming” (migrating to a custom code solution) becomes inevitable. This process is extremely costly, time-consuming, and slows innovation, resulting in a much higher total cost of ownership (TCO) in the medium and long term than if a more robust solution had been chosen from the start.</p><p>No-code, low-code, and “vibe coding” tools are powerful assets in any innovator’s toolkit, especially for validating hypotheses and obtaining quick feedback. But to build “real” products – those that need to scale, evolve with the market, maintain solid architecture, ensure security, and be economically viable in the long term – the flexibility, control, and robustness that code-based development offers are, in my opinion, irreplaceable. The decision of when to use each approach is strategic and must weigh initial speed against long-term sustainability and growth.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d05e1fb2fd28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Translator Wizard: A Deep Dive into the AI Encoder]]></title>
            <link>https://medium.com/@mesasergio/the-translator-wizard-a-deep-dive-into-the-ai-encoder-2917ae4c31cc?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2917ae4c31cc</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 01:04:23 GMT</pubDate>
            <atom:updated>2024-07-22T13:17:01.500Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever marveled at how machines seem to understand our language? How virtual assistants like Alexa or Siri engage in fluid conversations? Welcome to the captivating realm of the encoder, the magical brain powering these technological wonders in the field of Natural Language Processing (NLP).</p><h3>The AI Translator Wizard: Decoding the Encoder</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LoCCNFEgtJy60etnl_xLOQ.png" /></figure><p>Imagine the encoder as a translator wizard with superhuman abilities, armed with the latest in computational linguistics. Its mission: to transform our words into a numerical representation that machines can process and understand. But this wizard does more than simple translation; it contextualizes everything!</p><p>In technical terms, the encoder is a crucial component of many NLP models, especially in architectures like transformers. It converts input text into high-dimensional vector representations, capturing not just the meanings of individual words, but also their relationships and roles within the broader context.</p><h3>The Metamorphosis of Words: From Text to Vectors</h3><h4>First Act: The Transformation Spell (Input Embedding)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eueo6sUhkU-11s-yGOTpEQ.png" /></figure><p>When you input a sentence, our wizard (the encoder) converts each word into a magical suitcase — or more accurately, a vector — filled with 512 hidden meanings. In the NLP world, we call this process “embedding.”</p><p>Why 512 dimensions? Well, data scientists have found that this number provides a good balance between computational efficiency and representational power. It allows the model to capture subtle nuances in word meanings and their relationships.</p><p>Each dimension in this vector represents a different aspect of the word’s meaning or usage. For instance, one dimension might represent how “formal” the word is, another how “positive” or “negative” it is, and so on.</p><h4>Second Act: The Position Enchantment (Positional Encoding)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NNCLxIDbkgc0w2NeSFpy6g.png" /></figure><p>Here’s where the magic becomes even more impressive. Machines, unlike humans, don’t inherently understand word order. To solve this, our wizard employs a clever trick called positional encoding.</p><p>This encoding uses sinusoidal functions (sine and cosine waves) to create a unique pattern for each position in the sequence. It’s as if each word-suitcase glows with a distinct numerical pattern indicating its place in the sentence.</p><p>The beauty of this approach is that it allows the model to understand relative positions even in very long sequences, and it’s consistent regardless of the input length.</p><h3>The Magical Comprehension Factory: Inside the Encoder Layers</h3><h4>Third Act: The Chain of Spells (Encoder Stack)</h4><p>Now, our word-vectors journey through a series of magical transformations, each adding more layers of understanding. This is where the real power of the encoder lies.</p><p><strong>The Multiple Self-Attention Spell (Multi-Head Attention)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-93dV8wNbsn3_4VfXeXmg.png" /></figure><p>Imagine each word coming to life and starting to chat with all the others, asking, “Hey, how important are you to my meaning?” This is essentially what multi-head attention does. Technically, it allows each word to attend to other words in the input sequence, assigning them importance weights. The “multi-head” part means this process happens in parallel several times, allowing the model to capture different types of relationships between words. For example, in the sentence “The cat sat on the mat,” one attention head might focus on the subject-verb relationship (“cat-sat”), while another might focus on the spatial relationship (“sat-on-mat”).</p><p><strong>The Neural Network Conjuring (Feed-Forward Neural Network)</strong></p><p>After the attention party, each word goes through a magical gym — a feed-forward neural network. This network applies a series of linear transformations and non-linear activations (like ReLU) to each word representation independently. This step allows the model to process the aggregated information from the attention layer and introduce non-linearities, which are crucial for the model to learn complex patterns.</p><p>These two steps (attention and feed-forward) are typically repeated several times, forming what we call a stack of encoder layers. With each repetition, the word representations become more refined and context-aware.</p><h3>The Magical Grand Finale: Contextualized Representations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ST92PARdiA0FGJDY2DG7g.png" /></figure><p>At the end of this extraordinary journey, each word has been completely transformed. It’s no longer a simple word, but a rich, context-aware vector representation.</p><p>In NLP terms, we call these “contextualized embeddings.” Unlike static word embeddings (like Word2Vec or GloVe), these representations capture not just general word meaning, but also how that meaning changes based on the specific context in which the word appears.</p><h3>What Happens Next: From Encoding to Application</h3><p>All this processed information is now primed for various NLP tasks. It can serve as the foundation for:</p><ol><li>Generating human-like responses in chatbots</li><li>Performing accurate machine translation</li><li>Extracting key information in text summarization</li><li>Classifying text in sentiment analysis</li></ol><p>The possibilities are vast and continually expanding as researchers find new ways to leverage these powerful representations.</p><h3>The Final Act: The Encoder’s Role in Modern NLP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvLj74L-9uN5m094pTKcRQ.png" /></figure><p>The encoder, our information processing wizard, is a cornerstone of modern NLP architectures. It takes our simple words and transforms them into rich, context-aware vector representations that machines can understand and manipulate.</p><p>Models like BERT, GPT, and their variants all rely on variations of this encoding process. They’ve revolutionized how machines understand and generate human language, achieving unprecedented performance across a wide range of language tasks.</p><p>The next time you interact with a virtual assistant or use a translation service, remember the magical-yet-scientific process happening behind the scenes. It’s a testament to how far we’ve come in teaching machines to understand something as uniquely human as language.</p><p>As AI continues to advance, the encoder stands as a shining example of how clever algorithms, inspired by human cognition, can bridge the gap between human communication and machine understanding. The future of NLP is bright, illuminated by the algorithmic magic of encoders.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2917ae4c31cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Essential Techniques for Turbocharging API Performance: A Symphony of Efficiency]]></title>
            <link>https://medium.com/@mesasergio/5-essential-techniques-for-turbocharging-api-performance-a-symphony-of-efficiency-796f736d7edd?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/796f736d7edd</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Wed, 17 Jul 2024 17:24:21 GMT</pubDate>
            <atom:updated>2024-07-17T17:24:21.073Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DNmfrDyA4gcOsS58" /></figure><p>In a world where music and technology merge, there existed a digital orchestra called “Symphony API.” This orchestra didn’t play traditional instruments but handled data and requests with impeccable precision and harmony. Under the direction of Maestro Cadence, Symphony API became a world-renowned reference for performance and efficiency. But what was the secret behind their success? Here’s the story of how five essential techniques transformed Symphony API into a high-performance symphony.</p><h4>Caching: The Conductor’s Memory</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x9jzoTdJBOfKUJT4nFNeww.png" /></figure><p>The first challenge for the orchestra was how to remember each note and rhythm without missing a beat. Maestro Cadence decided to implement caching, a technique that stored frequently accessed data in a special memory like Redis or Memcached. This allowed the orchestra to quickly access information without repeatedly searching the database.</p><p><strong>Benefits:</strong></p><ul><li>Like a conductor avoiding repeated instructions, caching drastically reduced database load.</li><li>It significantly improved response times, allowing the orchestra to play without interruptions.</li></ul><p><strong>Challenges:</strong></p><ul><li>Deciding on the right caching strategy was like choosing the perfect score for each concert.</li><li>Managing cache invalidation to ensure data consistency was akin to constantly tuning the instruments.</li></ul><h4>Scale-out with Load Balancing: The Traffic Conductor</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCTHjuB1Tkc_FNfVz7UE0Q.png" /></figure><p>As Symphony API’s fame grew, so did the number of audience requests. To handle the increased traffic, Maestro Cadence implemented a load balancer, which acted like a traffic conductor, distributing requests among multiple server instances. This prevented a single server from becoming a bottleneck.</p><p><strong>Benefits:</strong></p><ul><li>Like an usher avoiding crowding, the load balancer efficiently managed the increased traffic.</li><li>It improved reliability by redirecting requests to healthy instances if one failed.</li></ul><p><strong>Considerations:</strong></p><ul><li>Stateless applications were easier to scale, like musicians who could switch seats without missing a beat.</li><li>It required infrastructure to manage load balancers, similar to coordinating logistics for a large event.</li></ul><h4>Asynchronous Processing: Real-Time Improvisation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2zfNkhcHpsF3ekPlIZNQ_A.png" /></figure><p>In a special jazz performance, Maestro Cadence decided to implement asynchronous processing. This technique allowed the orchestra to acknowledge client requests immediately and process tasks in the background, sending results later.</p><p><strong>Benefits:</strong></p><ul><li>It unblocked the client and improved perceived responsiveness, like a jazz solo that captivated the audience.</li><li>It allowed the API server to handle long-running tasks without delaying other requests.</li></ul><p><strong>Considerations:</strong></p><ul><li>It required careful design to manage background tasks, like coordinating a jam session.</li><li>It was not suitable for all API operations, just as improvisation doesn’t fit all musical pieces.</li></ul><h4>Pagination: The Program Pages</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAUEWswry-1Xwt3gW3mdhg.png" /></figure><p>During a grand concert with a full orchestra, Maestro Cadence decided to implement pagination. This technique limited the number of records returned per request, similar to how a conductor organizes pieces in a concert program.</p><p><strong>Benefits:</strong></p><ul><li>It reduced response sizes, especially for large datasets, like breaking a concert into several parts.</li><li>It prevented excessive memory consumption on both the client and server.</li></ul><p><strong>Implementation:</strong></p><ul><li>They used query parameters for the page number and size, like indicating the order of pieces in a program.</li><li>They included metadata in the response, like program notes guiding the audience.</li></ul><h4>Connection Pooling: Instrument Synchronization</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYQ0iIIl13v5qdOVRdVchg.png" /></figure><p>To maintain harmony, musicians didn’t tune their instruments every time they played a note. Similarly, Maestro Cadence implemented connection pooling, which maintained a pool of reusable database connections instead of creating a new one for each request.</p><p><strong>Benefits:</strong></p><ul><li>It minimized the overhead of establishing new connections, like musicians playing in tune from the start.</li><li>It significantly improved performance under high concurrency, like an orchestra playing in unison.</li></ul><p><strong>Implementation:</strong></p><ul><li>They used built-in connection pooling mechanisms offered by most database libraries/frameworks.</li></ul><h4>Additional Tips to Fine-Tune Your API Orchestra</h4><ul><li><strong>Optimize Database Queries:</strong> Ensure that queries are efficient, like well-written scores.</li><li><strong>Gzip Compression:</strong> Reduce response sizes, similar to how musical arrangements compact notes.</li><li><strong>Content Delivery Network (CDN):</strong> Cache static assets globally for faster delivery, like having copies of scores everywhere.</li><li><strong>Monitor and Profile:</strong> Use tools like New Relic or Datadog to identify bottlenecks, like a conductor adjusting the tempo to maintain harmony.</li></ul><p>Thanks to these techniques, Symphony API became a symphony of efficiency, delighting users and developers alike with its impeccable performance. Each request was a perfect note, and each response, a melody that resonated with precision and speed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=796f736d7edd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Main API Architectural Styles: A Technological Adventure]]></title>
            <link>https://medium.com/@mesasergio/exploring-the-main-api-architectural-styles-a-technological-adventure-c6d1762f5acc?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6d1762f5acc</guid>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[soap]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Mon, 15 Jul 2024 17:35:52 GMT</pubDate>
            <atom:updated>2024-07-15T19:26:55.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4aM4WqGSAn1Qj-YO" /></figure><p>Imagine a world where, no matter what language you speak, you always find a way to understand each other. That’s how APIs (Application Programming Interfaces) work in the software universe. They are the magical bridge connecting different systems, allowing them to communicate seamlessly. In this fascinating journey, you’ll discover the main API architectural styles and how each has its unique personality and special abilities.</p><h4>The Wise SOAP</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U_ACJxt5qWw7hJoA" /></figure><p>At the top of a mountain, in an ancient technological temple, resides SOAP (Simple Object Access Protocol). It’s the guardian of web services, using the ancient language of XML to communicate messages. Picture SOAP as a master of ceremonies in a medieval court, ensuring every message reaches its destination with security and precision.</p><p>SOAP was developed by Microsoft in 1998, and while its methods may seem formal and rigid, its strength lies in security and the ability to handle complex transactions. It’s like sending certified letters sealed with wax, ensuring only the intended recipient can open them.</p><ul><li><strong>Main Uses</strong>: Ideal for diplomatic missions where security and reliability are essential.</li></ul><h4>The Agile Traveler RESTful</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8AOcYDLSgkoguUjc" /></figure><p>Descending the mountain, we meet REST (Representational State Transfer), an adventurer traveling the HTTP roads. REST is free and flexible, using standard methods like GET, POST, PUT, and DELETE. It’s like a nimble messenger on a motorcycle, delivering messages quickly and adapting to any situation.</p><p>RESTful APIs are the most popular today. Their ease of handling various data formats like JSON and XML, and their ability to scale, make them a favorite choice for many developers. Imagine REST as a modern nomad who can communicate with any tribe encountered along the way.</p><ul><li><strong>Main Uses</strong>: Perfect for dynamic web applications that need to move fast and scale easily.</li></ul><h4>The Visionary GraphQL</h4><p>Under the shade of a great data tree, rests GraphQL, a visionary with a detailed map of every piece of data you might need. Picture GraphQL as a genie who grants you exactly the wish you ask for, no more, no less. With GraphQL, you can request only the information you need, making it extremely efficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sEG3Zq7qZAaE7eAg" /></figure><p>GraphQL, developed by Facebook, allows clients to get exactly what they need, avoiding data overload. It’s like having a buffet where you can serve yourself only what you want to eat, instead of receiving a plate full of things you don’t need.</p><ul><li><strong>Main Uses</strong>: Perfect for mobile apps where efficiency and flexibility are key.</li></ul><h4>The Fast gRPC</h4><p>In a high-tech lab, we find gRPC, an engineer specializing in speed and performance. Using HTTP/2 and Protocol Buffers, gRPC communicates efficiently and effectively. It’s like a Formula One driver, able to transmit messages at astonishing speeds without losing precision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yQCQTtF2-3DapP_2" /></figure><p>Developed by Google, gRPC offers authentication, load balancing, and other advanced features, making it a powerful tool for communication between distributed systems.</p><ul><li><strong>Main Uses</strong>: Ideal for high-performance environments requiring fast and efficient communication.</li></ul><h4>The Connector WebSocket</h4><p>In a city that never sleeps, where the lights are always on, WebSocket acts as a high-speed train conductor, connecting passengers (data) in real-time. Imagine a train that never stops, allowing constant bidirectional communication between the client and the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AegiOfpLVy9QkXai" /></figure><p>WebSockets are perfect for applications that need instant updates, like online games or financial trading platforms. It’s the solution for those who can’t afford even a second of delay.</p><ul><li><strong>Main Uses</strong>: Applications that require real-time synchronization.</li></ul><h4>The Messenger Webhook</h4><p>In a bustling market, Webhook is the street vendor who always knows when fresh products arrive. Instead of waiting to be asked, Webhook notifies its customers as soon as something important happens. It’s like having a personal messenger who alerts you every time something relevant occurs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VoXZW15LfluwNVrd" /></figure><p>Webhooks are user-defined and triggered by specific events. They’re ideal for integrating systems and providing real-time notifications. It’s the perfect tool for those who need to stay informed at all times.</p><ul><li><strong>Main Uses</strong>: System integrations and instant notifications.</li></ul><p>In this technological adventure, we’ve met SOAP, RESTful, GraphQL, gRPC, WebSocket, and Webhook, each with their own strengths and unique characteristics. Just like in a good story, each character plays an essential role, and choosing the right one depends on the needs and challenges of your mission. So, next time you design an API, remember these personalities and wisely choose the hero that will help you succeed.</p><p>I hope you enjoyed this journey and now see APIs not just as technical tools but as fascinating characters in the vast universe of technology. Until the next adventure!</p><p>If you want me to write articles explaining each one, let me know in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6d1762f5acc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the New Features of ECMAScript 2024 (ES15)]]></title>
            <link>https://medium.com/@mesasergio/exploring-the-new-features-of-ecmascript-2024-es15-3af058610386?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/3af058610386</guid>
            <category><![CDATA[news]]></category>
            <category><![CDATA[improvement]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Wed, 10 Jul 2024 20:12:16 GMT</pubDate>
            <atom:updated>2024-07-10T20:12:16.692Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iYkNMEQG64EwRzZQ" /></figure><p>Hi, developers! Today, we’ll dive into the new features of ECMAScript 2024 (ES15). This version includes several improvements and new functions that will help you write cleaner, more efficient, and maintainable code.</p><h3>JavaScript Version Numbers</h3><p>Starting in 2015, ECMAScript versions are numbered annually: ES6, ES7, etc. The 2024 version, known as ES15, will be officially released in June 2024. This annual numbering allows us to closely follow JavaScript’s continuous evolution and stay updated on the latest improvements and features.</p><h3>New Features in ES2024</h3><h3>Object.groupBy()</h3><p>The Object.groupBy() function allows grouping object elements based on values returned by a callback function. This is especially useful for organizing data intuitively. Here’s an example of grouping fruits by quantity:</p><pre>const fruits = [<br>  { name: &#39;apple&#39;, quantity: 10 },<br>  { name: &#39;banana&#39;, quantity: 20 },<br>  { name: &#39;cherry&#39;, quantity: 10 }<br>];<br><br>const groupedByQuantity = Object.groupBy(fruits, fruit =&gt; fruit.quantity);<br>console.log(groupedByQuantity);<br>// {<br>//   &#39;10&#39;: [{ name: &#39;apple&#39;, quantity: 10 }, { name: &#39;cherry&#39;, quantity: 10 }],<br>//   &#39;20&#39;: [{ name: &#39;banana&#39;, quantity: 20 }]<br>// }</pre><h3>Map.groupBy()</h3><p>Map.groupBy() is similar to Object.groupBy(), but for maps. It allows grouping map elements based on values returned by a callback function, providing additional flexibility when working with more complex data sets.</p><pre>const fruits = new Map([<br>  [&#39;apple&#39;, 10],<br>  [&#39;banana&#39;, 20],<br>  [&#39;cherry&#39;, 10]<br>]);<br><br>const groupedByQuantity = Map.groupBy(fruits, ([, quantity]) =&gt; quantity);<br>console.log(groupedByQuantity);<br>// Map {<br>//   10 =&gt; Map { &#39;apple&#39; =&gt; 10, &#39;cherry&#39; =&gt; 10 },<br>//   20 =&gt; Map { &#39;banana&#39; =&gt; 20 }<br>// }</pre><h3>Differences Between Object.groupBy() and Map.groupBy()</h3><p>The main difference between Object.groupBy() and Map.groupBy() is that Object.groupBy() groups elements into an object, while Map.groupBy() groups elements into a map. This distinction allows choosing the data structure that best fits your application’s needs.</p><h3>Temporal API</h3><p>ES2024 introduces the Temporal API, a series of new objects for handling dates and times more intuitively and accurately. The Temporal API is a significant improvement over existing date and time objects, providing a more robust and flexible way to work with these data.</p><h3>Temporal.PlainDate</h3><pre>const date = Temporal.PlainDate.from(&#39;2024-06-30&#39;);<br>console.log(date.year); // 2024<br>console.log(date.month); // 6<br>console.log(date.day); // 30</pre><h3>Temporal.PlainTime</h3><pre>const time = new Temporal.PlainTime(14, 30);<br>console.log(time.hour); // 14<br>console.log(time.minute); // 30</pre><h3>Temporal.PlainMonthDay</h3><pre>const monthDay = new Temporal.PlainMonthDay(5, 1);<br>console.log(monthDay.month); // 5<br>console.log(monthDay.day); // 1</pre><h3>Temporal.PlainYearMonth</h3><pre>const yearMonth = new Temporal.PlainYearMonth(2024, 6);<br>console.log(yearMonth.year); // 2024<br>console.log(yearMonth.month); // 6</pre><p>The improvements introduced in ECMAScript 2024 reflect the continuous focus on making JavaScript more functional and declarative. These updates not only simplify data handling but also enhance code readability and maintainability.</p><p>ECMAScript 2024 marks another significant step in the evolution of JavaScript. The new features and improvements are designed to make development more efficient and enjoyable. As we adopt these new tools, we can expect to write cleaner, more robust, and maintainable code.</p><p>For more details and examples on ECMAScript 2024, I recommend visiting the official <a href="https://www.w3schools.com/js/js_2024.asp">W3Schools page on ECMAScript 2024</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3af058610386" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creación de componente Autenticación y Registro con Angular & Firebase # 2]]></title>
            <link>https://medium.com/@mesasergio/creaci%C3%B3n-de-componente-autenticaci%C3%B3n-y-registro-con-angular-firebase-2-92c8926fd09d?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/92c8926fd09d</guid>
            <category><![CDATA[angular-material]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firebaseauthentication]]></category>
            <category><![CDATA[angularfire2]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Sat, 16 Feb 2019 20:25:23 GMT</pubDate>
            <atom:updated>2019-02-20T14:00:50.752Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/623/0*pgVTjYh-j1NV9NxQ" /></figure><p>Continuando con nuestro proyecto de crear un componente de autenticación y registro con Angular y Firebase, el cual comenzamos con la creación del proyecto, la configuración del entorno y dependencias que puedes ver dan click <a href="https://medium.com/@mesasergio/creaci%C3%B3n-de-componente-autenticaci%C3%B3n-y-registro-con-angular-firebase-1-8edbe14cb489">aquí</a>, vamos a continuar con la segunda parte de este pequeño tutorial.</p><p>En esta parte nos centraremos en desarrollar un Service que contendrá todas las funciones para realizar acciones que necesitamos en nuestro proyecto :</p><ul><li>Registrar un usuario nuevo con un correo electrónico y una contraseña</li><li>Iniciar sesión con un correo electrónico y una contraseña</li><li>Validar si un usuario esta o no autenticado</li><li>Recuperar la información de un usuario autenticado</li><li>Recuperar contraseña por medio de un enlace de correo electrónico</li><li>Verificar correo electrónico de una cuenta</li><li>Cerrar sesión de usuario</li><li>Iniciar sesión / Registrar usuario nuevo con Facebook</li><li>Iniciar sesión / Registrar usuario nuevo con Google</li></ul><blockquote>Este servicio lo consumiremos en los componentes que desarrollaremos en los tutoriales #3 y #4.</blockquote><p>Para comenzar, debemos iniciar creando nuestro Service, el cual llamaremos AuthFirebase y estará adentro de la carpeta providers/auth de nuestro proyecto, usando el angular CLI desde nuestra terminal con el comando:</p><p>$ ng g service providers/auth/auth-firebase</p><p>Si todo salido bien debemos ver en nuestro proyecto en src/app/providers/auth 2 archivos que nos creo el Angular CLI:</p><ul><li>auth-firebase.service.spec.ts ( pruebas unitarias)</li><li>auth-firebase-service.ts</li></ul><p>Nos centraremos en auth-firebase-service.ts !</p><p>Abrimos el archivo <em>auth-firebase-service.ts </em>y lo primero que haremos será importar a firebase, AngularFireAuth y Observable en nuestro servicio así:</p><pre><strong>import { Observable } from &#39;rxjs&#39;;<br>import * as firebase from &#39;firebase/app&#39;;<br>import { AngularFireAuth } from &#39;@angular/fire/auth&#39;;</strong></pre><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})</pre><pre>export class AuthFirebaseService { </pre><pre>  constructor() { }</pre><pre>}</pre><p>Lo segundo es declarar variable Observable user que podrá contener un objeto del tipo firebase.User o un null, así:</p><pre><strong>import { Observable } from &#39;rxjs&#39;;<br>import * as firebase from &#39;firebase/app&#39;;<br>import { AngularFireAuth } from &#39;@angular/fire/auth&#39;;</strong></pre><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})</pre><pre>export class AuthFirebaseService {</pre><pre>  <strong>private user: Observable&lt;firebase.User | null &gt;;</strong></pre><pre>  constructor() { }</pre><pre>}</pre><blockquote>La variable user la usaremos para determinar el estado de autenticación de un usuario y tambien para obtener los datos del usuario autenticado.</blockquote><p>Lo tercero que haremos será instanciar un objeto privado de la clase AngularFireAuth en nuestro constructor, tambien en nuestro constructor asignaremos a nuestra variable user el valor que se obtiene del observador de la instancia que acabamos de crear que identifica el estado actual de autenticación y que se llama authState.</p><pre><strong>import { Observable } from &#39;rxjs&#39;;<br>import * as firebase from &#39;firebase/app&#39;;<br>import { AngularFireAuth } from &#39;@angular/fire/auth&#39;;</strong></pre><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})</pre><pre>export class AuthFirebaseService {</pre><pre><strong>  private user: Observable&lt;firebase.User | null &gt;;</strong></pre><pre>  constructor(<strong>private afAuth: AngularFireAuth</strong>) {<br>    <strong>this.user = this.afAuth.authState;</strong><br>  }</pre><pre>}</pre><p>En este punto ya tenemos la capacidad de saber el estado de autenticación de firebase en nuestro proveedor de servicio, ahora comenzaremos a implementar las funciones utilitarias para hacer las acciones que planteamos al comienzo del tutorial.</p><ol><li>Obtener el estado de la autenticación y obtener la información del usuario autenticado.<br>Para ello vamos a crear 2 funciones</li></ol><ul><li><strong>authenticated</strong>: <em>Servirá para obtener un boolean con el estado de autenticación</em></li><li><strong>currentUser</strong>: <em>Servirá para devolver el usuario actual que esta en el atributo user de nuestro servicio</em></li></ul><p>Ambas funciones las declararemos como get ya que su única función será retornar un valor, si quieren saber un poco mas como definir funciones dentro una clase les recomiendo este <a href="https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Object/defineProperty#Description">enlace</a>.</p><p>Al final nuestras funciones deberían verse así:</p><pre><strong><em>// Obtener el estado de autenticación<br></em></strong>get authenticated():boolean {<br>  return this.user != null; // True ó False<br>}</pre><pre><strong><em>// Obtener el observador del usuario actual<br></em></strong>get currentUser(): Observable&lt;firebase.User | null&gt; {<br>  return this.user;<br>}</pre><p>Ya que tengamos nuestras funciones para determinar el estado de autenticación y el usuario autenticado, seguiremos con la implementación de nuestras funciones que tienen que ver con registro y autenticación con correo electrónico y contraseña, estas las llamaremos <strong><em>signInWithEmail </em></strong>y<strong><em> signUpWithEmail </em></strong>ambas retornaran una promesa del tipo firebase.auth.UserCredential.</p><pre><strong>// Registro con email<br></strong>signUpWithEmail(email, pass): Promise&lt;firebase.auth.UserCredential&gt; {<br> return this.afAuth.auth.createUserWithEmailAndPassword(email,pass);<br>}</pre><pre><strong><em>// Ingreso con email<br></em></strong>signInWithEmail(email, pass): Promise&lt;firebase.auth.UserCredential&gt; {<br> return this.afAuth.auth.signInWithEmailAndPassword(email,pass)<br>}</pre><p>En estas funciones estamos usando las funciones createUserWithEmailAndPassword y signInWithEmailAndPassword para realizar las acciones de registro e ingreso con email respectivamente, estos son parte de la interfaz auth de nuestra instancia afAuth de la clase <strong>AngularFireAuth, </strong>para saber un poco mas de estas sobre estas funciones de <a href="https://firebase.google.com/docs/auth/web/password-auth?authuser=1#sign_in_a_user_with_an_email_address_and_password">autenticación</a> y <a href="https://firebase.google.com/docs/auth/web/password-auth?authuser=1#create_a_password-based_account">registro</a>, den clic en los enlaces.</p><p>A continuación seguiremos las funciones para registrar/ingresar por medio de Facebook y Google, en estos llamados crearemos el provider de cada uno, especificando opciones sencillas para este ejemplo, en el caso de facebook le solicitaremos acceso a su fecha de cumpleaños y en el caso de google el acceso a sus contactos(solo como lectura), para saber mas de las opciones de cada uno de los proveedores les dejo los enlaces, <a href="https://developers.facebook.com/docs/facebook-login/permissions">facebook</a> / <a href="https://developers.google.com/identity/protocols/googlescopes?authuser=1">google</a></p><p>Las funciones quedarían así:</p><pre><strong><em>// Autenticación con Facebook<br></em></strong>authWithFacebook(): Promise&lt;firebase.auth.UserCredential&gt; {</pre><pre>const provider: firebase.auth.FacebookAuthProvider = new       firebase.auth.FacebookAuthProvider();<br>provider.addScope(&#39;user_birthday&#39;);<br>return this.afAuth.auth.signInWithPopup(provider);</pre><pre>}</pre><pre><strong><em>// Autenticación con Google<br></em></strong>authWithGoogle(): Promise&lt;firebase.auth.UserCredential&gt; {</pre><pre>const provider: firebase.auth.GoogleAuthProvider = new firebase.auth.GoogleAuthProvider();<br>     provider.addScope(&#39;https://www.googleapis.com/auth/contacts.readonly&#39;);</pre><pre>return this.afAuth.auth.signInWithPopup(new  firebase.auth.GoogleAuthProvider());</pre><pre>}</pre><p>Notemos varios detalles:</p><ol><li>Ambas funciones hace el llamado a la función <a href="https://firebase.google.com/docs/reference/js/firebase.auth.Auth?authuser=1#signInWithPopup">signInWithPopup</a>, esta función que es parte de firebase.auth, esta autentica un cliente Firebase utilizando un flujo de autenticación OAuth basado en ventanas emergentes. Si tiene éxito, devuelve el usuario que inició sesión junto con la credencial del proveedor. Si el inicio de sesión no tuvo éxito, devuelve un objeto de error que contiene información adicional sobre el error.</li><li>En ambas funciones se le pasa una instancia “provider” del tipo <a href="https://firebase.google.com/docs/reference/js/firebase.auth.GoogleAuthProvider?authuser=1">GoogleAuthProvider</a> ó <a href="https://firebase.google.com/docs/reference/js/firebase.auth.FacebookAuthProvider?authuser=1">FacebookAuthProvider</a>.</li><li>En ambas funciones nos retorna una promesa del firebase.auth.UserCredential.</li></ol><p>Listo… a este punto ya podemos hacer lo siguiente con nuestro servicio:</p><ol><li>Saber el estado de autenticación</li><li>Saber el usuario autenticado</li><li>Registrarnos con correo electrónico</li><li>Iniciar sesión con correo electrónico</li><li>Autenticarnos con Facebook</li><li>Autenticarnos con Google</li></ol><p>Solo nos quedan 3 funciones más que son hacer un reset a la contraseña, enviar correo de verificación de correo electrónico y cerrar sesión, adicional agregaremos una función para actualizar los datos de nombre y photo del perfil de usuario.</p><p><strong>Hacer reset de la contraseña<br></strong><em>Esta función es muy simple, solo se debe invocar la función sendPasswordResetEmail de nuestra instancia afAuth, se debe tener en cuenta que esta función recibe un email y dependiendo si este esta o no registrado en nuestro firebase realizará el envió de un mensaje de recuperación.</em></p><pre><strong>// Recuperar contraseña<br></strong>resetPassword(email): Promise&lt;void&gt; {<br>  return this.afAuth.auth.sendPasswordResetEmail(email);<br>}</pre><p><strong>Verificar correo electrónico</strong></p><p><em>Esta función se realiza por medio de la instancia del usuario autenticado, por lo que si este es null no se podrá usar la función, esta función no recibe ningún parametro, ya que hace uso de la información del “CurrentUser” para enviar el mensaje de verificación</em></p><pre><strong>// Verificar correo<br></strong>verifyEmail(): Promise&lt;void&gt; {<br>  return this.afAuth.auth.currentUser.sendEmailVerification();<br>}</pre><p><strong>Finalizar sesión</strong></p><p><em>Otra función de lo mas simple, solo debemos invocar la función signOut de la instancia afAuth.</em></p><pre><strong>// Finalizar sesión<br></strong>signOut(): Promise&lt;void&gt; {<br>  return this.afAuth.auth.signOut();<br>}</pre><p><strong>Actualizar perfil de usuario(en el firebase Authentication)</strong></p><p><em>Esta función al igual que la de verificar el correo electrónico hace uso de la instancia del usuario autenticado “CurrentUser” para poder llamar la función de actualización de perfil updateProfile, si no existe un usuario autenticado no se podrá usar esta función.</em></p><p>Esta función recibirá de forma opcional el nombre y la url de la foto, en el caso de que no se les pase el parametro, la función dejara los que tenia.</p><pre><strong>// Actualizar perfil firebase authentication<br></strong>updateProfile(name?,photo?):Promise&lt;void&gt; {</pre><pre>return this.afAuth.auth.currentUser.updateProfile({</pre><pre>displayName: <br>(name) ? name : this.afAuth.auth.currentUser.displayName,</pre><pre>photoURL: <br>(photo) ? photo : this.afAuth.auth.currentUser.photoURL</pre><pre>});</pre><pre>}</pre><p>Listo, ya terminamos todas nuestras funciones básicas, obviamente existen más funcionalidades que podemos agregar, pero eso lo haremos en otros tutoriales. por el momento les dejo las ultimas instrucciones que debemos tener en cuenta para que nuestro servicio funcione.</p><ol><li>Se debe habilitar las formas de autenticación en la consola de nuestro proyecto de firebase dando clic en el menu lateral izquierdo, en la opción “<strong>Authentication</strong>” en la pestaña “<strong>Método de autenticación</strong>” y encendiendo los métodos Correo electrónico, Facebook y Google.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s3P7SEV3P_pLmoNOdkLkLw.png" /></figure><p>En el caso de Facebook debemos darle los parametros Id de la App y Secreto de la App que se obtienen creando un proyecto en Facebook y siguiendo estas <a href="https://firebase.google.com/docs/auth/?authuser=0">instrucciones</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*ge74D0j0p1imBxk6dqGWnA.png" /></figure><p>Por el momento es todo seguiremos en el próximo artículo en el que veremos la forma de consumir nuestro servicio de autenticación…. Nos vemos.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92c8926fd09d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creación de componente Autenticación y Registro con Angular & Firebase # 1]]></title>
            <link>https://medium.com/@mesasergio/creaci%C3%B3n-de-componente-autenticaci%C3%B3n-y-registro-con-angular-firebase-1-8edbe14cb489?source=rss-eac38cf217e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/8edbe14cb489</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[angular-material]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angularfire2]]></category>
            <category><![CDATA[angularfire]]></category>
            <dc:creator><![CDATA[Sergio Mesa]]></dc:creator>
            <pubDate>Thu, 14 Feb 2019 17:24:05 GMT</pubDate>
            <atom:updated>2019-02-20T14:10:39.646Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iw0k8dVV5WkmKpoQeni5ig.png" /></figure><p>Este será el primero de espero… muchas publicaciones de ejemplos básicos sobre casos comunes que podrías utilizar en cualquier proyecto y que he recopilado o aprendido a hacer en mis varios años de experiencia como desarrollador.</p><p>En esta ocasión vamos a construir algo que suelo implementar en los proyectos que desarrollo con Angular &amp; Firebase, Un componente para realizar el registro/ingreso de un usuario por correo electrónico, registro/ingreso por Facebook, registro/ingreso por Google, verificación de correo electrónico, cambio de correo electrónico, cambio de contraseña y recuperación de contraseña por medio de correo electrónico.</p><p>Obviamente esto lo realizaremos en 4 cortos pero sustanciosos artículos que serán:</p><p># 1 — Instalación Angular Cli, Creación de proyecto, Instalación de Angular/material, Instalación de AngularFire2 ( Básicamente les enseñare a instalar las dependencias que necesitaremos en el proyecto).</p><p># 2 — <a href="https://medium.com/@mesasergio/creaci%C3%B3n-de-componente-autenticaci%C3%B3n-y-registro-con-angular-firebase-2-92c8926fd09d">Creación de AuthFirebaseService, Este será nuestro proveedor de funciones para realizar todas las operaciones que necesitamos con respecto a la autenticación de Firebase.</a></p><p># 3 – Creación de componente Registro, componente Ingreso y página de autenticación.</p><p># 4 – Despliegue del proyecto en agite base Hosting y conclusiones.</p><p>Dando esta claridad de lo que vamos a hacer, entonces, comencemos…bienvenido.</p><p><strong># 1 — Instalación, creación y configuración del proyecto</strong></p><p>Lo primero que debemos hacer para poder comenzar a realizar estos componentes será instalar el Angular Cli (Command Line Interface) es una herramienta que nos ayudará a Crear, Testear y Publicar nuestros proyectos de Angular, esta corre bajo NodeJS por lo que lo primero será necesario instalarlo si no lo tenemos desde <a href="https://nodejs.org/es/">https://nodejs.org</a>, descargamos el instalador y el resto será cuestión de next, next y mas next.</p><p><em>Para saber un poco mas de las funcionalidades de NodeJs pueden ir a su sitio oficial </em><a href="https://nodejs.org/es/"><em>https://nodejs.org</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qTGhVO7ZwnaVIZubQubHg.png" /><figcaption>Más información en <a href="https://cli.angular.io/">https://</a>nodejs.org</figcaption></figure><p>Comprobamos que si quedo instalando dando desde una terminal el comando $ node -v<strong>, </strong>esto debería retornar la versión instalada, en mi caso tengo la 10.14.2.</p><p>Cuando instalamos NodeJS a su vez instalamos el manejador de paquetes de Node el cual nos permitirá instalar aplicaciones y dependencias de Node llamado npm(Node package Module).</p><p>Con npm ahora si vamos a instalar de forma global en nuestra computadora el Angular Cli con el siguiente comando</p><p>$ npm install -g angular-cli@latest</p><p><em>Para saber un poco mas de las funcionalidades del Angular CLI pueden ir a su sitio oficial </em><a href="https://cli.angular.io/"><em>https://cli.angular.io</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G7VrsJ5paCNOi5EHzfSaIw.png" /><figcaption>Más información en <a href="https://cli.angular.io/">https://cli.angular.io</a></figcaption></figure><p>Comprobamos nuestra instalación con el comando $ ng version que nos devuelve la versión de angular cli y dependencias instaladas así:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*W4AMIL2Hscl23OXYijg8tQ.png" /><figcaption>ng version</figcaption></figure><p>Ahora que ya tenemos todo lo necesario para poder crear nuestro proyecto de Angular entonces vamos a ejecutar en una terminal y posicionados en la carpeta donde queremos que nuestro proyecto viva el comando:</p><p>$ ng new &lt;nombre-proyecto&gt;</p><p>Desde la versión 7.0 del Angular CLI nos comienza a preguntar opciones para la creación del proyecto como las siguientes:</p><p>// <strong><em>Si queremos que el CLI nos genere una clase para manejar nuestras <br>// rutas en el proyecto, en nuestro caso le damos (Y)</em></strong><br>?Would you like to add Angular routing?(y/N)</p><p>// <strong><em>Especificamos que formato de hojas de estilo deseamos usar, nos da la <br>// opción de css, sass, scss, less y stylus, los últimos 4 son <br>// pre procesadores de CSS ya depende del gusto de cada quien que <br>// selecciona, en nuestro caso a mi me gusta sass.</em></strong><br>?Which stylesheet format would you like to user?</p><p>Una vez terminado este cuestionario el Cli comenzará a generar nuestro proyecto, en el caso de que tengamos una versión anterior del Cli o queremos saltarnos este cuestionario podemos dar los atributos de las opciones en un solo comando de esta forma:</p><p>$ ng new &lt;nombre-proyecto&gt; --style=scss --routing=true</p><p>Si quieren saber un poco mas de los atributos del comando $ ng new en este <a href="https://angular.io/cli/new">enlace</a> lo pueden consultar.</p><p>OK!, ya tenemos nuestro proyecto generado! … Felicitaciones!, pero aun falta mucho por hacer.</p><p>Continuamos con nuestro proceso instalando angular material, este es un conjunto de componentes UI basado en Material Design para Angular, nos provee dentro de muchos componentes algunos como botones, inputs, iconos, layout, navbar, dropdown, etc …</p><p>Tenemos 2 formas de instalar angular material:</p><ol><li>Por medio de <strong>Schematics</strong> &lt; Resumido, es un conjunto de herramientas que nos dan flujos de trabajo para hacer tareas mas simples, como crear componentes, realizar actualizaciones, etc.&gt;</li><li>Por medio de <strong>npm</strong> y configuración de archivos en nuestro proyecto.</li></ol><p>Con angular Schematics es tan simple como ejecutar el siguiente comando:</p><p>$ ng add @angular/material</p><p>En el proceso nos realizarán varias preguntas que son:</p><p>// <strong><em>Nos pide seleccionar que tema queremos aplicar a nuestro proyecto, <br>// entre las opciones esta indigo/pink, deep purple/amber, <br>//pink/blue grey, purple/green y custom, en mi caso seleccionare <br>//indigo/pink</em></strong><br>?Choose a prebuild theme name, or &quot;custom&quot; for a custom theme</p><p>// <strong><em>Nos pide seleccionar que tema queremos aplicar a nuestro proyecto, <br>// entre las opciones esta indigo/pink, deep purple/amber, <br>//pink/blue grey, purple/green y custom, en mi caso seleccionare <br>//indigo/pink</em></strong><br>?Choose a prebuild theme name, or &quot;custom&quot; for a custom theme</p><p><strong>// HammerJS es una libreria que nos permite reconocer gestos realizados por un usuario y es necesaria en Angular Material si vamos a usar componentes que usen gestos como los slider, tooltip, etc, en nuestro caso le vamos a decir que Y a la pregunta</strong><br>?Set up HammerJs for gesture recognition?(Y/n)</p><p><strong>// Con Angular Material tenemos la opción de usar o no animaciones en los componentes con BrowserAnimationsModule, esta acción realizará la configuración del modulo para que lo podamos hacer, en nuestro caso le daremos Y.</strong><br>?Set up browser animations for Angular Material?(Y/n)</p><p>Cuando finalicemos este cuestionario, se comenzará a instalar y configurar los modulos y dependencias necesarias para que podamos usar Angular Material.</p><p>Por ultimo necesitamos instala el Angular CDK que es el kit de desarrollo de componentes que nos provee Angular con varias herramientas, componentes y patrones que podemos usar en nuestra aplicación como:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*Y6ktYrc3MZKVsyafIr2ttg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*4YDel4t0gREEqwgFZSybJw.png" /></figure><p>Para instalarlo por medio de Schematics ejecutamos el comando:</p><p>$ ng add @angular/cdk</p><p>Con esto ya tenemos listo y configurado nuestro proyecto para usar Angular Material y Angular CDK</p><p>Para realizar la instalación por medio de npm seré muy resumido en los pasos.</p><ol><li><strong>Instalar los paquetes necesarios por medio de npm i:</strong></li></ol><p>$ npm i -S @angular/material @angular/cdk @angular/animations</p><p><strong>2. Importar en nuestro app.module.ts el modulo para manejar las animaciones si las deseamos:</strong></p><p>Si las deseamos lo agregamos de esta forma con la importación de BrowserAnimationsModule.</p><pre>import {BrowserAnimationsModule} from &#39;@angular/platform-browser/animations&#39;;<br><br>@NgModule({<br>  ...<br>  imports: [BrowserAnimationsModule],<br>  ...<br>})<br>export class ProyectoAuthAppModule { }<br></pre><p>Si no deseamos tener animaciones importamos el modulo NoopAnimationsModule</p><pre>import {NoopAnimationsModule} from &#39;@angular/platform-browser/animations&#39;;<br><br>@NgModule({<br>  ...<br>  imports: [NoopAnimationsModule],<br>  ...<br>})<br>export class ProyectoAuthAppModule { }</pre><p><strong>3. Incluir el tema que deseamos aplicar en nuestro proyecto de material, recuerden que tenemos </strong><strong><em>indigo/pink, deep purple/amber, pink/blue grey, purple/green , </em>para aplicarlo tenemos 2 opciones:</strong></p><p><strong>Primera</strong>: en nuestro archivo styles.scss simplemente agregamos la siguiente linea:</p><pre>@import &quot;~@angular/material/prebuilt-themes/indigo-pink.css&quot;;</pre><p><strong>Segunda</strong>: en nuestro archivo angular.cli en el nodo de <em>projects &gt; architect &gt;options &gt; styles</em> adicionamos la ruta del archivo .css así:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*shG7iTxG8gX44WuJ9NC21A.png" /></figure><p><strong>4. Agregar soporte de gestos con HammerJS, esto lo realizamos instalando HammerJS asi:</strong></p><pre>npm install --save hammerjs</pre><p>y agregándolo en nuestro src/main.ts así:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*5qY4xgy2DYrJvm6dJnX9Eg.png" /></figure><p><strong>5. Opcionalmente podemos agregar los iconos de material a nuestro proyecto como &lt;link&gt; en el &lt;head&gt; de nuestro index.html</strong></p><pre>&lt;link href=&quot;https://fonts.googleapis.com/icon?family=Material+Icons&quot; rel=&quot;stylesheet&quot;&gt;</pre><p>A este punto ya tenemos habilitado nuestro proyecto de Angular para usar Angular Material como dios manda, continuaremos con el ultimo paso de este artículo que es la instalación de nuestra super librería <strong>AngularFire2.</strong></p><h4>Instalación de AngularFire2</h4><p>Para instalar angularfire2 solo debemos seguir estos 5 pasos que dare a continuación.</p><ol><li>Instalar las dependencias firebase(es el js oficial para usar firebase desde la web) y @angular/fire:</li></ol><pre>npm i -S @angular/fire firebase</pre><p>2. Configurar las variables del ambiente de Firebase en nuestro archivo /src/environments/environment.ts, esto requiere que se hagan varios pasos antes si aún no se ha hecho:</p><p><strong>Primero: Crear un proyecto en Firebase</strong></p><p>Para esto vamos a <a href="https://console.firebase.google.com/">https://console.firebase.google.com</a>, presionamos en el botón “<strong>Agregar Proyecto” </strong>y llenamos la información solicitada que básicamente es el nombre del proyecto, el id del proyecto, las ubicaciones(luego lo miraremos a profundidad, por el momento la dejamos como esta) y damos nuestro consentimiento o no para el uso compartido de la información(por favor lean los términos de esto). Luego le damos clic en el botón <strong>“Crear Proyecto”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*7F5koYiQ5OvsI_Mc-Yk4uA.png" /></figure><p>Segundo: Cuando tengamos nuestro proyecto creado, nos dirigimos a la opción “Project Overview” y damos clic en el <strong>&lt;/&gt; </strong>que se muestra en la imagen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LNtYhlSR7-hIa-vKqkVT7w.png" /></figure><p><strong>Tercero: Copiamos el contenido que esta adentro de var config</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*w-TsyI66mbi7vfy9gFAgNw.png" /></figure><p><strong>Cuarto: En nuestro /src/environments/environment.ts agregamos los datos de nuestro ambiente de firebase así:</strong></p><pre>export const environment = {<br>  production: false,<br>  firebase: {<br>    apiKey: &#39;&lt;your-key&gt;&#39;,<br>    authDomain: &#39;&lt;your-project-authdomain&gt;&#39;,<br>    databaseURL: &#39;&lt;your-database-URL&gt;&#39;,<br>    projectId: &#39;&lt;your-project-id&gt;&#39;,<br>    storageBucket: &#39;&lt;your-storage-bucket&gt;&#39;,<br>    messagingSenderId: &#39;&lt;your-messaging-sender-id&gt;&#39;<br>  }<br>};</pre><p>3. Agregamos el o los modulos de angularfire2 a nuestro app.module.ts, esto podemos hacerlo directamente sobre el archivo así:</p><pre>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br>import { NgModule } from &#39;@angular/core&#39;;<br>import { AppComponent } from &#39;./app.component&#39;;<br>import { AngularFireModule } from &#39;@angular/fire&#39;;<br>import { AngularFireAuthModule } from &#39;@angular/fire/auth&#39;;<br>import { AngularFirestoreModule } from &#39;@angular/fire/firestore&#39;;<br>import { environment } from &#39;../environments/environment&#39;;<br><br>@NgModule({<br>  imports: [<br>    BrowserModule,<br>    AngularFireModule.initializeApp(environment.firebase),<br>    AngularFireAuthModule, <br>    AngularFirestoreModule  <br>  ],<br>  declarations: [ AppComponent ],<br>  bootstrap: [ AppComponent ]<br>})<br>export class AppModule {}</pre><p>ó de una forma mas elegante podemos crear un modulo que contenga todos los modulos que vamos a usar, para ella ejecutamos el siguiente comando:</p><p>$ ng g module modulos/firebaseModulos</p><p>Esto nos crear un modulo en app/modulos/firebase-modulos.module.ts en el que podemos importar los modulos de angularFire2 que necesitemos y a su vez este será importado por nuestro app.module.ts, por el momento solo usaremos 3 modulos de angularfire2 que son AngularFireModule, AngularFireAuthModule y AngularFirestoreModule asi:</p><pre>import { NgModule } from &#39;@angular/core&#39;;<br>import { CommonModule } from &#39;@angular/common&#39;;<br>import { AngularFireModule } from &#39;@angular/fire&#39;;<br>import { AngularFireAuthModule } from &#39;@angular/fire/auth&#39;;<br>import { AngularFirestoreModule } from &#39;@angular/fire/firestore&#39;;<br>import { environment } from &#39;../../../environments/environment&#39;;</pre><pre>@NgModule({<br>  imports: [<br>    CommonModule,<br>    AngularFireModule.initializeApp(environment.firebase),<br>    AngularFireAuthModule, <br>    AngularFirestoreModule<br>  ],<br>  exports: [<br>    AngularFireModule,<br>    AngularFireAuthModule,<br>    AngularFirestoreModule<br>  ]<br>})</pre><pre>export class FirebaseModulosModule { }</pre><p>En este ejemplo quiero que noten 2 cosas:</p><ol><li>Estamos importando enviroment que es donde escribimos los datos de nuestro ambiente de firebase y esta misma instancia la estamos pasando como parametro en los imports a AngularFireModule.initializeApp para inicializar el modulo de AngularFire2.</li></ol><pre>AngularFireModule.initializeApp(environment.firebase),</pre><p>2. Estamos realizando el export de cada modulo que hicimos import, esto para poder hacer que se haga import de estos desde otro modulo(que es lo que haremos a continuación)</p><p>Ahora que ya tenemos nuestro FirebaseModulosModule listo vamos a importarlo en app.module.ts así:</p><pre>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br>import { NgModule } from &#39;@angular/core&#39;;<br>import { BrowserAnimationsModule } from &#39;@angular/platform-browser/animations&#39;;<br>import { AppRoutingModule } from &#39;./app-routing.module&#39;;<br>import { AppComponent } from &#39;./app.component&#39;;<br>import { FirebaseModulosModule } from &#39;./modulos/firebase-modulos/firebase-modulos.module&#39;;</pre><pre>@NgModule({<br>  declarations: [<br>    AppComponent<br>  ],<br>  imports: [<br>    BrowserModule,<br>    AppRoutingModule,<br>    BrowserAnimationsModule,<br>    FirebaseModulosModule<br>  ],<br>  providers: [],<br>  bootstrap: [AppComponent]<br>})</pre><pre>export class AppModule { }</pre><p>En este punto ya tenemos lista la configuración de nuestro proyecto, podemos validar que todo este OK dando el comando$ ng s -o el cual nos debería mostrar esta pantalla.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z8muqBaRUCjy5EaJQXRN1Q.png" /></figure><p>Por el momento es todo seguiremos en el próximo <a href="https://medium.com/@mesasergio/creaci%C3%B3n-de-componente-autenticaci%C3%B3n-y-registro-con-angular-firebase-2-92c8926fd09d">artículo</a>… nos vemos.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8edbe14cb489" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>