« first day (1755 days earlier)      last day (3207 days later) » 

3:00 PM
@Jimbo They will be, trust me. That's exactly the reason for all those slow frameworks. :P
 
Abe
@samaYo i don't know
 
@Fabor cancer fixing peaches piss you off?
 
@kelunik Nah, that's just Doctrine >:P
hides from ocramius
 
"The first indication
that something’s fishy is the getValue accessor
function. What does it mean to get the “value” of an
object? In what senses is an object’s value different
from the object itself?"
 
I don't like their fuzzy skin.
 
3:01 PM
lol
 
@LeviMorrison I don't know I'd probably have to read the rest of the RFC. It still sounds painful though. Currently we have callables that are made of primitive types, and they don't need any special handling. And we have callables that are closures, and they are not serializable, so also don't need special handling (other than throwing an error if you try to serialize one). Making it so that something that is easy to deal with now, be more difficult to deal with sounds ....ungood.
 
peaches are nice
 
@Ocramius would disagree with you @PeeHaa
that getter/setters are good
 
Abe
@DavidGraham link, again?
 
3:02 PM
@Danack If they are serializable how are they harder to work with compared to now?
 
Abe
@DavidGraham i think you didn't fully understand what @Ocramius was saying. i believe they both share the same vision of the thing
 
@Abe you want a link? sorry, confused
 
Abe
@DavidGraham isn't that a quote from something you are reading?
 
@Jimbo Should actually be 204 No Content. :P
 
@kelunik there's no no content. It's just much less content.
 
3:05 PM
@LeviMorrison just by needing another case for writing them out. And by being another thing to think about.
 
@Danack Writing what out?
 
@Fabor Damn I want a new puppy
 
@LeviMorrison For the example I was thinking of, when you have an application that needs to scan all of the plugins it has registered and generate a routing file for all of the routes, so as to avoid having to scan all the plugins each time the application runs.
 
i.e. all of the individual routes get written into a single file.
 
3:07 PM
So where is the extra case?
 
if (is_array($callable)) {
    $string = sprintf("['%s', '%s']", $callable[0], $callable[1]);
}
else if (is_string($callable)){
    $string = $callable;
}

fwrite($string);
 
@Abe sorry yeah link here: idinews.com/quasiClass.pdf
 
As I said - I probably need to see the rest of the RFC. Also, have you though about what the performance implications would be?
Particularly for the functions.
 
@Danack Why don't you just serialize it no matter what?
I don't get it.
 
user895378
Are we sure serializable closures are even a good idea?
 
3:09 PM
@rdlowrey No. But if they can be serialized I'm trying to understand @Danack's point about another case.
 
user895378
(considering that intercepting and modifying them in transit would then be the easiest way to create a remote code execution exploit, I mean)
 
yeah, it makes my job as an attacker much easier
immediate RCE
why not just send a string then eval() it
it's the same thing
 
@LeviMorrison Technically that example isn't using serialization it's just printing stuff out to generate new code.
 
I wish [un]serialize() never were introduced…
 
That's the use case that the current strings and arrays for callables is great at.
 
3:11 PM
@ScottArciszewski Because eval is evil!!1111111111 ;-)
 
It's the most common vulnerability in PHP.
 
@bwoebi Agree, but perhaps not for the same reasons.
 
And having to jump through a closure to achieve the same thing is more difficult....I can't really express it more simply than that.
 
bwoebi funny you should mention that ;P
 
@ScottArciszewski why funny?
 
Abe
3:12 PM
@DavidGraham and how that relates to you? :P
 
my latest CVE which I'm ~3 weeks from being free to disclose
 
@Danack So even if you have to add another else if in this case, what other cases are there?
If this is the only case then it's probably not worth worrying about.
The most common case for closures is actually running them, you know?
 
Abe
it is a simple class that wraps a single scalar, clearly it's useless
but your domain objects don't hold a single scalar, they hold many of them, and they have to be validated so that they fit the whole aggregate cluster, in the more complex cases
 
@LeviMorrison Off the top of my head, whitelisting stuff for security. e.g. I can easily inspect strings and arrays as being within a certain namespace. Trying to do the same with closures is not as fun.
 
@ScottArciszewski yeah… just don't use unserialize() in your code and you're safe against most RCEs.
 
3:15 PM
@bwoebi why is that ....because of how it is misused?
 
But I need to get on and do work, so I'll read the RFC when it's closer to being written.
 
@Abe @PeeHaa I feel like you guys are going to get me to use getters/setters and then down the road I'm going to regret it
I just resolved in myself (after lots and lots of painful research) that they are bad
even discussed heavily with @Ocramius the last few days
 
@Orangepill Well, yes. basically.
 
@Orangepill was there to witness
 
Abe
@DavidGraham if it's not a setter, then how you mutate the state? i don't understand
 
3:17 PM
@DavidGraham my take away from the whole conversation is at the domain level your focus needs to be on interactions as opposed to properties.... setters are bad because they are context free.
 
^ this
 
@DavidGraham but I think simple stuff like updatePhoneNumber is a perfectly valid interaction even though it would be implemented identically to a setPhoneNumber
 
@Danack Well it's something to think about it but that seems like a stretch to me.
 
Yeah, I agree. But it seems only useful for CRUD situations.
Like you are going to save right after that
 
Abe
but you don't need to know the context. domain is atomic, context makes me think that something could behave in many different ways. but in that case it's just two different types
 
3:20 PM
Otherwise, what's the context for setPhoneNumber?
So what do you typically do after you set the phone number?
Do you just save it?
 
Are you talking setters on entities
 
Or do you perform some other operation?
@RonniSkansing yes
 
@RonniSkansing In general
Setters are an anti pattern.
 
why should the entity ever know about any context?
 
@DavidGraham you save it at some point in the future...
 
3:22 PM
Because it's supposed to function with contextual validation
 
like which?
and I am guessing instead of setter you like the values passed via the ctor?
 
@RonniSkansing at the domain level you are implementing business rules, which in many cases behavior is bound to a context.
 
Like what context?
If it's my database entities, I really only see the db context
I does not need to know how it is consumed
 
Then it's just CRUD, not DDD
 
not its not crud
 
3:24 PM
your domain is simply a property bag
 
its just a entity
 
you put the data there then pass the object somewhere for saving
 
Abe
@DavidGraham it is not, since it contains validation (from the simple type checking of parameters, to the whole aggregate validation)
 
like a DTO
 
Abe
but it's not anemic if it contains validation
even the simple setFoo(Bar $foo){ $this->foo = $foo; } is validation, since you are filtering $foo to be a Bar instance
 
3:28 PM
So the entity is valid from from one setter to the next? No matter the order? or if some are called and others arent?
 
@RonniSkansing like the behavior that contextually a customer service person is allowed to change the shipping method without a supporting charge but that would be invalid for an accountant to do.
 
Like you have "setHired" and "setHireDate"
 
@Orangepill that sounds like logic that does not belong inside a entity?
 
Abe
domain objects must always be in a valid state, even if you have 1:1 setters/fields @DavidGraham
 
If you do "setHireDate" and don't do the other, then you have invalid state.
 
3:31 PM
@RonniSkansing I kinda agree... my thoughts are that an interaction should be abstracted out in some way
 
yea that is far away from the entity imo, something consumes the entity. The entity does not consume the logic
 
Abe
@DavidGraham you use a setter for both fields
 
but it is definately a domain concern... It should be what is interacting with the entity
 
Abe
$user->setHired($DT, $isHired)
 
yea @Orangepill
 
3:32 PM
yeah that makes sense
it seems like getters/setters are all about "saving"
 
Abe
how can getters be about saving? :P
 
you are focused on eventual persistence. by saying "$employee->setHire" instead of "$employe->hire"
 
Abe
you can do that, have more meaningful method names
 
And that's what this is about, more meaningfulness
all those links were about that
 
Abe
but it's still setters
 
3:36 PM
But people tend to add all these "getters/setters" and then expect their state to be valid for everything they do later
Or it's not very defensive programming
 
?
shouldnt the validation stop you there? How can it validate if it is in invalid state?
 
its all just to mitigate the fact that business rules don't always make any fucking sense but we have to reflect them anyway
 
I'm just saying guys, there's lots and lots of people against them. Don't take my word for it, go on a research. What is it that they are missing?
I didn't just blindly come to this conclusion recently. I've been trying to figure out why the big debate.
 
Abe
@DavidGraham knowledge? :P
 
Why does fowler say "getters/setters" are an anti-pattern?
What does he mean? Arbitrary getter/setters?
Getter/setters with little-to-no-purpose?
 
Abe
3:38 PM
i believe so, yes
 
People use the term "getter/setter"
so it's a term that represents the illusion that the object doesn't have public properties
If you are using "getter/setters" arbitrarily, you are doing no more than public properties
 
Abe
consider that "public property" doesn't necessarily mean the same thing in all languages
 
why the big talk for saying that a setter and a getter that does nothing for a protected member it is the same s a public. That does not mean they are a anti pattern, only if you use them like one.
 
Anonymous
@Orangepill I knew I read it somewhere, when I told you that getter/setters violate SOLID. That is if we can say SOLID ~ design pattern :)
 
Abe
3:41 PM
class Bar{ // valid. in java
    public Foo bar;
    public Foo baz;
}
class Bar{ // anemic. php
    public $bar;
    public $baz;
}
 
The reason it's an anti-pattern is later down the road it's harder to refactor, right?
 
@samaYo What tenant of SOLID do getter/setters violate?
 
I mean, if you have getter/setters then you when you look at your entity you don't see exactly what kinds of context it's working in?
But I guess that's pointless, because you would have tons of methods also, if you are using getters/setters wildely
 
@DavidGraham I am abit confused.. how did you come to the conclusion that setter/getters are bad?
Other than if they do nothing
 
@Ocramius got me away from getter/setter mentality. Now you guys are moving me back. ARGHHhhhhh
 
3:44 PM
(and might aswell be public)
 
Abe
man @DavidGraham the domain objects don't need to know the context. or, define "context"
 
^ contextual validation
it means, instead of "setting" you should be "promoting", "updating for a CRUD-like update and save", "firing", "moving to a new branch", etc...
 
@DavidGraham well does not sounds something I would put anywhere near my entities?
maybe in the consumer of a entity
 
I think people are saying that getters/setters are not helping reveal intention
 
^that
 
3:47 PM
@RonniSkansing What does your domain do for you then?
"Now, the more common mistake is to give up too easily on fitting the behavior into an appropriate object, gradually slipping toward procedural programming."
 
Abe
@DavidGraham don't like that. that can produce a potentially infinite number of isValidForX() methods :P that's the job you usually put within services
 
yes
the dbal entity's validation is specific for the database
but the entity does not consume the logic of where it is going to be used
 
@Abe you haven't told me what the job is for the domain entity then?
otherwise it's anemic
 
no, it has behavior and logic. but it does not incapsulate the logic of how it will be consumed other than its validation
 
uh?
I can't even see the flagged message
 
3:51 PM
@RonniSkansing give me some behavior examples?
 
isValid(), any hook in functionality on the setters/getters, events etc
 
@RonniSkansing this is where I think the whole DDD community disagrees with you
 
CONTEXT PEOPLE!
PEE HAA IS JELLY OF TERESKO
STOP FLAGGING FFS
 
Abe
actually that wasn't right. that's a method of User, not the service. but still the domain object doesn't have to know about the context that is using it @DavidGraham
 
3:53 PM
@DavidGraham so the whole DDD community thinks that a entity should have all that reponsibillity
 
^ yup
there are domain services, sure....but the entities should be rich
If it gets too big, maybe you have 2 entities
 
So what is a dbal entities responsibility`?
 
Sounds like you are coming from doctrine2 entities
doctrine2 is just the ORM
 
Representing a data structure in db, validation, all kinds of context validation (it knows all about how it will be used)
 
Abe
but all that doesn't relate to your previous statements @DavidGraham i think you should just start writing something :P
 
3:55 PM
you still need behavior in your entities
 
Yes state validation
 
@rlemon I doubt the people flagging it now are in this room....think it's >10k'ers from elsewhere...
Also the flagging system sucks.
 
You guys act like you haven't researched anything DDD? The entities are where you have business objects represented, with behavior
 
ugh, now @PeeHaa is banned for saying "fuck you" to someone who was drinking when he wanted a drink
 
It does - it doesn't provide enough context... what's going on @rlemon?
 
Abe
3:56 PM
@DavidGraham everything i said works with DDD
 
user895378
@Danack it really does
 
You guys are just modelling your domain with database tables
 
@JonClements Teresko: I'm already drunk, PeeHaa: fuck you
 
checking if a single field is valid, storing it in same named database table column
 
does it need more context?
 
3:56 PM
that's not ddd
 
@DavidGraham no
 
@JonClements short version, people are going out of their way to flag an old message after it's been flagged.
 
You haven't given me any examples to say otherwise
 
the entity is not the consumer of persistence
 
is the flag valid or not?
 
3:57 PM
isValid?
 
the persistence layer is a consumer of the entity
 
@JonClements not imo
two friends ripping eachother
 
/To the meta mobile!
 
user895378
@JonClements no. The two users involved have been regulars here for years
 
@JonClements invalid flag
 
user895378
3:57 PM
clearly only joking
 
@DavidGraham it sounds like your entities does all the things
or maybe I am not following
 
all the things for that entity
 
user895378
It sounds like OOP is in large-part snake oil ...
 
user895378
/me runs away laughing histerically
 
DDD is a great way to structure a software project
it's not the only way
 
3:59 PM
Actually it sounds like a AR thingy to me
 
Unsuspension – user has been manually unsuspended by a moderator
20 secs ago by Jon Clements
 
but anemic entities is not DDD
 
I like to structure using "code as you go"
 
but they are not anemic
 
AR = active record?
 
3:59 PM
yea
 
Abe
@RonniSkansing he's not entirely wrong though
 
What got flagged? (just got home again)
 
sounds like the ORM has convinced people they have objects
 
Abe
@PeeHaa you :D
 
thanks @JonClements
 
user895378
3:59 PM
@PeeHaa hehehe
 
@Abe What did I do?
 
7 mins ago, by Florian Margaine
http://chat.stackoverflow.com/transcript/message/24925807#24925807 @PeeHaa this just got flagged
 
@FlorianMargaine That doesn't link to anything
:)
 
Abe
@PeeHaa fu to teresko :D
 
user895378
3 mins ago, by rlemon
@JonClements Teresko: I'm already drunk, PeeHaa: fuck you
 
4:00 PM
well yeah, the message got removed
 
oh lol. tnx @JonClements
 
@RonniSkansing tell me in your own words what DDD is? And what your entities should do?
 
Good thing they couldn't read upside down otherwise @salathe would have also had a problem
 
user895378
Anybody want to volunteer to let me try a 1-minute kick-mute on them? I just want to see if it asks me to confirm in case I acidentally click the wrong button
 
go ahead
 
user895378
4:01 PM
@PeeHaa you're safe -- gave me a confirmation dialog
 
@PeeHaa why are you so feisty? You like that in person too?
 
user895378
thanks
 
@rdlowrey Any time
 
<-- wants an avatar
 
@rdlowrey sure - kick me if you want :p
 
4:02 PM
Is that even possible?
 
user895378
@JonClements why do I get the feeling it wouldn't work? :)
 
@DavidGraham I know my entities should not be the consumer of a persistence layer
 
I am tempted to try, but I'm scared :P
 
user895378
Besides, @PeeHaa is my personal kick-mute piñata
 
I can have persistence layers that consume my entities
not the other way around
 
4:03 PM
@rdlowrey lol love that name
 
ugh, my sense of humour really needs tuning it appears
 
hehehe
 
@rdlowrey try kicking yourself, it's fun
 
user895378
doesn't give me the option :(
 
Not possible (at least not from chat room interface)
/me boooos
 
4:04 PM
yeah, you have to send the http request yourself
 
lol
So much work :P
 
Abe
@DavidGraham the point you are missing is that the aggregate doesn't have to know about the context even if it looks so
if($user->canCheckIn())
$user->checkIn();
otherwise you are right
domain object is not just about own validation, it is part of a series of objects that is the aggregate
 
$userService->canCheckin() .. =]
$userService->checkIn(User $user..
 
^ $user is like a DTO
 
or better $userLoginService
 
4:07 PM
@RonniSkansing that is my approach
 
All I hear is. SRP violations =]
Mine too
 
Abe
@RonniSkansing nope. read about DDD
 
fat services, skinny domain objects
that's what you are doing
 
Abe
@DavidGraham i agree with you :P
 
user895378
@JonClements I have a python question ... how do you feel (personally -- just opinion-wise) about how python uses exceptions for flow control all over the place (I'm thinking specifically of how yield from subgenerator returns are "assigned" with an exception in this case)? Also, sorry for the multi-edit super-ping.
 
4:09 PM
someone agreed with me in this room!!?? whaaa? LOL, I'm honestly not stubborn
 
Abe
@RonniSkansing check CQRS
 
I know CQRS, what is the point to it, in this context?
 
yeah, I love CQRS (although i don't do ES, whew, complicated)
 
Your services could implement cqrs .. Im not really seeing where this is going
 
Abe
@RonniSkansing helps you considering/enforcing the domain object not as a single entity, but something that is strictly bound to its aggregate
sorry for multiple pings :P
 
4:12 PM
example?
 
CQRS to me is more about letting our domain entities manage business state. For "reads" do those separately.
No need to hydrate entities when you want something displayed on a screen.
Just make some query objects and view presenters
 
Abe
@Orangepill designing aggregates for both maintaining domain validation and for just-reading purposes makes you consider them not what they should be
 
that makes sense
 
0
Q: Chat flagging system and old messages

DanackThere seems to a flaw (imho) in the chat room flagging system. What I've seen happen multiple times is: Someone says something that is borderline flaggable. No-one takes offence during the time. Someone else sees the message by going through the chat archive and flags it. Hordes more people fro...

 
Yeah, a lot of times you have all these crazy ways of viewing things. Sometimes you have crazy reporting going on too. That's just "screens". Don't have your domain core managing that.
Think "writes" = commands to the domain. "reads" = view queries
commands and queries
 
4:20 PM
Also, I updated the Consistent Callables RFC, so that I'm already to submit it...in like a year.
7
 
Sometimes you will have "reads" in your repository (collection like interface). But these reads hydrate entities with the purpose of altering their state.
But for "screens", don't be inefficient and try to hydrate entities or manage that in the entity.
 
Hello I have a skill testing project.
*Neet to code a simple but most effective function for input data filter. No OOP, no prepare

function filter ($data, $con){
data=trim (htmlentities (strip_tags ($data));
if (get_magic_quotes_gqc ())
$data=stripslashes ($data);
$data=mysqli_real_escape_string ($con, $data);
return $data;
}

Is this safe? If no, how to cross this by injecter?
 
Ok, so @Ocramius tells me to avoid getters/setters and you guys say they are good (don't fear them) and use them freely in many circumstances?
 
Abe
@VarunaLex function filter($data, $con){ return ''; } // most effective filter function
 
@varunaLex what context are you sanitizing for...
 
4:29 PM
@Abe @Orangepill @PeeHaa @RonniSkansing I'm coming after you guys if I get in a bind next year from getter/setters LOL!
 
@DavidGraham lol Im already blind from it
 
blind from it?
blind from using them?
you are in deep with them, basically is what you are saying? LOL I know the feeling
 
yea I misread lol
 
Abe
@DavidGraham i don't know how to answer anymore :P
 
yeah, thank you all
 
Abe
4:30 PM
we should just wait for @Ocramius to show up
 
@Orangepill any kind of string except email, url, password
 
^ this
 
@rdlowrey Feel free to ask that in the Python room :p
 
we are pinging him a lot @Ocramius where art thou O @Ocramius
 
user895378
booo :)
 
4:31 PM
@Abe what you meant from it?
 
So is PHP the most popular chat on stackoverflow?
 
@varunalex Trying to filter for all context is probably the wrong approach... filter based on what you are doing with the data.
 
Does that mean we aren't getting work done? haha
 
@JonClements Why should PHP people need to go over to that room? :-P
 
Abe
@Orangepill it is certainly the wrong approach since it would lead to unnecessary data loss
 
4:33 PM
lazy low barrier of entry php, you think you can make up for it with your "sense of community" lol
So @Abe you follow DDD and are happy using getters/setters (like this: github.com/domnikl/DesignPatternsPHP/blob/master/More/…) right?
I think I'll go ahead and use them for now
 
Abe
$post = new Post();
// $post is invalid here
 
@Abe yes. You correct
 
Abe
should be:
$post = new Post($id, $title, $author, $stuff, $everythingthatisrequired);
or if it's too long:
$post = new Post($postBuilder);
 
Should use a factory =]
 
sometimes Value Objects can help reduce it down
 
4:36 PM
PostFactory->make*()
 
Abe
or that
 
I tend to like to add the Factory methods to the object itself, but thats my preference
 
Input data something like address, name, description ect
 
Abe
@RonniSkansing that's obvious, but it's just an example
 
$post = Post::createFromArray($array);
 
4:38 PM
@DavidGraham but then you got tight coupling or global instance binding to Post::
 
Abe
static methods are poo :P should be $postFactory->createFromArray($array)
 
unless those are used inside the factories (and then the factory is longer making it)
 
It's a global call, but returns an instance
none global instance
Yeah, pros and cons
 
why make a global call when you can make the call on a dependency (factory) which you can bind on a interface and injected into the consumer, instead of the consumer making it on demand
 
It's nice to have the builders there with the contructor
 
4:41 PM
hey..
 
but I don't have much to argue with you, you're mostly right. It's a matter of taste (and how many builder methods you offer)
 
Notice: Undefined index: board in /3w/wz.cz/j/jiggmin/CreateThread.php on line 16
what this means?
 
Sorry, I just struggled to many Laravel convos on static calling
 
Its telling me somethings wrong on line 16
$statement = "INSERT INTO thread (name,poster,board) VALUES (:name, :poster, :board)";
 
Laravel is using a facade
 
4:42 PM
no, that is not a facade
 
there's only 1 static method
1 static method to rule them all
lol
 
ie. "echo" is a static method
 
Something must be wrong with Php or database, I've never experienced such a problems
 
Why should PHP have all the convenience? Not saying you go crazy with that
 
4:43 PM
such problems-
I'm talking to myself
I better leave
Goodbye
 
Ok thanks @Abe
but I'm getting fitted data using foreach.

foreach($_POST as $ key){
// call function here
}
 
yeaah
 
Well I would never echo anything inside any service or controller
=]
 
hehehe (but it's there none-the-less)
 
gotta take a walk
need foodz [=
 
4:45 PM
^ to drop the kids off at the pool?
that kind of a walk?
oh food
 
heh, nah, just a small walk in the forest (really nice weather here) and some shopping
 
nice
 
@DavidGraham laters, I will try to be less the resistence and more paying attention to what you are actually trying to tell me... because to today, it totally flew by me.. #itsNotYouItsMe
 
@RonniSkansing lol same here
 

« first day (1755 days earlier)      last day (3207 days later) »