Hi there, I'm working on a currency converter which uses XML to dynamically retrieve exchange rates. Below is my class diagram so far:
Uploaded with ImageShack.us
The theory behind it is the selects the current currency + amount first. The currency name is then passed to the exchange rates class which retrieves the feed for this country and as it parses through stores the information in a hash map (currency, country as well as exchange rates in an array). The user then selects the desired currency and the desired currency name, current currency amount and hash table are passed to the converter class to carry out the conversion (the desired currency name is only needed as in the exchangerates hashtable inside there will be an array with the exchange rate of every country to that specific country so you just need the name to identify the correct rate). The converted amount is passed back and set as the desired currency amount and of course displayed to the user.
My question is does what I have above accurately representing this in the best way? It also seems a bit too simple to me with the amount of classes I have...


LinkBack URL
About LinkBacks

Reply With Quote
Seriously, what one programmer does another may do in a completely different way but each reach the same functionality...which one is better? Off the top of my head you could consider encapsulating ExchangeRates in the Converter so the UI doesn't even see ExchangeRates or how it is implemented. Might also consider making the Converter an interface. Both of these suggestions in my opinion would make the UI less dependent upon the implementation of these classes. However, ask me the same question in a week and I'll probably give you a different answer