✅ Design Pattern Advice
Hi everyone! I'd like to write a small calendar app, and the key feature I'd like it to have is being able to work with a number of different APIs, like google calendars or outlook. What would be the best design pattern to look into for something like this? I've been reading into adapter and factory.
9 Replies
Not sure I'd call this a "design pattern" problem, as you more or less just need to create a
IExternalCalendar
interface that represents the actions you want your program to be able to handle (fetching events, pushing new events etc), then implement that interface for each external providerThis is less about getting the job done and more about practicing, following best practices and of course, sounding better in the documentation
Doesn't change Pobiegas point though, best practises here would revolve around having good integrations that implement an interface that makes sense.
I guess you could call this an implementation of the adapter pattern, if you wanted to put a name on it
but its the only sane way to solve this particular problem
its not like all patterns solve the same problems, or are silver bullets in general
Thank you, this was very helpful!
Or rather, is :)
(And yes, putting a name on it makes me feel better. I'll certainly look into interface best practices though!)
its not strictly the adapter pattern thou, as the idea there is that you have an object and "wrap" it in an adapter
thats not what you do here, you simply implement an interface
noted! that's good to know!
Design patterns are good to learn as they codify things that you are probably already doing and provide justification and consequences for such choices. You won't need to follow the prototypical implementation in practice.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.