anongit / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 0 forks source link

Refactor periodic task execution in the service. #228

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently the service invokes each periodic task in a slightly different way.  
The three are announcements, splits and signal strength.

They should all implement the same interface and we should create a manager 
which controls all of them.

Then at track start and stop we just call start and stop on the manager not on 
each object.

This will clean up the code and hopefully give us the ability to perform each 
of the actions on either time or distance intervals.

Original issue reported on code.google.com by sandordo...@google.com on 19 Nov 2010 at 10:48

GoogleCodeExporter commented 8 years ago
We did a bit of brainstorming and we came up with the following design 
decisions:

- Support both time and distance based tasks.
-- There should be just one class that does all scheduling both time and 
distance based.

- Isolate Task logic from all scheduling logic.

- Remove dependency on TrackRecordingService on the Tasks.
-- We should introduce an interface for the Service.

- Make the interface for the TrackRecordingService as clean as possible.
-- The service should only see three methods:
--- scheduleAll()/restartAll()
--- cancelAll()
--- setFrequencyFor(Task t, Frequency f);
---- Where Task is an enum which a factory knows how to create the right task 
type.
---- Frequency is a type that can encode time, distance and other frequency 
types.

- Support dependency injection at as many levels as possible.

Original comment by sandordo...@google.com on 24 Nov 2010 at 9:41

GoogleCodeExporter commented 8 years ago
I'm interested in working on this refactoring, unless someone is already doing 
it or wants to do it :)

Original comment by ba...@google.com on 29 Nov 2010 at 5:27

GoogleCodeExporter commented 8 years ago
I started working on unifying this code.  Please let me know what you think of 
these changes:
http://code.google.com/r/sandordornbush-staging/source/detail?r=2732fbbc000c3f8c
9ea14679a64409853beed9ae

They are still initial and I would like comments to know if I am going in the 
right direction.

Original comment by sandordo...@google.com on 7 Dec 2010 at 5:56

GoogleCodeExporter commented 8 years ago

Original comment by sandordo...@google.com on 6 Jan 2011 at 11:54

GoogleCodeExporter commented 8 years ago

Original comment by sandordo...@google.com on 12 Apr 2011 at 3:11