« first day (1523 days earlier)      last day (3425 days later) » 

Bas
2:00 PM
But wouldn't the class name be then CarTaxesCalculator? Or something
 
That's probably a better name either way
Don't be afraid of long class names if they are more descriptive of responsibility
 
Bas
But then it should be calculateRoadTax i guess?
 
Why do you need at class at all at that point? Just make it a standalone function
 
Bas
I'm learning SRP.
 
2:01 PM
@Bas no, just make a getRoadTax(Car $car) =_=
 
standalone functions wont autoload :P
 
@ErikBaan Good point. So make it static within the class
 
Bas
@Machavity Was going to do that :)
What about this: A Car class, a CarTaxes class and a CarTaxesCalculatorclass :P
The car class represents a car, the CarTaxes class get's the car taxes based on a car, and the other calculates it
 
A CarTaxes class would just be a dumb collection of the computed values (IMO)
 
Bas
@DaveRandom True, i could get those with a variable aswell.
Whats IMO btw?
 
2:05 PM
In My Opinion
IMHO without the "Humble"
I'm not humble
4
 
Bas
Yeah your right.. same thoughts.
 
:-P
 
@Machavity why do we need classes at all, why don't we just make everything functional.
 
Bas
Atleast its great practice for me, atleast that's what i'm experiecing
 
@ziGi Go work with Lisp for a bit, then come back here and say that
 
2:06 PM
besides, isn't SRP making things a bit confusing, don't you end up with a class with a single method at the end of the day if you have to be strict
 
Responsibility != routine
 
how do you define responsibility?
 
Short question: Is it okay to "abuse" a DIC as Service Locator just to bind something to it? During my Bootstrapping process of my app I have dedicated classes for my components that configure them.

http://pastie.org/private/4twumufqmaay3mru85htda
 
@ziGi Because autoloading. I have some classes in my project that are nothing but wrappers for common static methods. It makes it easier to follow what I'm doing AND to find where the functions are defined.
 
still a: nope?
 
2:09 PM
@ziGi Describe what the class is supposed to do. Once you start saying "and" or "or" you probably need to think about splitting it up into multiple objects. But it depends on the application design and how zealous you are with the principle.
 
@ThomasDavidPlat I think so - you can make yourself feel better about it by calling it a config layer.
 
Bas
A "Tax" in english can be anything right? Not only reffered from "Roadtax"?
A cost or something.
 
I certainly wouldn't take SRP so far that you simply have one class with one method for everything
 
@cspray well I think it also depends on the point of view, how would you like to use it
 
@cspray that would be the opposite of SRP :P
 
2:10 PM
I'm beginning to think that it's wrong to have a single massive config at the top of your application - instead having the routing/dispatcher first call a module specific config layer stops you from having to have a monolithic config layer.
 
Bas
@cspray I like it, in some cases.
 
@ziGi Well, the way that SRP defines it is as "a reason to change". That's a weird definition that I've never really been able to reconcile in my own brain, not least because a lot of classes that definitely violate SRP could be made entirely stateless
 
@Bas The accepted definition in English is a fee imposed by the government in relation to the price of an item
 
@ThW any clue?
 
Well, for my own coding style, I've found that SRP leads me to smaller objects that I can more easily compose together.
 
2:11 PM
@Danack thanks! :)
 
@nikita2206 It is possible to take something that is supposed to be good so far that it becomes bad.
 
@DaveRandom If you limit it to "a business reason to change" it becomes more sensible.
 
Bas
@Machavity Ah okay, so a roadtax is a fee actually.
 
for the context of a person who uses a car to bring him from place A to B the responsibility of the engine is to accelerate the car. While from the point of view of a mechanic, the point of view is that the engine is made out of a lot of parts with a single responsibility each
the person driving the car doesn't need to know how the engine work if it can give him what he needs from it (rotation momentum)
 
Simply creating objects with one method because "zomg SRP!!1" is probably not the right reason. Creating objects with one method because it leads to a simpler design or better architecture? Yes.
 
2:12 PM
but the mechanic needs to know how it does
 
@Danack Doesn't make it any clearer for me, can you elaborate on what you would consider the difference to be?
 
@Bas Depends. Are we talking like a gasoline tax, used to fund making/repairing roads or a toll, where you directly pay a fee to drive on a road?
 
@ziGi and you could compose a car out of parts if it made sense for your application
 
Bas
@Machavity Yeah okay, its an calculation.
Based on the weight, where you drive and something else, didnt remember.
 
@PaulCrovella yes, what I am saying is that responsibilities can always be chopped and made more granular
 
Bas
2:13 PM
I dont even have my drivers license. lol.
 
@ziGi Try applying the CSP: Common Sense Principle
 
If you have a class that persists data and retrieves data those are already 2 responsibilities
but they both revolve around the data source
 
@Bas Sounds very much like a toll
 
so should they be split in 2 classes
 
Bas
Hm
CarFeeCalculator
CarTollCalculator.
 
2:16 PM
Ok imagine this scenario, you have a phone that receives calls and makes calls. Are those two responsibilities
or you can name it data communication responsibility
and put them both in the same class
that confuses me
 
@Bas I have no idea what either of those are computing. What is this fee, who is charging it?
 
@DaveRandom Say that you've got some code that prints sales reports. You want to modify how the reports are printed. The class that does the printing would need to be modified, but that's a technical reason for a change, so it's okay* for that change to be done in one class. Now say that you have two departments who each want their reports to be done differently. That's a business reason/choice that needs to be separated into two different classes.
*okay not great - obviously you could make an argument for versioning all the possible formatting choices, but you don't absolutely have to.
 
Bas
@DaveRandom I dont know, i'm trying to find a universal name for the road tax price, insurance price and fuel type price.
 
Bas
Yeah, you know. Gas etc
 
2:18 PM
@Bas "overhead"?
 
Bas
What's that then? :P
 
CarRunningCostCalculator
 
Bas
That doesnt sound like a monthly price to pay
hmm, one second
 
The question is, how far do you go when you have to split the functionality of a class
I have had this dilemma with a DataMapper
 
@darkyen00 I really dislike your whitespaces... But that's personal taste I guess. I prefer if ($foo) { compared to if( $foo ){
 
2:20 PM
since it acquires and persists data
 
@darkyen00 $dish is unused and $chef_id is kinda redundant, but other than that I don't see any real issues
 
but in general the concern is providing a communication between the application logic and data source
 
@darkyen00 also you are inconsistent. cartlines vs chef_orders. (camelcase ftw)
 
I also dislike you whitespace, but that's not really a PHP issue
 
so I put them in the same class although they are two different thing
 
2:21 PM
@darkyen00 also why does your cart have public variables? use getters instead
 
I am still hesitant though whether these are not two different concerns
 
Bas
@DaveRandom If you say so, my english isn't that great. I know the dutch word though..
 
ongelukkig
 
@Bas He's right. Overhead is a less specific term that applies to what it costs to actually run something. So my overhead on my car in general would include not just gas, but oil changes, tires, mechanic work, etc
 
Bas
Yeah okay.
 
2:22 PM
@Bas Running Cost would be a decent English term for it, it's a fairly common term. We don't really have a single word that adequately describes it.
 
hi
 
@darkyen00 and what's the point of the flag thing? why not just return directly instead of setting the flag and then returning?
 
Bas
But in this case, i'm only calculating the montly costs. which there are alawys
 
yo @NikiC
 
Bas
such as gas and insurance and roadtax
 
2:23 PM
Changing the part where the mapper persists and the mapper gets data from the DB would happen for different reasons so I still think I have to split them
 
@Bas I suppose "upkeep" would be an OK word but I'd go with Running Cost personally
 
Bas
It sounds better (running cost) in my opinion :)
 
@Bas I would argue that, in this case, breaking tax out is unnecessary. You're lumping direct costs with indirect ones. A toll would qualify as a direct cost but not tax
 
Bas
Hmm? :P
Meh, going to have lunch or something. Starving.
 
Hence why politicians like indirect taxes. Gas includes the tax costs baked in. I couldn't tell you how much gax tax I've paid this year
 
2:26 PM
A fine is a tax for doing wrong. A tax is a fine for doing well.
 
@Patrick done.
 
@Machavity sounds like you are pretty good with finances
 
And i was thinking of adding the ids not meeting requirements later on..
 
@Machavity I'd imagine there are 3rd world countries with a lower GDP, I know mine is
Although, aren't you #murican?
 
2:31 PM
@Machavity Actually, yes.
 
Bas
How is road tax getting calculated actually?
I dont know the sum.
 
Well I'd have thought that would be a pre-requisite to the project, really...
 
Morning
 
@ircmaxell Morning
 
Bas
@ircmaxell morning
 
2:35 PM
what's the good word?
 
Bas
What? :P
 
@ircmaxell The word for the morning is CarRoadTaxCalculationSystem
 
CarRoadTaxCalculationSystemFactory
 
Bas
+ 20 other classes :)
 
CarRoadTaxCalculationSystemFactoryCollectionFactory
 
Bas
2:37 PM
We're getting close though, the thing is i dont know how to calculate it... I dont even have a car
 
@Patrick why would anyone name something FactoryCollectionFactory, isn't that just redundant
:D
 
CarRoadTaxCalculationSystemStrategyFactoryBuilderFactory
 
CarRoadTaxCalculationSystemStrategyFactoryBuilderFactoryFacadeDecoratorComposerS‌​ervice
 
"I tried many way but each time I don't get the result expecting. " ... I always wonder if they're just saying that ...
 
@ziGi Ladies and gentlemen, I give you Zend Framework 1
 
2:42 PM
@Ja͢ck in all fairness, results are stubborn and it is really hard to get them expecting something.
 
@Ja͢ck translated: "I copied and pasted code from more than one location, yet somehow my paste buffer neglected to alter it for my needs each time."
 
Bas
Alright, i see the roadtax is getting calculated on which province you are living in, the fuel type of your car and the weight of your car
But how can i access the Driver's province?
Because its not a property of a car.
 
@Bas what about the type of fuel, I live in the Netherlands and I know that if you drive on Petrol you pay low tax, if you drive diesel you pay higher, and if you drive on LPG you pay the highest? Correct me if I am wrong, but doesn't that matter too?
 
Bas
2:48 PM
Every driver has a car, but not every car has a drivr
@ziGi Yeah thats what i ment with the fuel type. I live in the netherlands aswell but i dont have car.
 
@Bas computer drivers don't have cars
 
Bas
What? :P
 
@Bas a driver can have multiple cars?
 
Well your statement that every driver has a car is incorrect
 
Bas
@Patrick True.
@ziGi Well, a driver can have multiple cars then, or atleast a "Vehicle"
"Motorrijtuig" sorry.
But for now i'm only buildnig my system for a car
 
2:50 PM
well if the calculation is dependent on the province which is dependent on the driver
then most likely your calculation class needs it as a dependency
not only the car as a dependency
 
Bas
@ziGi Aye, ofcourse.
 
but I guess your logic should be more like
a car has an OWNER
and the OWNER of the car has a PROVINCE
 
Bas
Haha na that doesnt sound good in my opinion
well
a driver has a car, and is a person
A person has a province
 
@DaveRandom only if you do not trust your contributors
 
yes but I might drive my dad's car but not be the owner, so why do I care about the car tax, after all I don't own it
doesn't the tax depend on the owner of the car
not on the one who drives it?
 
Bas
2:54 PM
Hmm, true.
 
basically, it would be beneficial if you are working with some 3rd party developers and you want to make sure that they do not mess with the history, @DaveRandom
 
Bas
But, if you have a rule. Who drives the car must pay for it
:P
 
@ircmaxell I watched your video on Mediator Pattern but I am still wondering, what makes it different compare to Observer pattern?
 
observer is a direct emitter-receiver relationship. Mediator has an object in between
 
Oh I see
you are right, because with a mediator you can have multiple things attached to a single emission while with an Observer you have a single function execution
 
3:00 PM
@PaulCrovella :)
 
posted on December 17, 2014 by kbironneau

/* by balta */

 
.
@Patrick having read that, have you ever experienced the need to create a factory that creates other factories? I guess it is possible but I think it is a bit over the top.
 
@ziGi i made one the other day.. it was a factory that determined if the legacy factory or the new cool factory should be used
 
I can only think of one case when it is useful, if you want to do testing and create a MockFactoryFactory that creates some MockFactories
 
@ziGi Nope...
 
3:14 PM
@ErikBaan how does a factory determine what has to be used?
 
by the specs of the input object
the new cool factory could only be used when a specific property of the object was set
 
but why do you need a factory to do that?
 
ehmm good question
could've been a method in another object
maybe i've made a mistake ;-)
the legacy factory was used in multiple places in the codebase, so i created some sort of hybrid factory to be able to use the new and old factory and keep the usage the same :P
does this make any sense
 
@tereško Would rather just set up some server hooks in git to accomplish the same thing, probably (don't have the problem though so... might think differently if I did)
 
okay after playing around a few hours with Auryn I find it to be a great piece of software.
 
3:23 PM
PHP !== WORDPRESS
 
What you are doing wrong is coming here and dumping code before reading the rules of the room
 
Done
 
Wordpress is written in PHP
well most of it
 
Hate wordpress
 
you can still give us a gist or something
 
3:28 PM
Morning v2
 
Morning @RonniSkansing
 
Bas
@ziGi I'm still unsure about the calculate method, should that really return the value?
 
Hey @PeeHaa, coding or relaxing?
 
Bas
instead of a getxxx method
 
@RonniSkansing Debugging :(
 
3:29 PM
@PeeHaa =] client or own?
 
pastebin.com/Bkw1Mp1L Here it is, just basic question if my syntax is correct, (DB connection, the way the mysql request is made), because I can run it in phpmyadmin and it works, but when run on the website, I got NULL. Maybe I'm missing something. Documentation wise I think i followed it on point, but no luck
 
@RonniSkansing Client
 
@Bas my friend, what are you going to do with the value
 
Bas
Just get, and print.
 
Well what else would you expect to return besides the value?
if you have a calculator class that calculates road tax
 
3:30 PM
@PeeHaa have fun working.. =]
 
I guess it won't return bananas
although that would be great
 
Bas
Haha
$roadTax = CarRunningCostCalculator::calculateRoadTax($myCar);

Is that a correct syntax?
 
yes
but don't do this
because you are going to use it a few times
and then you will have to change something
and you would have problems because it would take you time to go and edit every place where you use it etc.
 
@Darius, have you debugged that all the values you (id's and such) are correct?
 
Bas
What do you mean?
 
3:34 PM
@Bas I'd recommend reading the manual for basic syntax questions - php.net/manual/en/language.oop5.basic.php
 
@Bas don't make calculateRoadTax static
 
haha Bas will be crazy now
 
look, the cost depends on the car, the province right?
 
Also, note that this forum has interleaved messages. You can see who someone was replying to by hovering over their message, if it has a 'reply thingy' at the start.
 
Bas
@ErikBaan Nah :P
@ziGi Yeah
 
3:35 PM
because he has been working on this for several days and everything he gets a different idea/answer for his problem :-)
 
Yeah, I have, I'm playing around with the "count" portion as well, adding $wpdb->wp_terms.count instead and stuff, but no luck.
 
Bas
@ziGi Do you mind starting a new room that we can talk dutch? Its much easier for me to understand
 
@Bas invite me too
 
@RonniSkansing ty :)
 
Bas
Alright. :)
 
3:35 PM
Hi, have any of you recently bumped into mysql xception 4200. I am having a problem with my own made drupal module. It wont be inserting anything to MySQL database, even if i do it by the book, and i've done it with few examples. Nothing seems to work...
 
@Bas I can't speak proper Dutch actually
 
Bas
Same.
 
@Darius, what if you drop the global $wpdb; and use pdo or mysqli instead, do you get a successfull query? Also have you smashed it up at wordpress.stackexchange.com?
 
Bas
Trying to invite you erik.
 
3:37 PM
@RonniSkansing PDO would work, I'll try asking there. Thanks :)
 
@Darius your welcome and good luck with it.
 
Why are there 7 yes voted on that?
 
I really, really want to vote for the middle choice...
^^ so lonely :(
 
Derick, the man who votes no on everything, voted yes?
 
3:53 PM
@NikiC WTF, Derick voted yes?
 
Hehe... "why'd you open voting when there are issues?" *votes yes*
 
The best room of the network now stays open for business thanks to @caprica and @rlemon
 
4:12 PM
junits support for data providers sucks
 
1 message moved to Orphan GIFs
\o/
 
:-)
 
/\
smiley belly!
 
hehehe
 
hooray for outdated tutorials (6 months old, version update since then :D) lol.
 
4:24 PM
You got it fixed @Darius?
 
yessir :) Digged it up and found out that the function name I was using was obsolete now.
no errors were given off by it though so it was annoying to find
thanks again.
and on that note, I'm gonna get some sleep. Have a good day guys
 
Have a good one
 
4:49 PM
6 messages moved to bin
For great justice
 
good call
 
@PaulCrovella Just give it 2 days and either I or @DaveRandom or even worst both enter the room drunk... :)
 
@DaveRandom I'm never going to see @ircmaxell's smiley face in the same way again... :(
 
I'm going to raid the shop people. later
 
@salathe Just wait until you see someone use :-(( in anger
 
4:55 PM
@salathe link?
 
in bin, 11 mins ago, by DaveRandom
@salathe I saw it as a man being poked in the belly by a penis and now I can't unsee it.
 
LOL
/me will do that every time now
 
@salathe how do I do something that would be rendered as a <ul> in docbook, I just can't figure it out :-(
There's nothing like docbook for making you feel stupid
Or me, anyway
 
I can't even find anything in the manual that does it, although there must be something that does it somewhere
 
@salathe :->
 
@PaulCrovella ahh yeh nice one, tnx
 
@DaveRandom itemizedlist
o.O Paul got it for you. Sorry for noise.
 
np :-)
 
@DaveRandom itemizedlist
\o/
 
5:12 PM
anyone else?
:-P
 
@DaveRandom pong
 
@Jimbo too slow, doesn't matter any more :-P
 
@DaveRandom what was it?
 
doctrine related question from Adrian Hardy, he might still be interested in an opinion, but he's offline now
If you feel so inclined you could go have a chat in #phpnw tomorrow
 
@salathe :-⊃
 
5:25 PM
I now have enough reputation to use stackoverflow chat! I had no idea that stackoverflow has chat!
 
@lawjeremy Welcome to StackOverflow chat. If you want noob trolls, try the JavaScript room. If you want old, miserable men who haven't progressed past 1999, try the C++ room. For anything else, please hold.
 
haha thanks @Jimbo
 
but no one is trying to bridge the gap for women in coal mining, or road working
 
I read this excerpt to my wife:
> Microsoft Research
in partnership with
Constance Steinkuehler
and the team at
University of WisconsinMadison
plans to create
a girls-only computer
science Massive Open
Online Course (MOOC)
to excite them into
learning computer
science through games,
projects and peer
mentoring.
She said:
> lol It sounds like an advertisement for preschool
 
5:33 PM
:D
 
5:48 PM
@AndreaFaulds When writing tests, could you please add the ?> at the end? This allows running it directly.
Also, you get a +1 on the Unicode code point escape sequence RFC
Not that it needs votes or anything ^^
 
6:23 PM
@NikiC Ah! That's a good idea, I'll try to keep to that in future. I do like running tests directly sometimes
@NikiC Also, I just realised that your AST work is basically clearing up after Zeev and Andi
They came up with the 2-stage-only system. But that was still better than what preceded it.
 

« first day (1523 days earlier)      last day (3425 days later) »