Agum Posted May 3, 2007 Share Posted May 3, 2007 So I am working on this online system, and it employs an OO design for the most part. I was wondering for "utilities" functions, should I make another class for them or put them in the global scope? What are the advantages of each? Does it even matter? By utilities function I mean things like, a function that checks an email string for validity, and so on. Putting them in a class doesn't mean I'll make any objects, but just that I have to call it by Classname::func() every time, since they are just generic functions. Link to comment https://forums.phpfreaks.com/topic/49758-solved-utilities-functions-class-or-global/ Share on other sites More sharing options...
genericnumber1 Posted May 3, 2007 Share Posted May 3, 2007 It's totally up to you. Some people like to use static oop classes for name spacing and sectioning of functions, while some people like to use normal functions because they're a little bit faster. I prefer to use static classes since they help me lump my code together for future use so I don't have to pick and choose which functions I want to transfer to a different application, I just copy the whole class. Plus the name spacing thing helps when using third party code. Link to comment https://forums.phpfreaks.com/topic/49758-solved-utilities-functions-class-or-global/#findComment-244072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.