briggySmalls / late-train-mate

A lightweight website that provides stats on delayed or cancelled UK train services
MIT License
0 stars 0 forks source link

Use a frontend framework #15

Closed briggySmalls closed 6 years ago

briggySmalls commented 7 years ago

Currently results are send from the server to the client. These results are handled by JavaScript and pushed into the DOM.

For more complex behaviour, such as #3 or even just rearranging results as #13 some sort of MVC framework would be preferred. I.e. results being held in a JavaScript object representing the model and the view reflecting the state of the model.

briggySmalls commented 7 years ago

If separation between the model and the view is pursued, then it might make sense for a total reconsideration of the app. For flexibility for future enhancements, it would be useful to have all the HSP API data in the client browser, rather than just results that the server has processed. This way if more complex logic or added details are desired (e.g. result row expanding to show the scheduled/actual arrival times of a specific journey, per station) it simply need be used, rather than the comms between server and client updated.

briggySmalls commented 7 years ago

Cursory research threw up the following big names:

Angular 1.x is an MVC framework designed by google with biggest market share. Angular 2.x is the latest, API-breaking version that is immature has only just got a stable API. React is a facebook framework that seems to be just the 'V' of 'MVC' and prefers JavaScript to HTML to define DOM elements. Knockout is another MVC framework that seems to have been beater by Angular.

I like the idea of Angular 2.x. It is a full MVC framework, so provides the whole package. The dominance of Angular 1.x indicates 2.x could be the future leader. Its API sounds much nicer than 1.x.

briggySmalls commented 6 years ago

Implemented Angular2/express project