Micky Hulse
2013-09-04 19:25:14 UTC
Hi all!
Example code:
<https://gist.github.com/mhulse/6441525>
Goal:
I want to have a "utility" class that contain utility methods which should
have the option of being called multiple times on a page.
I think my main goal is to avoid having to "new" things ... I don't really
need to create an instance here (there's no need for a constructor in this
case).
Question:
Is the above simple pattern a good way to have a class that calls static
methods?
To put it another way, is there any reason why I would not want to use the
above code?
Basically I want to wrap these simple functions in a nice class wrapper and
have the ability to call them without having to jump through more hoops
than is necessary.
Are there any pitfalls to writing a class like this? Or, is this the
standard way of writing a simple "utility" class for this type of situation?
Please let me know if I need to clarify my questions.
Thanks for your time?
Example code:
<https://gist.github.com/mhulse/6441525>
Goal:
I want to have a "utility" class that contain utility methods which should
have the option of being called multiple times on a page.
I think my main goal is to avoid having to "new" things ... I don't really
need to create an instance here (there's no need for a constructor in this
case).
Question:
Is the above simple pattern a good way to have a class that calls static
methods?
To put it another way, is there any reason why I would not want to use the
above code?
Basically I want to wrap these simple functions in a nice class wrapper and
have the ability to call them without having to jump through more hoops
than is necessary.
Are there any pitfalls to writing a class like this? Or, is this the
standard way of writing a simple "utility" class for this type of situation?
Please let me know if I need to clarify my questions.
Thanks for your time?