Skip to content

Commit d91d3c1

Browse files
Yenniferhsugan0tech
authored andcommitted
translation: Translates Layers Pattern to Spanish (iluwatar#2700)
* ADD: Spanish translation for Layers pattern * UPD: Minor formatting fix for layers pattern
1 parent b754c18 commit d91d3c1

File tree

2 files changed

+98
-1
lines changed

2 files changed

+98
-1
lines changed

layers/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Wikipedia says
2828
> In software engineering, multitier architecture (often referred to as n-tier architecture) or
2929
> multilayered architecture is a client–server architecture in which presentation, application
3030
> processing, and data management functions are physically separated.
31+
3132
**Programmatic Example**
3233

3334
On the data layer, we keep our cake building blocks. `Cake` consist of layers and topping.
@@ -90,4 +91,4 @@ Use the Layers architecture when
9091

9192
## Credits
9293

93-
* [Pattern Oriented Software Architecture Volume 1: A System of Patterns](https://www.amazon.com/gp/product/0471958697/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0471958697&linkCode=as2&tag=javadesignpat-20&linkId=e3f42d7a2a4cc8c619bbc0136b20dadb)
94+
* [Pattern Oriented Software Architecture Volume 1: A System of Patterns](https://www.amazon.com/gp/product/0471958697/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0471958697&linkCode=as2&tag=javadesignpat-20&linkId=e3f42d7a2a4cc8c619bbc0136b20dadb)

localization/es/layers/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Layers
3+
category: Architectural
4+
language: es
5+
tag:
6+
- Decoupling
7+
---
8+
9+
## Propósito
10+
11+
Capas (*Layers* en inglés) es un patrón arquitectónico donde las responsabilidades del software se dividen entre diferentes
12+
capas de la aplicación.
13+
14+
## Explicación
15+
16+
Ejemplo del mundo real
17+
18+
> Considere un sitio web que muestra pasteles decorados para bodas y similares. En lugar de que la página web
19+
> acceda directamente a la base de datos, depende de un servicio para entregar esta información. Luego, el
20+
> servicio consulta la capa de datos para recopilar la información necesaria.
21+
22+
En otras palabras
23+
24+
> Con el patrón arquitectónico de Capas, diferentes responsabilidades residen en capas separadas. La capa de vista solo
25+
> está interesada en la renderización, la capa de servicio ensambla los datos solicitados de varias fuentes, y
26+
> la capa de datos obtiene la información del almacenamiento de datos.
27+
28+
Wikipedia dice
29+
30+
> En ingeniería de software, la arquitectura multitier (a menudo referida como arquitectura n-tier) o
31+
> arquitectura multicapa es una arquitectura cliente-servidor en la que las funciones de presentación, procesamiento de aplicaciones
32+
> y gestión de datos están físicamente separadas.
33+
34+
**Ejemplo programático**
35+
36+
En la capa de datos, guardamos nuestros elementos básicos. `Cake` consta de capas (*layers*) y cobertura (*topping*).
37+
38+
```java
39+
@Entity
40+
public class Cake {
41+
@Id
42+
@GeneratedValue
43+
private Long id;
44+
@OneToOne(cascade = CascadeType.REMOVE)
45+
private CakeTopping topping;
46+
@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
47+
private Set<CakeLayer> layers;
48+
}
49+
```
50+
51+
La capa de servicio ofrece `CakeBakingService` para un fácil acceso a diferentes aspectos de los pasteles.
52+
53+
```java
54+
public interface CakeBakingService {
55+
void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException;
56+
List<CakeInfo> getAllCakes();
57+
void saveNewTopping(CakeToppingInfo toppingInfo);
58+
List<CakeToppingInfo> getAvailableToppings();
59+
void saveNewLayer(CakeLayerInfo layerInfo);
60+
List<CakeLayerInfo> getAvailableLayers();
61+
}
62+
```
63+
64+
En la parte superior tenemos nuestra `View`, responsable de renderizar los pasteles.
65+
66+
```java
67+
public interface View {
68+
void render();
69+
}
70+
@Slf4j
71+
public class CakeViewImpl implements View {
72+
private final CakeBakingService cakeBakingService;
73+
public CakeViewImpl(CakeBakingService cakeBakingService) {
74+
this.cakeBakingService = cakeBakingService;
75+
}
76+
public void render() {
77+
cakeBakingService.getAllCakes().forEach(cake -> LOGGER.info(cake.toString()));
78+
}
79+
}
80+
```
81+
82+
## Diagrama de clases
83+
84+
![alt text](../../../layers/etc/layers.png "Layers")
85+
86+
## Aplicabilidad
87+
88+
Utilice la arquitectura de Capas cuando:
89+
90+
* Quiera dividir claramente las responsabilidades del software en diferentes partes del programa.
91+
* Quiera evitar que un cambio se propague a lo largo de la aplicación.
92+
* Quiera hacer su aplicación más mantenible y testeable.
93+
94+
## Créditos
95+
96+
* [Pattern Oriented Software Architecture Volume 1: A System of Patterns](https://www.amazon.com/gp/product/0471958697/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0471958697&linkCode=as2&tag=javadesignpat-20&linkId=e3f42d7a2a4cc8c619bbc0136b20dadb)

0 commit comments

Comments
 (0)