mercredi 25 octobre 2017

Advice on design pattern

I am in a software engineering class and I need to pick a design pattern to use for a 'feature'... I have two features, and one of them is to have a feature where a user can enter a zip code and time span of days (up to 7). A collection with weather ratings for each day is generated (say a vector of ints, with 1 being good and 3 being bad) that my teammates will use in the class to do various calculations with.

I just wanted some advice on a design pattern I can use because we are being forced to use one. I am using a singleton pattern for the GUI of the project, and I gotta think of one for this feature.

My thought process for the flow is as follows:

  • After user enters calculate, the GUI will call a function in this feature sending the zipcode and amount of days (to be stored in the GUI singleton maybe??)
  • My feature will take the Zipcode and # of days and connect to an OpenWeatherAPI, and will need to Parse through a JSON format being returned and for each day rate the weather (something very simple like if temp is over 70 degrees, rating is a 1, between 50-70, ratings is 2, and below 50 rating is 3) and store this into a vector collection and return this.

I just have to choose a pattern and justify why I chose it, create a class diagram, sequence diagram, etc. I was thinking of something that removed implementation from the interface, so maybe bridge? Honestly this 'feature' is small (probably isn't even a feature haha) and I don't know too much about design patterns.

Thank you so much in advance for your help!

Aucun commentaire:

Enregistrer un commentaire