Re: Math_Function
| From: | Etienne Kneuss | Date: | Thu, 26 Jan 2006 15:57:38 +0000 |
| Subject: | Re: Math_Function | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-41094@lists.php.net to get a copy of this message | ||
Hi,
Ants Aasma a écrit :
> As I see it, a defined function is just an expression with defined
> parameter order. Eg. the expression "x+y*z" has parameters/free
> variables x,y,z and can be considered to be a function f(x,y,z) = x+y*z.
Extending it to expressions would allow equations, and vector/matrix
representation (which is not something needed, but it would be a plus).
> I'm with you on lightweight, well defined packages, but derivatives
> just fit so well into function/operator definition classes. Every
> function has a derivative and the derivative is specific to that
> function. The overhead, at least now, is minimal - just one relatively
> simple function to compile. I don't see any real reason to factor out
> that functionality. Knowledge about ones derivative fits very well
> into a function definition. Factoring it out creates a parallel
> class/logic/information hierarchy, whatever way you implement it, and
> that just seems to me as a bad code smell.
There is quite a big problem with the design you currently use : its not
extensible in functionalities. We're only able to extend the defined
functions' list. Adding new functionalities that are function dependent
would require a modification of every functions' class. So either we
have a Math_Function package that already implements everything (which
is not something wanted), either we have an isolated package that is not
extensible.
Compared to Math_Derivative, the biggest advantage is a good looking
design, which doesn't in fact provide many advantages. Talking about a
novice user, I think its easier for him to implement a new function just
by giving the derivative expression, than having to create a class for it.
I think it would be better to consider another design, that would
probably contain some parallel class/logic/information that can't IMO be
avoided if the goal is to have extensible, small and surgical packages.
(quoting Bertrand)
> If you have any good ideas how would a derivative operation package
> look like with a high-level expression datastructure, I'd love to hear it.
Well, I will try to imagine an effective design from a different point
of view than yours. And we will compare :)
I would really like to have other devs into this thread !
Kind regards,
--
Etienne Kneuss
http://www.colder.ch/
colder@php.net