DEV Community

Discussion on: Simplifying code

Collapse
 
mykezero profile image
Mykezero

Awesome! I will also do a refactoring of the whole program. Definitely let me know if you have questions about the implementation and when I convert the whole program, definitely ask why I have written something a specific way. Programming is almost like an art: everyone balances the programming statements a different way.

I've written the code to separate English from Spanish because the main program module does not care which language is used, but cares that we communicate the menu with our customer. So from that perspective, that is why I have separated it out. If you wanted to support Japanese next, we might ask someone for a new translation for that. Then, all we'd need to create is a new dictionary for Japanese and only add a new enum entry and a new dictionary. We are gaining maintainability by separating the languages out of the main module. Which is why I said it may not shorten the code, but we are trading for maintainability.

Hopefully after the refactor we can have someone python wise comment how to improve further and why!