Dependency Manager for PHP https://getcomposer.org/
For example, if a function needs to return 5 for a given input, you could make it look for that exact input and return 5, then the test will pass
of course that is not the correct code and the implementation would never be complete
But he actually promotes writing code like that to get the very first tests to pass.
So the principal that tells you not to keep writing stupid code to make the tests pass is this:
When changing the tests, make them more specific. When changing the code make it more generic.
The transformation priority list has some different ways you can make the code more generic in order of priority.
I think the way the list works is, if you are able to use the transformation type at the very top of the list to make the tests pass, that is ideal because it is the most generic change you can make to your code
Anyway, he really seems to be onto something with this list. He claims that if you follow this process while writing a sorting algorithm, you end up writing quicksort by accident!
So when you follow this very short circle process of the 3 laws of TDD and the priority list, programming starts to feel, really stupid.
You would expect that maybe you can write algorithms that work, but are they actually good? Are they efficient? Well it turns out they are extremetly efficient. You end up writing better algorithms than if you used a more "intelligent" approach.
@still-dreaming-1 Have you put this all into a Medium article? If not, you should!
(or if one already exists, provide the link! :P)
But by that point, Uncle Bob is getting so prescriptive with this process for writing code that, you could almost teach it to a computer program...
Thank you! Great material that deserves due consideration. That's a wrap for me, but it's been a pleasure! Looking forward to seeing you in this channel regularly!
So basically I want to try to find a way to write a function that accepts an executable contract, whatever parameters were passed in to the function being called, and then attempts various algorithms to fulfill the contract and utilize the transformation priority premise to alter its own algorithm. Once the contract has been fulfilled, it returns, and it doesn't matter if the algorithm used is "complete" or not because the contract was fullfilled.
this fails to load class App_Test_MyClass located in lib/App/Test/MyClass.php when doing composer dump-autoload it works only with composer dump-autoload -o am I missing something?
it works only when defining it as "":"lib/"
tried psr4 autoloading instead?
dont think psr0 autoloadings been supported for several years now
yeah, i suppose so
might find more docs/articles giving better help with that
from looking at the ClassLoader code, it replaces the underscore with a backslash, so App_ becomes App\, it assumes it's supposed to be a namespace
seems confusing, in docs it provides an example with underscores, i thought that means it expect partial class name, not a namespace
but it was still funny that dump-autoload -o just scans those directories and correctly builds the class map
im not sure myself - have you tried using the classmap or files method?
no, '":"lib/" solved it. i was curious if it was a bug or smth
i would probably expect a classmap would work too
Im getting an error "Cannot create cache directory /composer/cache/repo/https--packagist.org/, or is not writable....". I've googled the issue and many said it had to do with a ~/.composer file. However I do not have that, I'm on CentOs if that matters.
@JosephLeon Yeah, I can't imagine the user as whom you are running composer has sufficient rights to create a directory at the root of the filesystem.
If you don't have a ~/.composer file, create one. :D