Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Taking the Sting Out of PHP 5 Programming

Posted by ScuttleMonkey on Sun Jan 22, 2006 04:34 PM
from the agile-web-development dept.
bfioca writes "Where are the all-in-one PHP frameworks that make building well-factored and maintainable applications as easy as building simple sites? O'Reilly ONLamp's recent article Simplify PHP Development with WASP shows how to make a simple database-backed site with WASP in just a few lines of code. Other PHP 5 frameworks such as symfony and PRADO have been getting a lot of recent attention as well."
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • Drupal? (Score:4, Informative)

    by rjung2k (576317) on Sunday January 22 2006, @04:37PM (#14534522) Homepage
    I don't claim to be a web architecture guru, but what's wrong with Drupal? [drupal.org] Open source, PHP 5-friendly, and does everything from vanity sites to corporate sites.
    • Re:Drupal? (Score:4, Interesting)

      by albalbo (33890) on Sunday January 22 2006, @04:45PM (#14534550) Homepage
      I think you have to hack it to get it to work multisite? Also, the URLs are pretty horrible.

      That's not to say stuff like PRADO is any good either - I used it for a commercial site, and it's a pain to maintain. It's an ASP-style component system, and doesn't fit the web model - if you want to do 'Ajax', for example, you're screwed.

      symfony looks interesting, though, and much more lightweight.
      • I looked at the symfony site. Once I got to the HTML templates with embedded PHP, I closed the window. If I want to combine code with HTML, I'll use JSP or ASP - the component model and syntax are cleaner.

      • Re:Drupal? (Score:4, Informative)

        by truthsearch (249536) on Sunday January 22 2006, @06:01PM (#14534894) Homepage Journal
        No, it takes no hacking to work multisite. I'm running 3 sites on one code base right now. The URLs are very short. There's nothing horrible about them. And if you turn on the right module you can automatically link to /title/page+title. Learn about an app before complaining about it.
      • Re:Drupal? (Score:5, Informative)

        by kbahey (102895) on Sunday January 22 2006, @09:39PM (#14535850) Homepage
        Disclaimer: I am a Drupal community member and developer.

        I think you have to hack it to get it to work multisite?


        Nope.

        Drupal has multi site out of the box, and has been like that for years. For some 18 months, I ran 4 different domain out of the same code base and the same database even (with database prefixes).

        Also, the URLs are pretty horrible.


        Drupal boasts "clean URLs" out of the box as well. This means that urls do not have to be www.example.com?q=node/123 but rather www.example.com/node/123 (this requires mod_rewrite).

        Moreover, Drupal has out of the box the path module which allows you to alias any page to any URL you like. There is also a contributed module (pathauto) that makes this totally automated.

        Check my web site for examples (all URLs are aliased).
        • Personally, I consider "www.example.com/node/123" to be an incredibly nasty URL. It's completely arbitrary and holds no semantics. Not knocking Drupal in particular, just that a lot of people seem to think that the lack of a question mark makes a URL "clean". If node 123 is a blog post about slashdot, it should be something like "www.example.com/blog/slashdot-dupes-article-nine t een-times". I have a homegrown framework that does stuff like this automatically; it's not that hard.

          My only experience with Drupa
    • Drupal is a content management framework, these are application frameworks. In other words Drupal is the application and once you've installed it and whatever modules you need all you have to do is input your content while an application framework requires you to use it to write an application before you can think of content. Drupal is very useful if you want to do what it or one of its modules already does but it is less flexible for custom applications.
        • You're right of course, Drupal is extremely flexible. But if you want to write a custom app that nobody's written before as a module you still have to get your hands dirty and write that module from scratch for Drupal's API. The idea of an application framework is to provide a mechanism to simplify the development of new applications rather than just an existing application with an API to plug your coded-from-scratch application into.

          Both types of approach have their advantages and disadvantages. Drupal's

    • Re:Drupal? (Score:2, Informative)

      Looking at the frequency of attempted exploits for drupal holes on my website there is a lot wrong with it (I do not even have PHP installed). At least from security perspective.
      • So portscans of my Macs prove there are many Mac exploits? Drupal has had just a few very specific security issues, just like any other internet-based app. There are many thousands of drupal-based sites, so evil-doers have written scripts to hunt down and take advantage of those that haven't upgraded. Nothing here uncommon to any other system. My drupal referrer logs fill with thousands to requests for IIS-specific files, yet I've never run a site on Windows.
      • Re:Drupal? (Score:3, Informative)

        You probably saw scans for the old versions of xmlrpc.

        This was a third party library that we incorporated in Drupal a while back to do some remote stuff (e.g. remote blogging, ...etc.)

        If you do not use third party client apps to post, you can delete the file xmplrpc.php altogether if you wish.

        When it was discovered that it has security flaws, we replaced it completely.

        Newer versions are as secure as they can be.

    • We actually tested out Drupal for possibly doing a customer's portal site last year. It had a lot of features and was quick to set up, but it was a nightmare to customize it beyond anything simple. I think it's a great product for non-techies to get something up with, but it's too restrictive for any complex business logic needs.
      • If you want to do anything beyond things that relate directly to content management then Drupal's not a great option. In theory you could strip out most of the module and use it as an app framework, but you won't get gaining too much over writing your own foundation. Drupal is mostly specific to CMS needs.
      • Couldn't agree more.

        In the long run, I would rather write my own CMS than use someone elses. When I first learned PHP, I wrote my own system. Now that I'm older and less stupid, I realize how many security holes where in the application, but in the 3 years I used it, not one hiccup because it wasn't documented anywhere.

        I messed around with Mambo (sorta, kinda, like Drupal) and really didn't like it. I hacked it a little to do what I wanted, but found it wasn't for me.

        At the same time, I'm a little at a loss
  • Bogus (Score:4, Insightful)

    by Anonymous Coward on Sunday January 22 2006, @04:59PM (#14534612)
    Give me a break, depending on such things is terribly bad for maintainable code. Exactly the opposite of the billing given above. Will code written with it be compatible with PHP 6? How long after PHP 6's release will such tools be made compatible? If you need tools to simplify php coding, you might as well just forget it.

    If you want a quality product, there are no shortcuts. There is no such thing as a free lunch.

    A big thumbsdown on this kind of crap. "Sting" to PHP 5 programming? Get real.
    • Re:Bogus (Score:4, Insightful)

      by afd8856 (700296) on Sunday January 22 2006, @05:20PM (#14534702) Homepage
      You are either ignorant to what a real open source framework would represent (limit code reinvention, benefit from community effort, etc) or are not in the target group of such a framework (maybe you work for a big company that has a large programming team, who knows).
      Either way, I can tell you that, from my personal experience, learning and adopting a framework in your work can have a lot of benefits, for me, as a small custom business solutions provider.
  • by aphexddb (87610) on Sunday January 22 2006, @05:01PM (#14534621) Homepage Journal
    JASPF (Just another silly PHP framework)

    If you are looking for quick app development and you aren't joe home user making a website you are going to need something thats based off a model -> view -> controller architecture. Symphony does this, so does the cake [cakephp.org] framework.
  • by afernie (915570) <<ten.estoc> <ta> <einrefa>> on Sunday January 22 2006, @05:42PM (#14534796) Homepage
    Sting has had his finger in entirely too many pies since The Police broke up...
  • Zope is supposed to be some great product. But, when I do a search for Zope on dice.com, I might get one hit.

    I get the feeling these php frameworks might be even more obscure.

    Now, compare that to a product like ColdFusion.

    I don't use any of those products. But, I've got to wonder.

  • by webwright (910240) on Sunday January 22 2006, @07:17PM (#14535222)
    I tear my eyes out everytime someone calls a framework a "shortcut". Usually they follow it by "There's no substitute for good coders writing good code." The business reality is that most coders are not exceptional, and some are pretty lousy. You can spend all of your budget on human resources finding epic-quality coders (and then scratch some more to come up with their epic-salaries) or you can do what the rest of the world does-- get the best programmers they can find and afford. A framework helps un-exceptional coders write better (and more consistent/maintainable) code. This arguments seems akin to saying "forget word processors! Just get someone who can make Vi or Emacs dance and turn 'em loose." It seems to me that the evolution of software is pretty much the act of layering increasingly-smart frameworks on top of machine language to allow high quality results more accessible to more people.
  • the fact that because of all of the php-4 compliant code that it breaks, few ISPs doing web hosting services are in any hurry to upgrade because too many customers simply don't have the time to rewrite their applications to be compliant with php-5, much less take advantage of any or all of the new features.

    this is hitting me hard as i'm trying to put together an xml-intensive app and am stuck using home-grown open-source XML parsing and generating packages, mostly unfinished, that won't be finished because they've been superseeded by the php5 libraries that i can't use yet.

    • this is hitting me hard as i'm trying to put together an xml-intensive app and am stuck using home-grown open-source XML parsing and generating packages, mostly unfinished, that won't be finished because they've been superseeded by the php5 libraries that i can't use yet.


      This is exactly why I'm switching to Ruby and Ruby on Rails. If I have to rewrite the whole applicatin, I'm going to switch to something better.
  • I've found that the best way to build a framework is to figure out the style of the company/organization in question, and then slowly build up a framework that fits over time. And, don't make your code married to the framework, just date it. Leave ways to code around it if it does not fit a particular situation.

    For example, here is a simple set of functions to format a typical data entry form with title on the left side and input box/item on the right. If you want to code HTML directly instead of use the he
    • I think you're right. I've been around the loop a few times now, and I've examined any number of frameworks. I've used a few, but more often, I've rolled my own.

      The big advantage of frameworks is they make the things the designer wanted to make easy, easy. The problem with frameworks is they make things the designer never thought of or never wanted either harder than it would be to do it directly, harder than it should be, or, in the worst cases, flat out impossible.

      I've found that for larger projects, the
    • Let me get this right..
      You have a low-enough UID to supposedly be somewhat knowledgeable, yet you advocate writing frameworks and not marrying the code to the framework..?
      Then why the hell are you mixing the View in with the Model (and most likely Controller too?)

      Honestly, it's people like you who give PHP a really bad name.
      Any sane person would AT LEAST be using a templating system like Smarty [php.net].
  • I know PHP has matured as a technology when people feel it's painful to use.

    I realize that programming languages are supposed to be painful, but for me, PHP 3 made programming fun again. As a sysadmin sort it was remarkable to be coding and enjoying it. This seemed to be true no matter whether it was a 10-line hack to get something done on a website, or a top-down structured project.

    And you know when then turnaround happened? When PHP stopped being fun? I have an opinion. I think it coincided with the
    • I know PHP has matured as a technology when people feel it's painful to use.

      Are you KIDDING?!?!?

      15 years ago, I took some college classes on programming. Then, the "thing to do" for intro programming was Pascal - with all the super-strict data types, memory allocation, linked lists, and compiling crap. I hated it - somebody would type a number 3, I'd add 5 to it, and get 56. It was painful to get an input form that somebody could type some stuff in.

      Yes, I know about the ASCII char table, and it seems just
    • Global variables are not harmful at all. The misuse of global variables is. This is a very common misconception shared by most new PHP programmers who read the wrong material on the web, or listen to other inexperienced PHP programmers for security advice.

      Now, I'm going to take a leap here, and assume you're actually talking about the register_globals directive, and not global variables in general. From the site: [..]This page will explain how one can write insecure code with this directive but keep in [php.net]

  • Frameworks are fantastic beasts. I fear them yet I adore them at the same time. I do this with anything that I didn't write. Indeed, I moreso do this with anything that I do write!

    To the point: I see a lot of people bashing the concept of frameworks and stating that you shouldn't use frameworks because it's just being lazy or that frameworks are a bad thing. I believe this negativity comes from inexperience and ignorance.

    I agree, these are biting words, but consider the fact that the arguments used to suppo
  • I'm disappointed that Slashdot editors are allowing more and more people to use /. simply as a means for self-promotion. Case in point: here we have a posting by Brian Fioca, referencing an article by Brian Fioca, which talks about a framework by Brian Fioca.

    And I wonder why I'm always so surprised that people complain about bias in the media...
  • Of course PHP is somewhat quirky. We all know that. I'd also rather do all my stuff with Python, Zope and Django. But it happens to be that everything is run in PHP nowadays and lots of clients want PHP modifications or an extension to one of the 10 million PHP/MySQL CMSes out there.

    Luckily there are neat tools that make professional PHP project work very easy and fun:

    PHPTAL (http://phptal.motion-twin.com/ [motion-twin.com]) is a PHP based redoo of Zopes TAL (Template Attribute Language) - the best Templating concept ever. M
    • Currently I'd discount Ruby from any sizable web development as it's still very much a minority language and it'd be practically impossible, or outragously expensive, to hire a Ruby developer. If your development team or company vanish (run over by a bus, move to Australia, whatever) you need to be able to get someone else who can come in and maintain the code quickly. That just wouldn't happen for a site written in Ruby. Of course, it'd be fine for any small development like a homepage or a blog .. but PHP
      • considering the forum in posting, I wouldn't be surprised if I was modded down, buut I signed up on slashdot finally just to make this my first post as a reply

        while I agree its a niche language now, it won't be long I imagine till ruby ges more mainstream. The main thing holding ruby back so far has been a lack of books on the subject. hoowever, that is quickly changing and already ruby is more popular than python in japan.

        caveat emptor: I've only been dabbeling in ruby for the past week or so

        anyway, so far
      • There are a lot more Ruby developers than Ruby jobs.

        And they tend to be better developers too, those that enjoy hacking and being productive.
      • If your programming immune system immediately rejects any language that is more mindbending than the simple if/while/for/switch/function constructs of C-like languages, you will forever be a pretty naive programmer.

        As an example, JavaScript has OO, but no classes! How do you suppose that is? It's prototype-based OO. It's an interesting alternative to class-based OO. Well-rounded programmers can pick up a concept like that rapidly -- they don't just say "this is too much of a hassle."

        The basics in Ruby a
        • LOL... You actually bothered to learn all those horribly inconsistent functions? is_null, isset? strtolower, hex2bin? strip_tags, stripslashes? strpos($haystack, $needle), preg_match($needle, $haystack)? Or are you accepting that looking at the docs every half an hour is normal?

          With a manual as clear, conside and accessable as PHP's, who cares? There are hundreds of functions in the 'core', but not all of those in the PHP manual are compiled in on most setup's. Who really learns the libraries and function

          • With a manual as clear, conside and accessable as PHP's, who cares?

            I haven't looked at the PHP docs for a while now, but one Perl programmer made up a table of PHP functions [tnx.nl] that even PHP programmers find useful! That page also has a *lot* of good comparisons to Perl. It's amazing how much baggage PHP has accumulated over the years.

          • This is the one point I have to agree with. PHP has great documentation (with loads of comments). I had to learn Python in school and to this day I still can't browse around the documentation properly without getting frustrated. Python is a great language, it enforces great structure and readability, but the docs for it are incredibly annoying.
    • Maybe something like http://developers.slashdot.org/article.pl?sid=02/1 2/19/1740205&tid=156 [slashdot.org] mentionened on /. would appeal to you, although I wouldn't recommend it (well, people like me usually get to rewrite stuff like it)
    • Re:I need PHP (Score:5, Insightful)

      by killjoe (766577) on Sunday January 22 2006, @05:57PM (#14534870)
      So let me get this straight. You don't know PHP, you don't want to learn PHP but you want use PHP to build some web apps. Did I get that right?

      Seems like a fools errand to me. I predict you will fail miserably and your web site will be hacked within 24 hours of you putting it up.

      You really should learn the language that you are trying to build web sites in.
        • Look, unless you are able to at least glue these components with SOME code, you aren't going to get anywhere. Just forget about it, because such an elaborate GUI does NOT exist. GUI isn't your solution either, since you don't understand the fundamentals of the problems you are trying to solve. Sorry, but you're either going to have to hit the books, or pay/convince someone else to do this for you.
          • I think I understand the fundamentals, I just don't know PHP.. I can design a database, and I can understand the kind of interaction there needs to be between the tables. Imagine a GUI, first step design a database, with tables and relations. NExt step, you can define some tables as some standard ones, like "username" or "password". Then choose the actions that the PHP pages will do and include, for example the username and password box. And then define on the "logged-in" php page what can happen from whic
            • Macromedia/Adobe Dreamweaver has *limited* support for what you describe (table views [kind of], forms, db updates, page layout, and maybe cookies). You still won't be able to design digg.com with zero understanding of how PHP and web apps work though, regardless of how good the tool is.

              Also, your understanding of databases and interfaces needs to be more sophisticated than building a contact manager in MS Access...
    • Why don't you learn PHP?

      If you know some programming already (even BASIC will suffice), then you can pick up PHP. If you know C++, even better. If you don't know programming, step away from the PHP and go learn something that won't let people hack your websites (and even if you don't get hacked, will allow your website to keep running in the meanwhile).

      If you don't know HTML...uh...make sure you're comfortable with it before starting, because it's almost impossible to make a useful webpage if you can progra
    • What would be even better is, if the framework would be the refined by-product of a large scale project.
      Most frameworks are built from some sort of ideology without any real need; they are solutions in search of a problem.
    • Well said, plus the example is just replacing one type of language for another. If you're going to embed code within HTML why not just use PHP? With PHP you don't have to learn some new scripting language to put in the HTML and you don't have additional processing overhead for the framework to intereprete the HTML files. It's just putting a scripted language on top of a scripted language. Why do it?