So I have a couple methods in my class that return NSDictionary has a response.
The issue is, returning NSDictionary doesn’t really tell you what the dictionary holds.
I feel as if another programming wanted to use my class, he/she would find it troublesome to understand exactly what kind of information a particular method returns.
My question is: Is this considered bad programming design? Classes should be self-explanatory and reusable.
Or is this considered ok since you can determine what keys a dictionary holds, and as long as the keys are descriptive enough, it should be self-explanatory?
If it’s a concrete, recurring data representation, then you should really consider using a class to represent this data.
It can be, or a dictionary can be the best solution in some cases. It really depends on the data you return, and how it affects the client. If you can simplify the program (in the big picture) by creating a class to represent this data, then the dictionary is surely the wrong solution.
A typical indication is the noise the client goes through when receiving your data — do they need to do a bunch of dynamic key and type testing all over the place? Then it is likely a good candidate that your program can be simplified and easier to maintain if it is represented as a proper class.