Creating a WTF



  • I'm just wondering if it's only me who sometimes gets the feeling that one day in the not-too-distant future the current you're currently working on will be featured on this site? For example, I'm currently starting out a new web application and I'm trying out some new (new to me) class methodologies - eg: an incredibly abstracted parent class which defines virtually all of the objects from the database, and through a consistent naming scheme, it automatically creates the linkages between objects. For now (the very early stages of development), all tests have shown it to be working very well, but I just have this niggling suspicion that I'm going to create something like what I read on here every day.

    Does anyone have any advice? How will I know if the currently sweet setup turns sour?



  • @nickf said:

    I'm just wondering if it's only me who sometimes gets the feeling that one day in the not-too-distant future the current you're currently working on will be featured on this site? For example, I'm currently starting out a new web application and I'm trying out some new (new to me) class methodologies - eg: an incredibly abstracted parent class which defines virtually all of the objects from the database, and through a consistent naming scheme, it automatically creates the linkages between objects. For now (the very early stages of development), all tests have shown it to be working very well, but I just have this niggling suspicion that I'm going to create something like what I read on here every day.

    Does anyone have any advice? How will I know if the currently sweet setup turns sour?

    I propose you take a short look at Ruby on Rails, if you haven't done so. What you describe sounds like the "convention over configuration" policy of RoR. Since RoR apparently works and has many fans, chances are that your project will work out well, too.

    As for the initial question, the only reason my work is not constantly on the front page is because I want to keep my job, for now at least. ;-)



  • Yeah, it was reading about how RoR works that sort of inspired me. I haven't really explored it fully, and please feel free to correct me, but from what I read Ruby doesn't sound as fully featured or powerful as PHP, which is what I know, so I decided to stick to PHP.



  • @nickf said:

    Yeah, it was reading about how RoR works that sort of inspired me. I haven't really explored it fully, and please feel free to correct me, but from what I read Ruby doesn't sound as fully featured or powerful as PHP, which is what I know, so I decided to stick to PHP.

    Them's fightin' words!  Perhaps you meant RoR isn't as fully featured or powerful for web applications as PHP, which is at least a potentially reasonable debate.  But if we're just comparing languages, then you've crossed over into crazy land.  PHP is an incredibly popular disaster masquerading as a language.  Ruby is perhaps not really suited for software development either, but it's so much more elegant it's like Queen Elizabeth to PHP's pile of dog vomit.



  • @nickf said:

    Yeah, it was reading about how RoR works that sort of inspired me. I haven't really explored it fully, and please feel free to correct me, but from what I read Ruby doesn't sound as fully featured or powerful as PHP, which is what I know, so I decided to stick to PHP.

    I haven't done much in Ruby yet (unfortunately, not part of my current job) but from what I know, it's by far a better designed language than PHP will ever be. Of course it's perfectly possible that PHP currently offers more bindings to usefull libs, but I doubt even that.



  • PHP is (at least where i live) á de facto standard, and ruby and also python for that matter are still small players in the web application game.

    This says absolutely nothing about which is better, but it does mean that problems will be more often already solved for php, while ruby may still have trouble with it, because there is no one that needs that feature at the moment.
    However since they both have come a long way,  i'm guessing that if there are unsolvable problems at the moment they will be pretty specific.

     And although i haven't read more then the poignant guide to ruby, i'm willing to bet that php indeed has bindings to far more libraries then ruby, simply because php is used more, and quite often inappropriately even.  I mean php has GTK bindings, i mean WTF?  why would any sane person write a desktop application in PHP.




  • if you realize your coding style in ruby or php (or whatever you decide to use) looks exactly like the way you code C/C++ (or whatever your native language is) then you may be doing something wrong.



  • @stratos said:

    á de facto standard

    I am going to shove that acute accent up your nose.



  • @stratos said:

    PHP is (at least where i live) á de facto standard, and ruby and also python for that matter are still small players in the web application game.

    Everywhere else, too.  RoR isn't even close to giving anybody a run for their money.  Hell, they're just now getting the thing to run at reasonable speeds.

    This says absolutely nothing about which is better, but it does mean that problems will be more often already solved for php, while ruby may still have trouble with it, because there is no one that needs that feature at the moment.
    However since they both have come a long way,  i'm guessing that if there are unsolvable problems at the moment they will be pretty specific.

    The gap is closing, mostly because Ruby and Python have reached the point where they have enough presence to justify adding bindings for them if you are creating them for PHP anyway.  Unfortunately, few projects are going to the extremes of wxwidgets, which has created a layer on top of the Ruby bindings that follows the Ruby conventions.

    And although i haven't read more then the poignant guide to ruby, i'm willing to bet that php indeed has bindings to far more libraries then ruby, simply because php is used more, and quite often inappropriately even.  I mean php has GTK bindings, i mean WTF?  why would any sane person write a desktop application in PHP.

    There are plenty of insane people out there, and they have no qualms about such a crazy system.
     



  • And although i haven't read more then the poignant guide to ruby, i'm willing to bet that php indeed has bindings to far more libraries then ruby, simply because php is used more, and quite often inappropriately even.  I mean php has GTK bindings, i mean WTF?  why would any sane person write a desktop application in PHP.

    There are plenty of insane people out there, and they have no qualms about such a crazy system.
     


    Perl, ruby, python and lua also have gtk bindings. I really don't know why you're chewing PHP out for having them. Generally if you want to develop a fast GTK app then they are useful, PHP-GTK's documentation was alot better than perl-gtk's IMO, those are the only two I've tried though.



  • @Lingerance said:

    And although i haven't read more then the poignant guide to ruby, i'm willing to bet that php indeed has bindings to far more libraries then ruby, simply because php is used more, and quite often inappropriately even.  I mean php has GTK bindings, i mean WTF?  why would any sane person write a desktop application in PHP.

    There are plenty of insane people out there, and they have no qualms about such a crazy system.
     


    Perl, ruby, python and lua also have gtk bindings. I really don't know why you're chewing PHP out for having them. Generally if you want to develop a fast GTK app then they are useful, PHP-GTK's documentation was alot better than perl-gtk's IMO, those are the only two I've tried though.

     

    Perhaps, but most applications have a state for longer then a split second. since 99.99% of al php code isn't meant to run longer then that, i would consider building a desktop application with php at the very least risky, good documentation or not.

    -edit-

    @assufield, i was trying to point out that i wasn't trying to say that php is the only de facto standard. 



  • @stratos said:

    @assufield, i was trying to point out that i wasn't trying to say that php is the only de facto standard. 

    English isn't Dutch. :)

    It's just a language, or rather, just one language.



  • crap, never mind then :)



  • @stratos said:

    Perhaps, but most applications have a state for longer then a split second. since 99.99% of al php code isn't meant to run longer then that, i would consider building a desktop application with php at the very least risky, good documentation or not.

    well yeah, but that's only because 99.99% of php code doesn't use GTK and isn't meant to be run for more than a split second. If you [i]wanted[/i] to, then it'd be quite possible, and no more dangerous/risky than you make it.

    I don't really understand the massive hate on PHP in these forums. Is it one of those things like VB which isn't necessarily a WTF in itself, but because the barriers to entry are so low, the quality of developers it attracts is also so low?



  • @nickf said:

    I don't really understand the massive hate on PHP in these forums. Is it one of those things like VB which isn't necessarily a WTF in itself, but because the barriers to entry are so low, the quality of developers it attracts is also so low?

    There's that, and the fact that PHP is necessarily a WTF in itself.

    Search forum for arguments and links to pages with more arguments.



  • @nickf said:

    @stratos said:
    Perhaps, but most applications have a state for longer then a split second. since 99.99% of al php code isn't meant to run longer then that, i would consider building a desktop application with php at the very least risky, good documentation or not.

    well yeah, but that's only because 99.99% of php code doesn't use GTK and isn't meant to be run for more than a split second. If you [i]wanted[/i] to, then it'd be quite possible, and no more dangerous/risky than you make it.

    I don't really understand the massive hate on PHP in these forums. Is it one of those things like VB which isn't necessarily a WTF in itself, but because the barriers to entry are so low, the quality of developers it attracts is also so low?

    I don't necessarily think php is a wtf, i use it on daily basis for my job. However i like to use the right tool for the right job. And since writing desktop applications isn't really the core strength of PHP, and largely untested, i would discourage using it as such. Because the chance that you will find obscure problems when using php for desktop applications is pretty high. I would think for instance that searching for memory leaks isn't a big priority in php land, because it doesn't matter that function such and such leaks massive memory over the course of a few hour, since the application won't be alive longer then a split second.

    Now perhaps PHP is a massively great language to use for desktop applications, but i rather not be the first one to find out. I much rather will use python or some other language that has already proven that it can be easily used to create desktop applications.

    Of course all this is spoken fro the assumption that it's used for "work". If its a hobby project or just a proof of concept idea it doesn't really matter.
     



  • @stratos said:

    I don't necessarily think php is a wtf, i use it on daily basis for my job. However i like to use the right tool for the right job. And since writing desktop applications isn't really the core strength of PHP, and largely untested, i would discourage using it as such. Because the chance that you will find obscure problems when using php for desktop applications is pretty high. I would think for instance that searching for memory leaks isn't a big priority in php land, because it doesn't matter that function such and such leaks massive memory over the course of a few hour, since the application won't be alive longer then a split second.

    PHP does not live for a split second, unless you run it as CGI, and it usualy does not in Apache. I know some version of PHP4 had a memory leak with images (GD library) where not all memory was freed when images where not cleanly destroyed by the script. Because of that almost all hosts had the image library turned off, else they had Apaches running out of memory everywhere.

    But I agree on the right tool for the right job. PHP is not ment as a desktop app language. VB might be a horrible monster of a language (VB6 that is, not .NET, which is just Java with Basic syntax) but it is SO fast to make something simple in, fast to debug, and almost free from 'wierd' crashes.

     

    (Note: I do not use php professionaly, just for hobby. VB and C on the other hand...) 



  • Your web app design doesn't sound like a WTF, but the way you're going about it is heading there.

    If you're worried about things turning sour, then your best strategy would be to exploit an existing solution. I'm working with RoR at the moment, and ActiveRecord is something you may as well not rewrite.

    Performance issues in rails are mainly down to the performance of ruby; a language where speed has traditionally been sacrificed in favour of incredible flexibility (ruby's metaprogramming features are an example), and is something that is apparently being worked on heavily for ruby 2.0. There are ways to mitigate these problems (caching, throwing hardware at the problem, ignoring it since most sites don't generate enough traffic to make it a problem).

    Similar ORM features exist for python, .NET languages, etc. Your best strategy would probably be to find an existing framework, and exploit it. If you later want to develop your own framework, all the best to you, but you'd at least do well to have some experience with the current breeds first.



  • @drinkingbird said:

    Your web app design doesn't sound like a WTF, but the way you're going about it is heading there.
     

    You apparently didn't notice that you were resurrecting a four month old thread. Your advice is way too late. 



  • @drinkingbird said:

    ...

     


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.