Hello Matthew,
thank you for this detailed answer!
I am too, very frustrated about this discussion till now. From my
perspective this is the first time i got constructive points to work
with. To fix my contributory fault, i will bring more explanations of my
thoughts and concrete examples.
Not too shure if it's wise to answer inline. However i want to maintain
context and flow of how you see it.
> My point is that nothing, ever, is good enough to meet your standards,
> whatever they are. And you pick and pick and pick at every proposal,
> with very little constructive feedback other than, "this is no good,"
> even when the editors make changes based on your feedback.
One point is, i can't speak in high terms of something, what i see as
"half done".
The other point is, we seem to talk at cross purposes. I hope to
mitigate this by being more exact on what my intentions are.
> I'm asking for you to engage in the spirit of consensus, and not to
> just pick everything apart.
Not shure if i can do this. I need to disassemble all the things first
to get (better) overview. However i will try to express my findings
better/more positive.
> Which misinterpretations and misconceptions?
Not conducive to answer this. I am not shure i will answer this at all
but if then in a separate post.
> - When we implemented URI interfaces, we specifically indicated they
> would only model web-based URIs: i.e., HTTP or HTTPS. But then you
> asked why it doesn't allow for mailto: schemes.
I have not seen this point at that time, so i asked. Not modeling other
schemes is focused, right and good.
> - When we implemented a URI interface, and explicitly stated it was to
> model only web-based URIs (just as we did with streams), to allow us
> to model URIs for the purposes of HTTP messages, you then argued for a
> new general-purpose PSR for URIs.
We don't need all the features of general-purpose URIs in this PSR. Any
other PSR is out of scope. Sorry that/if i brought that up.
To clarify, my point is about strict handling of uris (http, https).
When saying "strict", in http-uri-interface context, i think of following:
* check scheme (scheme, to determine default port)
* check on non-empty host
* check on non-empty path
This checks should be the default and only for the special edge cases,
it should be allowed to skip them.
* provide/abstract parsing methods
* and access to all parts (forms, query params, ...)
Encourage unified access to all parts of URI through the instance of
UriInterface. So we don't need access to superglobals anymore.
This points should ensure that a typehint on UriInterface is expressive:
* function foo(UriInterface $uri) { ... } // i have a valid uri with all
needed parts and can transform to any form and get any single part
Currently, as i know, this typehint indicates only that i will get a
not-null string. Correct me if i'm wrong.
clear position: I think URIs have to be strictly immutable.
The rest of "(im)mutable" i have to omit here (better handled below).
I hope the main points are better visible now. If this is misleading or
ambiguous please say so. I will try to clear every aspect.
(there will be a point about new/current implementation below)
> - When asked about immutability or selected mutability, you replied
> off-topic by asking what the interfaces *do* (when they have been
> described all along as value objects, and not objects with behavior).
I can't follow you here. For me, every object can be immutable no matter
if VOs, Entities, services, flyweight, ...
The main point is to _not_ provide any methods that can change inner
values. This point is not about set vs. with. I think this is not about
behavior too.
Maybe an example is better suited:
In my domain i need to design two big corporations. With all the inner
values like employees, locations, buildings, subsidiaries, what so ever.
The first corporation is Sun Microsystems and the second is Oracle. It
would be strange to see new employees appear in an object modeling Sun
and common at Oracle.
The point about interfaces is, that both are corporations and i want to
typehint somewhere else on CorporationInterface. In this place i can
only rely on the immutable part.
I am sure this is not enough of an explanation. More to follow.
> - Again, when asking about immutability, you then changed the topic to
> ask about the lifetime of the message objects, with no context about
> why this was relevant to the discussion. You brought it up again once
> selective mutability was implemented, and stated that "this is
> crucial."
> When I and others indicated the way current frameworks work
> and what we're targeting (requests are referenced throughout the
> application request cycle, as are responses), you argued they
> shouldn't be, but would not provide counter-examples to show the
> application workflow you envision.
I have looked up this emails and have to admit, the context is missing
completely.
This whole thing is way too big and it's too late to reason it out. Here
are only some bullet points:
* lifetime of objects
** Information passed in from extern is long-living and immutable.
Configuration or an incoming request on the server are examples for
this. I do not differentiate them and refer to both as configuration.
** Long-living mutable objects are global state.
* calling tree/stack trace: short-living mutable objects are created and
destroyed all over the place
* construction graph: no mutable objects present at all
Sorry, i can't make my point clear on this. Not even sure it's
beneficial to this PSR as it's a bigger picture. I have to rethink if i
want to reason about this at all.
> - When asked what the pros/cons of immutability would be, you argued
> mutable is a superset of immutable, and argued to remove
> incoming/outgoing interfaces. And then later, when immutable instances
> were proposed, you argued that doing so precludes the ability to write
> mutable implementations. Which is your real argument?
Sorry for confusion. This are different points in different context.
Please see below.
> - When we argued about whether or not the URI interface should allow
> any request-target, you argued yes; and then you argued, once
> implemented, that it should only ever model absolute URIs. Which do
> you really want?
Both. UriInterface derive request-target from absolute uri.
> - Once we had immutability in place, you then argued, "step back and
> look at the 'Identity' of all this [sic] objects". However,
> immutability is an implementation detail of value objects, which, by
> definition, have identities based on the aggregate of all values they
> encompass. Why was identity suddenly a consideration?
The point about Identity is a helper construct to split VOs and
Entities. As pointed out above, both can be (im)mutable.
* In current context all VOs are immutable. This is uncontroversial
(edge cases are offtopic).
* Whether Entities should be (im)mutable is highly context dependent.
Remember the example with corporations.
As i see it, "Request" and even more "Response" are Entities. A client
requests a resource on a php server and identifying this resource with
an Uniform Resource Identifier. This word "Identifier" is very specific
and as we design not-on-wire-message we can use this URI as the
entity-identifier.
The point about Entities deserves an extra post however.
> - Once we had immutability in place, you stated you are "for and
> against immutability, depending on whether it is *conceptionally*
> right or wrong."
Okay, here we go!
In my eyes immutability is not bound to some technical concept.
Immutability is always a requirement of the domain. It's even more
profound, all state existed previously in time is immutable. If we
mutate previously existing objects, we timetravel and kill our
grandfather. Sounds wired, but that's the point.
(configuration, life-time of objects, ex-something)
* Request to server is configuration from past time and immutable
* Responses need to be build up thus mutable
(and vice versa for request build up incrementally and response immutable)
> So, color me confused — you argue for immutability one day, then
> against it another day, and mostly against how I've implemented it in
> phly/http.
The implementation in phly/http has it's assets and drawbacks. (This is
not about (im)mutability.)
* asset: pass-by-reference-semantics are jimmied. Many current designs
mutate state all over the place. To allow them to do this without any
side effects, is a clear win.
* drawbacks: To get the desired changes back, we are now bound to a hard
coded return type. If we have some other infos to return, we need to
hack around this return type (effects: attributes, or "return
array($responseClone, $otherInfos)"). There is the functional way to
handle this with a deep call-tree. However i don't know how well php
will handle this. This is currently a quite uncommon approach in the php
world.
This is too vague to be useful. Sorry. I need to get better example for
this.
> I literally have zero idea what your position is, other
> than that you're arguing constantly against anything implemented. I
> have no idea what would be a conceptionally right use case for
> immutability *to* *you*.
The right thing for me™:
* "strict" uri as a default
* anything incoming immutable
* anything outgoing mutable
* immutable as "do not provide any mutators at all"
> And yes, I *have* listened to you. In fact, there's two huge changes
> I've made based on your feedback:
>
> - I removed the concept of incoming/outgoing. You were correct: there
> are only requests and responses. We *do* need to treat server-side
> requests slightly differently, but the basic idea is the two messages.
Don't know what to say.
> - Your comments about URIs made a lot of sense when considering that a
> client will need the absolute URI (well, the scheme and authority) in
> order to make a connection. I wasn't sure how to model this, but Evert
> came up with the current implementation, which solves it nicely
> (allowing the ability to specify a request-target in the Request,
> while still composing a URI).
I don't grasp this concept. This was new to me and more of a hack.
> Again, you have not come down with a clear position about what you
> find "crude" and "hobbling". My emails to you — on list, on issue
> trackers, and privately — have not been met with anything actionable I
> can do, and, most often, I'm met with contradictory advice from email
> to email I receive from you.
I don't think i will ever come up with actions you can do. I am not your
boss. Sorry for failing to explain my thoughts. I try...
> This is why I'm frustrated.
I understand now.
> And now you have stooped to my own level, which I opened by attacking
> you. Again, my apologies.
Accepted. Please excuse me too.
> - I have tried many, many approaches to HTTP messages over my career.
> I introduced request and response objects to ZF1 in 2006, worked on
> shared interfaces prior to ZF2, helped with the ZF2 HTTP design, and
> have been actively working on PSR-7 since last year.
> - I've researched HTTP implementations across many languages to
> understand which ones work and which ones don't, how they're modeled,
> and the ramifications of each.
> - Yes, I'm new to *using* value objects, but have been aware of them
> and reading about them for around 5 years. I'd not played with the
> immutable aspects of them prior to PSR-7, and was actively against the
> idea, because I thought it would pose architectural limitations. I
> stepped out of my comfort zone when confronted, and tried something
> new. I don't always adopt every new thing I try, but I *do* at least
> try to understand them. Value objects clicked for me only when I used
> them.
> - I am actively working towards understanding the ramifications of
> value objects for PSR-7, and trying to incorporate feedback. I've
> changed my mind and position on various directions of PSR-7 many times
> since taking over as editor. I likely will again.
Thank you for your work. I have used ZF since 0.8 (?) so some of this
happened right in front of my eyes.
> I will do so. I also ask that you extend the same courtesy to me.
Fair deal.
I am very happy about concrete questions i can try to find answers for.
It's only to much at once. Will work out some of this things better. Any
suggestions where to start?