Development Setup
Code Style Guidelines
Based on the existing codebase, follow these conventions:Package Naming
- Use lowercase:
lad.com.alura.conversormoneda - Organize by layer:
controladores,modelos,vista
Class Naming
- PascalCase for classes:
ConversorApp,ConsultaMoneda - Descriptive names that reflect purpose
- Spanish variable names (project convention):
monedaBase,cantidad,resultado
Code Organization
Indentation and Formatting
- Indentation: 4 spaces (no tabs)
- Braces: Opening brace on same line
- Spacing: Space after keywords (
if,for,while)
Modern Java Features
The codebase uses modern Java features:- Records: For immutable data classes (see
RegistroConversion.java:6) - Text blocks: For multi-line strings (see
Conversor.java:4-18) - Switch expressions: With
yieldkeyword (seeConversorApp.java:50-76) - Lambda expressions: For stream operations (see
ConversorApp.java:37)
Adding New Currency Pairs
To add support for additional currency conversions:public static void eleccionUserMenu() {
System.out.print("""
Sea bienvenido/a al Conversor de Moneda =]
==================================================
1) Dólar =>> Peso argentino
2) Peso argentino =>> Dólar
// ... existing options ...
9) Dólar =>> Euro // New option
10) Euro =>> Dólar // New option
==================================================
Elija una opción válida:
""");
}
objetivo = switch (opcion) {
// ... existing cases ...
case 9 -> {
base = "USD";
yield "EUR";
}
case 10 -> {
base = "EUR";
yield "USD";
}
default -> objetivo;
};
if (opcion == 11) { // Updated from 8 to 11
System.out.println("Gracias por usar el conversor.");
break;
}
The
ConsultaMoneda class (see ConsultaMoneda.java:14) already supports any valid currency pair through the ExchangeRate-API. You only need to update the menu and switch logic.Testing Conversions
Before submitting changes, test your modifications:Submitting Changes
Enhancement Ideas
Consider these potential improvements:Code Enhancements
- Extract API key to configuration file or environment variable
- Add input validation for amounts
- Implement error handling for network failures
- Add unit tests for
ConsultaMonedaclass - Support custom currency pair input
Feature Additions
- Save history to file
- Display historical trends
- Add currency symbols
- Support batch conversions
- Add favorite currency pairs
Architecture Improvements
- Separate concerns more clearly
- Add configuration management
- Implement dependency injection
- Add logging framework
- Migrate to Maven/Gradle for dependency management
Getting Help
If you encounter issues:- Review the Building guide for compilation help
- Check the Dependencies page for library information
- Examine the existing code for examples
- Test with the working currency pairs first
Code Review Process
Pull requests will be reviewed for:- Functionality: Does it work as intended?
- Code style: Follows existing conventions?
- Testing: Has it been tested thoroughly?
- Documentation: Are comments clear and helpful?
- Compatibility: Works with JDK 17+?