These are chat archives for composer/composer

7th
Sep 2017
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:06
Argh, I don't understand why it always feels like my tools are fighting me. It makes me want to write my own everything from scratch just so I understand the tools enough to look up and fix why they aren't working.
Ben Johnson
@cbj4074
Sep 07 2017 00:27
@still-dreaming-1 I know the feeling (as do we all to some extent, I'm sure!). Any progress on this? ^
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:28
Finally got it! I looked at the psr4 autoload file generated by composer and noticed it actually was using StillDreaming even though it should be StillDreamingOne
I had already tried deleting both vendor directories, but apparently I needed to also delete my composer.lock files
I guess that is a good lesson learned, when all else fails delete the vendor directory and the veondor.lock file. I guess that is the nuclear option.
sorry composer.lock file
Ben Johnson
@cbj4074
Sep 07 2017 00:32
@still-dreaming-1 That's precisely correct. The composer.lock does just that: it locks your dependencies at specific versions. (That is to say, never run composer update in Prod, because it ignores the lock file and just grabs the latest versions of everything that match your constraints, which can introduce any unforseen problem into your code-base!)
(That file should always be committed to source)
Be aware also of installed.json
I should revise that a bit. The first "fix" is always to delete installed.json and vendor, and then run composer install.
(this, of course, requires having a composer.lock handy, and ideally, source-controlled)
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:35
@cbj4074 interesting! So lets say I'm keeping composer.json and composer.lock in the version control, but I don't have the vendor directory under version control
then I run a composer update in my dev environment
I guess that could update the composer.lock file?
Ben Johnson
@cbj4074
Sep 07 2017 00:36
@still-dreaming-1 There are very few good reasons to keep the vendor directory under version-control. The biggest one is no Internet access in the build environment.
(that's just a related FYI)
Yes, that's correct!
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:37
Well, until I understand composer better I have been keeping vendor under version control and I don't do anything with composer on production.
Ben Johnson
@cbj4074
Sep 07 2017 00:38
You should only ever run composer update in a local/dev environment, and vet the changes before committing composer.lock.
And then in prod, you should only ever run composer install (install!)
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:38
But ideally, I think the general recommendation is not to keep vendor under version control and use composer in some way on production to get changes
Ben Johnson
@cbj4074
Sep 07 2017 00:38
I don't rely on Composer in Prod, personally.
I use other means to copy the files from "staging" or whatever you want to call it into Prod
(like rsync)
You can also use symbolic links to make an atomic switch-over
I treat staging as a "hot spare", basically.
At any time, I can push staging into production and know that things will "just work"
This, of course, requires that one not store "persistent" data in any of the environments we're discussing. That data should live "in the cloud" (as much as I hate that term)
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:41
Yeah we should probably be doing that. I just try to get the release done "really fast" and hope nobody is doing anything important at the time... Actually I'm surprised that has worked for me for several years now without any noticeable issues...
Ben Johnson
@cbj4074
Sep 07 2017 00:41
Just depends on how much downtime you can afford, right? :D
Just out of curiosity, which project/framework are you leveraging that uses Composer?
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:42
I guess that is a factor. We have other issues causing more down time than releases, releases have never been a practical problem for us.
Well right now I'm actually working on a hobby project, but I also use it at work.
My hobby project is more interesting though
Ben Johnson
@cbj4074
Sep 07 2017 00:43
Gotcha, that's an ideal scenario!
PHP, though?
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:43
I just barely started it, so it doesn't do anything yet. I just created a repo for it called PurposefulPhp
On github
It is purely just an idea at this point
But I have this crazy idea kicking around in my head that won't go away
Basically, if you think about the history of programming, we have only been taking things away
structured programming took away goto. And that turns out to be a good thing
functional programming takes away assignment, which also seems to be a good thing
object oriented programming took away function references, or something like that according to Uncle Bob.
but since those things were discovered nothing really new has been discovered
What is still left to take away?
So I'm trying to take away having to write function implementations, or at least some of them
You write your classes and methods
well the signatures anyway
You also write executable contracts
PurposefulPhp basically should provide a contract fullfiller that fulfills the contracts at runtime
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:49
So when I tell people about it in more detail it reminds them of machine learning, but that is actually not the way I envisioned it.
To the programmer using it, it should not feel like machine learning.
The programs you make with it should not have to have anything to do with machine learning
I know it is a crazy idea, but I have to try it
It is inspired by a combination of Uncle Bob and Jim Coplien
At the very core of their beliefs, they have almost the same take on programming. But they have almost completely opposing views on how to apply those principals
The stuff Uncle Bob talks about is basically just different elements of extreme programming
Jim Coplien doens't like extreme programming
Uncle Bob pushes TDD
Ben Johnson
@cbj4074
Sep 07 2017 00:51
Damn, it just got deep! :D
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:52
haha
Coplien says TDD is not agile, it is waterfall
At one point he promoted contract driven development as an alternative to TDD
But Uncle Bob discovered something amazing that he says is approaching a formal proof
it is called the transformation priority premise
Ben Johnson
@cbj4074
Sep 07 2017 00:54
Do tell... what's the basic nature of it?
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:54
Basically he was promoting the "3 laws of TDD" for a while
Write just enough of a test for it to fail
Write just enough production code to make the test pass
Ben Johnson
@cbj4074
Sep 07 2017 00:55
(need to step away for a few, but will check back after, keep it rollin'!)
still-dreaming-1
@still-dreaming-1
Sep 07 2017 00:55
I forget the 3rd law but, it might be refactor...
Anyway, eventually he asked the question, what is to stop someone from continuing to write really stupid code to make the tests pass?
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!
still-dreaming-1
@still-dreaming-1
Sep 07 2017 01:01
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.
Ben Johnson
@cbj4074
Sep 07 2017 01:02
@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)
still-dreaming-1
@still-dreaming-1
Sep 07 2017 01:03
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...
Ben Johnson
@cbj4074
Sep 07 2017 01:04
I've seen ol' Bob speak. He's a fascinating individual, and I respect his opinion. I need some time to digest this!
still-dreaming-1
@still-dreaming-1
Sep 07 2017 01:04
Transformation priority premise: https://www.youtube.com/watch?v=B93QezwTQpI&t=2s
Ben Johnson
@cbj4074
Sep 07 2017 01:06
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!
still-dreaming-1
@still-dreaming-1
Sep 07 2017 01:07
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.
ttfn
still-dreaming-1
@still-dreaming-1
Sep 07 2017 14:33
@cbj4074 Here is the link for my PurposefulPhp: https://github.com/still-dreaming-1/PurposefulPhp
@cbj4074 And there is the link for the chatroom for any type of PurposefulPhp related chat: https://gitter.im/still-dreaming-1/PurposefulPhp
Ben Johnson
@cbj4074
Sep 07 2017 15:41
@still-dreaming-1 Awesome! Thank you! I will check that out :thumbsup:
Mike Schinkel
@mikeschinkel
Sep 07 2017 22:59

@cbj4074

"Be aware also of installed.json"

Yes! That just bit me yesterday.