farbodsz / TimetableApp

The modern way to manage your school life.
Apache License 2.0
2 stars 2 forks source link

Improve 'agenda' architecture to reduce tight-coupling #267

Closed farbodsz closed 7 years ago

farbodsz commented 7 years ago

Instead of inheriting from ItemListFragment and having very similar Fragments for assignments, exams, and events, we've created an AgendaListFragment which can display any combination of these types - for example, just Assignments, Assignments and Events, or all.

At the moment, this functionality makes it easy to have three tabs each displaying different types.

Now, we've also used an AgendaItem type as a superclass of Assignment, Exam, or Event. An AgendaListItem type is used for anything displayed on the list, so AgendaItem and AgendaHeader inherit from it. Further, there are two types of AgendaHeader - PastAgendaHeader and UpcomingAgendaHeader for flexibility when switching view types in each tab between past and upcoming items.

This new design is much better since it prevents classes depending on each other and tight-coupling.

Finally, the AgendaDataHelper class is used to encapsulate the retrieval of data, depending on the filters set.


The architecture can be improved even more because there is still tight-coupling elsewhere in the code.


See #265

farbodsz commented 7 years ago

This can be merged for now to help whilst we work on other features, but note that further work needs to be done to improve the overall architecture of the app.