« first day (2710 days earlier)      last day (2235 days later) » 

12:01 AM
It's not so bad, I have some back troubles though so a bed is pretty necessary
 
ah, yeah. I've had to start laying on my stomach sometimes because my lower back will give me trouble. I need to keep working on my core muscles...
This is entirely situational, but have you tried yoga?
yessss I can finally watch season ten of Doctor Who
 
12:20 AM
I really should, I haven't really gotten the time too
I stretch in the mornings though, it seems to help a little bit
 
12:40 AM
doing a few poses at different times of the day can help a lot
 
You're probably right, especially when I'm sitting down on the computer all day :P
 
@Tiffany dunno .. I stopped soon after 10th left, the stories were getting ... dunno ... shallow and annoying
 
@tereško early episodes with the 11th were kinda boring, but they got better
12th is great
 
dunno ... I hated the River Song plotline
 
fair enough
 
12:51 AM
and it feels that they have forgotten the "show, don't tell" part of the whole process
I think I actually saw half of the season with 12th
 
trying to remember where about that story arc ended, but it's been nearly six months
 
the "Missy plotline" was as terrible as River
 
shrug
 
what I really hated is how they ruined the Silence plotline for the 11th
it had such a potential
 
1:25 AM
!!remind help
@jeeves - you around?
 
1:50 AM
@Danack I don't think he chats anymore
!!dad
ooor he's borked
!!uptime
 
he's_dead_jim.jpg
 
Does this class I wrote have some bad code smell? It seems repetitive but I can't seem to find a better way to do it.
(If anyone cares to look for me :P)
 
@Alesana it probably shouldn't be a class, just a set of functions maybe.
 
I was thinking I shouldn't put functions outside of classes
 
2:05 AM
And here I am trying to learn how to be more functophobic :P
 
If all the state needed for the function can be represented by arguments and a return value then it should be a function, probably.
 
Should I still have those functions in their own file?
 
Wes
2:28 AM
@LeviMorrison how about we disable fallback to root scope via ini setting or a declare per namespace
being functophobic is a consequence of the fact that php has no function autoloading, imo
 
@Alesana Things don't need files all to themselves.
@Wes I can understand this view but the real issue to me seems to be an over-reliance on autoloading. It's as if vast amounts of developers can't preload libraries because of poor architecture or something.
 
I am supposed to follow FIG PSR standards, one which is autoloading and using namespaces.
 
Using "standards" just to follow them is pointless.
 
:/ I don't make the requirements
 
What's the actual description of the assignment?
Or rather, the phrasing around using PSRs and such.
 
2:34 AM
> we’ll be looking for clean, well-documented code following PSR defined by PHP-FIG and tests to support code.
 
Okay, maybe slightly more context?
Anyway, see PSR-2's conclusion:
> There are many elements of style and practice intentionally omitted by this
guide. These include but are not limited to:
[. . .]
-Declaration of functions
 
Ah good point
 
If the data is structured and can't be reasonably done with arrays then put the data in classes.
 
Sometimes using methods makes sense; if the routine needs access to private information, for example.
 
Wes
2:41 AM
@Tiffany try making marmalade at home. it doesn't take a lot of skills :D
 
However, consider if that "private" variable is really just data you could (and ought) to pass in as an argument. In this case it probably should be a function instead.
If a function can be written which uses only the public API then consider making it a freestanding function instead of a method (or possibly a static method, just don't get caught in the static state trap).
 
@Wes I probably don't have the motivation to go through with making it
 
For instance, consider if you had a library which has a Collection class which has map, filter, and reduce methods. These methods just use the public data/methods on the class then they probably ought to not be instance methods.
This becomes obvious if you consider that there are infinite uses of the class, and not every case can be pushed into the class.
 
Wes
it's super simple or i wouldn't suggest doing it. totally worth also
 
For instance, there might be other routines you might want to add such as zip or chunk. If it's not your class you can't just go add them anyway.
 
2:46 AM
I honestly thought marmalade was some kind of chocolate
like chocolate syrupy stuff
 
Wes
lol
how do you call that?
 
I'm having a hard time wrapping my head around how I would do it as a function, I'm writing a package to be used in various applications, and the package is autoloaded. I don't know how I'd autoload the functions
 
Wes
another name we use for it is confettura
anyway, it's just water, fruit, sugar, boil
 
I'm thinking of molasses
which isn't chocolate but looks like it
 
Wes
can do with any fruit
but pick one without seeds you can easily take out :P
 
2:51 AM
I dunno. If I can find instructions that are easier than what I read, I might try it sometime.
I think I've said this before, but I don't like cooking because I don't like dealing with the clean up
The act of cooking itself is enjoyable
Mostly, I'm just a lazy bum
 
Wes
:B
the clean up part is annoying. i avoid stuff that requires cleaning too
 
anyway, bedtime
goodnight
 
Wes
gn \o
@Alesana a

function xxx($foo, $baz){} can be equally served as:

function yyy($baz){
    return xxx(new Foo(), $baz);
}

or

public function yyy($baz){
    return xxx($this->foo, $baz);
}
they are both form or partial functions
 
@Tiffany \o Goodnight
 
Wes
so basically the standalone function is the most reusable entity
 
2:58 AM
I just don't know how to autoload the standalone function, I could be having a brain fart though
 
Wes
you cannot autoload
need to require() it manually. that's the problem :P
so it's acceptable if you put your functions in a Functions class, and have them defined as static methods
unfortunately that's the best we got
 
Ahh, I see. Yeah so it's part of a package that gets autoloaded, they're the only functions that could go standalone so I could put them in a Functions class, but that would be the same yet less descriptive as a Calculator class
 
@Alesana Then I guess for the sake of the assignment you can do them as static methods.
For your own education's sake you should look up the term "pure function" sometime after you've completed your homework.
 
@LeviMorrison I will do so ^^. Yeah a static function seems to be the way to go
 
Wes
11 hours ago, by Wes
https://i.imgur.com/SrizJVW.png or https://i.imgur.com/irLhrxA.png (it's a sidebar) cc @kelunik @PeeHaa
opinion^ imagine a site like php.net
@kelunik eh, truncated content sux. it's never useful
description is just too much for a menu, right?
 
3:19 AM
Yes.
 
Wes
i am convinced :P
 
Another concern will be larger build times to gather and display that extra information.
 
Wes
that is no problem in my case. not using docbook
i'm writing a phpdocumentor thingy
 
In that case if you know the number of items is small then it might work.
 
Wes
i'm not sure
the largest namespace i have is 27 classes, which already does for a massive menu
 
3:41 AM
Hi
Is it possible to have an array inside another array as a value in a JSON data?
It gives error.
 
@Simon.B It's not that you're putting an array inside of an array, it's that you're putting a key:value inside of an array. In JSON, arrays cannot have keys, only objects can.
So either you change the value of qualifications into an object and give everything keys, or you keep it as an array and remove the Languages key.
 
@Alesana Thank you, so you mean associative arrays are not allowed in JSON right?
 
Wes
they are called objects
 
@Wes That's a perfect point! (thumb-up)
 
Wes
{key: content, key2: content2}
[content, content2]
 
3:53 AM
@Wes Yes, cool, thanks
 
morning
 
\o
 
o/
 
@Simon.B Keep in mind here, JSON is actually not PHP-related. It's JavaScript Object Notation. In JS, objects and arrays follow the same rules.
 
@Alesana Yeah I know that. Except two or three minor differences they are pretty similar.
 
3:57 AM
@Simon.B JS and PHP are pretty similar, or JS and JSON?
 
@Alesana JS objects and JSON
! :D
 
Just making sure :P
 
@Alesana Haha, thank you, PHP is the best of both worlds :p
@Alesana In this case, can we say that there's this limit to JSON data, but it's an unimportant limit?
 
4:19 AM
Oh god I suck at math
Well, geometry
 
@Alesana How come?
 
Trying to detect if two line segments intersect, I think I've just been working for too long and my brain is giving out
 
Wes
5:21 AM
youtube.com/watch?v=XKRj-T4l-e8 @FélixGagnon-Grenier
 
I've heard for a while that you shouldn't have to have inline comments to describe your code, your code should describe itself. But, when dealing with complex geometric algorithms with conditionals, would that be an exception?
 
Wes
yeah don't follow idiotic rules. just make sure that comments are actually useful
 
Usually I do a pretty good job with having my code describe itself but when I'm dealing with multiple lines that have 2 points each and each point has 2 coordinates then I'm doing tons of calculations with them there is no way the code can describe itself :P
 
5:37 AM
What you all use on windows for C++ or C like ide and what C standard?
 
Wes
@Alesana yes people like to make up easy to sell simple rules like "don't comment, let your code describe itself"
 
@Wes Well, my code did become much cleaner once I started following that rule.
 
Wes
yes but unless you are a math genius and everybody in the team is, you might want to comment math-heavy code and kinda stuff
 
I am barely understanding it what I am putting down, pretty much translating a C++ solution into PHP. I know if I weren't so tired I could wrap my head around how it works
 
Wes
cargocult is what everybody does :B
 
5:46 AM
:B As long as I'm not the only one
To be fair, the assessment says...
> "The formulas to solve these simple problems can quickly be found online"
it doesn't say...
> "The formulas to solve these simple problems can quickly be understood online"
Although I do question their use of the word "simple".
 
Wes
:B
lines intersection was fairly easy iirc
problem is curves intersection :B
 
Is this making it harder than it has to be?
It must be that I'm overly tired
I don't understand how orientation is related, and I also don't understand why he chose those points in particular.
But, something tells me that I went over this in 8th grade (at 13 years old) and I understood it just fine
 
Wes
no, it's that
i don't remember anything, but i can tell it looks of the right length :B
it's not one liner if it's what you are asking, no
 
I was expecting it to be like ($line1['pointA']['coordinateX'] - $line2['pointA']['coordinateX']) * (something - something) and then it's done.
In all reality though I'm sure I'll grasp the concept in the morning when I'm well rested and haven't drank anything :B
 
Wes
6:10 AM
http://sketchtoy.com/68572521 #programmingPictionary
 
@Wes sprintf
 
Wes
\o/
 
It took me a second lol
 
Wes
http://sketchtoy.com/68572534 #programmingPictionary
@Alesana rtrim :D ahaha
 
:D
Haha your drawing skills are much better than mine
@Wes I almost want to say explode
But I don't think that's it
 
Wes
6:28 AM
nop
 
I'm stumped
 
Wes
:D
 
moin
 
6:50 AM
\o
 
Wes
o/
 
I am learning PHPUnit, I have am wondering if this is a good way to run tests?
 
Wes
no
 
/me is 34 today
18
 
Wes
function data(){
    return [[1],[2],[3],[4],[5],[6]];
}
/** @dataProvider data */
function test($i){
    self::assertNotSame($i, 555);
}
@Alesana
for more info, check "data providers" in phpunit's doc
@JoeWatkins \o/ happy joeday
 
6:59 AM
@JoeWatkins Ohh happy birthday!
@Wes Thanks!
I think I got it now. Something about how I originally had it just didn't feel right :P
 
Wes
great @Alesana if you are like me, you might want to put the data in different files
public function dataProvider($test){
return require(__DIR__ . "/Tests/" . $test . ".php");
}

usage: /** @dataProvider dataProvider */
for me that improved readability and manageability a lot
 
7:14 AM
morgen
 
Hmm then I would have to have a different file for each dataProvider, but I have multiple tests in this one file. That might be a different problem altogether though
 
Happy Birthday @JoeWatkins
 
Wes
@Alesana data providers are usually very long, that's why
 
@Wes Hmm maybe I should be providing more data then
 
Wes
no, it depends
 
7:19 AM
Happy birthday @Joe \o/
 
Wes
What is Boundary Testing?
Boundary testing is the process of testing between extreme ends or boundaries between partitions of the input values.

So these extreme ends like Start- End, Lower- Upper, Maximum-Minimum, Just Inside-Just Outside values are called boundary values and the testing is called "boundary testing".
The basic idea in boundary value testing is to select input variable values at their:
Minimum
Just above the minimum
A nominal value
Just below the maximum
Maximum
boundary value analysis is a good testing pattern
 
I think that's kind of what I subconsciously did
 
Wes
so if you accept an integer from 0 to 100 inclusive, you test inputting:
-2, -1, 0, 1, 2
98, 99, 100, 101, 102
 
It's a bit more difficult since they're lines
 
Wes
i know
 
7:24 AM
But I think I was doing that same concept, 4 lines that went from completely intersecting to barely touching, then for the other set it was 4 lines that went from being way far away from each other to just about touching
 
Wes
that sounds correct
 
I should have learned PHPUnit ages ago :B
 
Wes
phpunit is simple, testing isn't :B
 
Good point
Should I be writing doc-block comment descriptions for my tests? I assume the names are explanatory enough
 
Wes
if you use data providers you can do
function data(){
   yield "negative out of range value" => [-1, FALSE];
   yield "start range" => [0, TRUE];
   yield "end range" => [100, TRUE];
   yield "positive out of range value" => [101, FALSE];
}
martinfowler.com/bliki/GivenWhenThen.html this is a pattern for naming tests
given collection is empty
when adding an element
then collection is not empty
doesn't work for me :B
 
7:32 AM
Ah in that case I should define whether it should assertFalse() or assertTrue() in the dataProvider, and not have one test for the false ones and one for the true ones?
I'll take a look :B
 
Wes
@Alesana it's up to you. i don't use assertfalse or asserttrue
i use self::assertSame($exp, $act)
 
Ah that seems better.
 
Wes
that way i can parameterize the $exp
 
They know I haven't used PHPUnit before so I think they'll give me some slack
@Wes I'm not changing the state of anything, just testing if calculations are correct, so I'm not sure if it'll work :/
 
Wes
it's very verbose
 
7:44 AM
/*
 * Given many different lines
 * When detecting if they intersect
 * Then check that the detection matches the expected boolean
 * @dataProvider intersectingLinesProvider
 */
I don't know if I'm grasping this concept :P
 
Wes
nah, just do
test_functionName or test_methodName
then use data names in data provider for the description, if you really need it
yield "negative out of range value" => [-1, FALSE];
if you don't use data providers then do test_functionName_returns_4_when_summing_2_to_2
unfortunately that's what we do :B
 
Heh that's an interesting test name. I was going to ask if I should always be using data providers. For example, I use random data to make a Point object to detect if it intersects with a Line object, expecting an exception because it doesn't support Point vs Line intersection. I just put random values because the values aren't important just the type is. I don't think I need to test multiple Point objects to make sure they're all of the wrong class :P
@Wes PHPUnit should have some system to put a doc-block comment in there and have it read you off the description of a failed test
 
Wes
it's not necessary most of times
 
8:00 AM
The method call would be $line->intersects($point);, so I guess if I'm understanding, the test name would be test_Intersects_DetectPointAndLineIntersection_ExceptionThrown()
 
Wes
$line->intersects... point?
 
That's why it throws an exception :P
 
Wes
i don't understand, what's the actual code?
shouldn't it be $line->intersects($anotherLine) ?
 
        /**
         * Determines whether this line intersects with an element of an unknown class
         */
        public function intersects($element): bool
        {
            $elementClass = get_class($element);

            switch ($elementClass) {
                case Point::class:
                    throw new NonCompatibleTypesException("Detecting an intersection between a line and a point is not supported.");
                case Circle::class:
                    throw new NonCompatibleTypesException("Detecting an intersection between a line and a circle is not supported.");
I can't make it code styled :/
 
Wes
public function intersectsLine(Line $line): bool{}
public function intersectsCurve(Curve $curve)...
don't do that :P
 
8:04 AM
def intersect(a, b)
  # Should return true or false indicating whether or not
  # a and b intersect.
end

You may also find it more natural to define a.intersect(b).
That's how the challenge puts it
 
Wes
public function intersects(Geometry $g){
   if($g instanceof Line){
        return ....;
    }
    throw new TypeError("...");
}
where Line implements Geometry
 
I need a switch in the Circle class
    /**
     * Determines whether this circle intersects with an element of an unknown class
     */
    public function intersects($element): bool
    {
        $elementClass = get_class($element);

        switch ($elementClass) {
            case Point::class:
                return Calculator::circleIntersectsPoint($this, $element);
            case Circle::class:
                return Calculator::circleIntersectsCircle($this, $element);
            case Line::class:
                throw new NonCompatibleTypesException("Detecting an intersection between a circle and a line is not supp
So I thought I would be consistent
 
Wes
don't use get_class
you need to use instanceof or it won't work with inheritance
 
Ah okay I see
The thing is, point, line, and circle have different public methods
Point has getCoordX() / getCoordY(), Line has getStartPoint() / getEndPoint(), and Circle has getRadius() / getCenterPoint()
 
Wes
sounds right
 
8:10 AM
They can't implement the same interface then
 
Wes
so you have a non finite set of arguments to pass to $line->intersects(...) right?
 
Only 2
 
Wes
means that can be circle, square, curve, anything
should probably be functions rather than methods then
but in your case, since it's actually finite
Geometry would be a marker interface
an interface with no methods
 
Ah, I misunderstood. There are 3 set of arguments
 
Wes
if php had union types it would be
public function intersects(Circle|Polygon|Line|Point $geometry){

}
 
8:14 AM
That would be convinient
I did originally have it implement the same interface
 
Wes
the closest thing to that is a marker interface + instanceof and typeerror
public function intersects(Geometry $g){
   if($g instanceof Line){
        return ....;
    }elseif(...){
    }elseif(...){
    }
    throw new TypeError("...");
}
 
I'm just looking up a marker interface, can you add public methods to a class implementing a marker interface?
 
Wes
or switch if you like
yes
 
For some reason I thought that all public methods had to be declared in the interface
 
Wes
interface Geometry{}
class Line implements Geometry{
    function getX(){}
    function getY(){}
}
no :P
 
8:16 AM
Another brainfart
 
Wes
can also implement more interfaces
interface Geometry{}
class Circle implements Geometry, Shape{
    // ...
}
class Polygon implements Geometry, Shape{
    // ...
}
not sure about the names :B
 
Wait what is wrong with get_class()?
 
Wes
class MyCircle extends Circle{}
get_class($o) will be MyCircle, not Circle
so it will fail
as opposed to $myCircle instanceof Circle
 
That makes sense
So then I will just have..
<?php declare(strict_types = 1);

namespace GeometryCalculator\Element;

Class ElementInterface
{
    public function intersects(ElementInterface $element): bool
}
 
Wes
no please don't use the interface suffix
call it Geometry
more importantly don't call it interface if it's a class :P
interface Geometry
{
    function intersects(Geometry $other): Bool;
}
i think you mean this
class Circle implements Geometry{
    // ...
}
 
8:29 AM
Bleh the assessment says to follow FIG PSR standards and they say to suffix with Interface
 
Wes
right?
 
I meant interface ElementInterface
 
Wes
it's bs
 
It looks super tacky
 
Wes
php-fig is crap
don't follow that
 
8:31 AM
Well it seems tacky when defining it, but not when implementing it.
 
I have to though
 
Wes
don't
it's a stupid distinction
is an abstract class with only abstract methods an interface or a class?
 
Haha okay I'm sure it won't make a difference anyways I'll just keep it Geometry
I'm having another brainfart
 
Wes
i have one every min. welcome to the club
 
:P they seem to be happening more and more often
 
Wes
8:42 AM
:B
 
If I have Class Line implements Geometry {...}, I can have put a method's dependency as either function foo(Line $line) {...} or function foo(Geometry $geometry) {...}, and there's no code smell?
For some reason I was thinking the whole point one of the points of a interface is that you never require a class that implements it
But now I'm not sure
 
Wes
php doesn't support overloading, nor it does support unions or generics
so the best you can do is use geometry
what you are doing isn't the most obvious thing to model :P geometry is fine
 
So, I should have, for example, public static function lineIntersectsLine(Geometry $lineA, Geometry $lineB): bool instead of using Line? :B
Damnit you still have me doing the :B
 
Wes
in that case it should be Like $linea, Line $lineb
but when you call it, it should be
function intersects(Geometry $other){
    if($other instanceof Line){
        return Calc::lineIntersectsLine($this, $other);
    }
    throw new TypeError("unsupported operand");
}
 
Ah yeah, for that one the whole purpose was to use Geometry
Haha thanks for this PHP class, I feel like I've increased my knowledge quite a bit today
 
Wes
8:50 AM
:D
though despite php doesn't have generics and stuff, the signature
function intersects(Geometry $other)
is actually the correct one
the operands of "intersects" are any geometry
 
Right that part makes sense. I originally had it styled like that but I had this idea in my head that all public functions of a class must also be defined in the interface it implements. It turns out, it was the other way around.
 
Wes
if i was writing the code i would have just Calc::lineIntersectsLine and kinda methods
but intersects() is nice to have
but in practice it's just a shortcut for functions in calc::
 
I was debating. I thought intersects() showcased my knowledge a bit more.
I don't know, I am trying to learn how to make objects do things to themselves more instead of having to instantiate other objects to do things to them
Well, I guess with static methods I don't have to instantiate anyways but it's the same idea
 
Wes
intersects() is not wrong
it's definitely something nice to have
and a legitimate method on a Geometry object
imo
 
:B It seems kind of JS like but I like it
    switch (true) {
        case $geometry instanceof Point:
 
Wes
8:57 AM
so russia is voting again, putin expected to win with 80% of votes
 
I didn't realize that he had that much overwhelming support
 
Wes
it's a monarchy/almost dictatorship
 
But, a lot of people do support him
 
Wes
not 80% probably
 
Maybe not 80% like polls say
Yeah :P
I respect the guy
 
Wes
9:00 AM
i don't
 
I don't particularly agree with what he does with other countries, and I think he should put more effort into shutting down discrimination against minorities
But from what I've seen he seems to actually do what the people want and work for the people. Well, unfortunately the people of Russia collectively might not want the best for others.
 
Wes
he's himself a major source of discrimination
 
Putin for the win!
 
I disagree that he is a major source of discrimination
 
Wes
lgbt people, "jews", ukrainians, syrians migrants just some of the people he's insulted or worse
 
9:12 AM
Well, I can agree with that. I guess what I am trying to say is that he is less discriminative than the average Russian. I don't like him for that, but as a leader I respect him.
 
Wes
he is an effective leader, but unfortunately not a good one
 
As in average Russian I moreso mean, the average Russian that is in the government :P
 
Wes
but i prefer all the time a trump over a putin
 
The only reason I could prefer Trump over Putin is that Trump has less power
I hope
 
Wes
it's true
 
9:16 AM
While Putin might be a bad person at least he's a sane person
Do you think I should throw a TypeError instead of a custom NonCompatibleTypesException?
 
Wes
not so sure about that. he could participate sanely in the global community, but he decided he wants to be everybody's enemy
with wars, killing, and probably much worse stuff than that
 
That's the part I partly disagree with. I'm not solid on my opinion about this, but I do think that he has no interest in being anyone's enemy, but just to do what's best for the country.
 
@Alesana Yes.
 
@kelunik Thanks
 
9:42 AM
happy birthday @Joe :)
also mornings
 
\o
 
o/
 
Wes
mornin
 
'nin wesminster
 
It's 6am here now I have got to get some sleep
Night all
 
9:56 AM
nn
 
Wes
\o
@Ekin that's peehaa writing
right? :B
 
it was me no :)
 
Wes
:P
 
peehaa is probably asleep still
 
Wes
he's living in the us east coast timezone now
 
10:01 AM
morni
 
\o
 
Wes
i actually fixed my clock so that i can get to see that bit of spring sun
today seems a decent day
 
10:22 AM
it's starting to look like spring here
 
Wes
yeah, finally
 

« first day (2710 days earlier)      last day (2235 days later) »