Thursday, April 4, 2019

How far to take the SRP part of SOLID?

Hello there,

I am a fairly noobish programmer in that I haven't been out in the wild very much. I have been contemplating a particular instance of my application in which I have to contact an API and save the results to a database.. I have to do this on a schedule every 5 minutes.

Presume I have three classes; - One class to raises a 'timetocallapi' message at intervals? (The same functionality of a timer) - One class to respond to the 'timeticallapi' message and actually go and do the call to the api - One class that handles saving the data to the database?

Is that what is commonly done? Like really it's just a timer is it silly to have an extra class? It's possible at some point that it may be an inconsistant interval or some such thing.

Would I be foolish to have one class that does all the above? Where does one draw the line with SRP?

Thank you kindly for any thoughts on the matter John

How far to take the SRP part of SOLID? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team