In this mini-project, you will explore (a) the use of associative arrays and other kinds of maps, (b) programming to specifications in support of a larger project, (c) dealing with conflicting approaches to Java programming, and (d) considering some of the issues at play in designing software for people with disabilities (and using software as a disabled person).
Do the assignment at https://accessibilityeducation.github.io/assignments/AAC/AAC.html, using your AssociativeArray class instead of HashMaps. Please leave your AssociativeArray and KVPair classes in the structures package.
To do this assignment, you should follow these steps, modifying them as you consider appropriate.
.project package from the repository.src/structures).AACCategory class with stub methods that follows the specifications given at https://accessibilityeducation.github.io/assignments/AAC/AACCategory.html.
AACCategory class will likely contain an AssociativeArray<String,String> that maps image locations (strings) to words (also strings).AACMappings class with stub methods that follows the specifications given at https://accessibilityeducation.github.io/assignments/AAC/AACMappings.html.
AACMappings class will likely contain an AACCategory object that maps filenames to their corresponding words. You may also want an AssociativeArray<String,AACCategory> that maps either filenames or names to categories.getImageLocs(), getTexst(String), and getCurrentCategory() follow.Note that you will likely need to update AssociativeArray to support methods like getImageLocs().
public String[] getImageLocs() {
return new String[] { "img/food/icons8-french-fries-96.png", "img/food/icons8-watermelon-96.png" }; // STUB
} // getImageLocs()
public String getText(String imageLoc) {
return "television"; // STUB
}
public String getCurrentCategory() {
return "food"; // STUB
}
Submissions that fail to meet any of these requirements will get an I.
[ ] Includes the specified `.java` files, correctly named. (They should
be in the appropriate package.)
[ ] Each class has an introductory Javadoc comment that indicates
the author and purpose.
[ ] Includes a `README.md` file that contains the appropriate information
(authors, purpose, acknowledgements if appropriate)
[ ] All files compile correctly.
Submissions that fail to meet any of these requirements but meet all previous requirements will receive an R.
[ ] Appears to follow Google Java style guidelines for indentation and such.
[ ] Appears to correctly load a file.
[ ] Appears to correctly add an image to the top-level category.
[ ] Appears to correctly switch to subcategories.
[ ] Successfully grabs words from subcategories.
[ ] Appears to correctly switch to the default screen.
Submissions that fail to meet any of these requirements but meet all previous requirements will receive an M.
[ ] All (or most) repeated code has been factored out into individual
methods.
[ ] All or most variable names are appropriate.
[ ] `AACCategory` and `AACMappings` do not access any fields in
`AssociationList` or `KVPair`.
How do we add new categories?
It seemed from the specs that categories are only created when you load the file upon creating a new
AACMapppings. However, upon looking at the underlying code, I determined that any images on the default screen are considered categories.
I hear you also did this MP. What part did you find hardest?
Yes, I did this MP. I try to do most of them. I found writing a
keysmethod forAssociationListthe hardest part because creating arrays using generics is painful. I assume there’s a good way to do it, but I always find myself struggling.
How did you address the problem?
Since we only need an array of strings I was tempted to write at
String[] keyNamesmethod. However, that seemed like an easy out. If I were re-designing the assignment, I’d probably require that we provide an iterator for keys rather than an array of keys.
In the end, I used something similar to the mechanism I used in the constructor. That is, I used
Arrays.newInstanceusing the first key in the pairs array to specify the type.
Of course, I couldn’t do that if I had no key/value pairs, so I returned
nullin that case, which complicated the implementation ofgetImages.
What else was difficult?
I didn’t see a natural way to write
isCategory; it seemed much more natural to check if a word is a cateogry than if an image location is a category. I later discovered that they didn’t useisCategoryand they assume any image on the home screen is a category.
Can I provide full path names to the images?
No. That’s not portable. You should write portable code.
Can I change the names of the images?
I’d prefer that you don’t change the names of the images. It may interfere with our testing.
The interface for adding image/text pairs seems fairly cumbersome, particularly for users with limited mobility.
I’d agree. Let’s assume that a friend or assistant would add them.
Why do you think our AACMappings class would benefit from a field
of type AssociativeArray<String, AACCategory>?
You’ll need to keep track of the AACCategory for each image on the top-level page.
Why do you think our AACMappings class would benefit from a field
of type AACCategory?
You’ll need to keep track of the location-to-name mappings somewhere. I think it’s easier if you use an
AACCategoryfor uniformity.