« first day (2388 days earlier)      last day (2554 days later) » 
00:00 - 17:0017:00 - 00:00

5:01 PM
@tereško my opinion is that you should bend these rules to maximize usability, but when security is the top priority in a vacuum, that's the logical conclusion
AviD's law comes to mind :)
 
Wes
@tereško with my mocking framework. ahahaha :P
more seriously, classes are globals, you can't do much here, except
protected $classExists = "class_exists"; // replace this before the test
($this->classExists)($className);
but yeah, it sucks
this is the kind of things i wanted to solve anyway. "class_exists($a)" is replaced to mock_function_call("class_exists", [$a]) which i can program to return whatever i want, just before the test
 
5:21 PM
in Teenage Territory, 54 mins ago, by Rishav
@littlepootis how'd you recommend I get started with PHP?
Guy's trying to harm himself. Send help.
 
Wes
your MapperFactory is actually a MapperMapper :D
why you need that?
 
I think you dont know what DataMapper is
 
Wes
probably, i'm not good with names
 
well ... or you just looked at the Mock\Mapper and not on any of the real classes
 
Wes
5:40 PM
in my interpretation factories only convert input and they don't have state. A mapper (and repository) grabs (or creates through a factory) content from an external source, which in your case is the classes' symbol tables.
optionally a mapper also does the other way around, put an object back in the original source
but it's just naming...
*classes' symbol table
 
what are you talking about ?!
 
Wes
just ask @Gordon, he is the pattern encyclopedia
 
> in my interpretation factories only convert input and they don't have state. A mapper (and repository) grabs (or creates through a factory) content from an external source, which in your case is the classes' symbol tables.
factories do not convert input
 
Wes
*convert optionally i should've said
apart than creating the instances
 
and I am not even sure what you mean by "mapper grabs or creates through factory content from an external source"
and I have no clue, why you wanted to shim a built in function of php
 
Wes
5:50 PM
writing some code
@tereško because you are relying on global state (both classes and class_exists are global) with that? what if you create Foo\Bar accidentally somewhere else, perhaps in another test. sure you can workaround that by checking first you aren't using a class name that exists, but sucks
 
@iroegbu because in latvian it is "metode"
:P
 
Wes
i stand with my interpretation because i like the distinction
however that could be different from what other people think a data mapper is
private $cache = []; <- this is database
hence that's a mapper
 
no
 
Wes
again imho
 
5:57 PM
that is not database
it is an array, that acts as runtime cache
 
Wes
it's a repository then
 
@ScottArciszewski what is AviD's law, can't seem to find it anywhere
 
here is a free hint for you, @wes: you are not supposed to test other layers of abstraction
 
> Security at the expense of usability comes at the expense of security. - AviD's Rule of Usability
Found it
 
6:08 PM
and php built in functions like spl_autoload_register() and class_exists() are language-level constructs
 
Wes
you are referring to shimming class_exists? you shim it exactly for to not rely on the validity of it
or for to have it returning arbitrary deterministic results
 
@Danack I don't work for Facebook but I do contribute to the SDK. It's good to use if you need to do more than just oAuth stuff. Namely, integrating with the Javascript SDK or integrating into a Page tab or app canvas. It provides "helpers" to handle those contexts (basically validating/decoding Facebook signed requests from different sources). It also has a pretty simple API for uploading videos in chunks and a few other API simplifications. :)
 
Wes
sammy \o
 
posted on April 30, 2017

New Cyanide and Happiness Comic

 
6:38 PM
@Wes halp
I cannot find the "dock to..." menu in chrome dev tools
 
Wes
ahahahahaha
 
...
 
Wes
did i ever mention that chrome dev tools is a monumental piece of turd
 
Rub it in like that :P
@Wes s/dev tools//
 
Wes
worst of all, it's so slow now that is almost impossible to use
like you type in and characters appear after 5-10 seconds
for no reason
 
6:42 PM
tbh I like them all
Don't like FF's devtools either
And firebug is really slow
is/was
haven;t checked it out if it's still alive
 
Wes
they are all slow
being a frontend developer now is a nightmare
i can't find the dock thing
 
@PeeHaa maybe you need to invest in something more powerful than an average phone as your choice of PC
I can always help you out with that :P
 
@Wes Meh. Probably will be fixed again with the next update tomorrow as usual
lol @Wes. There is actually an update ready while I was typing that
Yeap. Fixed it
 
hey guys
 
Wes
but thanks to you i've found a setting for something i really hated @PeeHaa :B
 
6:52 PM
@Wes ?
hey @taco o/
 
Wes
settings > preferences > appearance > panel layout
set to "auto" is madness. clearly should've been "horizontal"
 
What
Noooooooo
 
Wes
did it explode :B
 
REVERT REVERT
It didn't explode, but
really?
That's better?
 
Wes
there is one place for the dev tools, on the right, and that's the right layout
 
6:55 PM
Just that we are seeing the same thing:
 
Go Atlanta United!
 
@Wes you just need a bigger monitor: i.stack.imgur.com/Jog2B.png
 
Stacked like that is better for you?
 
Wes
you should dock it on the right, not on the bottom
 
Or did my chrome did something weird again?
 
Wes
6:57 PM
unless you have a 9:16 monitor :B
this is how i use it when editing css
 
Oooooh you have docked it to the right
 
Wes
i keep the panel with the "computed style" and the "box preview" collapsed
 
I either dock it to bottom or separate screen on the right
 
Wes
they are useful only if you don't know what you are doing :B
 
Nobody ever looked at the box preview I assume
 
6:59 PM
@PeeHaa Nope, it's dead. But Firefox has a Firebug theme for its devtools.
 
developing on a 16:9 monitor is a form of punishment
 
@kelunik Makes sense they give up
 
Wes
i have a 21:9 monitor i use vertically @tereško :B i couldn't get used to it...
but it's useful as a second monitor now
 
Jze
hello guy,
 
hi
 
7:20 PM
!!dad
 
How many apples grow on a tree? All of them
 
7:49 PM
if (isset($_POST['submit'])) {
    if(isset($_POST['delete'])){
        $index  = $_POST['delete'];
        $data = file("comments.txt");
        unset($data[$index]);
        $data = array_values($data);

    }
}
why does this not erase a line in my text file?
 
You never write it back to the file
 
hehehe
 
lol
so @PeeHaa would I be better off erasing the entire file and then replacing it with the new file?
 
If the file isn't big that's the easiest yeah
You don't have to manually erase it. Just write the new contents to it
 
7:56 PM
yeah it is just a few lines, but i dont know what the most effective way is
I figured just using unset and array_values would overwrite the file
ah
 
Wes
still don't get why you wanted to use files... databases are easy and you are replicating one, basically
 
well this is for a class, and the first half of this assignment is to do it with a file, then we do it with mysql
 
Wes
oh, well that makes sense
 
i like mysql a lot
im just unfamiliar with files..i thought unsetting the array which is a file would write back to it
 
@Hello The array is not the file
It just contains (/copies) the lines in the file into memory
 
8:00 PM
ah
 
Wes
protected function applyTransformationsToStatementsInNamespace(array $statements){
that looks like a test name :B
 
@Hello as you get more experienced, you will see how ill informed that particular statement is
 
lol
I hope,
Also I got my issue resolved
yay solving problems is fun woooooo
 
MySQL is to RDBMS like McDonalds is to food
 
POPULAR
 
8:08 PM
@Danack no it doesn't. That I mentioned in the question, ttl is different as it refers to how long the message was in queue and is discarded as soon as it gets picked up by some consumer and starts getting processed. What I wanted was "ttl for in progress in consumer", I mean to put a time cap on how long can it stay in processing rather than being in queue.
 
@Hello sure .. but also a terrible choice
 
lol
could you explain why? im curious
 
Wes
its sql dialect is very different from what it should be @Hello and it is pretty bad at anything that is not very simple queries
like, you can nest queries in mysql, but they are going to perform very badly
 
ah
 
@Hello it currently implements the SQL:1999 language subset, with customization, that are incompativel with other RDBMSs
it suffer from lack of features and has serious issues with ACID
 
Wes
8:14 PM
on the other hand is very reliable and if you write the right queries is also fast. i wouldn't say it's the mcdonalds of rdbms :B that's mongodb :B
 
it is not very reliable
writes are fast only on MyISAM ... which is what you use, when you dont actually care too much about getting the data back
 
ive only used mysql with java
so this will be my first time using mysql with php 😃 I must say, files/databases are so cool
 
for small applications (especially mobile ones) it actually tends to be a good idea to learn SQLite
for larger projects - a really good option is PostgreSQL (it has basically the same feature set as Oracle, but without the need to sell your family in slavery)
 
 
1 hour later…
9:23 PM
thank you
 
9:54 PM
Fourth argument not documented – #74516
 
@Jeeves lol don't care.
 
@Danack What came first, the chicken or the egg?
 
@Jeeves your mother.
 
@Danack My mother at least acknowledged me as her child.
3
 
10:17 PM
Evenin 11
 
10:42 PM
hello ;)
 
In MVC should models are there cases where a model may have more than one service? Furthermore, should/do conceptual models typically have their own service?
It seems in the case of a conceptual model, you may have a dedicated domain object, but you may not necessarily have a dedicated service.
 
Wes
there is no "model" i think the word you are looking for is aggregate
 
But in that case it seems you would leak rewrote g conceptual models into controllers.
 
Wes
and yes services may tie together one or more aggregates
 
is anything wrong with the following snippet? I can't figure it out... if($var){echo 'registered';} mysqli_close($db);exit();
 
10:44 PM
@Wes But probably would not have their own object mapper?
 
Wes
each aggregate has its own mapper, as aggregates are considered a single indivisible unit
 
I'm escaping Eloquent and other "one class is a model" implementations. I realized they hurt more than they help after heavy usage.
 
Wes
that normally
 
@Wes That mapper would be a transaction of the other two aggregates for example?
And that should not just be stuck in the service even though it will provably just be a transaction and a call to both object mappers of the other two aggregates?
 
Wes
i have one repository and mapper for each aggregate normally, but i had sometimes to build mappers out of other smaller mappers. the important bit is that the repository should be one for each aggregate
@Allenph the transaction is the single method you have in a service
which may span several aggregates and other services
in fact you can have transactions built around smaller transactions that also make sense on their own, singularly
not sure if i'm being clear enough :P
 
10:51 PM
Actually, thinking about it, it would use the SERVICES of two other aggregates. Not just the mappers.
 
Wes
yes, in that case you are wrapping two transactions into a bigger one
if i've understood you correctly...
 
@Wes, yeah. I'm a bit confused. Why would you want to build an object for what may be 4 or 5 lines of code?
 
Wes
what do you mean? :\
 
Say you have two aggregates which are independent resources. Say you have a third resource which is simply those two aggregates in one.
You build a service. Really the only mapping you need has already been constructed and implemented in the other two aggregates.
 
Wes
no, you don't want overlapping aggregates
 
10:54 PM
Why make a separate mapper for the third aggregate?
 
Wes
any given bit of data should be in one place only
so you don't create an alternative aggregate for representing some other aggregate's data in an alternative way
 
Isn't that going to lead to rewriting in your controllers if two resources are almost always used together?
But not always?
 
Wes
if resources are almost always used together they should stay in the same aggregate
 
So also throw away the idea that an aggregate/model is a table.
 
Wes
indeed it's not
an aggregate can span multiple tables
 
10:58 PM
That leads to another question though. Say I have a table which is polymorphic. More than one aggregate uses this table. I do not want to write the domain object twice.
Where does the domain object reside?
 
Wes
that's totally fine, you don't have a relationship between the aggregate and how it's represented in a database in any way
in fact database is usually designed for performance, while objects are designed so that they make sense in the domain
and the one should not affect how the other is designed
 
Right. That I understand. The problem I'm having is that it seems like I must have an aggregate representing such polymorphic tables that is used in several other aggregates.
 
Wes
that would be still part of the infrastructure layer, it's not something that should affect the aggregates. it's just a layer around the mapper
 
You lost me.
 
Wes
you can have a repository for it, which will be a dependency of other repositories, the ones of the aggregates
@Allenph can't explain it better :B what's exactly the thing you are doing?
what are these "polymorphic tables"
a generic key => value collection?
 
11:09 PM
I'm reading and learning from stackoverflow.com/questions/5863870/…
As suggested by someone. I don't remember who. But the fact that I don't know what the implementation layer is means I'm missing a big picture somethinf.
For example, in an app I am currently working on there is an entity table. On the API there are no such things as entities, but there are businesses and white labelers. In the aggregate for businesses and the aggregate for white labels, the main table would be the polymorphic entity table.
However I don't want to write the validation logic for the data that will end up in the entity table twice.
 
Wes
so you start out modeling the single aggregate. the aggregate is a collection of objects that must be valid on its own. it doesn't have to rely on external resources, its logic is self contained
you cannot ask a database for stuff from within these objects
makes sense so far?
 
No. I thought the whole point was for an aggregate to have a mapper.
Meaning I should be able to ask an aggregate for data which it gets from the database.
 
Wes
it's the other way around, you give the data to the aggregate. it's not the aggregate asking data to the database
if you have aggregates bound to data mappers you are doing active record, which is an antipattern for everyone except laravel's community :D
 
Wait...
So an aggregate is not an object nor an abstract idea of grouping a service, a mapper, and a domain object together?
All of these three things are just floating in limbo?
 
Wes
11:25 PM
that's the model in its entirety. an aggregate is

Car::getName()
Car::getYear()
Car::getColor()
Car::getEngine()
Car::getEngine()::getCubicCapacity()
Car::getEngine()::getMileage()
model is the aggregate plus e.g. CarRepository, MySQLCarMapper
the aggregate is just the objects containing the domain logic for e.g. an used car on sale, they don't have knowledge of any other things except the objects and types they contain
 
So there would not be a persist method on the car.
 
Wes
exactly! that's active record, and it's considered an anti pattern :P
 
But Car here is your service. The service does not provide methods for using the mapper?
 
Wes
aggregates don't collaborate with other aggregates directly, that's the job of services
 
Ohhhhhhhhhhhhhhh...
That solves so many problems.
Should the mapper check the validity of the data passed to it though?
 
Wes
11:31 PM
Aggregate "CarOnSale"
CarOnSale::getID()
CarOnSale::getName()
CarOnSale::getYear()
CarOnSale::getColor()
CarOnSale::getEngine()
CarOnSale::getEngine()::getCubicCapacity()
CarOnSale::getEngine()::getMileage()
CarOnSale::getOwnerID();
CarOnSale::getManufacturerID();

Aggregate "Owner"
Owner::getID()
Owner::getName()
Owner::getLocationID()

Aggregate "CarManufacturer"
CarManufacturer::getID()
CarManufacturer::getName()
CarManufacturer::getLocationID()

Aggregate "Location"
Location::getID()
Location::getName()
other aggregates are referenced by id
but you check that the id is valid not within those aggregates, but within services
 
Woah, woah, woah. Now I am very confused.
The classes you are calling methods on are not the services?
 
Aggregates !== services
 
So there's an object which has..
Wait, no...
 
Wes
function serviceMethodSetNewOwnerToCarOnSale($carID, $newOwnerID){
    $car = $this->carsOnSale->getByID($carID);
    $oldOwner = $this->owners->getByID($car->getOwnerID());
    $newOwner = $this->owners->getByID($newOwnerID);

    $oldOwner->sellsCars(1);
    $newOwner->buysCars(1);
    $car->setOwnerID($newOwnerID);

    $this->commit();
}
this is a service method. very stupid example and very simplified. in practice it looks different especially for the transaction part
$this->carsOnSale
$this->owners
are the repositories
commit() takes anything that is being fetched and saves it back to the database
 
Those repositories are what I would call a collection in Eloquent?
 
Wes
11:42 PM
i have no idea about eloquent
repositories are very simple glorified data mappers (they usually have a similar api)
 
It's basically an array of data objects. Cars in this case?
 
Wes
they basically avoid you to fetch the same thing twice, by keeping in them stuff that was already fetched within the transaction
 
Wouldn't it be better to wait until you have a more specific WHERE clause then calling for a whole list then getting one listing from it?
 
Wes
getByID($id){
    if(@$this->storage[$id] === null){
        $this->storage[$id] = $this->mapper->getByID($id);
    }
    return $this->storage[$id];
}
that's a simplified repository. just that...
@Allenph example of "wait for a more specific where" ?
you have to know all the things involved in a transaction before doing anything, otherwise you aren't locking against concurrent changes anything, making transactions pointless
 
I misread. You were right.
 
Wes
11:49 PM
// first you fetch everything, possibly in order so that you don't get deadlocks
$car = $this->carsOnSale->getByID($carID, LOCK_FOR_WRITE);
$oldOwner = $this->owners->getByID($car->getOwnerID(), LOCK_FOR_WRITE);
$newOwner = $this->owners->getByID($newOwnerID, LOCK_FOR_WRITE);
then you do the changes, save back and commit
 
I see.
I think I have a lot more to read tonight. I'm sure I'll have a billion questions while I'm working tomorrow. Thanks!
 
Wes
in my last project i did a "god" repository that fetches all the things in order (alphabetically) so i'm avoiding deadlocks. i've never had one in practice though :B
what i'm saying is that for the average project you don't need to worry about deadlocks. even if you had that problem you can always refactor later
 
anyone here know whats the best way to get user input time ?
 
Wes
for the average project you just do it with en.wikipedia.org/wiki/Isolation_(database_systems)#Serializable and that will do just fine for 99.999% of times
 
00:00 - 17:0017:00 - 00:00

« first day (2388 days earlier)      last day (2554 days later) »