[dev] Nag_Task Class question

Jan Schneider jan at horde.org
Sun Oct 23 02:35:43 PDT 2005


Zitat von "Kevin M. Myer" <kevin_myer at iu13.org>:

> I started working on Nag last night, to add email notification for task
> add/mod/delete.  I thought it might be simple - just cut and paste the
> code from Kronolith, make a few variable and code changes and we end up
> with task notifications.  However, as I found out, its not quite that
> simple.  I do have it working now but wanted to try and understand why
> Nag and Kronolith differ in their code implementations.
>
> (This is my non-programmer interpretation, so bear with me)
> Kronolith has a Kronolith_Event class and you can create a
> Kronolith_Event object and this object is passed to a number of Driver
> functions.  Nag has no such class, so the equivalent Driver functions
> take a bunch of parameters instead.  So what I did is implement a
> Nag_Task class, and use the object for the notification emails.  The
> end result is the notification code is very similar to Kronolith.
>
> What I'm wondering is if one method is "better" than the other.

No. Besides that it always depends on how a developer looks at problem 
that is to be solved, in this case it makes sense to have different 
techniques accessing "application objects".

In my point of view, an event is much more like a single object than a 
task which is more like a row of some tabular data. An event can "do" 
much more on its own, it deals with alarms, attendees, free/busy 
information, recurrences, several kind of notifications etc. A task is 
much simpler (at the moment).

This is of course due to change, tasks already have alarms, get 
notifications now, will probably get recurrence one day. So it might 
make sense implementing tasks as objects too, if it simplifies coding, 
e.g. requiring much fewer parameters to be passed around.

> Obviously, they both work, but for apps that might need to implement
> similar methods, its currently not easy to reuse code, as I found out.
> If it was preferred to use objects, then would it make sense to convert
> Nag to use them throughout, instead of just having them available for
> ease of reusing Kronolith's notification code?  I don't know enough to
> have an opinion, except to say that it would seem to make sense to be
> consistent.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list