I recently wrote a program in which I wrapped a map data structure to increase the readability of code like so :
package wrappers;
import model.primary.customer.Customer;
import java.util.HashMap;
public class CustomerMap extends HashMap<Integer, Customer> {
}
I needed all the functions of the hashmap , and wanted to keep it wrapped inside a class so that it's readable... that's why I used a wrapper class.. However, a programmer told me that this is ironically making my code less readable / understandable ...
Here is another data structure for which I used a wrapper :
package wrappers;
import model.primary.customer.AgeRange;
import java.util.EnumMap;
import java.util.HashMap;
public class MovieAgeRangeMap extends HashMap<Integer, EnumMap<AgeRange, Integer>> {
}
I still believe that wrapping data structures which are complicated and long , like the last one mentioned, makes them readable ...
What is the threshold of complication , after which one SHOULD put datastructues in wrappers ? What's a good rule of thumb ?
Also, when I made the project , a fellow programmer told me that I had a LOT of packages , which was not good , as I had overcomplicated the solution .... However, I did that because making a lot of packages and putting logically related code in a package made the project organized and intuitive . So , what's the problem with having a lot of packages ? What's the ideal package number for my project ?
I'm more than happy to get any sort of constructive feedback about any shortcomings in my project!!