{
  "id": 7151339,
  "title": "Strategy in Java to decouple freight calculation",
  "url": "https://urgent.news/2026/09/13/strategy-em-java-para-desacoplar-o-calculo-de-frete",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-13T18:22:41.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/emanuel_lima/strategy-em-java-para-desacoplar-o-calculo-de-frete-22p6"
  },
  "original_language": "pt",
  "account": "The article discusses the application of the Strategy design pattern in a Java-based e-commerce system. The pattern allows for the selection of different calculation strategies for shipping costs, such as economic and express shipping. The example code provided demonstrates how the pattern can be implemented, with the `FreteEconomico` and `FreteExpresso` classes implementing the `FreteStrategy` interface. The `CalculadoraFrete` class acts as the context, delegating the calculation to the chosen strategy. The article also presents a UML diagram and a high-level architecture of the system.",
  "summary": "Autor: Emanuel Antônio Lima Rocha 1 Base fundamental Introdução O Strategy é um padrão comportamental que reúne maneiras alternativas de executar uma operação sob um contrato comum, permitindo escolher a implementação usada pelo contexto. No catálogo de Gamma e colaboradores, ele pertence à categoria dos padrões comportamentais [1]. A separação entre contexto, interface e estratégias concretas…",
  "key_points": [
    "Strategy pattern allows choosing different implementations for an operation under a common contract.",
    "Separates context, interface, and concrete strategies, enabling algorithm variation by composition.",
    "Demonstrates calculating shipping costs in a checkout, decoupling rules into distinct strategies."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}