-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0a0813
commit b9ed583
Showing
15 changed files
with
590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="target/generated-sources/annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# VScode | ||
.vscode/ | ||
|
||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
# maven build | ||
target/** | ||
|
||
# IJ files | ||
*.iml | ||
.idea/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>macowins</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
<filteredResources> | ||
<filter> | ||
<id>1618248178304</id> | ||
<name></name> | ||
<type>30</type> | ||
<matcher> | ||
<id>org.eclipse.core.resources.regexFilterMatcher</id> | ||
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments> | ||
</matcher> | ||
</filter> | ||
</filteredResources> | ||
</projectDescription> |
4 changes: 4 additions & 0 deletions
4
00-lecture/macowins/.settings/org.eclipse.core.resources.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/main/java=UTF-8 | ||
encoding//src/test/java=UTF-8 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.apt.aptEnabled=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | ||
org.eclipse.jdt.core.compiler.processAnnotations=disabled | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# Maco Wins | ||
|
||
## Contenido | ||
|
||
- Consigna | ||
- Requisitos | ||
- Enunciado | ||
- Resolución | ||
|
||
## Consigna | ||
|
||
### Requisitos | ||
|
||
- Identificar los requerimientos | ||
- Presentar una solución utilizando el paradigma objetos | ||
- Explicar lo necesario en prosa | ||
- Si se descarta alguna alternativa durante el desarrollo de la solución, o si se tiene otra solucióm, explicarla brevemente | ||
|
||
### Enunciado | ||
|
||
La conocida empresa de ropa formal para caballeros, Macowins, es capaz de darle soporte a la venta de prendas. Un fragmento de la grabación del analista con el cliente: | ||
|
||
> “Queremos saber el precio de venta de una prenda y sus tipos, los tipos de prenda son: sacos, pantalones, camisas.” | ||
El cálculo del precio de una prenda es, el precio propio de la prenda modificado según el estado de la prenda, que pueden ser: | ||
|
||
- _Nueva_: en este caso no modifican el precio base. | ||
- _Promoción_: Le resta un valor fijo decidido por el usuario. | ||
- _Liquidación_: Es un 50% del valor del producto. | ||
|
||
Ah, un requerimiento más: Macowins registra las ventas de estas prendas y necesita saber las ganancias de un determinado día. | ||
|
||
> “Cada venta tiene asociada las prendas que se vendieron, su cantidad y la fecha de venta. | ||
> Las ventas pueden ser en efectivo o con tarjeta. En el caso que sea con tarjeta, tienen el mismo comportamiento que en efectivo (el cual no modifica el precio), sólo que se le aplica un recargo según la cantidad de cuotas seleccionadas (cantidad de cuotas \* un coeficiente fijo + 0.01 del valor de cada prenda).” | ||
## Resolución | ||
|
||
### Requerimientos | ||
|
||
- Permitir consultar: precio, tipo de una venta de prenda. | ||
- Resumen de ganacia de un determinado día. | ||
|
||
### Solución | ||
|
||
![Diagrama de Clases](images/maco_wins-cd.png) | ||
|
||
Tomo como Hipótesis de trabajo que se pide presentar un producto solución. | ||
Siguienda con esa idea, como el requirimiento es `consultar precio, tipo de prenda` uno debería poder determinar, dado un nro de venta y una posicion obtener la ganancia de una prenda en particular. | ||
|
||
Presento la siguiente solución: | ||
|
||
Una app de Reporte. | ||
|
||
La cual presentaría la siguiente tabla, permitiendo distintos filtros, por ejemplo: por `Fecha`, por `Items`, por `Cliente`, etc. Y distintos ordenamientos, citando algunos por `Total Abonado` por `Ganancias` por `Descuentos`, etc. | ||
|
||
| Fecha | Nro de Venta | Items | Cliente | Precio Base | Descuentos | Recargos | Total Abonado | Ganancias | | ||
| :---: | :----------: | :---: | :-----: | :---------: | :--------: | :------: | :-----------: | :-------: | | ||
|
||
Donde estarian agrupados por fechas, indicando el total de cada fecha. De esta manera cumpliria el requisito de **Resumen de Ganancia por día**. | ||
|
||
Suponiendo el fetch de estos datos séan | ||
|
||
```ABAP | ||
" Selecciono todas las columas de la cabecera de ventas | ||
SELECT * FROM zVENTAS_CABECERA "Para el ejemplo invento una tabla Z | ||
INTO CORRESPONDING FIELDS OF TABLE et_entityset. "Lo almaceno en la tabla exportable | ||
* Me ahorro en detalles de filtros y ordenamientos, que no aportan a la solución en sí. | ||
``` | ||
|
||
Luego, siguiendo la lógica de nuestros objetos planteados... | ||
|
||
Los cálculos serían | ||
|
||
```js | ||
coeficienteFijo; | ||
|
||
class Venta { | ||
prendas; | ||
cuotasTarjeta; | ||
subtotal; | ||
|
||
descuentos() { | ||
return this.prendas.reduce((prenda) => prenda.descuento(), 0); | ||
} | ||
ganancia() { | ||
return this.prendas.reduce((prenda) => prenda.ganancia(), 0); | ||
} | ||
// Asumo que ganancia no incluye los recargos | ||
total() { | ||
return ganancia() + confirmarPago(); | ||
} | ||
confirmarPago() { | ||
return this.cuotas * coeficienteFijo + 0.1 * this.subTotal; | ||
} | ||
} | ||
|
||
agruparPorFecha(Ventas) // No considero necesario desglosar esta función | ||
.map((agrupacion) => | ||
/* Asumo cada agrupacion como si fuera: | ||
agrupacion = [Venta0, Venta1, ...] | ||
Nótese que esta función la describo para demostrar el uso del método ganancia() */ | ||
agrupacion.reduce((Venta) => Venta.ganancia(), 0) | ||
); | ||
``` | ||
|
||
Con detalle por Venta que mostraría el detalle de cada `posición` de cada venta. | ||
|
||
| Prenda | Estado | Tipo | Cantidad | Precio Base | Descuentos | Ganacias | | ||
| :----: | :----: | :--: | :------: | :---------: | :--------: | -------- | | ||
|
||
```ABAP | ||
" Selecciono todas las columas de la cabecera de ventas | ||
SELECT * FROM zVENTAS_DETALLE "Para el ejemplo invento una tabla Z | ||
INTO CORRESPONDING FIELDS OF TABLE et_entityset. "Lo almaceno en la tabla exportable | ||
WHERE nro_de_venta EQ lv_venta. "Suponiendo que en lv_venta esta la primary key de la cabecera. | ||
``` | ||
|
||
Dónde el calculo de ganancias sería | ||
|
||
```js | ||
class Estado { | ||
obtenerPrecio(precioBase, descuento) {} | ||
} | ||
|
||
// Por ejemplo para los estados actuales... | ||
|
||
/* | ||
Nuevo = { | ||
descripcion = "no modifican el precio base". | ||
obtenerPrecio(precioBase, descuento){return precioBase} | ||
} | ||
Liquidacion = { | ||
descripcion = "Es un 50% del valor del producto.". | ||
obtenerPrecio(precioBase, descuento){return precioBase * 0.5} | ||
} | ||
Promocion = { | ||
descripcion = "Le resta un valor fijo decidido por el usuario". | ||
obtenerPrecio(precioBase, descuento){return precioBase-descuento} | ||
} | ||
*/ | ||
``` | ||
|
||
Notese que se permitiría una futura adición de nuevos estados. | ||
|
||
```js | ||
class Prenda { | ||
estado; | ||
//... | ||
ganancia() { | ||
return estado.obtenerPrecio(this.precio, this.descuentoManual); | ||
} | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.macowins</groupId> | ||
<artifactId>macowins</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<name>macowins</name> | ||
<!-- FIXME change it to the project's website --> | ||
<url>http://www.example.com</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- JUNIT Jupiter --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>5.7.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> | ||
<plugins> | ||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.2</version> | ||
</plugin> | ||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
Oops, something went wrong.