Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Any downsides to implementing the Observer-Pattern inside a service?  RSS feed

Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my app I want to "observe" an object if a button is pressed.

What I've done is create two buttons, "start" and "stop", these hook into the starting/stopping of a Service.

Inside that service, would it be a good place to implement an observer? ie when the service is started it will start observing another object, when it stops it will stop observing.

Is this a good design? Also, I can't find any specific examples/posts related to integrating the observer pattern and the service class, I can find separate tutorials but nothing combined.

Ankit, you're normally good for advice, any thoughts?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!