« first day (502 days earlier)      last day (4446 days later) » 

10:00 PM
@NikiC Thank you. but it is still gunna be closed bc people see the (4) and jump on it.... :-\
 
@NikiC Better, but I still don't see the point... Eih...
 
adjust the question again so that it is not restricted to static methods stackoverflow.com/questions/9524658/php-5-4-classexpr-syntax
 
by the way, did anyone else have any leap-year fun yesterday?
 
@MelvinProtacio @NikiC ^^
 
I think nobody of you really understood the question :)
 
10:01 PM
@Leigh just an ordinary day
 
Especially @MelvinProtacio.
 
Idk how to do that... @NikiC ... Im not a good writer at all
 
@MelvinProtacio: We had a site die due to a creatively written date search
 
Asking for a usecase for a feature is a valid question for stackoverflow
 
@Neal @MelvinProtacio You might have to do $class->{$method}() to resolve ambiguity.
 
10:01 PM
@NikiC I did, and objected to the original question
 
@LeviMorrison But my version won't allow the curly braces.
 
your edit makes it better, but I still don't care for it (but I prob would not have cv-ed the edit)
 
7
Q: What are the valid use cases of goto in PHP?

NikiCI know, there are other questions about the goto statement introduced in PHP 5.3. But I couldn't find any decent answer in there, all were of the type "last resort", "xkcd", "evil", "bad", "EVIL!!!". But no valid example. Only statements that there aren't any uses. Or statements that there are s...

 
That gets an error.
 
@Neal . . . I'm pretty sure I'm not running PHP 5.4 . . .
Let me make sure.
 
10:02 PM
@MelvinProtacio: Also Microsoft Azure fucked up horribly yesterday, and knocked one of UK central governments new projects offline :)
 
@NikiC lol
 
@LeviMorrison that doesn't resolve ambiguity it just delegates it to another variable that you have to look up on the code :D
 
btw, @MelvinProtacio, you are completely wrong regarding static methods ;)
They are inherently evil.
 
@Leigh wow! that's something we need to celebrate LOL
 
Every possible use of a static method can and will bite you in the future.
 
10:04 PM
@NikiC but they are there because of some specific uses
 
@Neal @MelvinProtacio:
class Foo {
    public function bar() {
        return 'Foo::bar';
    }
}

$foo = new Foo;
$bar = 'bar';
echo $foo->{$bar}();
 
@MelvinProtacio No, they are there because there are too many inexperienced programmers for this to be removed ;)
 
That works on PHP 5.3.6
 
@NikiC Pedantic note: every possible use of a static method can and will bite you in the future when programming in an OOP style
 
4
Q: Should I remove static function from my code?

NealMy code is located here: https://github.com/maniator/SmallFry Should I make it so that that the App class does not have to use static functions but at the same time be able to set and set variables for the app from anywhere? Or should I keep it how it is now with App::get and App::set methods? ...

 
10:04 PM
@LeviMorrison 5.4 only added the static Foo::{'bar'}() ;)
 
@NikiC no, even in java static exists and in c++
 
Old question of mine
Alot of my code has changed since then
 
@ircmaxell When programming in any reasonable style :) :P
 
I still have one static class
 
@MelvinProtacio Didn't I say inexperienced programmers?
 
10:05 PM
@NikiC I know you are talking about static, but they were having to do call_user_func_array and claimed I couldn't do what I did. Examples > words.
 
Basically for global variable handling.
 
@NikiC No, because functional programming uses statics inherintly (since statics are indistinguishable from functions)
 
@ircmaxell Functional programming is an entirely different concept where you can't really talk about the concept of static class variables.
 
@NikiC that's really generalizing and a very conclusive statement, as far as i know, that idea only comes when we studied unit testing because statics cannot be unit tested
 
@MelvinProtacio Which is why they are evil.
 
10:07 PM
@MelvinProtacio Which is why they are evil!
 
in real world scenario when dealing with class and objects we can think of statics as something that can change all instances of an object like a rename of a specie of an animal if that animal is newly discovered
 
I'm working on a legacy app (Who isn't?) and the use of functions instead of methods has made it an absolute pain to test and debug.
 
@MelvinProtacio You are saying that as if unit testing were some unimportant thingy that nobody does anyways.
 
@NikiC again very conclusive statement
:P
 
@MelvinProtacio I'll support him on it.
If you can't unit test it, you can't easily debug it either.
and that is a HUGE problem.
 
10:09 PM
@LeviMorrison not at all, you can do testing without unit testing
especially functional testing
 
@MelvinProtacio You missed the point. I am testing Singletons in my dev server. I cannot easily debug it.
 
@LeviMorrison singletons? that's easy if you know how to create atomic methods. when i do singletons only getInstance() is the static method and no complex method body
 
i wounder , how long will it take till 5.4.0 hits freebsd ports
 
after you get the instance, then it's easy because all other methods are non-static
 
@tereško A day or so probably
 
10:11 PM
that's a hope
 
@NikiC that's why I said OOP paradigm
 
freebsd ports are pretty much the fastest thing I've seen concerning releases.
 
i have been waiting for 5.4.x to make switch to freebsd's 9.x branch
 
Not like Debian or stuff like that ^^
 
lol
 
10:12 PM
i really don't get it when a bunch of people come up with too much generalization :(
 
does latest debian have 5.3 already in repositories ?
 
@tereško maybe. I wouldn't be so sure ^^
 
Ubuntu 11.10 Desktop is on PHP 5.3.6
 
@MelvinProtacio , there is no generalization when it comes to singletons ; they represent globals state .. that's it .. just like global variables
 
@MelvinProtacio Abstraction (=> generalization) is a programmer's instinct :)
 
10:14 PM
If you want a recent version of anything you should just compile it
 
@PeeHaa +1
 
@tereško no, what i mean is this: Which is why they are evil.
 
That's probably a reason why the freebsd ports work so well: You compile yourself :)
 
@PeeHaa , i will .. i just want it to be tied in with other compiled software that i have
 
@tereško in words not in architectural design LOL
@tereško also not all the time it is represented as state, it could also be a behavior because methods could also be static not just variables :D
 
10:16 PM
do you know what term "global state" means ?
 
@MelvinProtacio When you can't unit test something, that means you are breaking known standards for reliable, maintainable code.
Simple as that.
 
ok then you can't test the main method of all java/c# console or desktop applications
 
@ircmaxell hair splitting :P
 
@LeviMorrison , not that singletons are only thing that mangles the unittesting
 
because they all start from static void main()
:P
 
10:17 PM
@MelvinProtacio And you don't want to test that method.
 
@MelvinProtacio Yes, and it is a beef I have those languages as do many others. Although, you don't really need to test main . . . the testing should already be done.
 
Testing main() means testing everything at once, somehow, magically. But you want to test units.
4
 
@NikiC Hear, hear!
 
@NikiC but not at all times
because in the end, the users do not want to unit test everything
they do whitebox blackbox shallow testing whatever testing that is not unit test
 
users ?
 
10:18 PM
@MelvinProtacio Are users testing stuff now. Are you Google?
 
end-users
 
why would users test ANTHING ?!
 
Unit testing is up to the developer, not up to the user...
 
did i say anything?
 
@NikiC That's what I do
 
10:19 PM
still they are tests :P
 
@MelvinProtacio , maybe you should just stop , because you clearly have no idea what unittesting is
 
@tereško i know what unit testing is
 
@tereško Users test lots of stuff. It's called Beta testing
 
@ircmaxell :)
 
:-P
 
10:20 PM
but i'm not constrained to only unit testing
 
@tereško Debian is currently on PHP 5.3.10 according to DistroWatch.
 
@NikiC To quote from a conf. not so long ago "You don't need unit test if you have test units (users)"
 
@LeviMorrison , then its a recent change , since in last summer they were still using 5.2.x
 
why do majority of the developers think only for themselves.. i wanted to think like that if i am going to create a compiler but if i'm going to create an application targeting non-developers, i should somehow put myself in the position of my client
 
A lot of the guys at work have some file watcher thing that runs unit tests every time a file is saved
 
10:21 PM
@edorian Why is everybody against me :(
 
@NikiC , he never said that he agreed with that statement
 
@tereško They were on PHP 5.3.6 last fall. You just missed it :)
 
pff nite all. cya all tomorrow when I;m sober again :P
 
@PeeHaa cya!
 
that's not what i was told by hosting company , @LeviMorrison ... then again "the fix" was "our specialists are installing ubuntu to provide you the required php version"
 
10:24 PM
@tereško Ubuntu is still on 5.3.6. Debian itself is on latest.
 
my only point is to suggest or recommend not to use static but please don't generalize that static is evil. just like people, don't generalize it. i believe if some people are fag then you don't want to be called as such in a very general way.
 
but static IS evil
 
@MelvinProtacio People who think static methods aren't evil are fags.
 
@LeviMorrison , be serious please
 
10:24 PM
@MelvinProtacio Then we are simply disagreeing: I don't think that static is evil in some cases. I really do think that it is always evil.
 
(@MelvinProtacio no offense meant, I just had to)
 
@tereško: I find static least evil when used outside of static functions. (like referencing a child classes constants from a parent class), in that case it's actually damn helpful
 
@NikiC ok that's your point of view then don't use it even on singletons
 
@MelvinProtacio That's fine, cause @NikiC won't be making any Singletons.
(Probably)
(Most likely)
(Don't want to speak for him too much)
 
@LeviMorrison you should swear not to use that static keyword that's evil and if part of your code is evil then the entire code is evil
 
10:26 PM
@Leigh , :: isn't called "static operator" , but a "scope operator"
 
@tereško: I was talking about the static keyword
 
@MelvinProtacio Ugh... well, it might surprise you, but people here might actually tell you that Singletons are actually worse than just some static helper methods... :)
 
@MelvinProtacio , you should never use singletons , ever
 
not at all times you can use :: you normally use that for static if outside of the scope but if inside the scope of the class like when using parent or self, the method don't need to be static
well that's your point of view because majority of the people here are speaking on the web development point of view
 
gods below , this guy just does not listen , please read : kore-nordmann.de/blog/0103_static_considered_harmful.html
 
10:29 PM
but if you are considering shell scripts and other multithreaded applications you may find singletons as life saver
 
also
> Hidden Globals -- hidden globals have a well-defined access scope, and would include, for example, private 'static' variables in classes and 'static' variables in '.c' files and variables in anonymous namespaces in C++. This solution cages and localizes globals rather than tames them - you'll still get bitten when it comes to concurrency and modularization and testing/confinement, but at least all such problems will be localized and easy to repair, and there won't be linking problems.
 
@MelvinProtacio You are in a PHP chat room after all :)
 
and php can also be used as a console app
 
.. or that page is also from "web development point of view"
 
10:29 PM
@NikiC using php-cli
 
@tereško: I meant like this, did I miss the point? codepad.viper-7.com/Wwsobj
 
@MelvinProtacio So what? Why would you need a singleton for that?
 
@Leigh , that code is so wrong
 
I won't argue about singletons in multithreaded apps, as I simply have no idea about that (@LeviMorrison does :). I'm only arguing about singletons in PHP.
 
@tereško: Because?
 
10:31 PM
depends on your use-case, sometimes for management of files or monitoring or for management of config across all the threads, or sometimes, when a shared resource is needed
 
@Leigh because it breaks Liskov substitution principle
 
@MelvinProtacio I'm completely honest when I say that I have needed more than one FileSystem instance. That is NOT a good use case for a Singleton. :)
 
@MelvinProtacio If you are still talking about php-cli, then I really don't see why you need singletons for that. Just create the instances only once, and you're good.
 
@MelvinProtacio , please , go and read about dependency injections , and as for threads .. statics have no impact on it
 
@tereško: I don't know what that is, and the wikipedia page bored me in the first 10 words
 
10:33 PM
user image
2
 
lol
 
:D
 
this is shorter version
 
@tereško i can't explain it clearly but i really believe i can make my code more readable and i can save lots of memory if i were to use singleton for multithreaded app specially for db connections and shared resources
 
@MelvinProtacio Not in PHP you can't, not even CLI
 
10:34 PM
@tereško: I still don't see whats wrong with that code, I use something similar for my MongoDB activerecord/datamapper whatsits
 
@MelvinProtacio You can always instantiate something only once. You don't need a singleton to do that.
 
If we were talking C++ or Java, then yes, you can save some memory by using one instance, but it doesn't have to be a Singleton.
 
@LeviMorrison but i'm opposing in general and not in php because majority of the languages have static and you people are generalizing too much on the static is evil
:P
@NikiC you can instantiate only once but can you pass around that instance on all threads?
 
@MelvinProtacio You don't understand multi-threading, my friend.
 
@MelvinProtacio if you can't explain it clearly, then stop. think it through. trust us; we've each seen (and even made!) our share of singletons, and we can tell you from experience, they're not more readable, and if you manage to save any memory, the savings still won't outweigh the costs
 
10:36 PM
there is hell-lot thins he does not understand
 
@LeviMorrison ok, you all are geniuses and you know everything, i am the one who doesn't know anything
 
and i cannot believe that i am agreeing with @LeviMorrison
 
very conclusive and judgmental people
 
@tereško lol
 
@tereško lol
@tereško I cannot believe I agree with you :P
 
10:36 PM
lol
 
@MelvinProtacio I'm not trying to put you down. I just wrote a multi-threaded webserver in C. I do know what I'm talking about.
 
@MelvinProtacio See, this is one of the extraordinary situations where the whole PHP room agrees :D
 
i did in java and c#
 
well .. java runs in JVM , which lets you share the global state
 
I'm serious: if you can't pass one resource to multiple threads, you don't understand the basics of multi-threading.
 
10:37 PM
C++ (by default ) doesnt
 
well, it's your point of view, i don't have to bend your principles :P but for me, statics are most of the time evil.. not static is evil
 
and i am not even sure that you can run multiple threads in same JVM
 
you can
 
what is a singleton, but a static reference...? :P
 
@MelvinProtacio , yes , there is your point of view ... and then there channels consensus + stupid people like Martin Fowler and UncleBob
 
10:39 PM
@tereško yeah they are stupid and you are genius :P
 
so , you clearly must be right , and we are just picking on visionary maverick
 
@tereško send me a copy of your books so that i could learn something :P
 
@MelvinProtacio funny part is, even most of the stupid people agree. :P
but eh.
you do what you want.
 
If I was that bored.. I could feel a mock banner ad with "singletons in your area" coming on...
 
@cHao i like that most
 
10:41 PM
@MelvinProtacio btw, @tereško's Martin Fowler and UncleBob are stupid was sarcastic. Seems like you missed that ;)
 
we can't force you to build things a certain way. but we can certainly say "i told you so" when they collapse under their own weight.
 
@cHao , ya know , how there is always that one guy in development company, who insists that you should select DOM elements in javascript by rel attribute ( or something equally crazy ) ... ?
 
yep.
 
( the example what a real-life thing .. .last workplace )
 
@tereško Select by rel . . ? What an idea! I should revamp all my code right away!
 
10:43 PM
our framework here was built on some principle that objects should never be called directly or something. it's freaking bizarre
 
@tereško and there are those people who just conforms to the majority and doesn't even want to stand out and think differently
 
@cHao óÒ
 
hence , the "visionary maverick"
 
@MelvinProtacio A honest question: Do you use Mac/other Apple stuff? (Because of the "think different")
 
every class in the system (well, every non-trivial class) has a $vars, that basically serves as a dictionary of the object's fields
and of course, it's public
 
10:44 PM
@NikiC not at all
 
@MelvinProtacio Good :)
 
@NikiC android and linux FTW! :D
 
so instead of $obj->status or even $obj->getStatus(), we have $obj->vars->get('status') :P
 
@cHao there is a pattern for it :
2.6 Flypaper

The Flypaper Pattern is written by one designer and maintained by another. The designer maintaining the Flypaper Pattern finds herself stuck, and will likely perish before getting loose.
 
@MelvinProtacio I can assure you that I am not one of those people. @tereško and I have even argued about Singletons in the past. I have been around. I have thought for myself. I came up with: static methods are evil. So should you never use them? No, there is the situation where you are doing evil things . . .
 
10:45 PM
i'm working on getting rid of it
 
@LeviMorrison or probably the right thing
you are just looking in a different perspective
sometimes, people go to a position and stay there forever. they don't want to go around and view something in a different perspective. what if the evil is actually the good?
 
the right thing can still be evil :P
and you should still feel a little dirty when you do it
lol
 
@cHao LOL are you getting horny on that? :)) that's the only good thing that is evil at the same time :))
 
not quite what i was talking about.
perv.
lol
 
10:48 PM
:D
 
see, i can think of that funny line because i think in different perspectives :P
 
Empty exception handlers are evil. Anyone disagree?
 
@LeviMorrison yes :P
 
@MelvinProtacio , just because you do not know what LoD or SOLID means , does not make you right .. or "person with different perspective" .. it just makes you ignorant
 
@LeviMorrison maybe
 
10:50 PM
(You can interpret that "yes" either as "yes, they are evil" or "yes, I want to say otherwise". It's up to you ;)
 
@tereško as you say, you're the wise with lots of words :P
 
@MelvinProtacio him and just about everyone else that's said anything in the past hour :P
 
@NikiC Ambiguity removed.
 
@LeviMorrison But the ambiguity was intentional!
Heh, I think I'll merge some stuff to 5.4 now
Though, on the other hand I'm much too lazy...
 
@MelvinProtacio face it...you and all the other singleton junkies are on the wrong side of this argument. :)
 
10:53 PM
@cHao i can't accept that that is wrong and i don't have to argue on that
i rest my case but i'm still not convinced that statics are evil
 
you don't have to accept it. you're wrong whether you acknowledge it or not. :)
 
@MelvinProtacio It's Thursday evening (damn, I just thought it was Friday :(), so let's stop arguing. In a few months you'll come back and see what we meant anyways :P
 
it is evil if you don't know how to use it. any other thing in the world if you don't know how to use may be perceived as evil
it's friday here
:D
 
@MelvinProtacio 6 minutes to go
 
Evening ya all! :)
 
10:54 PM
it's 6:48AM here
 
@MelvinProtacio lol
why up so early (late?)?
 
@NikiC my shift is over, night work :D
 
it's evil even when you do know how to use it. sometimes it's the best answer, but it should make you feel bad each time you use it.
cause the more you use it, the higher the chance you're using it wrong.
 
Anyone here used eval?
 
@LeviMorrison yes
 
10:56 PM
@cHao it's helpful for me even if i rarely use it because i know when that time come that i need to use it
 
@NikiC Did you feel all nasty inside?
 
@LeviMorrison No.
 
@NikiC o.0
 
not in a while. only thing i'd use it for now is to generate classes on the fly
and i've never had occasion even to do that
 
eval() has always been utilized under very strong supervision and regulation. There was no possibility of fault.
 
10:58 PM
eval() is more evil then than static :P
 
No
eval() is much less evil.
 
because you can test it but you can get numerous results
 
a) It has some, rare, but still some, valid use cases. Static does not
 
not predictable results ALL the time
 
b) People realize that it is dangerous, but people don't realize how dangerous static is.
 
10:58 PM
eval() isn't as likely to cause unpredictable magic halfway across the app.
 
if you put a very complex code on eval then it will
 
no, it won't.
 
just like static methods
 
unless your design is fundamentally broken.
like, say, if you were using statics for everything.
 
ok, predictable but dangerous. that's really opposing statements
 
10:59 PM
:)
 
@MelvinProtacio Something can be predictably dangerous :P
 
well, that's all for the day, gotta leave :P
need some sleep
 
explosives are predictable but dangerous. but also really useful for when that pickle jar just refuses to open. :)
 
you also get some sleep
 
@MelvinProtacio night ;)
@cHao lol
Yeah, C4 is the solution to all our problems, right?
 
11:01 PM
yep. and if it doesn't solve your problem, you didn't use enough of it.
 
When in doubt, set it on fire
no , not star it
 
unstard
 
I've been writing raw XMLHttpRequests lately. I forgot how nice ajax libs are lol
 
@NikiC you used Twitter Bootstrap?
 
@NikiC , there is somewhere original for that line
 
11:05 PM
@Eugene no
 
Jul 18 '11 at 8:51, by edorian
When in doubt: Set it on fire
 
@Eugene I have. <3 for small projects.
 
I've just posted a small fix for a fluid layout with sticky footer.
There diff. samples, but thought to propose personal view on that.
 
11:28 PM
hello.. can someone please tell me the difference between $ and $$
 
@webgal in which context?
 
example like $var and $$var
in php
 
Ah, okay
$var is just a normal variable
$$var var is a variable variable
It means that it look up the variable with the name which is stored in $var.
You shouldn't use this ;)
 
oops sorry.. was just confused!
thank u so much!
 
np
 
11:33 PM
@NikiC . . . I shouldn't use variable variables?
;)
 
eh. i use variable variables. they're fun. :)
 
@LeviMorrison Only with prior written permission ;)
 
@NikiC What are you working atm?
 
@tereško thanks
 
eh. people are here cleaning
i should be gone
lol
 
11:35 PM
np
 
later
 
11:55 PM
My english skills have really suffered recently (moving to Switzerland). But I'm learning Swizz German, pieces of French and Italian, ext, some javascript and a new buiness language .. it should even out when the next series of dr. who comes out :)
 

« first day (502 days earlier)      last day (4446 days later) »