« first day (2604 days earlier)      last day (2359 days later) » 

12:00 AM
if all you have is: "so .. emm .. I saw SQL query in your page, you should look for anything that could cause it" basically translates as simply sending a mail with "hey, your code might have a bug. tnxby"
 
My guess is, the whole thing might be logged. I should probably keep a copy (and send) of the crap was trying out.
But, I couldn't reproduce the error.
 
12:28 AM
I would guess it was not caused by your code in particular
could be mod_php/php-fpm going tits up, or maybe a bad droplet came online
think: devops problem
 
 
1 hour later…
1:54 AM
dat dead room
 
 
2 hours later…
3:59 AM
morning
 
4:14 AM
Morning
o/
 
\o
 
\o
 
4:45 AM
@Linus how's going new job?
 
@Akshay good no work to do for now.
Weekends are holidays now :D
 
@Linus Amazing! But it's okay for some time not more
BTW which company it is?
 
@Akshay teckmindz
 
okay it's in Noida?
 
Yeah
 
4:53 AM
Great
 
5:14 AM
Can someone help me with a silly Docker/PHP/Apache question?
 
Good morning
 
@Orangepill good morning.
o/
 
@MatthewVita Just ask... don't ask to ask
 
:) Sorry. Give me one moment to really think about how to ask the question... want to be exact.
 
 
2 hours later…
7:29 AM
@JoshHallow you can use rollout its a php application deployment system. grandappstudio.com/roll-out
 
7:53 AM
Morning people
\o
 
Wes
8:05 AM
hodor
 
hodor
 
hodor
 
GoT sucks
 
Wes
no, your mum sucks
 
8:15 AM
:b
 
Wes
@Gordon you are fighting a battle that you can't win
 
@Wes with my tweet? I am not fighting
I just want him to read it because it has some merit
 
Wes
well you can't even argue about it :D ddd people love static constructors for irrational reasons
 
When I read the article I was actually expecting to disagree with it
but then I felt it makes some valid points so I linked matthias
 
Wes
a static method must not mutate private state of the class it is in. do we agree on that? because if that is the case, you should be using strategy pattern instead

private $shit;
static functon fromBaz($baz){
    $obj = new self();
    $obj->shit = 123;
    return $obj;
}
 
8:27 AM
@Patrick might be interested in it, too twitter.com/go_oh/status/936868693232967681
 
Wes
if you don't do that (that is, you only use public interface) , then it is only matter of where you put the factory
 
you have to be careful with yegor though. some of his stuff is really thought provoking and good, some other is weird and overly dogmatic
 
@Gordon alredy reading
 
Wes
and imho a standalone function is better than a static method
 
@Wes but a static constructor makes sense to be part of the class. it's more cohesive
 
8:30 AM
@Wes the argument yegor makes is that whatever that class is, it should likely be BazShit implements Shit
 
class HexColor implements Color
So you need to either duplicate your value object logic or also add an abstract class?
 
yes, I dont think that's necessarily bad though
the latter
 
and it doesn't feel right that RgbColor and HexColor are different classes. Hex and Rgb are just two different representations of the same value
Does he talk about the disadvantages of static constructors somewhere?
For example I use generate() a lot, for value objects that contain UUIDs or datetimes. So he would suggest this?
 
@Patrick but they will have different logic on how to get to that value
 
class GeneratedUserId implements UserId
@Gordon with the static constructor you would just store it in one format. Which one doesn't matter since it's encapsulated
Just seems much more clean to me than what he suggests. But maybe I'm missing something
 
8:37 AM
@Patrick I mean additional logic beyond the ctor. Like the lighten() example he gives.
 
Wes
@Patrick it's tightly coupled. new self() is like extends. inject all the things for the win
class XXX implements Foo{
    static function fromInt(int $int){
        return new self($int * 123 + 2761 / 197); // duplicated code
    }
    // ...
}

class YYY implements Foo{
    static function fromInt(int $int){
        return new self($int * 123 + 2761 / 197); // duplicated code
    }
    // ...
}

versus:

function FoofromInt(FooFactory $factory, int $int): Foo{
    return $factory->new($int * 123 + 2761 / 197);
}
standalone functions with abstract factory stack up really well
aka composition/aggregation. you are suggesting it in the book :P
 
@Gordon well in that case you need different objects, but I have never seen that need so far in the real world
@Wes it's not just low coupling fo everything. High cohesion, low coupling
A static constructor belongs to the class, not into a random function. Otherwise how are you going to find it?
 
Wes
dude, tell me what's the difference between a static constructor and a factory function :D
there is none...
 
@Wes one is cohesive, one is not
 
I agree with @Patrick on that. The function is detached and has no cohesion whatsoever. I'd be fine with $fooFactory->fromInt() or even FooFactory::fromInt()
 
8:44 AM
Value objects are just types. You don't need to avoid all new calls in your classes, only for your dependencies
 
Wes
cohesion is one of the fuzzy concepts that make our job a nightmare. it's bullshit because it's not an absolute concept, it's subjective
 
@Wes what? I like my job :P
 
Wes
yeah but people throw in these rules and other people follow them like religion, like SRP
 
I have absolutely nothing against factories. I use them a lot. But for simple value objects I find static constructors work really well
Also in 99% of the cases there are no interfaces or multiple implementations
If there is a problem that I'm not seeing and I'm likely to run into in the future, please let me know ^^
But I don't agree that static is always bad
 
Wes
class Bar{
private $shit;
static functon fromBaz($baz){
    $obj = new self();
    $obj->shit = 123;
    return $obj;
}
}
did you ever do this?
 
8:48 AM
no
 
Wes
i mean changing a private non static field from a static constructor
 
that shouldn't even work?
or maybe I just never tried :D
 
Wes
it works. if you do that then you could easily move the factory outside the class
people use static constructor because they effectively have one class with multiple internal states
with ifs and switches all over the place
 
@Wes not at all
 
Wes
when you defend static constructors you defend that over polymorphism (strategy)
otherwise, it's only matter of where you define the function. and i couldn't care less about that tbh
 
8:52 AM
a named constructor is just a new() call
You can be more explicit and have multiple constructor for the same object which are big wins
It doesn't change anything for the instantiated object
@Wes btw have you read effective java? Seems like all our disagreements are covered in there
named constructors, final, private... :D
 
Wes
meh i feel there is not much to discuss here. you like "cohesive" code but i like anything to be stackable
 
@Wes so you disagree with low coupling/high cohesion? (the second part)
 
Wes
i for instance wrap factories into other factories and then again in other factories. in the end i just have simple functions. and you cannot do that with static methods
i disagree that cohesion is even a thing
 
Well then it will be hard to agree on this issue :)
 
Wes
and, you probably misunderstood what i said about private
i was talking only about methods
 
8:58 AM
They should never be private?
 
Wes
never say never. but if the routine can live outside the class then yes it should be standalone and injected instead
especially if it's a big one...
 
Do you have any code up somewhere that follows that approach?
 
Wes
nobody gives a damn if you use a private method for some random delegation or as a shortcut for a simple operation, but if you have a big private method you are hiding it between other methods that use it internally, and you are testing it through those other methods, and the complexity of the code increases massively
not only that
but you probably also have duplicated tests, because you are forced to cover it through all the methods that make use of it
private function x(){}
functon a(){ $this->x(); }
functon b(){ $this->x(); }
now if function x() was injected and tested alone, you wouldn't have to do that
you would have to test only what "a" adds to "x", and not the result of "a + x" together
 
Well if a class does more than one thing, then it makes sense to split it up
But I don't optimize my code for testability. That's just a sideffect of clean code
Anyways, gotta go to training. Was an interesting discussion :)
 
Wes
:P
lata
@pablogl i only test public methods. if a private method is complex enough to need testing, it generally needs its own object.
 
9:15 AM
@Wes that article completely agrees with my worldview? ^^
 
Wes
well, it's not what i read in the book at least :D
 
If you also want to read something :P
 
Wes
you said that everything should be private by default :D
seems like an invite of doing the opposite of what you should do
methods should probably be public, fields should probably (almost certainly) be private
 
@Wes but that's what he is saying too? If it does too much, extract it?
> It seems to me that some of the people that claim to be arguing against private methods are in fact arguing against issues that are orthogonal to private methods; you can violate SRP with and without private methods; you can mess with internal mutable state with and without private methods, and so on.
> Making private methods public don’t automatically lead to better design; it can also lead to an unnecessary inflated API, weak encapsulation, and increased maintenance overhead.
I am confused, the article seems to support my arguments ^^
 
Wes
of course, but "default to private" doesn't sound to me like a good advice
it depends.
i actually wanted you to read the articles he links
 
9:21 AM
> When you expose a method publicly, from that moment on you’re “forced” to keep that method working and honoring its contract; otherwise, your consumers will suffer with breaking changes in their code!
That's why I default to private
Default to private, make things protected and public when you have to access them from another scope
 
Wes
you make it public... but in another class, obviously
and mark it @internal (that's the best you can do with php)
 
is there anything in the tutorial code where you would have extracted it into another class?
Or are we arguing semantics but writing similar code? :D
 
Wes
semantics, and i didn't like "default to private" :P
blanket statement imho
unless you explain all the implications :D
 
But you have to default to something? ^^
And default to public or protected is wrong imo
 
I second default to private
 
9:25 AM
Really gotta run now or I'll miss the train :D
 
I used to favor protected but it will just lead to people overriding your stuff in unpredictable ways and then it's api or you break their stuff. it better to provide well defined extension points.
 
Wes
"default to private" is validating classes that contain private methods for the most part. that's bad for me
a class serves a purpose to the outside world, not to itself, and that is done through public methods, not with privates. if you have mostly private methods then you cocked up something
the words i'd use are: avoid private methods and limit the number of public ones, according to ISP
properties should always be private in php instead
 
Limit the number of public ones I agree to. I like minimal interfaces unless it's a facade. but I dont see any value in limiting private methods. they help to structure your code. I agree though that having a lot of them might hint at an additional object wanting to come out.
 
Wes
yes. thanks :P it's what i'm saying...
avoid private methods <ins>if you can</ins>
 
no
very much no
 
Wes
9:33 AM
lol
there are a lot of valid uses for private methods, don't get me wrong
i am saying, if the private method can live outside the class and work just as well
then it should probably stay in its own object
 
what you are effectively achieving with "avoid privates" is that people will not structure their code because they think its somehow bad to have a private methods. and then you'll get these single public method objects with 300 lines of code in it.
 
Wes
yes that's not good either. i'm not sure how to say it though
i use private methods for internal-to-the-class delegation
all other uses could technically be standalone functions
 
Wow had some shit stuck in my eye for like 4 hours. tried poking/rubbing it out, washing it and all. Nothing. Read a tip to pull upper eyelid over lower eye lid and roll eye upwards. Worked like a charm! Eye pain liberation!
 
I recently wrote a class that uses a LoadingCache (java). I newed the cache in the ctor of the class and assigned it to a private property. It would store tokens. The class had two private methods that would operate on that cache. So far so good. Works. But by virtue of cohesion, it would have been better to create a dedicated object and moving the methods there and make them public.
 
TBH I wish there were more open source examples of code standards of real-world applications.
 
9:40 AM
That would be an example where the private method might have been misplaced, but it's much more an issue of responsibility assignments than of visibility
 
Wes
can you go underwater with eyes open? @Fabor that works too, like in a basin
 
It's already sorted
 
Wes
for the future :P
@Gordon the nice thing about private is that you can extract them in their own classes later. i usually do that when i can't sensibly test them
in the end it happens naturally. you probably do the same
 
@Wes yes, testing the cache was much easier then
so I guess what you are trying to say is not to avoid private methods but to consider where you put methods. that's what GRASP has suggestions for.
 
@Fabor heh, I almost always use that technique to remove any sort of foreign particle from my eye :B
 
9:44 AM
private methods are just fine
 
Wes
yes, but they shouldn't be abused, that's why i disliked that "default to private" statement
 
but its sensible
 
Wes
there is so much to say about that than just a simple statement
 
also, kids use OOP. Real men do procedural
 
Wes
anyway, time for a brew
i've ran out of usb ports on my mobo. and i hate hubs
 
9:46 AM
I have a feeling that @Wes is slowly meta-metamorphosing into a Brit
 
@Wes, the Britalian
 
Wes
need to get one of these
or i need to get one that weights 50kg or something so that it doesn't move around :B
 
@Gordon woah, that term has some real close pronunciation with 'Brittanian'
 
@SaitamaSama くコ:彡
 
Wes
some days ago i watched "home alone" and i realized that marv and harry are just evil mario and luigi. it blew my mind
 
9:50 AM
@Wes You need that many?
 
@Wes I found a great anime for you myanimelist.net/anime/10087/Fate_Zero
 
I just watched "Erased". That was good. On Netflix. Cheesy end though
 
You mean Boku dake ga Inai Machi?
 
yes
 
well, if you like that theme, you'd prolly like Re Zero as well myanimelist.net/anime/31240/…
 
9:55 AM
I like Bami Bangang
 
The heck is that?
 
the main hero is a suckling pig in pepper sauce
 
lol
porco rosso
 
yes
 
10:00 AM
:B
 
nom nom
I miss non-vietnamese food
Going for BBQ tonight
 
I'll probably have pulled pork tonight
 
nom. You watch new Thor film?
 
mornin
 
10:04 AM
Mornsko
 
@Fabor totally not
 
Wes
@Gordon do you have @Patrick's book?
 
@Wes nope
 
@Gordon It's worth trying IMO. Not like the typical Marvel
More comedy orientated
 
Wes
what do you think about that :B
 
10:11 AM
@Fabor thats what they said about deadpool, too and I didnt like it
 
@Gordon Deadpool was more slapstick, adult comedy. They're different. Maybe when it comes to DVD you can check it out.
 
Wes
private __construct + named constructor
i blame @ocramius
he does these things :D
 
ok
 
Wes
:P
 
@Wes can do
 
10:15 AM
@Ocramius Your alias could be Docramius. No one would know.
 
Wes
randomly adds one level of indirection for no reason whatsoever because can do
:B
 
Anonymous
!!wotd
 
literatim letter-for-letter; literally.
 
Wes
10:35 AM
just found a youtube easter egg. the loading indicator on a fidget spinner video is a fidget spinner :B
 
that better be true :B
woah
 
@Fabor I... didn't understand that :P
 
Doctrine + Ocramius :X
 
uhmmmmmmm
 
Wes
11:15 AM
user image
7
 
ping @Gordon ^
 
how did you add dad jokes to Jeeves, again?
 
Wes
!!dad help
 
Did you hear about the guy who invented the knock knock joke? He won the 'no-bell' prize
3 messages moved to Trash
 
Wes
no idea
 
11:20 AM
Sep 5 at 19:46, by Dereleased
!!dad add ghosttypes / What is a ghost's favorite data type? / BOOlean!
 
right :b
!!dad add cloud / What are clouds made of? / Linux Servers, mostly.
 
@SaitamaSama Ha ha ha! Brilliant! I'll save that one about cloud for later!
 
@Jeeves that laugh almost sounds mechanical
 
@SaitamaSama Well so are you.
 
posted on December 02, 2017 by kelunik

- Expose `current-jobs-ready` in tube stats (#15).

 
11:37 AM
Also morning
 
Mornhaa
@PeeHaa Terraria later? :X
 
OVERWATCH!!!!
 
@Fabor Not sure. Don't count on it to be sure ;-)
 
11:51 AM
It's never sure -_-
 
Still trying to wake up :) And not sure what we're doing later yet. I know I need to get a bottle of raki at least :P
 
booze and terraria
hand in hand
I mean in a few hours FTR
 
Anonymous
can anyone suggest a movie to watch? I am so relaxed and in a perfect place to watch a good movie right now
 
umm... Hollywood?
 
@samayo Got netflix?
Also what genre etc?
 
Anonymous
11:53 AM
@Fabor I have it but the subscription ended. Anything with good story
 
Good Will Hunting
 
@littlepootis Funnily enough I was also thinking of that film
 
Anonymous
seen it
 
@samayo Watch the UK TV series "Sherlock"
 
Yeah, Sherlock is pretty nice
 
Anonymous
11:56 AM
@Fabor ah good one, had that booked in my mind.
 
Wes
how do you format long closures?

callFn(function($a, $b, $c) use($d, $e, $f){

});

callFn(function(
    $a,
    $b,
    $c
) use(
    $d,
    $e,
    $f
): ReturnType{

});
 
Anonymous
ok kicking off sherlock. I am using solarmovies btw, if anyone knows better DM pls
 
Anonymous
@Wes eww :)
 
Wes
i would have preferred that "use" had the same syntax of global $var; cc @bwoebi @LeviMorrison
callFn(function($a, $b, $c): ReturnType{
    nonlocal &$d;
    nonlocal $e;
    nonlocal &$f;

});
i wouldn't hate using closures if that was the syntax
 
12:01 PM
For the few times that happens, the one you posted above is just OK
 
Wes
"few" is calculated upon your experience only :P also just one is enough to annoy me
i am serious, can we alias use() to nonlocal like python (ish) so i don't have to be acrobatic with indentation? also cc @NikiC
 
That is, adding an extra keyword for a feature that already exists (and works) because of white spaces (that don't matter in the language)
 
^ that
 
Wes
oh shut up. that is not a valid argument. ask anyone, everybody hates using use()
callFn(function($a, $b, $c): ReturnType{
    use &$d;
    use $e;
    use &$f;

});
there, no new keywords
what does that even mean
 
Why not just use global for that, if you must?
 
Wes
12:10 PM
wut?
$bobo = 123;
return new class(){
   private $foo = nonlocal $bobo;
};
 
@Wes I actually like use. Makes things much easier to reason about.
And yes, you could just use nodejs :P
 
The result of this command hostname -f is this: srv.pronexo.net
 
Wes
it is a mess to format
 
what's that?
 
@Wes OCD
 
12:16 PM
@IROEGBU isn't it FQDN ?
 
@Shafizadeh No, I wasn't replying you
 
ah ok sorry
 
@Wes CTRL+L
 
12:30 PM
@Wes can't we use:
callFn(function ($foo) {
    import $external;
});
?
 
Wes
also. nonlocal is probably a bad idea since it means import by reference in python (iirc)
$external = new Baz();

callFn(function ($foo) {
    use $external;
})
or this.
 
"use" already has a meaning ... well .. two meanings even
 
Wes
dunno about the keyword. i'm ok with anything
a more bigger problem is that like global, a variable can have two meanings
function(){
$foo = 123; // local
global $foo; // becomes global
}
 
@tereško few days ago you gave me a screenshot of your domain zone ... can you please give me that link again?
 
why?
also it was more like a month ago
 
12:41 PM
@tereško I want to define a FQDN and I guess there was some clue in that image
actually I've defined it and all I want to do is adding a record for it (for routing)
 
I cant actually find that image, sry
 
ok I will keep searching ... thx
is this sentence correct?
> I will keep searching
 
Wes
(English perspective)
added it for you.
 
Anonymous
@Shafizadeh yes
 
Wes
brb going out. lata :D
it's correct though
 
12:51 PM
@samayo ok thx
@Wes ha ha ha thank you :-)
 
Anonymous
@Shafizadeh answer it
 
I cannot open youtube
it's banned in my country
 
Anonymous
You can use a proxy. I was in Iran once, and I used to access FB/Youtube via a proxy
 
@Wes I'd like to note that global is an execution time statement while use () is a definition time statement. You need to bind the imported variables ahead of time, unlike global which simply looks up the global variables table upon execution.
 
12:55 PM
@samayo yes I can .. gimme a se
c
btw, been here already? @samayo
 
Wes
15 mins ago, by Wes
a more bigger problem is that like global, a variable can have two meanings
function(){
$foo = 123; // local
global $foo; // becomes global
}
that makes it a bit of a mess yeah
 
Anonymous
Yeah, in 2012 I was in the Kish Island @Shafizadeh
 
Wes
i think you mean that
brb
 
@samayo good, why did you come here? any specific purpose or just for fun?
 
Anonymous
To renew my UAE via
 
12:58 PM
:-)
 

« first day (2604 days earlier)      last day (2359 days later) »