--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
On Monday, 18 July 2011 at 14:17, Yurii Korotia wrote:
oops again: 1000000 >> 1
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
Besides, if your are looking for performance bottlenecks, please consider how JModel and, as a result, com_content get to provide pagination. I have seen beefy servers being reduced to a pile of junk just because com_content was trying to paginate the front page of the site. The site only had a few dozen thousand articles.
Well, if you are still looking for a way to save 39 nanoseconds per page load, I would suggest removing comments and whitespace from all PHP files. You will save about 50 nanoseconds doing that. Just because you can doesn't mean you should ;)
Nicholas K. Dionysopoulos
Lead Developer, AkeebaBackup.com
Web: https://www.akeebabackup.com
Blog: http://www.dionysopoulos.me/blog
Sent from my iPad. Please excuse my brevity.
If you have thousand of articles in a category (typical news site when nobody is archiving old content) you end up SELECTing thousands of rows without a query LIMIT. MySQL dutifully proceeds to load the whole freaking lot to memory which a. makes things dead slow and b. consumes all your RAM. You site is now self-p0wned.
> why
> not use magic __set() and __get() methods to store such values to an
> internal array or a state object?
Because one *never* wants to use magic setters and getters. They are
misleading, because one doesn't see, that the data may be manipulated
during transfer.
And, for clean code's sake, one would always avoid direct access to
another object's properties, since that prohibits refactoring of the
internal data representation.
Ideally, *all* properties are private, and only accessible by getter and
setter methods, following the naming convention setXxxx()/getXxxx().
That way, one gets self-documenting code with better maintainability and
testability.
> I think this would make more sense from an architectural point of
> view. Moreover, if we also add a magic __call() function we could
> allow for chaining which in turn would allow us to write something
> like $this->foo($value1)->bar($value2)->baz($value3)->display();
The names of properties are nouns or adjectives; the names of methods
are verbs. Following this clean code rule, it is prohibited to address a
property 'foo' using a method foo(). It must be setFoo() instead.
Since a modern IDE can generate getter and setter methods on a single
mouse click, using the magic __call() smells ugly. It is more work to
keep the DocBlocks in sync, and will most likely not be updated, when a
new property is introduced. Thus, you will have improper documentation.
Therefor this is a bad idea. Use real getter and setter methods instead.
Regards,
Niels
--
| http://www.kolleg.de · Das Portal der Kollegs in Deutschland |
| http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------
Nicholas K. Dionysopoulos
Lead Developer, AkeebaBackup.com
Web: https://www.akeebabackup.com
Blog: http://www.dionysopoulos.me/blog
Sent from my iPad. Please excuse my brevity.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
Thank you.
JM
>--
>You received this message because you are subscribed to the Google
>Groups "Joomla! General Development" group.
>To post to this group, send an email to joomla-de...@googlegroups.com.
>To unsubscribe from this group, send email to
>joomla-dev-gene...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/joomla-dev-general?hl=en-GB.
--
>Please keep the Subject wording in your answers
This e-mail and any attachments may be confidential. You must not
disclose or use the information contained in this e-mail if you are
not the
intended recipient. If you have received this e-mail in error, please
notify us immediately and delete the e-mail and all copies.
-----------------------------------------------------------
Jean-Marie Simonet / infograf768
Joomla Leadership Team - Production Working group
Joomla! Translation Coordination Team
@JM did you seriously just interrupt the flow of conversation over your irresponsible filter?
@Nicholas I know that PHP provides magic getters and setters, but I would highly discourage their usage.
Using public getSomething() and setSomething() with private fields keeps the internal logic private thus NOBODY needs to know how it works... it just does. Furthermore, it keeps things much more readable throughout the life of the class. You know exactly what data you are handling and manipulating and what it belongs to.
Magic getters and setters are a holdover from when PHP was starting to become more object oriented. I have never had to use them and don't foresee a time where I would, especially when there are better, more clear, easily documented, easily understood alternatives.
One should feel dirty using those things IMO lol
> joomla-de...@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-gene...@googlegroups.com.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.