[TYPO3-core] Wrapper methods around globals?

Markus Klein klein.t3 at mfc-linz.at
Wed Mar 19 18:12:18 CET 2014


Hi!

That reminds me of my cleanup patches:
https://review.typo3.org/25547 ([TASK] Getters for global objects in PageLayoutView)
https://review.typo3.org/25295 ([CLEANUP] Cleanup code style in PageLayoutView)

Kind regards
Markus

------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member

> 
> Hey.
> 
> On 03/19/2014 11:42 AM, François Suter wrote:
> > Now Kay Strobach thinks this should not be done for performance reasons.
> > Do we have guidelines about this?
> 
> I'd suggest to use common sense as guideline ... in general I'm not willing to
> sacrifice code beauty because of performance reasons. This should only be
> done if you are handling a code section that is called insanely often where
> code uglyfication gives us a real and measurable benefit. Not implementing a
> method because one is afraid of the overhead of doing an additional function
> call ... hey, this is PHP, not assembler! A single function call during some
> operation just does not matter.
> 
> In this special case, the toolbarItem class is (afaik) only called if you really use
> the button, the wrapper method is nice for several reasons (type hinting in
> ide, easier mocking) and we've done that at several places already for exactly
> these reasons. If you think it looks better with a local variable, then do that,
> too. Other good candidates for these wrapper methods are usually
> TYPO3_DB and LANG.
> 
> My 2 cents
> Christian
> _______________________________________________
> Before posting to this list, please have a look to the posting rules on the
> following websites:
> 
> http://typo3.org/teams/core/core-mailinglist-rules/
> http://typo3.org/development/bug-fixing/diff-and-patch/
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-core



More information about the TYPO3-team-core mailing list