Common method names (was: "Re: [PEAR-DEV] HTML_Template_IT package release")

From: Date: Sat, 31 Aug 2002 14:12:58 +0000
Subject: Common method names (was: "Re: [PEAR-DEV] HTML_Template_IT package release")
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-8775@lists.php.net to get a copy of this message
On Fri, 30 Aug 2002 10:21:28 -0500 (CDT) Brent Cook <busterb@mail.utexas.edu> wrote: > I've been using HTML_Template_IT with HTML_QuickForm, and noticed that the > method to get the results from a template is get() but the method on > Quickform is toHTML(). Should they be a little more similar? I know that a > template can be used for more than HTML, but perhaps the verbs should be > the same (this goes for all packages that generate formated output). I > think that get, as in getHTML() would be a nice universal verb. I think it would be a wise idea in general to extend the PEAR coding guidelines with suggestions for some common method names. I´ve been (forced to) working with the .NET framework lately and a big advantage is that most classes follow a common method naming system. This makes it easy to work with a new class because you can rely on some common method names to be always present and doing almost the same (or at least accept and return the same variable types). So I guess it wouldn´t be too bad to introduce something like this to PEAR. Say, a common method "get()" for getting a string representation of a class´ output, "show()" for printing it to the browser. Those methods could commonly accept an optional parameter where applicable, that determine the type of output (if the class supports multiple output types). This can be one of several common constants like i.e. "PEAR_OUTPUT_HTML", "PEAR_OUTPUT_XML" and the like... Just an idea. > Sorry, that was a little OT. Hi everyone, BTW. I'm back and married now! Congrats! :-) Regards, Markus -- Markus Wolff <wolff@21st.de>

« previous php.pear.dev (#8775) next »