<?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: Mayra</title>
    <description>The latest articles on DEV Community by Mayra (@team3).</description>
    <link>https://dev.to/team3</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%2F1429913%2F6243885c-a15b-4230-b1eb-56fa08b78cff.png</url>
      <title>DEV Community: Mayra</title>
      <link>https://dev.to/team3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/team3"/>
    <language>en</language>
    <item>
      <title>Unifying the Ecosystem: Building and Deploying an MCP Server for Modern Clients</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Mon, 01 Dec 2025 00:08:29 +0000</pubDate>
      <link>https://dev.to/team3/unifying-the-ecosystem-building-and-deploying-an-mcp-server-for-modern-clients-afd</link>
      <guid>https://dev.to/team3/unifying-the-ecosystem-building-and-deploying-an-mcp-server-for-modern-clients-afd</guid>
      <description>&lt;p&gt;&lt;strong&gt;The Power of the MCP Server&lt;/strong&gt;&lt;br&gt;
The modern development landscape is diverse, requiring seamless communication between tools like AI assistants (e.g., Claude), IDEs (e.g., VSCode), and custom CLI tools. This is where the Message Control Protocol (MCP) Server steps in, acting as a unified communication broker.&lt;/p&gt;

&lt;p&gt;The MCP Server provides a single, standardized endpoint for command execution and data exchange. This article provides a concise guide to building a basic MCP Server using Python and deploying it to Google Cloud Run, demonstrating its immediate utility for diverse MCP Clients.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server Implementation Core (Python &amp;amp; Flask)&lt;/strong&gt;&lt;br&gt;
We use Python and the Flask framework to create a simple HTTP service that listens for POST requests containing our MCP message format (JSON).&lt;/p&gt;

&lt;p&gt;_&lt;strong&gt;The MCP Message Protocol&lt;/strong&gt;&lt;br&gt;
_All client-server communication adheres to a simple JSON structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "client_id": "vscode-ext-001",
  "command": "GET_STATUS",
  "payload": {
    "target_resource": "db_connection"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;_&lt;strong&gt;Flask Handler Snippet&lt;/strong&gt;&lt;br&gt;
_The core logic processes the incoming command and returns a structured response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask, request, jsonify

app = Flask(__name__)

def process_command(data):
    """Handles business logic based on the MCP command."""
    command = data.get("command")

    if command == "GET_STATUS":
        # Simulates checking resource status
        resource = data.get("payload", {}).get("target_resource", "unknown")
        status = "OK" if resource == "service-A" else "ERROR"
        return {"status": "success", "response": f"Status for {resource}: {status}"}

    return {"status": "error", "response": f"Unknown command: {command}"}

@app.route('/mcp/control', methods=['POST'])
def mcp_handler():
    try:
        data = request.get_json()
        if not data:
            return jsonify({"status": "error", "response": "Invalid JSON"}), 400

        response = process_command(data)
        return jsonify(response), 200

    except Exception as e:
        return jsonify({"status": "fatal_error", "response": str(e)}), 500

if __name__ == "__main__":
    import os
    port = int(os.environ.get("PORT", 8080))
    app.run(host="0.0.0.0", port=port)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cloud Run Deployment (Serverless)&lt;/strong&gt;&lt;br&gt;
We containerize the Python server using a Dockerfile and deploy it to Google Cloud Run for automatic scalability and high availability.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Dockerfile Summary&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
The Dockerfile sets up the Python environment, installs dependencies from requirements.txt, and runs the Flask application on the port specified by Cloud Run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# (Omitted full Dockerfile for brevity)
# Key steps: FROM python:3.10-slim, COPY requirements.txt, RUN pip install, CMD ["python", "app.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Deployment Steps&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
After building the Docker image and pushing it to a container registry, the deployment is executed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 1. Build: gcloud builds submit --tag gcr.io/[PROJECT-ID]/mcp-server
# 2. Deploy: gcloud run deploy mcp-server --image gcr.io/[PROJECT-ID]/mcp-server --platform managed --allow-unauthenticated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The deployed service provides a public URL (e.g., &lt;a href="https://mcp-server-xyz.a.run.app" rel="noopener noreferrer"&gt;https://mcp-server-xyz.a.run.app&lt;/a&gt;) for all clients to connect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCP Client Connectivity&lt;/strong&gt;&lt;br&gt;
Our deployed server is now ready to serve any client adhering to the MCP structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Client Example 1: AI Assistant (e.g., Claude)&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
An AI assistant can be configured to use our MCP Server URL as an external tool. When a developer asks, "What's the status of Service-A?", the AI translates this into the GET_STATUS command and sends it to the server. The server responds with the status, which the AI then converts back into a natural language response: "Service-A is currently reporting an OK status."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Client Example 2: VSCode Extension&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
A VSCode extension can connect to the MCP Server to trigger actions. For instance, a button press in the IDE might send an EXECUTE_JOB command to clean up local resources or initiate a deployment pipeline. The server handles the logic, and the extension confirms success to the user, enhancing developer workflow directly within the IDE.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
By implementing the MCP Server on a serverless platform like Google Cloud Run, we have established a scalable and flexible control layer. This unified protocol simplifies tool integration, paving the way for more powerful and interconnected development ecosystems.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>cloud</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Observability Practices in Modern Applications: Real-Time Monitoring with Prometheus and Grafana</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Sun, 30 Nov 2025 23:54:01 +0000</pubDate>
      <link>https://dev.to/team3/observability-practices-in-modern-applications-real-time-monitoring-with-prometheus-and-grafana-4g97</link>
      <guid>https://dev.to/team3/observability-practices-in-modern-applications-real-time-monitoring-with-prometheus-and-grafana-4g97</guid>
      <description>&lt;p&gt;Observability is a critical practice in modern software development. It allows teams to understand the internal state of applications by collecting, analyzing, and visualizing data from logs, metrics, and traces. Unlike traditional monitoring, observability provides a proactive approach to detecting, diagnosing, and resolving issues before they affect users.&lt;/p&gt;

&lt;p&gt;In this article, we will explore observability practices using Prometheus for metrics collection and Grafana for visualization, with a simple real-world example in Python.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Core Observability Practices&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Structured Logging: Captures application events in a consistent format, making it easier to analyze errors.&lt;/li&gt;
&lt;li&gt;Metrics Collection: Monitors system performance, such as CPU usage, memory consumption, or request latency.&lt;/li&gt;
&lt;li&gt;Distributed Tracing: Tracks requests across multiple services to detect bottlenecks.&lt;/li&gt;
&lt;li&gt;Proactive Alerts: Notifies teams when system behavior deviates from expected patterns.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Practical Example: Counting Requests in a Web Application&lt;/strong&gt;&lt;br&gt;
We'll create a Python application that tracks incoming requests and exposes metrics to Prometheus.&lt;br&gt;
Python Code Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from prometheus_client import start_http_server, Counter
import random
import time

# Create a counter metric for HTTP requests
REQUEST_COUNT = Counter('app_requests_total', 'Total HTTP Requests')

def process_request():
    """Simulate processing a request"""
    REQUEST_COUNT.inc()  # Increment the counter
    time.sleep(random.random())  # Simulate request processing time

if __name__ == '__main__':
    # Expose metrics on port 8000 for Prometheus
    start_http_server(8000)
    print("Server running on port 8000. Metrics exposed for Prometheus.")
    while True:
        process_request()

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

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Every call to process_request() increments the app_requests_total counter.&lt;/li&gt;
&lt;li&gt;Prometheus scrapes the metrics from &lt;a href="http://localhost:8000/metrics" rel="noopener noreferrer"&gt;http://localhost:8000/metrics&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Grafana can then visualize these metrics in real time using dashboards.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real-World Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By implementing observability practices like this:&lt;/li&gt;
&lt;li&gt;Teams can detect unusual spikes in requests or errors before they affect users.&lt;/li&gt;
&lt;li&gt;Engineers gain actionable insights to improve system reliability and performance.&lt;/li&gt;
&lt;li&gt;Scaling this setup allows monitoring of microservices or distributed systems efficiently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Observability is essential for modern applications, especially in distributed and cloud-native environments. By combining metrics collection with powerful visualization tools like Prometheus and Grafana, developers can maintain high system reliability and respond quickly to incidents.&lt;/p&gt;

&lt;p&gt;Next Steps / Recommendation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extend this example to include logging structured errors using Python’s logging module.&lt;/li&gt;
&lt;li&gt;Implement alerting in Grafana for threshold breaches.&lt;/li&gt;
&lt;li&gt;Explore distributed tracing with tools like Jaeger or OpenTelemetry.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>monitoring</category>
      <category>devops</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Repository Pattern in Golang: A Practical Guide</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Fri, 07 Nov 2025 03:04:31 +0000</pubDate>
      <link>https://dev.to/team3/repository-pattern-in-golang-a-practical-guide-1kla</link>
      <guid>https://dev.to/team3/repository-pattern-in-golang-a-practical-guide-1kla</guid>
      <description>&lt;p&gt;The Repository Pattern, documented in Martin Fowler's "Patterns of Enterprise Application Architecture," separates data access logic from business logic. This article demonstrates its implementation in Golang through a real-world e-commerce example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br&gt;
Without proper separation, your code mixes business logic with database operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func ProcessOrder(orderID string) error {
    db.Query("SELECT * FROM orders WHERE id = ?", orderID)
    // Business rules buried in database code
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;Tight coupling to database&lt;/li&gt;
&lt;li&gt;Hard to test&lt;/li&gt;
&lt;li&gt;Code duplication&lt;/li&gt;
&lt;li&gt;Can't switch databases easily&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Solution: Repository Pattern&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The pattern provides an abstraction layer between business logic and data access, treating data like an in-memory collection.&lt;/p&gt;

&lt;p&gt;Benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Testability (easy to mock)&lt;/li&gt;
&lt;li&gt;Flexibility (switch databases)&lt;/li&gt;
&lt;li&gt;Clean separation of concerns&lt;/li&gt;
&lt;li&gt;Centralized data access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Implementation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Domain Model&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// domain/product.go
package domain

import "time"

type Product struct {
    ID          string
    Name        string
    Price       float64
    Stock       int
    Category    string
    CreatedAt   time.Time
    UpdatedAt   time.Time
}

func (p *Product) Validate() error {
    if p.Name == "" {
        return errors.New("name required")
    }
    if p.Price &amp;lt; 0 {
        return errors.New("invalid price")
    }
    return nil
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repository Interface&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// repository/interface.go
package repository

import (
    "context"
    "github.com/yourusername/ecommerce-repository/domain"
)

type ProductRepository interface {
    Create(ctx context.Context, product *domain.Product) error
    FindByID(ctx context.Context, id string) (*domain.Product, error)
    FindAll(ctx context.Context) ([]*domain.Product, error)
    FindByCategory(ctx context.Context, category string) ([]*domain.Product, error)
    Update(ctx context.Context, product *domain.Product) error
    Delete(ctx context.Context, id string) error
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PostgreSQL Implementation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// repository/postgres.go
package repository

import (
    "context"
    "database/sql"
    "github.com/yourusername/ecommerce-repository/domain"
)

type PostgresProductRepository struct {
    db *sql.DB
}

func NewPostgresProductRepository(db *sql.DB) *PostgresProductRepository {
    return &amp;amp;PostgresProductRepository{db: db}
}

func (r *PostgresProductRepository) Create(ctx context.Context, product *domain.Product) error {
    query := `
        INSERT INTO products (id, name, price, stock, category, created_at, updated_at)
        VALUES ($1, $2, $3, $4, $5, $6, $7)
    `
    _, err := r.db.ExecContext(ctx, query,
        product.ID, product.Name, product.Price, 
        product.Stock, product.Category, time.Now(), time.Now())
    return err
}

func (r *PostgresProductRepository) FindByID(ctx context.Context, id string) (*domain.Product, error) {
    query := `SELECT id, name, price, stock, category, created_at, updated_at 
              FROM products WHERE id = $1`

    product := &amp;amp;domain.Product{}
    err := r.db.QueryRowContext(ctx, query, id).Scan(
        &amp;amp;product.ID, &amp;amp;product.Name, &amp;amp;product.Price,
        &amp;amp;product.Stock, &amp;amp;product.Category, &amp;amp;product.CreatedAt, &amp;amp;product.UpdatedAt)

    if err == sql.ErrNoRows {
        return nil, fmt.Errorf("product not found")
    }
    return product, err
}

func (r *PostgresProductRepository) FindByCategory(ctx context.Context, category string) ([]*domain.Product, error) {
    query := `SELECT id, name, price, stock, category, created_at, updated_at 
              FROM products WHERE category = $1`

    rows, err := r.db.QueryContext(ctx, query, category)
    if err != nil {
        return nil, err
    }
    defer rows.Close()

    var products []*domain.Product
    for rows.Next() {
        p := &amp;amp;domain.Product{}
        err := rows.Scan(&amp;amp;p.ID, &amp;amp;p.Name, &amp;amp;p.Price, &amp;amp;p.Stock, 
                        &amp;amp;p.Category, &amp;amp;p.CreatedAt, &amp;amp;p.UpdatedAt)
        if err != nil {
            return nil, err
        }
        products = append(products, p)
    }
    return products, nil
}

func (r *PostgresProductRepository) Update(ctx context.Context, product *domain.Product) error {
    query := `UPDATE products SET name=$1, price=$2, stock=$3, 
              category=$4, updated_at=$5 WHERE id=$6`
    _, err := r.db.ExecContext(ctx, query, product.Name, product.Price,
        product.Stock, product.Category, time.Now(), product.ID)
    return err
}

func (r *PostgresProductRepository) Delete(ctx context.Context, id string) error {
    query := `DELETE FROM products WHERE id = $1`
    _, err := r.db.ExecContext(ctx, query, id)
    return err
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In-Memory Implementation (Testing)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// repository/memory.go
package repository

import (
    "context"
    "sync"
    "github.com/yourusername/ecommerce-repository/domain"
)

type InMemoryProductRepository struct {
    mu       sync.RWMutex
    products map[string]*domain.Product
}

func NewInMemoryProductRepository() *InMemoryProductRepository {
    return &amp;amp;InMemoryProductRepository{
        products: make(map[string]*domain.Product),
    }
}

func (r *InMemoryProductRepository) Create(ctx context.Context, product *domain.Product) error {
    r.mu.Lock()
    defer r.mu.Unlock()
    r.products[product.ID] = product
    return nil
}

func (r *InMemoryProductRepository) FindByID(ctx context.Context, id string) (*domain.Product, error) {
    r.mu.RLock()
    defer r.mu.RUnlock()

    product, exists := r.products[id]
    if !exists {
        return nil, fmt.Errorf("not found")
    }
    return product, nil
}

func (r *InMemoryProductRepository) FindByCategory(ctx context.Context, category string) ([]*domain.Product, error) {
    r.mu.RLock()
    defer r.mu.RUnlock()

    var products []*domain.Product
    for _, p := range r.products {
        if p.Category == category {
            products = append(products, p)
        }
    }
    return products, nil
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Business Service&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// service/product_service.go
package service

import (
    "context"
    "github.com/yourusername/ecommerce-repository/domain"
    "github.com/yourusername/ecommerce-repository/repository"
)

type ProductService struct {
    repo repository.ProductRepository
}

func NewProductService(repo repository.ProductRepository) *ProductService {
    return &amp;amp;ProductService{repo: repo}
}

func (s *ProductService) CreateProduct(ctx context.Context, product *domain.Product) error {
    if err := product.Validate(); err != nil {
        return err
    }
    return s.repo.Create(ctx, product)
}

func (s *ProductService) GetProduct(ctx context.Context, id string) (*domain.Product, error) {
    return s.repo.FindByID(ctx, id)
}

func (s *ProductService) GetProductsByCategory(ctx context.Context, category string) ([]*domain.Product, error) {
    return s.repo.FindByCategory(ctx, category)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Main Application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// main.go
package main

import (
    "database/sql"
    "log"
    "net/http"
    "github.com/gorilla/mux"
    _ "github.com/lib/pq"
)

func main() {
    db, _ := sql.Open("postgres", "postgres://user:pass@localhost/ecommerce?sslmode=disable")
    defer db.Close()

    // Switch implementations easily
    repo := repository.NewPostgresProductRepository(db)
    // Or use: repo := repository.NewInMemoryProductRepository()

    service := service.NewProductService(repo)

    r := mux.NewRouter()
    r.HandleFunc("/products", createProduct(service)).Methods("POST")
    r.HandleFunc("/products/{id}", getProduct(service)).Methods("GET")
    r.HandleFunc("/products", listProducts(service)).Methods("GET")

    log.Fatal(http.ListenAndServe(":8080", r))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Testing Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func TestProductService(t *testing.T) {
    repo := repository.NewInMemoryProductRepository()
    service := service.NewProductService(repo)

    product := &amp;amp;domain.Product{
        ID: "1", Name: "Mouse", Price: 29.99, Stock: 50, Category: "electronics"}

    err := service.CreateProduct(context.Background(), product)
    if err != nil {
        t.Fatal(err)
    }

    found, _ := service.GetProduct(context.Background(), "1")
    if found.Name != "Mouse" {
        t.Errorf("expected Mouse, got %s", found.Name)
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Database Schema&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE products (
    id VARCHAR(255) PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    price DECIMAL(10, 2) NOT NULL,
    stock INTEGER NOT NULL,
    category VARCHAR(100) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_category ON products(category);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the Project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Setup
go mod init github.com/yourusername/ecommerce-repository
go get github.com/gorilla/mux github.com/lib/pq

# Run with PostgreSQL
DATABASE_URL="postgres://user:pass@localhost/ecommerce" go run main.go

# Run with in-memory (testing)
USE_MEMORY=true go run main.go

# Test API
curl -X POST http://localhost:8080/products \
  -d '{"id":"1","name":"Mouse","price":29.99,"stock":50,"category":"electronics"}'

curl http://localhost:8080/products/1
curl http://localhost:8080/products?category=electronics
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key Advantages&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Easy Testing: Swap PostgreSQL for in-memory implementation&lt;/li&gt;
&lt;li&gt;Database Independence: Change databases without touching business logic&lt;/li&gt;
&lt;li&gt;Clean Code: Each layer has one responsibility&lt;/li&gt;
&lt;li&gt;Maintainability: All queries in one place&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;When to Use&lt;/strong&gt;&lt;br&gt;
Use Repository Pattern when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complex business logic&lt;/li&gt;
&lt;li&gt;Need to support multiple databases&lt;/li&gt;
&lt;li&gt;High test coverage required&lt;/li&gt;
&lt;li&gt;Large team with separate concerns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Avoid when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple CRUD apps&lt;/li&gt;
&lt;li&gt;Prototypes&lt;/li&gt;
&lt;li&gt;Very small projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The Repository Pattern provides a clean separation between business logic and data access. This example shows how to implement it in Golang with real code that you can use in production.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/mayrafc/golang-repository-pattern.git" rel="noopener noreferrer"&gt;https://github.com/mayrafc/golang-repository-pattern.git&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Martin Fowler's Book: "Patterns of Enterprise Application Architecture"&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>architecture</category>
      <category>designpatterns</category>
      <category>go</category>
    </item>
    <item>
      <title>Beyond Traditional Dashboards: A Deep Dive into Modern Data Visualization Tools</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Sun, 14 Sep 2025 05:41:07 +0000</pubDate>
      <link>https://dev.to/team3/beyond-traditional-dashboards-a-deep-dive-into-modern-data-visualization-tools-iel</link>
      <guid>https://dev.to/team3/beyond-traditional-dashboards-a-deep-dive-into-modern-data-visualization-tools-iel</guid>
      <description>&lt;p&gt;In today's data-driven world, the ability to create interactive, engaging visualizations has become crucial for data scientists, analysts, and developers. While traditional business intelligence tools have their place, modern Python-based visualization frameworks like Streamlit, Dash, and Bokeh are revolutionizing how we build and deploy data applications. These tools enable rapid prototyping, seamless interactivity, and cloud deployment without extensive web development knowledge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Modern Visualization Tools Matter ⚡&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Traditional dashboard solutions often require significant setup time, expensive licenses, and specialized skills. Modern Python-based tools democratize data visualization by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lowering the barrier to entry - Pure Python development&lt;/li&gt;
&lt;li&gt;Enabling rapid prototyping - From concept to deployment in hours&lt;/li&gt;
&lt;li&gt;Providing native interactivity - Built-in widgets and real-time updates&lt;/li&gt;
&lt;li&gt;Supporting cloud deployment - Easy scaling and sharing&lt;/li&gt;
&lt;li&gt;Integrating seamlessly with the Python data ecosystem&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Streamlit: The Fastest Way to Build Data Apps 🚀&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;br&gt;
Streamlit has gained massive popularity for its simplicity and speed. With just a few lines of Python code, you can create sophisticated web applications that automatically update as users interact with them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Magic commands&lt;/strong&gt; - Automatic rendering of variables and plots&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built-in widgets&lt;/strong&gt; - Sliders, buttons, file uploads, and more&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching system&lt;/strong&gt; - Optimized performance for data processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Component ecosystem&lt;/strong&gt; - Extensible with custom components&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code Example: Interactive Stock Price Dashboard&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;import streamlit as st
import pandas as pd
import yfinance as yf
import plotly.graph_objects as go
from datetime import datetime, timedelta

# App configuration
st.set_page_config(page_title="Stock Price Dashboard", layout="wide")
st.title("📈 Interactive Stock Price Dashboard")

# Sidebar for user inputs
st.sidebar.header("Stock Selection")
ticker = st.sidebar.text_input("Enter Stock Symbol", value="AAPL")
period = st.sidebar.selectbox("Time Period", 
                             ["1mo", "3mo", "6mo", "1y", "2y", "5y"])

# Fetch and display data
@st.cache_data
def load_stock_data(symbol, period):
    stock = yf.Ticker(symbol)
    data = stock.history(period=period)
    return data, stock.info

try:
    data, info = load_stock_data(ticker, period)

    # Display company info
    col1, col2, col3, col4 = st.columns(4)
    with col1:
        st.metric("Current Price", f"${data['Close'][-1]:.2f}")
    with col2:
        change = data['Close'][-1] - data['Close'][-2]
        st.metric("Daily Change", f"${change:.2f}", 
                 delta=f"{(change/data['Close'][-2]*100):.2f}%")
    with col3:
        st.metric("Volume", f"{data['Volume'][-1]:,}")
    with col4:
        st.metric("Market Cap", f"${info.get('marketCap', 0):,}")

    # Interactive chart
    fig = go.Figure()
    fig.add_trace(go.Candlestick(
        x=data.index,
        open=data['Open'],
        high=data['High'],
        low=data['Low'],
        close=data['Close'],
        name=ticker
    ))

    fig.update_layout(
        title=f"{ticker} Stock Price",
        yaxis_title="Price ($)",
        template="plotly_dark"
    )

    st.plotly_chart(fig, use_container_width=True)

    # Data table
    if st.checkbox("Show Raw Data"):
        st.dataframe(data.tail(10))

except Exception as e:
    st.error(f"Error fetching data for {ticker}: {str(e)}")

# Footer
st.markdown("---")
st.markdown("Built with Streamlit 🚀")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;Deployment on Streamlit Cloud ☁️&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Push your code to GitHub&lt;/li&gt;
&lt;li&gt;Connect your repository to Streamlit Cloud&lt;/li&gt;
&lt;li&gt;Deploy with one click - no configuration needed!
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# requirements.txt
streamlit
pandas
yfinance
plotly
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Dash: Enterprise-Grade Interactive Applications 🏢&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Developed by Plotly, Dash is perfect for building production-ready applications with complex interactivity and custom styling. It's built on top of Flask, React, and Plotly.js.&lt;br&gt;
&lt;strong&gt;Key Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Callback system - Reactive programming model&lt;/li&gt;
&lt;li&gt;Enterprise security - Authentication and authorization&lt;/li&gt;
&lt;li&gt;Custom styling - Full CSS and component customization&lt;/li&gt;
&lt;li&gt;Scalability - Built for production environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code Example: Sales Analytics Dashboard&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;import dash
from dash import dcc, html, Input, Output, callback
import plotly.express as px
import pandas as pd
import numpy as np
from datetime import datetime, timedelta

# Sample data generation
np.random.seed(42)
dates = pd.date_range(start='2023-01-01', end='2024-01-01', freq='D')
products = ['Product A', 'Product B', 'Product C', 'Product D']
regions = ['North', 'South', 'East', 'West']

data = []
for date in dates:
    for product in products:
        for region in regions:
            sales = np.random.normal(1000, 200) * (1 + 0.1 * np.sin(date.dayofyear * 2 * np.pi / 365))
            data.append({
                'Date': date,
                'Product': product,
                'Region': region,
                'Sales': max(0, sales),
                'Units': int(sales / np.random.uniform(10, 50))
            })

df = pd.DataFrame(data)

# Initialize Dash app
app = dash.Dash(__name__)

# Define layout
app.layout = html.Div([
    html.H1("Sales Analytics Dashboard", 
            style={'textAlign': 'center', 'color': '#2c3e50'}),

    html.Div([
        html.Div([
            html.Label("Select Product:"),
            dcc.Dropdown(
                id='product-dropdown',
                options=[{'label': p, 'value': p} for p in products],
                value=products,
                multi=True
            )
        ], className='six columns'),

        html.Div([
            html.Label("Select Date Range:"),
            dcc.DatePickerRange(
                id='date-range',
                start_date=df['Date'].min(),
                end_date=df['Date'].max(),
                display_format='YYYY-MM-DD'
            )
        ], className='six columns'),
    ], className='row'),

    html.Br(),

    html.Div([
        html.Div([
            dcc.Graph(id='sales-trend')
        ], className='six columns'),

        html.Div([
            dcc.Graph(id='regional-sales')
        ], className='six columns'),
    ], className='row'),

    html.Div([
        dcc.Graph(id='product-comparison')
    ])
])

# Callbacks
@app.callback(
    [Output('sales-trend', 'figure'),
     Output('regional-sales', 'figure'),
     Output('product-comparison', 'figure')],
    [Input('product-dropdown', 'value'),
     Input('date-range', 'start_date'),
     Input('date-range', 'end_date')]
)
def update_charts(selected_products, start_date, end_date):
    # Filter data
    filtered_df = df[
        (df['Product'].isin(selected_products)) &amp;amp;
        (df['Date'] &amp;gt;= start_date) &amp;amp;
        (df['Date'] &amp;lt;= end_date)
    ]

    # Sales trend over time
    daily_sales = filtered_df.groupby(['Date', 'Product'])['Sales'].sum().reset_index()
    trend_fig = px.line(daily_sales, x='Date', y='Sales', color='Product',
                       title='Sales Trend Over Time')

    # Regional sales distribution
    regional_sales = filtered_df.groupby('Region')['Sales'].sum().reset_index()
    regional_fig = px.pie(regional_sales, values='Sales', names='Region',
                         title='Sales by Region')

    # Product comparison
    product_sales = filtered_df.groupby('Product')['Sales'].sum().reset_index()
    comparison_fig = px.bar(product_sales, x='Product', y='Sales',
                           title='Sales by Product')

    return trend_fig, regional_fig, comparison_fig

if __name__ == '__main__':
    app.run_server(debug=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Deployment on Heroku&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;# Procfile
web: gunicorn app:server

# requirements.txt
dash
plotly
pandas
numpy
gunicorn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# For Heroku deployment, modify the last line:
server = app.server

if __name__ == '__main__':
    app.run_server(debug=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bokeh: High-Performance Interactive Visualizations ⚡&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Overview&lt;/strong&gt;&lt;br&gt;
Bokeh excels at creating highly interactive visualizations that can handle large datasets efficiently. It's particularly strong for real-time applications and complex multi-plot layouts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High performance&lt;/strong&gt; - WebGL rendering for large datasets&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server applications&lt;/strong&gt; - Built-in server for real-time updates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexible layouts&lt;/strong&gt; - Complex multi-plot arrangements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript integration&lt;/strong&gt; - Custom interactions and extensions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code Example: Real-time IoT Sensor Dashboard&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;import numpy as np
import pandas as pd
from datetime import datetime, timedelta
from bokeh.layouts import column, row
from bokeh.models import ColumnDataSource, DatetimeTickFormatter
from bokeh.plotting import figure, curdoc
from bokeh.models.widgets import Div
import random

# Initialize data sources
source_temp = ColumnDataSource(data=dict(time=[], temperature=[]))
source_humidity = ColumnDataSource(data=dict(time=[], humidity=[]))
source_pressure = ColumnDataSource(data=dict(time=[], pressure=[]))

# Create figures
temp_plot = figure(title="Temperature Sensor", x_axis_type='datetime', 
                   width=400, height=300)
temp_plot.line('time', 'temperature', source=source_temp, 
               line_width=2, color='red', legend_label="°C")

humidity_plot = figure(title="Humidity Sensor", x_axis_type='datetime', 
                      width=400, height=300)
humidity_plot.line('time', 'humidity', source=source_humidity, 
                   line_width=2, color='blue', legend_label="%")

pressure_plot = figure(title="Pressure Sensor", x_axis_type='datetime', 
                      width=800, height=300)
pressure_plot.line('time', 'pressure', source=source_pressure, 
                   line_width=2, color='green', legend_label="hPa")

# Format datetime axes
for plot in [temp_plot, humidity_plot, pressure_plot]:
    plot.xaxis.formatter = DatetimeTickFormatter(hours="%H:%M")
    plot.legend.location = "top_left"

# Statistics display
stats_div = Div(text="&amp;lt;h3&amp;gt;Real-time Statistics&amp;lt;/h3&amp;gt;", width=800, height=100)

def update_data():
    # Simulate sensor data
    new_time = datetime.now()
    new_temp = 20 + 5 * np.sin(new_time.minute * 2 * np.pi / 60) + random.normalvariate(0, 1)
    new_humidity = 50 + 10 * np.cos(new_time.minute * 2 * np.pi / 60) + random.normalvariate(0, 2)
    new_pressure = 1013 + 20 * np.sin(new_time.minute * 4 * np.pi / 60) + random.normalvariate(0, 5)

    # Update data sources
    source_temp.stream(dict(time=[new_time], temperature=[new_temp]), rollover=100)
    source_humidity.stream(dict(time=[new_time], humidity=[new_humidity]), rollover=100)
    source_pressure.stream(dict(time=[new_time], pressure=[new_pressure]), rollover=100)

    # Update statistics
    if len(source_temp.data['temperature']) &amp;gt; 0:
        avg_temp = np.mean(source_temp.data['temperature'][-10:])
        avg_humidity = np.mean(source_humidity.data['humidity'][-10:])
        avg_pressure = np.mean(source_pressure.data['pressure'][-10:])

        stats_text = f"""
        &amp;lt;h3&amp;gt;Real-time Statistics (Last 10 readings)&amp;lt;/h3&amp;gt;
        &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Average Temperature:&amp;lt;/strong&amp;gt; {avg_temp:.2f}°C&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Average Humidity:&amp;lt;/strong&amp;gt; {avg_humidity:.2f}%&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Average Pressure:&amp;lt;/strong&amp;gt; {avg_pressure:.2f} hPa&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Last Update:&amp;lt;/strong&amp;gt; {new_time.strftime('%H:%M:%S')}&amp;lt;/p&amp;gt;
        """
        stats_div.text = stats_text

# Layout
layout = column(
    Div(text="&amp;lt;h1&amp;gt;IoT Sensor Dashboard&amp;lt;/h1&amp;gt;", width=800, height=50),
    row(temp_plot, humidity_plot),
    pressure_plot,
    stats_div
)

# Add to document
curdoc().add_root(layout)
curdoc().add_periodic_callback(update_data, 1000)  # Update every second
curdoc().title = "IoT Sensor Dashboard"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Deployment on Bokeh Server&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;# Run locally
bokeh serve --show dashboard.py

# For cloud deployment (requirements.txt)
bokeh
numpy
pandas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cloud Deployment Strategies ☁️&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streamlit Cloud (Easiest)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;**Pros: **Free, zero configuration, automatic updates from GitHub&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Limited customization, resource constraints&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best for:&lt;/strong&gt; Prototypes, small applications, demos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Heroku (Balanced)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt;Easy deployment, good free tier, supports all frameworks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Dyno sleep on free tier, can be expensive at scale&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best for:&lt;/strong&gt; Medium-scale applications, team projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AWS/GCP/Azure (Enterprise)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros:&lt;/strong&gt; Full control, unlimited scaling, enterprise features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cons:&lt;/strong&gt; Complex setup, cost management required&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best for:&lt;/strong&gt; Production applications, large-scale deployments&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Choose Streamlit&lt;/strong&gt; for quick prototypes and simple apps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose Dash&lt;/strong&gt; for enterprise applications with custom styling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose Bokeh&lt;/strong&gt; for high-performance, real-time visualizations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tools revolutionize data visualization by enabling data scientists to build interactive dashboards without web development expertise. Start with the tool that fits your needs and expand as requirements grow.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Enterprise Design Patterns: Implementing the Active Record Pattern in Ruby</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Sun, 14 Sep 2025 04:41:46 +0000</pubDate>
      <link>https://dev.to/team3/enterprise-design-patterns-implementing-the-active-record-pattern-in-ruby-3j11</link>
      <guid>https://dev.to/team3/enterprise-design-patterns-implementing-the-active-record-pattern-in-ruby-3j11</guid>
      <description>&lt;p&gt;Enterprise applications power businesses from banks to e-commerce platforms. Building robust, maintainable, and scalable enterprise systems requires not only well-written code but also the right architectural patterns.&lt;/p&gt;

&lt;p&gt;One powerful pattern from &lt;strong&gt;Martin Fowler’s Catalog of Patterns of Enterprise Application Architecture&lt;/strong&gt; is the &lt;strong&gt;Active Record Pattern&lt;/strong&gt;. This pattern combines the domain object with data persistence, simplifying CRUD operations and making the code straightforward for smaller domains or prototyping.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the Active Record Pattern?&lt;/strong&gt;&lt;br&gt;
The &lt;strong&gt;Active Record Pattern&lt;/strong&gt; maps an object in the application directly to a row in the database. Each object is responsible for saving, updating, and deleting itself from the database.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Easy to understand and implement&lt;/li&gt;
&lt;li&gt;Encapsulates data access logic within the object&lt;/li&gt;
&lt;li&gt;Reduces boilerplate code for CRUD operations&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Can become messy for complex domains where business logic grows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real-World Example: User Management System in Ruby&lt;/strong&gt;&lt;br&gt;
We will implement a simple user system where the User object handles its own persistence using the Active Record pattern.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# user.rb
require 'sqlite3'

# Create database connection
DB = SQLite3::Database.new "enterprise.db"
DB.execute &amp;lt;&amp;lt;-SQL
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY,
    name TEXT,
    email TEXT
  );
SQL

class User
  attr_accessor :id, :name, :email

  def initialize(name, email, id=nil)
    @name = name
    @email = email
    @id = id
  end

  def save
    if @id
      DB.execute("UPDATE users SET name=?, email=? WHERE id=?", [@name, @email, @id])
    else
      DB.execute("INSERT INTO users (name, email) VALUES (?, ?)", [@name, @email])
      @id = DB.last_insert_row_id
    end
  end

  def self.find(id)
    row = DB.execute("SELECT * FROM users WHERE id=?", id).first
    row ? User.new(row[1], row[2], row[0]) : nil
  end

  def self.all
    DB.execute("SELECT * FROM users").map { |row| User.new(row[1], row[2], row[0]) }
  end

  def delete
    DB.execute("DELETE FROM users WHERE id=?", @id) if @id
  end
end

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Demo&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;# main.rb
require_relative 'user'

# Create users
alice = User.new("Alice", "alice@example.com")
alice.save

bob = User.new("Bob", "bob@example.com")
bob.save

# List all users
puts "All users:"
User.all.each { |user| puts "#{user.id}: #{user.name} (#{user.email})" }

# Find and update user
user = User.find(1)
user.name = "Alice Smith"
user.save

# Delete a user
User.find(2).delete

puts "After updates:"
User.all.each { |user| puts "#{user.id}: #{user.name} (#{user.email})" }

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Expected Output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;All users:&lt;br&gt;
1: Alice (alice@example.com)&lt;br&gt;
2: Bob (bob@example.com)&lt;br&gt;
After updates:&lt;br&gt;
1: Alice Smith (alice@example.com)&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Why Active Record Helps&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encapsulation: Each object handles its own persistence&lt;/li&gt;
&lt;li&gt;Simplicity: Easy to implement for small applications or prototypes&lt;/li&gt;
&lt;li&gt;Readability: CRUD operations are directly visible on the object&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more complex systems, patterns like Repository or Unit of Work might be better, but Active Record is excellent for quick development and simple domains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The Active Record Pattern is a practical enterprise design pattern for managing domain objects with integrated persistence. By using Ruby, we demonstrated a user management system where objects can save, update, and delete themselves, making the code readable, maintainable, and easy to extend.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Java Design Principle: Open/Closed Explained</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Sun, 14 Sep 2025 04:33:50 +0000</pubDate>
      <link>https://dev.to/team3/java-design-principle-openclosed-explained-5d50</link>
      <guid>https://dev.to/team3/java-design-principle-openclosed-explained-5d50</guid>
      <description>&lt;p&gt;One of the biggest challenges in software development is keeping systems flexible and scalable without breaking existing functionality. This is where software design principles come in, helping developers build robust and maintainable applications.&lt;/p&gt;

&lt;p&gt;A key principle is the &lt;strong&gt;Open/Closed Principle (OCP)&lt;/strong&gt;, part of SOLID, which states:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Software entities should be open for extension but closed for modification.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means your code should allow adding new functionality without changing existing code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Problem&lt;/strong&gt;&lt;br&gt;
Imagine a payment processing system. At first, it only accepts credit cards, but later, users request PayPal and cryptocurrency payments.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bad design: constantly modifying the same class, increasing the risk of errors.&lt;/li&gt;
&lt;li&gt;Good design with OCP: create new classes to extend functionality without touching existing code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example in Java&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;// Common interface for any payment method
interface PaymentMethod {
    void pay(double amount);
}

// Initial implementation: Credit Card
class CreditCardPayment implements PaymentMethod {
    @Override
    public void pay(double amount) {
        System.out.println("Paying $" + amount + " with Credit Card.");
    }
}

// New implementation: PayPal
class PayPalPayment implements PaymentMethod {
    @Override
    public void pay(double amount) {
        System.out.println("Paying $" + amount + " with PayPal.");
    }
}

// New implementation: Cryptocurrency
class CryptoPayment implements PaymentMethod {
    @Override
    public void pay(double amount) {
        System.out.println("Paying $" + amount + " with Cryptocurrency.");
    }
}

// PaymentProcessor class WITHOUT modifying existing code
class PaymentProcessor {
    private final PaymentMethod paymentMethod;

    public PaymentProcessor(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public void process(double amount) {
        paymentMethod.pay(amount);
    }
}

// Demo main
public class Main {
    public static void main(String[] args) {
        PaymentProcessor creditCard = new PaymentProcessor(new CreditCardPayment());
        creditCard.process(100);

        PaymentProcessor paypal = new PaymentProcessor(new PayPalPayment());
        paypal.process(200);

        PaymentProcessor crypto = new PaymentProcessor(new CryptoPayment());
        crypto.process(300);
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Expected Output&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Paying $100 with Credit Card.&lt;br&gt;
Paying $200 with PayPal.&lt;br&gt;
Paying $300 with Cryptocurrency.&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PaymentMethod interface: defines a contract all payment types must follow.&lt;/li&gt;
&lt;li&gt;Concrete classes (CreditCardPayment, PayPalPayment, CryptoPayment): implement the contract.&lt;/li&gt;
&lt;li&gt;PaymentProcessor: executes any implementation of PaymentMethod.&lt;/li&gt;
&lt;li&gt;Extensibility: if a new method like Apple Pay is added, just create a new class implementing the interface—no existing code is modified.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefits of the Open/Closed Principle&lt;br&gt;
✔️ Fewer errors: existing working code remains untouched.&lt;br&gt;
✔️ Reusability: new classes only implement the common interface.&lt;br&gt;
✔️ Scalability: easily add new functionality.&lt;br&gt;
✔️ Maintainability: code is modular and clear.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The Open/Closed Principle (OCP) teaches developers how to design systems that grow without breaking existing functionality. This Java example demonstrates how a payment system can adapt to new methods by extending the code with new classes.&lt;/p&gt;

&lt;p&gt;Applying OCP results in software that is robust, flexible, and ready for future changes.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Automating Unit Testing with Jenkins: A Complete Real-World Example</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Thu, 03 Jul 2025 21:02:42 +0000</pubDate>
      <link>https://dev.to/team3/automating-unit-testing-with-jenkins-a-complete-real-world-example-2ak</link>
      <guid>https://dev.to/team3/automating-unit-testing-with-jenkins-a-complete-real-world-example-2ak</guid>
      <description>&lt;p&gt;In the fast-paced world of software development, automation is key to delivering reliable code efficiently. Continuous Integration and Continuous Deployment (CI/CD) tools like Jenkins help developers automate repetitive tasks such as building, testing, and deploying applications.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore how to use Jenkins to automate the execution of unit tests using a simple Node.js project. This includes a real-world working example, full code, and explanations. You’ll also find a public GitHub repository with everything set up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Jenkins?&lt;/strong&gt;&lt;br&gt;
Jenkins is an open-source CI/CD server that allows developers to automate the building, testing, and deployment of software. It is highly customizable through a vast ecosystem of plugins and supports a wide range of languages, platforms, and tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jenkins vs Other CI/CD Tools&lt;/strong&gt;&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%2F2yq42otecmv34yhg09i8.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%2F2yq42otecmv34yhg09i8.png" alt="Image description" width="522" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jenkins shines when you need maximum flexibility and control in your CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Overview&lt;/strong&gt;&lt;br&gt;
We’ll build a simple Node.js application with a unit test, then automate testing using a Jenkins Pipeline. The project includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A basic JavaScript function (sum)&lt;/li&gt;
&lt;li&gt;A test using Jest&lt;/li&gt;
&lt;li&gt;A Jenkinsfile to define the pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Project Structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jenkins-test-example/
├── Jenkinsfile
├── package.json
├── app.js
└── __tests__/
    └── app.test.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Jenkinsfile&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;
pipeline {
    agent any

    stages {
        stage('Install Dependencies') {
            steps {
                sh 'npm install'
            }
        }

        stage('Run Tests') {
            steps {
                sh 'npm test'
            }
        }
    }

    post {
        success {
            echo '✅ Tests passed!'
        }
        failure {
            echo '❌ Tests failed!'
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Jenkinsfile defines two main stages: installing dependencies and running tests. It also provides a post-build message depending on success or failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;package.json&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;{
  "name": "jenkins-test-example",
  "version": "1.0.0",
  "scripts": {
    "test": "jest"
  },
  "devDependencies": {
    "jest": "^29.0.0"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;app.js&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;function sum(a, b) {
  return a + b;
}

module.exports = sum;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;tests/app.test.js&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;const sum = require('../app');

test('adds 1 + 2 to equal 3', () =&amp;gt; {
  expect(sum(1, 2)).toBe(3);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How to Run It Locally&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Node.js&lt;/li&gt;
&lt;li&gt;Clone or download the project&lt;/li&gt;
&lt;li&gt;Run the following in terminal:
&lt;code&gt;npm install&lt;/code&gt;
&lt;code&gt;npm test&lt;/code&gt;
You should see:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PASS  __tests__/app.test.js
✓ adds 1 + 2 to equal 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Public Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can find the complete working project here:&lt;br&gt;
&lt;a href="https://github.com/mayrafc/Jenkins" rel="noopener noreferrer"&gt;https://github.com/mayrafc/Jenkins&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Jenkins is a mature, flexible, and powerful tool for automating software development pipelines. With the example shown in this article, you can start creating your own automated testing workflows today.&lt;/p&gt;

&lt;p&gt;If you're looking for full control and extensibility, Jenkins remains one of the best options in the DevOps world.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Applying API Testing Frameworks: Real-World Examples Using Postman</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Thu, 05 Jun 2025 20:03:25 +0000</pubDate>
      <link>https://dev.to/team3/applying-api-testing-frameworks-real-world-examples-using-postman-12ah</link>
      <guid>https://dev.to/team3/applying-api-testing-frameworks-real-world-examples-using-postman-12ah</guid>
      <description>&lt;p&gt;In the API-driven world of modern software, backend services are only as reliable as the tests we write for them. Whether you’re building a microservice or a full RESTful API, API testing is essential to validate your endpoints, responses, and business logic.&lt;/p&gt;

&lt;p&gt;In this article, I’ll walk you through how to use Postman—one of the most popular API testing frameworks—to create real-world API tests with practical examples and code.&lt;/p&gt;

&lt;p&gt;🔹&lt;strong&gt;Why Use a Framework Like Postman?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Postman allows developers and QA engineers to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create and send HTTP requests to an API&lt;/li&gt;
&lt;li&gt;Write automated test scripts in JavaScript&lt;/li&gt;
&lt;li&gt;Organize requests into collections&lt;/li&gt;
&lt;li&gt;Use environments and variables to test across stages (dev, staging, production)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It combines ease of use with powerful features for testing REST, GraphQL, and SOAP APIs.&lt;/p&gt;

&lt;p&gt;🔹&lt;strong&gt;Real-World API Testing Scenario&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s assume you’re building an API for a bookstore. You have this endpoint:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GET https://api.mybookstore.com/books&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your goal is to verify that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The server responds with HTTP 200&lt;/li&gt;
&lt;li&gt;The response body is JSON&lt;/li&gt;
&lt;li&gt;Each book object has a title, author, and price&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔹&lt;strong&gt;Creating a Test in Postman&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After sending the request in Postman, go to the Tests tab and write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Response is JSON", function () {
    pm.response.to.be.json;
});

pm.test("Each book has required fields", function () {
    const books = pm.response.json();
    books.forEach(book =&amp;gt; {
        pm.expect(book).to.have.property("title");
        pm.expect(book).to.have.property("author");
        pm.expect(book).to.have.property("price");
    });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These scripts use Postman’s built-in Chai.js assertion library to check the API response.&lt;/p&gt;

&lt;p&gt;🔹&lt;strong&gt;Testing with Parameters and Edge Cases&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s test a filtered request like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GET https://api.mybookstore.com/books?author=Orwell&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
You can write a test to ensure that all returned books are from that author:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pm.test("Books returned are by Orwell", function () {
    const books = pm.response.json();
    books.forEach(book =&amp;gt; {
        pm.expect(book.author).to.eql("Orwell");
    });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a real-world example of validating query parameters and filtering logic in the backend.&lt;/p&gt;

&lt;p&gt;🔹&lt;strong&gt;Using Environments for Flexibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can define variables in Postman environments like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;base_url = https://api.mybookstore.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then, in your requests:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{{base_url}}/books&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This allows you to reuse the same tests for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local development (localhost)&lt;/li&gt;
&lt;li&gt;Staging (staging.mybookstore.com)&lt;/li&gt;
&lt;li&gt;Production (api.mybookstore.com)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔹&lt;strong&gt;Organizing Tests in Collections&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Postman lets you organize your requests into collections with folders like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;/books endpoints&lt;/li&gt;
&lt;li&gt;/authors endpoints&lt;/li&gt;
&lt;li&gt;/orders endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each folder can contain multiple request types (GET, POST, PUT, DELETE) and associated tests. This structure mimics how your backend is organized.&lt;/p&gt;

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

&lt;p&gt;Good testing makes great APIs. Postman empowers developers to test early, test often, and test well—with minimal setup and maximum impact.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Applying the SAST Tool Checkov to a Terraform IaC Project</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Mon, 21 Apr 2025 02:17:26 +0000</pubDate>
      <link>https://dev.to/team3/applying-the-sast-tool-checkov-to-a-terraform-iac-project-1l23</link>
      <guid>https://dev.to/team3/applying-the-sast-tool-checkov-to-a-terraform-iac-project-1l23</guid>
      <description>&lt;p&gt;Infrastructure as Code (IaC) is a powerful practice that allows developers to define and manage cloud infrastructure using code. However, just like application code, IaC can introduce security risks if not properly reviewed.&lt;/p&gt;

&lt;p&gt;Static Application Security Testing (SAST) tools help detect vulnerabilities before infrastructure is deployed. In this article, we will use Checkov, a SAST tool designed for IaC, to scan a small Terraform project and identify security issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Checkov?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Checkov is an open-source SAST tool developed by Bridgecrew. It scans Terraform, Kubernetes, CloudFormation, and other IaC templates for misconfigurations and insecure code patterns.&lt;/p&gt;

&lt;p&gt;Key features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supports multiple IaC platforms&lt;/li&gt;
&lt;li&gt;Easy to install&lt;/li&gt;
&lt;li&gt;Detects real-world cloud security issues&lt;/li&gt;
&lt;li&gt;Works locally or in CI/CD pipelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Installing Checkov is very simple. Just use pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install checkov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installation, you can scan your project folder with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;checkov -d .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Here is a basic Terraform configuration that creates a public S3 bucket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# main.tf
provider "aws" {
  region = "us-east-1"
}

resource "aws_s3_bucket" "my_bucket" {
  bucket = "my-public-bucket-123"
  acl    = "public-read"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although this configuration works, it has a security flaw: the bucket is publicly accessible, which may expose sensitive files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scanning with Checkov&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we run checkov -d . in the folder containing main.tf, Checkov scans the code and outputs a warning like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Check: CKV_AWS_20
Message: S3 Bucket has an ACL defined which allows public access.
File: /main.tf:6-10
Severity: HIGH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means Checkov successfully identified the risk of public access in the bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fixing the Issue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To fix this vulnerability, we can change the ACL to "private":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_s3_bucket" "my_bucket" {
  bucket = "my-public-bucket-123"
  acl    = "private"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After updating the code and scanning again, Checkov confirms that the issue is resolved.&lt;/p&gt;

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

&lt;p&gt;Using a tool like Checkov helps prevent cloud misconfigurations before deployment. It’s easy to use, fast, and powerful — making it perfect for scanning Terraform and other IaC platforms.&lt;/p&gt;

&lt;p&gt;By integrating Checkov into your workflow, you improve security and reduce risk in your infrastructure.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Applying the SAST Tool RIPS to a PHP Application</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Mon, 21 Apr 2025 01:52:58 +0000</pubDate>
      <link>https://dev.to/team3/applying-the-sast-tool-rips-to-a-php-application-4bib</link>
      <guid>https://dev.to/team3/applying-the-sast-tool-rips-to-a-php-application-4bib</guid>
      <description>&lt;p&gt;In secure software development, static application security testing (SAST) is a crucial technique for identifying vulnerabilities before an application reaches production. This article demonstrates the application of the RIPS Code Analysis tool on a small PHP web application to identify potential security risks through automated analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is RIPS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RIPS (Real-time Intrusion Prevention System) is a tool specialized in analyzing PHP source code. It is widely recognized for its ability to detect vulnerabilities such as SQL injections, XSS, CSRF, file inclusion, and other common errors in PHP applications. RIPS analyzes data flow and code structure to pinpoint potential attack vectors.&lt;/p&gt;

&lt;p&gt;Although RIPS has been acquired by SonarSource, the free version is still available and valid for academic or testing purposes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation and Use of RIPS (Free Version)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For this article, the free version of RIPS was used, which can be run locally through a browser. The following steps were followed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the ZIP file from a reliable repository (e.g., GitHub: RIPS).&lt;/li&gt;
&lt;li&gt;Extract the files to a local server (XAMPP, WAMP, or any PHP environment).&lt;/li&gt;
&lt;li&gt;Access it through the browser at the local path, for example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost/RIPS/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.Select the PHP source code directory you wish to analyze.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHP Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below is the PHP code used for the analysis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
// file: greeting.php
$name = $_GET['name'];
echo "Hello, " . $name;
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code appears harmless, but it has a security issue: the content displayed comes directly from the user (via $_GET) and is not validated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Does RIPS Detect in This Code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When analyzing this file with RIPS, it reports:&lt;/p&gt;

&lt;p&gt;⚠️ Cross-Site Scripting (XSS): Since we are displaying something from the user ($name) without validating it, an attacker could enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost/greeting.php?name=&amp;lt;script&amp;gt;alert('Hacked')&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would trigger a popup on the page, demonstrating that the site is vulnerable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Fix It?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One way to fix this issue is by using htmlspecialchars() to sanitize the input before displaying it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
// file: greeting_safe.php
$name = htmlspecialchars($_GET['name']);
echo "Hello, " . $name;
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this change, if someone tries to inject code, the browser will not execute it.&lt;/p&gt;

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

&lt;p&gt;RIPS is a useful and easy-to-use tool for finding security flaws in PHP code. In this case, it helped us identify that we were displaying user input without validation, which could be dangerous.&lt;/p&gt;

&lt;p&gt;Thanks to RIPS's analysis, we were able to fix the Cross-Site Scripting (XSS) issue and make our application more secure.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Deploying a Node.js Application on AWS</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Sat, 06 Jul 2024 03:10:29 +0000</pubDate>
      <link>https://dev.to/team3/deploying-a-nodejs-application-on-aws-3338</link>
      <guid>https://dev.to/team3/deploying-a-nodejs-application-on-aws-3338</guid>
      <description>&lt;p&gt;Deploying applications to the cloud is essential for modern software development, offering scalability, reliability, and cost-efficiency. AWS (Amazon Web Services) is a leading cloud service provider that offers various deployment options such as Elastic Beanstalk, EC2, and Lambda. This article focuses on deploying a Node.js application using AWS Elastic Beanstalk, highlighting its simplicity and efficiency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Choose AWS?&lt;/strong&gt;&lt;br&gt;
AWS provides several advantages for application deployment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability: AWS services can automatically scale to handle increased traffic and workload.&lt;/li&gt;
&lt;li&gt;Reliability: AWS's global infrastructure ensures high availability and fault tolerance.&lt;/li&gt;
&lt;li&gt;Cost-Effectiveness: Pay-as-you-go pricing allows optimized cost management.&lt;/li&gt;
&lt;li&gt;Flexibility: A wide range of services cater to different deployment needs, from fully managed services to more granular control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AWS Deployment Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Elastic Beanstalk&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Elastic Beanstalk simplifies deployment and management by handling the &lt;br&gt;
  underlying infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- EC2 (Elastic Compute Cloud)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Provides scalable virtual servers, offering more control over the &lt;br&gt;
  deployment environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Lambda&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Enables serverless deployment, allowing code execution in response to &lt;br&gt;
  events without managing servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploying a Node.js Application Using AWS Elastic Beanstalk&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
Before you start, ensure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account&lt;/li&gt;
&lt;li&gt;AWS Command Line Interface (CLI) installed and configured&lt;/li&gt;
&lt;li&gt;Node.js installed on your local machine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Deployment Guide&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Set Up Your Environment&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Install AWS CLI:&lt;/strong&gt;
Download and install the AWS CLI. Configure it with your AWS credentials:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Install Elastic Beanstalk CLI:&lt;/strong&gt;
Install the Elastic Beanstalk CLI to interact with the service:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install awsebcli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;- Create a New Directory for Your Project:&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;mkdir my-aws-app
cd my-aws-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Initialize Your Application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Initialize Elastic Beanstalk:&lt;/strong&gt;&lt;br&gt;
Set up a new Elastic Beanstalk application in your project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eb init -p node.js my-aws-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Create Your Node.js Application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Create a Simple Express Application:&lt;/strong&gt;&lt;br&gt;
Initialize a new Node.js project and install Express.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
npm install express
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;-Create app.js with the following content:&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;const express = require('express');
const app = express();

app.get('/', (req, res) =&amp;gt; {
  res.send('Hello, AWS Elastic Beanstalk!');
});

const port = process.env.PORT || 3000;
app.listen(port, () =&amp;gt; {
  console.log(`Server running on port ${port}`);
});

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Update package.json:&lt;/strong&gt;&lt;br&gt;
Ensure your package.json includes a start script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "my-aws-app",
  "version": "1.0.0",
  "description": "A simple Node.js app on AWS Elastic Beanstalk",
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Deploy Your Application&lt;br&gt;
Create a new environment for your application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eb create my-aws-env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Deploy Your Application:&lt;/strong&gt;&lt;br&gt;
Deploy your application to the created environment:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Monitor Your Application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Open Your Application in Your Browser:&lt;/strong&gt;&lt;br&gt;
After deployment, open your application using:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Monitor Environment Health:&lt;/strong&gt;&lt;br&gt;
Use the Elastic Beanstalk dashboard on the AWS Management Console to monitor your application's health, logs, and metrics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
AWS Elastic Beanstalk simplifies the deployment process, allowing developers to focus on building applications rather than managing infrastructure. By following this guide, you can efficiently deploy a Node.js application on AWS and leverage AWS's robust cloud services.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>API Architecture Styles: Sockets</title>
      <dc:creator>Mayra</dc:creator>
      <pubDate>Wed, 12 Jun 2024 03:49:30 +0000</pubDate>
      <link>https://dev.to/team3/api-architecture-styles-sockets-4pip</link>
      <guid>https://dev.to/team3/api-architecture-styles-sockets-4pip</guid>
      <description>&lt;p&gt;API architecture is fundamental to modern application development, enabling efficient communication between different systems. One architecture style particularly useful for real-time communication is the use of sockets. This article provides a comprehensive introduction to sockets, how they work, their practical applications and a code example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are Sockets?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A socket is like a digital plug that allows two different computer programs to communicate with each other over a network. Sockets are like a telephone line that connects two people, allowing them to talk and listen at the same time. Using sockets, applications can send and receive data in real time. Sockets can use different protocols, such as TCP for a secure and reliable connection, or UDP for faster but less secure communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Sockets Work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To understand how sockets work, let's consider a simple analogy: a telephone conversation between two people.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Opening the Connection:&lt;br&gt;
&lt;em&gt;Client and Server:&lt;/em&gt; In the context of sockets, one program acts as a server (waiting for incoming connections) and another as a client (initiating the connection).&lt;br&gt;
&lt;em&gt;IP Address and Port:&lt;/em&gt; To establish a connection, the client needs to know the IP address of the server and the port on which the server is listening.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connection Establishment:&lt;br&gt;
&lt;em&gt;TCP:&lt;/em&gt; Uses a three-way handshake process to ensure a reliable connection.&lt;br&gt;
&lt;em&gt;UDP:&lt;/em&gt; Does not require a handshake and is ideal for applications that need to transmit data quickly without concern for reliability (e.g., live video streams).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Exchange:&lt;br&gt;
&lt;em&gt;Bidirectional:&lt;/em&gt; Once the connection is established, both ends can send and receive data simultaneously, as in a telephone conversation where both people can talk and listen at the same time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Closing the Connection:&lt;br&gt;
&lt;em&gt;Termination:&lt;/em&gt; At the end of the communication, both ends close the connection to free up resources.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Basic Example of Sockets in Python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To illustrate how sockets work, here is a simple example of a server and a client in Python.&lt;/p&gt;

&lt;p&gt;Server (server.py):&lt;/p&gt;

&lt;blockquote&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;
&lt;span class="c1"&gt;#Create a TCP/IP socket
&lt;/span&gt;&lt;span class="n"&gt;server_socket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;server_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;localhost&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9999&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;server_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Esperando conexión...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;,&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;server_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Conexión establecida desde:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#We receive customer data
&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mensaje recibido:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="c1"&gt;#We send a response to the customer
&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;#We close the connection
&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;Cliente (client.py):&lt;/p&gt;

&lt;blockquote&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#Create a TCP/IP socket
&lt;/span&gt;&lt;span class="n"&gt;client_socket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;client_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;localhost&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9999&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;#We send a message to the servermessage = "Hola, soy el cliente"
&lt;/span&gt;&lt;span class="n"&gt;client_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="c1"&gt;#We received the response from the server
&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Respuesta del servidor:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="c1"&gt;#We close the connection
&lt;/span&gt;&lt;span class="n"&gt;client_socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;This example shows how a client connects to a server, sends a message and receives a response. The server listens for incoming connections, receives data and responds with the same data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical Applications of Sockets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Live Chats:&lt;/p&gt;

&lt;p&gt;Example: applications such as WhatsApp and Telegram use sockets to send and receive messages instantaneously. Each message sent is translated into data that travels through a socket to the recipient in real time.&lt;/p&gt;

&lt;p&gt;Online Games:&lt;/p&gt;

&lt;p&gt;Example: Multiplayer games like Fortnite and Call of Duty rely on sockets to synchronize player actions in real time, providing a fluid and responsive gaming experience.&lt;/p&gt;

&lt;p&gt;Sockets are an essential technology for real-time communication in a variety of modern applications. From live chats to online games and live video streams, sockets enable seamless and continuous interaction between clients and servers. Although they can be complex to implement, the benefits they offer in terms of speed and bidirectionality make them indispensable in the development of real-time and interactive applications.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
