@Bonner웃 ... no, that's not a good analogy. I was asking because it seems like you are not even experienced enough to qualify as "novice". I'm not trying to be rude; I am not an expert either.
This is not nearly the most complicated piece of shit code in our app.
This is one of the better parts, and I'm happy to say that all of us in the team can understand this understandably non-trivial piece of code pretty much at a glance
thats the term, just ran the static code analyzer in visual studio for a project I've written at home, all but one are 1 2 and 3's, the only place that is a mess is code I copied from Topshelf
@Allenph I am not using DDD. Which means that my factories are not creating domain entities. Therefore I have factories that produce mappers in my services
@tereško Part of it is kind of that. The rest is that I'm trying to keep my overhead as low as possible to get some better coding standards in the code.
Looks like you just have a really generic method where you call all the setters.
And that it's reliant on your columns being named a certain way.
Is there a reason people will make an object's (ex private $currency) variable private, then make a public function (ex public function getCurrency()) that just echo's the private variable?
@FélixGagnon-Grenier I've thought about it and come to the conclusion I don't need anything like Amp for quite a while; I just don't have enough stuff that needs high performance like amp to justify the added complexity.
and you can't really use the same array with multiple mappers
besides, I try to make add a little architectural boilerplate as possible - especially since architecture has a lot in common with battle plans: they do not survive the contact with an enemy
if you only add the code as much as you need, it will be easier to alter it
I'm trying to learn best coding practices, this might be based on opinion but would it be redundant to put the key of an array as a value for the array? For example $currencies = ['usd' => ['code' => 'usd', 'symbol => '$', 'name' => 'US Dollar',],];?
It is by code so it has to be the key, but for some reason I feel like the array that is the value should contain all the information about it. I guess there's no real reason though.
@PeeHaa This is actually something that's been confusing me a lot. There are times when I need to pass an array in the constructor, but I also need to ensure that it has certain keys.
@Allenph I have came across that conundrum as well. I think in that case since it might be slightly more expensive to select more things through relational databases I would not select what you're using to select it.
@PeeHaa The array is actually in the constructor, it contains information about all currencies. It would retrieve it from a JSON file in production but in this case I am completing an assessment and they ask for it to be 1 script file.
Well, I have two objects. A domain object with no behavior other than getters and setters which seems dumb to test, and a mapper which maps those domain objects to an external API.
I feel like they both can and should be tested, I just don't see any cases that don't involve hitting the eternal API.