After completing an Android application as a final project for one of my courses, I wanted to further explore Android app development on my own. At the time, I was planning out my future course selection for the following semester, I found this process very inefficient. While picking courses there are many components to keep in mind, such as: core courses, credit count and a specific requirement for higher level courses. So, I decided to create a course planning app customized specifically to aid students pick the right courses in the simplest and most efficient way possible.
“Course Planner” is very simple to use. The student begins by selecting all of his/her completed courses. Determined by the student’s prerequisites, the app fetches all computer science courses available to them and displays them on the screen. Students can simply press on a course name, and view a list of its corresponding prerequisites and description.
Finally, the app summarizes useful information such as: missing core courses, total credit count, and required credits from higher level courses. This summary creates a simple and efficient way for students to see their course completion standing with regards to the degree’s requirement. At any point, students can change their selected courses using the menu, and have the option to look at all offered courses under the “Course Archive” option.
I designed three classes to manage my data: Course , CourseParser, and CoursesManager.
The Course class represents a course with a unique id (the course number), a name, a description, required prerequisites, etc. It also holds information useful for degree planning such as whether it is a core course, and how many credits it’s worth.
CourseParser is a class used to parse all of the courses’ data from a json file. It does so by reading the file, parsing the information into JSON objects and arrays. CourseParser deals with exceptions such as missing critical information, by disregarding the corresponding invalid course. However, fatal errors such as missing data file or bad file format cannot be dealt by CourseParser. Thus, CourseParser throws such exception for the calling activity to deal with.
CourseManager is a singleton class used to store all courses along with the user’s completed and chosen courses. Since CourseManager is a singleton we are guaranteed to have only one instance of it throughout the app’s runtime. This design pattern allows for manipulation and access to data from every activity in the app instead of passing data from one activity to another. Every Course has a unique id (integer) that is an invariant that must be kept.
Course data is frequently accessed by all activities, so I chose to store them in a HashMap rather than another data structure. A HashMap allows obtaining any specific course’s information in constant time. Due to the fact that every course has a unique id (which is the invariant), I used the courses’ ids as the keys in my HashMap.