Re: Static utility class?
| From: | Micky Hulse | Date: | Thu, 05 Sep 2013 01:06:38 +0000 |
| Subject: | Re: Static utility class? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322044@lists.php.net to get a copy of this message | ||
Hi Rodrigo, thanks for the help, I really appreciate it!
On Wed, Sep 4, 2013 at 5:55 PM, Rodrigo Santos
<rodrigos.santos01@gmail.com> wrote:
> Hi, first, sorry for the bad English.
Not bad at all! Very clear and well written reply (heck, it's better
than my native English writing), so thank you! :)
> Yes, at least, as far as I know, this is the perfect way to do what you want
> to do. Think like this: when you instanciate a class, you are allocating
> memory. If you don't need any information stored, then you don't need to
> allocate memory, right? So, it's is logic to have a class that you will call
> only one fragment when you need it, rather than load the entire class just
> for one method.
Interesting! That makes a lot of sense.
Now you've piqued my interests! :)
I was going to head down a different path, but you've inspired me to
further explore the use of static methods/properties/variables/other.
A part of me just wants to learn more about PHP OOP, and using static
members is something I've not explored much. Seems like a simple
functional utility class would be a good time to play and learn more.
:D
> Just be careful to organize your utility methods by by meaning. Don't put a
> method that make dating stuff and a method that write a random string in the
> same class. By doing so, you are breaking the object orientation purpose.
Excellent tip! Thank you Rodrigo! I really appreciate the tips/advice
and inspiration. :)
Have a great afternoon!
Cheers,
Micky