First of all, the performance issue is very much not a concern. As you continue writing code, you definitely need to focus on not worrying about performance for this kind of thing. Instantiating objects is nothing compared to some of the stuff that you deal with. Real memory wasters are loading a TON of Eloquent objects (instead of batch loading) and other stuff.
If you ever wonder if there's a performance issue, just do it and find out. That's just the best way. Write code to be easy to read and easy to modify. Performance is something that's only a problem when it is.
I keep finding that I am somewhat anxious about performance of these sorts of things.. But, I have to push past it. I force myself to keep instantiating a bunch more service level objects to do my work. I'm always amazed at how well it works. There's just something about the old days that messes with my head.
Yeah I know that this is not somewhat of a performance issue. But hey! Loading two files just to use one method isn't that awesome... right ?!
Well, it depends on what your perspective on object-oriented programming is. If you like OOP, then this is exactly the sort of thing that happens all the time. You instantiate 1-6 objects to call a single public method. It's just the name of the game.
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us