Please create an account to participate in the Slashdot moderation system



Forgot your password?
Close
binspam dupe notthebest offtopic slownewsday stale stupid fresh funny insightful interesting maybe offtopic flamebait troll redundant overrated insightful interesting informative funny underrated descriptive typo dupe error
458710 story
Programming

TIOBE Declares Python the Programming Language of 2007 166

Posted by timothy from the welcome-to-the-annual-proggie-awards dept.
The TIOBE Programming Community Index has declared Python as the Programming Language of 2007 due to a 58% surge in its popularity rating during the year, making it now the sixth most popular programming language and finally surpassing Perl. They also assert that Python has become the "defacto glue language," being "especially beloved by system administrators and build managers."
This discussion has been archived. No new comments can be posted.

IOBE Declares Python the Programming Language of 2007

Comments Filter:
  • by Anonymous Coward writes: on Wednesday January 09, 2008 @02:11PM (#21972262)
    Oh, wait. A bit late for that isn't it?

  • by Burz ( 138833 ) writes: on Wednesday January 09, 2008 @02:15PM (#21972306) Homepage Journal
    ...frameworks and apps written in Python. It got off to a good early start with Zope, but the hype over PHP sadly swamped all else.
  • by slyn ( 1111419 ) writes: <ozzietheowl@gmail.com> on Wednesday January 09, 2008 @02:16PM (#21972338)
    Two oblig python links:

    Python @ xkcd [xkcd.com]

    and

    Python @ Bash.org [bash.org]

    HHSSSHSHSSS
  • by pembo13 ( 770295 ) writes: on Wednesday January 09, 2008 @02:17PM (#21972354) Homepage
    I would just like to say thank you as I accept this award on behalf of my fellow Python brothers. We all know that God created the universe with Python, but allowed the non believers to think that it was Perl or LISP so that they would not commit seppuku.
  • by Jack9 ( 11421 ) writes: on Wednesday January 09, 2008 @02:35PM (#21972718)
    OPED:
    Wouldn't call it the year of Python since there's nothing special that's happened with Python this year. Heard a LOT more hype about Ruby (f that).
    Tried the twisted framework. Garbage.
    Frameworks can't be written successfully in a baby language like PHP, Python frameworks aren't gonna magically appear.

    I'll take PHP, Java for backend and Flex/Actionscript for frontend.
    • by mstahl ( 701501 ) writes: <marrrrrk@gmail. c o m> on Wednesday January 09, 2008 @03:01PM (#21973308) Homepage Journal

      PHP, Java for backend and Flex/Actionscript for frontend

      Them's fightin' words, sir!

      But seriously.... I've just gotten so tired of PHP in the past two years, and Ruby was such a great improvement to it. I used Python before PHP and my only complaint at the time was that it really was more trouble than it was worth at the time to write whole web applications in Python. You could, but languages like PHP were made for the web, so it got superseded. Once upon a time I wrote a few games in Python using PyGame and PyOpenGL though and had nothing but great experiences with that. I wouldn't call Ruby a cure-all, but it's pretty flexible and really pleasant to use for a wide variety of projects.

      That being said, I think that your post really misses the fact that for every task there's usually one or two programming languages or frameworks that would be "best" for that task. While PHP and Java may work as a backend for you, many of my projects are almost completely perfect for a Ruby on Rails implementation or specifically require functionality that exists nowhere else. Meanwhile Actionscript implies Flash, and I only have a couple of things brewing right now where Flash is even an option, much less advisable. I'm not trying to slam you here; I'm just saying that like anything else your mileage may vary.

      Also, python's supposedly getting tail recursion and some other tasty features soon. I might be tempted to pick it back up if it can surpass ruby in its efficiency that way.

    • by AlXtreme ( 223728 ) writes: on Wednesday January 09, 2008 @06:47PM (#21976948) Homepage Journal

      Frameworks can't be written successfully in a baby language like PHP, Python frameworks aren't gonna magically appear.

      Like Django [djangoproject.com], perhaps?

      I'm with you on twisted; you nead to twist your head around it. Python has indeed had a relatively quiet year. Django on the other hand seems to be doing things just right and leaves the programmer with the final say in how he wants to structure his application. I've been using it for various projects over the last 1.5 years: it has never let me down and shortened development time considerably, leading to very happy clients.

      Given I charge by the hour, I might have to pick up Java to crank up those invoices...
      • by NewbieProgrammerMan ( 558327 ) writes: on Wednesday January 09, 2008 @10:55PM (#21979518)

        I'm with you on twisted; you nead to twist your head around it. ... Django on the other hand...

        As I understand it, Twisted is more of a framework for writing frameworks; it's not meant to provide the sort of higher-level stuff that people generally expect when they say "web framework." If I'm wrong about that, somebody please correct me.

        • by AlXtreme ( 223728 ) writes: on Thursday January 10, 2008 @05:35PM (#21991790) Homepage Journal

          As I understand it, Twisted is more of a framework for writing frameworks; it's not meant to provide the sort of higher-level stuff that people generally expect when they say "web framework." If I'm wrong about that, somebody please correct me.

          Yes and no. I must admit having to look it up [wikipedia.org], as it has been a while I looked at twisted. Twisted provides a framework for networked applications, be them client-side or server-side. They have their own Web-oriented framework called TwistedWeb, which can be used to write a web-facing server. So yes, it's a (networking) framework with which you can write a framework, however not generally a 'web framework' like in the usual sense.

          If you want to make your own (web) server in python, Twisted is a valid choice. If you want to make a web application, Django is a valid choice. There is little overlap, besides the fact that they both are python libraries.
  • TIOBE? (Score:4, Funny)

    by LMacG ( 118321 ) writes: on Wednesday January 09, 2008 @02:45PM (#21972928) Journal
    I plugged that into Wikipedia and I got redirected to The Importance of Being Earnest.

    The linked page in the summary doesn't give any clues. Do we get to make up our own meanings? How about The Infernal Order of Bastard Evildoers? Seriously, who are these herpephilic people?
  • by Haeleth ( 414428 ) writes: on Wednesday January 09, 2008 @02:47PM (#21972970) Journal
    It all depends how you count it. For example, here [indeed.com] is a comparison based on available jobs that shows Perl still vastly in the lead, followed by PHP, with Python and Ruby both trailing by a long way. I'm sure there are other figures that prove that PHP is the biggest language, and yet others that show Ruby is growing fastest, etc. etc. etc.

    TIOBE's methodology is distinctly suspect, too. Looking at search engine result counts - which are estimates, and in the case of Google are well documented to be inaccurate - is hardly scientific. And they're using YouTube as one of their search engines?! How is that going to produce meaningful figures?

    (Yeah, I'm still bitter that ML is so unpopular. But you can't call me a Perl fanboy, because I dislike all "dynamic" programming languages equally, and program largely in C++ and OCaml.)
    • by DragonWriter ( 970822 ) writes: on Wednesday January 09, 2008 @03:01PM (#21973318)

      TIOBE's methodology is distinctly suspect, too. Looking at search engine result counts - which are estimates, and in the case of Google are well documented to be inaccurate - is hardly scientific. And they're using YouTube as one of their search engines?! How is that going to produce meaningful figures?


      Their measuring the popularity of language foo by "Programming foo" hits, with some special case modifications to deal with particular languages where that kind of query would be problematic. Its not at all a reliable metric, but among the quick-and-dirty language-comparison metrics, it doesn't seem to be notably bad (not, again, that its any good, just that whole pack is really bad and this seems no worse than average.)

      Using YouTube makes some sense given the kind of measure they are doing, since "Programming foo" screencasts that might be distributed via YouTube are as meaningful as the average "Programming foo" webpage.

      (I hate screencasts, personally, but that's a different issue.)
    • by Dasher42 ( 514179 ) writes: on Wednesday January 09, 2008 @03:36PM (#21973966)
      Not to argue that TIOBE's statistics aren't suspect, but the number of available jobs banging on Perl isn't meaningful to me. I've already had too many jobs where the first order of business is someone pointing me at a directory and saying, "These are your predecessor's Perl scripts. Please figure this out and make things work."

      The last time I had free rein in something like that, I did just that, and made a clean rewrite to make a few cleanly commented, consistent Python modules that did the work of all the previous scripts, sans bugs. Just the fact that assignment by reference is the default, that building data structures deeply requires no line noise, makes the program design easy to get right the first time. No "oops, need another dollar sign there". No "how do I refer to a value in a hash of lists of hashes again?" You just do it.

      Maybe it's that my sense of programming comes from years of looking at some of the cleaner C and C++ out there, and reading Design Patterns, makes me prefer a language that encourages design and clean coding practices by default. I don't want to deal with one more script from someone who munged strings of data with regular expressions where they should have used data structures or objects. Those of you who are about to clean up piles of Perl code with Perl Medic in hand, I salute you. You're braver than I care to be anymore.
      • Just the fact that assignment by reference is the default, that building data structures deeply requires no line noise, makes the program design easy to get right the first time. No "oops, need another dollar sign there". No "how do I refer to a value in a hash of lists of hashes again?" You just do it.

        Yes, yes, yes. That was the exact issue that made me come to love Python. It's not that I can't make complex structures in Perl, but that every time I wanted to do anything non-trivial I had to reach for the camel book. And heaven help you if you wanted to change a function to return a hash of list of hashes instead of a scalar, because then you'd have to change the calling code's semantics for storing the results. Hard? No. Annoyingly pointless? Oh, yeah.

        I don't have anything against Perl. I just got tired of doing all the extra work that I had just assumed was a necessary evil until I saw otherwise.

      • by Sentry21 ( 8183 ) writes: on Wednesday January 09, 2008 @11:17PM (#21979730) Journal

        Just the fact that assignment by reference is the default, that building data structures deeply requires no line noise, makes the program design easy to get right the first time. No "oops, need another dollar sign there". No "how do I refer to a value in a hash of lists of hashes again?" You just do it.
        This is definitely true, though your mention of assignment by reference reminded me of something.

        I was experimenting with writing an IRC bot in Python from the ground up, opening up a socket and sending data into it (no frameworks or anything). After a while, I got fed up with killing the bot and restarting it every time I wanted to test new code (and people were getting tired of it quitting and rejoining), so eventually I came up with a solution.

        I factored the bot class out into a separate module, and wrote a script that instantiated an object of the class, which then connected to the server, joined channels, etc. Then, I added functionality to the class to take all of its data structures (list of channels, list of users, and even the TCP socket itself) and pack them up into a dict, then return the dict. Finally, I added some code to import a dict and replace the data structures with the content of the dict, and then two or three lines of code to unload and reload the IRC bot module.

        The result? I now have an IRC bot written in Python which allows me to modify the code live, without restarting the bot. If I want to add a new function, or add support for another command (one of the myriad numeric commands that, at this point, keeps ending up in my console), I can add it and then simply !rehash in IRC, and the bot reloads its own code, swapping out the old for the new.

        Because objects are passed by reference, the socket itself moves from one instance to another, and the bot never has to disconnect. It was a rather ingenious hack, imho, was startlingly simple to implement, and was made possible by the amazing dynamicness of Python.

        Woo!
        • Then, I added functionality to the class to take all of its data structures (list of channels, list of users, and even the TCP socket itself) and pack them up into a dict, then return the dict.

          Kudos for a slick hack! But here's how I might approach that:

          Create a class called "Settings" or similar. Change your bot class's __init__ method to accept a Settings object, like "def __init__(self, settings)". Then, change your code to refer to self.settings directly, such as replacing "self.socket" with "self.settings.socket". Once you do that, you can get rid of all the code that deals with saving and restore state, since all state will already be bundled into one convenient object.

        • by DragonWriter ( 970822 ) writes: on Thursday January 10, 2008 @12:18PM (#21986050)

          I now have an IRC bot written in Python which allows me to modify the code live, without restarting the bot.
          .
          .
          .
          It was a rather ingenious hack, imho, was startlingly simple to implement, and was made possible by the amazing dynamicness of Python.


          Its a clever hack, but there is nothing really specific to Python about it. Lots of languages would let you do that: indeed, that's one of the things that I've seen raved about regarding the use of Lisp in, e.g., the space program. Certainly, Lisp/Scheme, Ruby, and Perl all support that kind of hack fairly naturally.

          If Python's the place where it clicked for you, that's great, but don't be misled to think that its unique or even part of some new breed in that respect.
      • by Nevyn ( 5505 ) * writes: on Thursday January 10, 2008 @04:54PM (#21991044) Homepage Journal

        The last time I had free rein in something like that, I did just that, and made a clean rewrite to make a few cleanly commented, consistent Python modules that did the work of all the previous scripts, sans bugs.

        Sounds good, then someone can come in a few months/years from now and re-write in NBL [blogspot.com] because it's getting 100x as much data and now takes 3 weeks to process the data, using 500GB of RAM. Or because it's dumping pages of backtrace for a: missing file / an int() that should be a str() / misspelled word. Or just that noone can (under)stand the invisible syntax, so can't work with it.

        As someone who's worked a lot with both Perl and Python, I'd say the biggest differences are that Perl has had a lot more inexperienced developers writing code for it and that Perl has basically been unmaintained for like 8 years now. Oh and that Python developers think that their languages is the best, but Perl developers know their language used to be ;).

          • by mr_mischief ( 456295 ) writes: on Thursday January 10, 2008 @11:21AM (#21985084) Journal
            Mine uses four spaces. How many does yours use? What about the guy sending me the next patch that's supposed to help my project? What about the guy who cleaned it up and sent it to him.

            The problem with the whitespace isn't that it's enforced as a coding standard. It's that it changes the meaning of the code. You could use brackets, parentheses, some other punctuation, or keywords to denote blocks and still enforce indentation in the parser. Then you'd be able to say Python enforces good style but a program could easily reformat code to your own standard whenever the whitespace got screwed up.

            Like I said, if you like Python, that's fine. I don't. It's not a bad language. It just has a quirk it picked up from ABC that I really don't care to mess with after having messed with it in ABC years ago.

            Perl has odd quirks, too, as do Ruby, C, Pascal, Smalltalk, Forth, and Lisp. Some people hate Lisp for its parentheses. Other people love it for the same reason. Some people hate Perl for all the abbreviations and punctuation characters, while other think that's a great strength. It's all about trading off what you want in a language to avoid things you don't. No language is perfect, including Python, and people seem to make a lot of software work despite that.
    • by DavidNWelton ( 142216 ) writes: on Thursday January 10, 2008 @03:38AM (#21981208) Homepage
      Perfect stats are impossible. However, I think that even imperfect stats can give you a good glimpse of what's going on. This is my own attempt at doing so, which I think is a bit better than TIOBE's in that I track more things:

      http://www.langpop.com/ [langpop.com]

      Hopefully, I'll have trend data up there soon as well.
  • by blueZhift ( 652272 ) writes: on Wednesday January 09, 2008 @03:00PM (#21973300) Homepage Journal
    This is certainly interesting news. These days when I just need to script something fast, Python is definitely my tool of choice because it works everywhere that I do, and is easier, for me at least, to deal with than Perl. Though I still have a soft spot for Perl because it was the first programming language that actually earned me any money!
  • by Mark Programmer ( 228585 ) writes: on Wednesday January 09, 2008 @03:13PM (#21973510) Homepage
    especially beloved by system administrators and build managers.

    Absolutely. This year we replaced an old build system written in make with a (vastly superior) Python solution written from scratch. The replacement took one programmer about two weeks. The make system had taken two programmers a disgusting amount of time to build and support. What suprised me most upon completing the changeover was that the Python solution was faster than the gmake solution; since Python compiles to bytecode, re-running the build script was a quicker operation than gmake's re-parsing of the make files.

    Python's advantage as build glue is that it is just simple enough to be nearly shell scripting (write a simple wrapper, and you can pretty much just write shell script). But it has the features of a decent high-level language---including, most importantly, integrated documentation and a debugger. Anyone who doesn't understand why one would need a debugger for a build system hasn't yet written a build system complicated enough.

    Really though, this is less a statement in support of Python and more a statement against gmake. Make's age really shows as a build language, and if not for all the tools in the GNU world that depend upon / assume the existence of a make engine, I would encourage everyone to just toss the whole thing overboard and create all new build scripts in something else. You have better things to do with your time than reverse engineer code written in a nearly incomprehensible string-parsing language by someone who---in spite of the "standards" that have built up around make over the years---has gone off and done his own thing anyway. If you're going to have to deal with custom build code, you may as well own the challenge completely.
    • re-running the build script was a quicker operation than gmake's re-parsing of the make files.

      Erm, make files? Plural? Well, there's your problem...

      I forget where, but there is a paper somewhere on the dangers of recursive make, advocating a single makefile instead (with a few includes). And they have a point.

      I'm all for replacing Make, but performance isn't the reason.

    • by GrievousMistake ( 880829 ) writes: on Wednesday January 09, 2008 @08:29PM (#21978228)
      Really? One of the problems I've had with Python is how hard it is to use it as a shell scripting language. Namely, the functions for browsing and manipulating the file system are low-level, OO-hostile, quirky, and scattered seemingly almost randomly between os, os.path and shutil. I find them so unwieldy I'll sometimes just cheat and call .bat files from Python to operate on files.
      Apparently some people even have it as their CLI of choice, so I may be missing something, but I've been unable to pry out of them what the secret is.
    • Do you know of a good guide to using Python as a replacement for bash shell scripts? Lots of people seem to use it for this purpose, and I was interested in finding a nice guide to learning how to do this.
      • We looked into it, and scons is very good. The reason we didn't use it is because, ironically, it's too powerful (and relatedly complicated)---it gives a nifty complexity-for-power tradeoff that we simply decided we didn't want to leverage. Since we already knew exactly what we wanted our make process to do, we found it faster and easier to just write the Python script we wanted than to figure out the "scons way" to do things. Dependency management is a good example: scons offers automatic dependency walking, but we already had explicit dependency lists that we were comfortable updating, and didn't want to take the time to learn enough about the scons dependency walker to trust it.

        If we'd been writing a make process on a brand new project, reading up on scons and understanding the structure it places upon your build process would have been a better choice. As it stands, we had a very specific plan, we could see it fairly clearly in "straight-line" python, and the instant scons's requirements got in the way we tossed it overboard and forged ahead.
  • tools for the task (Score:4, Interesting)

    by Speare ( 84249 ) writes: on Wednesday January 09, 2008 @03:18PM (#21973614) Homepage Journal

    First off, let me say that I love both Perl 5 and Python 2.x and have used each of them on a wide diversity of projects. I've implemented my own OO system on top of each, I've used each for CGI, I've used each for AI, natural language processing, and game programming. Both languages have their idiosyncratic idioms and it's really annoying when you see a lot of C-ish code in either Perl or Python projects. It's also very possible to write ugly "write once" code in either one, don't be misled by the whitespace arguments: ugly code is about how you express (or fail to express) a problem and a solution.

    However, I have to say, pick the tool for the job. There are things that are more naturally expressed in Perl idioms than in Python idioms. There are things that are much more clear and direct about Python code for outsiders to read and understand. If I were doing a ton of regex text scanning work, Perl incorporates it into the language directly, whereas it's a bolt-on for most other languages. If I were doing a ton of object management, I like the compactness of Python's syntax over that of Perl's. Both have great extensibility but the available extensions and support can shape your choice for a given project. I wish Python had true equivalents to Perlmonks and CPAN; conversely I wish CPAN modules were more crisp and consistent, attributes I think I find in the community-written Python modules I've used.

    • by renoX ( 11677 ) writes: on Wednesday January 09, 2008 @06:33PM (#21976744)
      > pick the tool for the job.

      That's why Ruby is nice, it's as readable as Python but it has regex included (of course if you use overcomplicated regex in your code the readability will suffer, but that's not a language issue).
      • by NewbieProgrammerMan ( 558327 ) writes: on Wednesday January 09, 2008 @11:02PM (#21979578)

        That's why Ruby is nice, it's as readable as Python but it has regex included...

        Just curious, are you talking about having to "import re" in Python instead of just having regex support by default, or is there something significant lacking in Python's regex support? (Not trolling, it's just nice to have some additional information about the differences in the languages)

        • by DragonWriter ( 970822 ) writes: on Thursday January 10, 2008 @12:43PM (#21986518)

          That's why Ruby is nice, it's as readable as Python but it has regex included...


          Just curious, are you talking about having to "import re" in Python instead of just having regex support by default, or is there something significant lacking in Python's regex support?


          The need to import a library isn't a big deal, but Ruby's core support isn't just support functions "included by default", its also a simple literal syntax available and perl-style magic variables related to regexs. Now, I'm not too fond of the magic variables, but the magic variables are probably convenient to people coming from Perl, and the literal syntax is a convenience if you are using regexs a lot.

          So you can test a string against a regexp with something like:

          /pattern/ =~ string

          And get nil if there is no match, and the index of the start of the match if there is one. In Python, you get the same with something like:

          re.search(pattern, string).start


    • by ricegf ( 1059658 ) writes: on Thursday January 10, 2008 @08:43PM (#21993978) Journal

      I wish Python had true equivalents to... CPAN

      Just curious - in what way is the Cheeseshop not equivalent to CPAN? Not as many Python eggs as CPAN modules, of course, but otherwise I easy_install as easily as I ppm. Or maybe you mean something else?

  • by bn0p ( 656911 ) writes: on Wednesday January 09, 2008 @03:43PM (#21974100)
    TIOBE bases their ratings on the number of search engine queries for "<language> programming' [tiobe.com]. Maybe it's just me but I don't equate an increase in search engine queries regarding programming in python as indicating an increase in the popularity of python.

    Put another way, the number of people looking up information on a language X != the number of people programming in language X.


    Never let reality temper imagination
    • by rjames13 ( 1178191 ) writes: on Wednesday January 09, 2008 @07:25PM (#21977464)
      I never put "language programming" into a search engine I find "language library tutorial" is better. Of course that means I am learning "language" and "library". If I'm already programming in a specific language and know where the libraries documentation is then I have it bookmarked.
  • Just Say No! (Score:3, Interesting)

    by Endymion ( 12816 ) writes: <slashdot,org&thoughtnoise,net> on Wednesday January 09, 2008 @03:43PM (#21974102) Homepage Journal
    Just say no to Bondage and Discipline Languages [catb.org]!

    ...any language where the author thinks lambda is "too confusing" and should be removed is doomed from the start.
  • by splutty ( 43475 ) writes: on Thursday January 10, 2008 @10:58AM (#21984740)
    Now here's something probably most of you don't know :) Eve Online (The Space MMO from CCP) (You know, the one people seem to love bashing) is actually written in Python.

    First time I realized that was about 3 days after installing the game and seeing all kinds of familiar extensions in cache and library directories. Fun stuff :) An actual game written in a language that's derived from a language that was originally designed for games.
    • Re:Hmmm (Score:3, Funny)

      by the_B0fh ( 208483 ) writes: on Wednesday January 09, 2008 @02:17PM (#21972356) Homepage
      PHP and ActiveX over Python?

      Mamama!!!! Make the bad man go away, please.
      • Re:Hmmm (Score:4, Interesting)

        by mysqlrocks ( 783488 ) writes: on Wednesday January 09, 2008 @02:36PM (#21972726) Homepage Journal

        PHP and ActiveX over Python?

        What's up with all the PHP haters on Slashdot? For building most web applications it's the place to be. Zend is working hard to increase the level of professionalism of the PHP community. I've recently started using Zend Framework [zend.com] and it's a really nice way to build web applications.

        • Re:Hmmm (Score:3, Insightful)

          by AmaDaden ( 794446 ) writes: on Wednesday January 09, 2008 @02:45PM (#21972952)

          What's up with all the [your favorite programing language] haters on Slashdot?
          *sigh* Welcome to Slashdot....
        • Re:Hmmm (Score:4, Insightful)

          by XorNand ( 517466 ) * writes: on Wednesday January 09, 2008 @02:58PM (#21973244)
          I can't quite figure out if you're a subtle troll or not? However, one of the biggest complaints about PHP programmers is that they're oblivious to a lot of important aspects of programing. Security being one of the biggies. Not being aware of the general criticisms of their chosen tools is another. (Which, if you're not a troll, you've proven my point.) I happen love Python, but I'm also aware of why many people don't like it.
          • Re:Hmmm (Score:5, Informative)

            by mysqlrocks ( 783488 ) writes: on Wednesday January 09, 2008 @03:15PM (#21973568) Homepage Journal

            Not being aware of the general criticisms of their chosen tools is another. (Which, if you're not a troll, you've proven my point.)

            I'm not a troll, just wondering why there's so much bashing of PHP on Slashdot. I am aware of many of the criticisms of PHP. One of them you mentioned:

            However, one of the biggest complaints about PHP programmers is that they're oblivious to a lot of important aspects of programing.

            You'll see that I partly addressed that criticism with my "Zend is working hard to increase the level of professionalism of the PHP community" statement. I'm not going to go into a full length defense of PHP but if you are looking for such a defense I would suggest 10 PHP Myths Dispelled [jaybill.com]. I am not a PHP zealot, I just have a lot of experience with it and would prefer to build web applications using PHP over the alternatives that I've tried (Java/JSP, ASP.NET). I can't compare it to RoR or Python since I have tried neither. I've read about both and have seen nothing compelling to make me consider switching. I'm quite productive developing in PHP and am quite aware of both it's advantages and criticisms.

            • by Qbertino ( 265505 ) writes: <moiraNO@SPAMmodparlor.com> on Wednesday January 09, 2008 @09:19PM (#21978744)
              Sure there is PHP bashing, as is bashing of many other PLs. Just watch a Lisp or C guy go after Java to see what I mean.

              The truth is, the people that really are programming and solving problems rarely rant about a PL without having tried it. PHP is an extremely n00by-friendly programming language - also because of it's wide availability - and thus lots of code in PHP is quite wacky actually. This falls back on to the PL itself. Flash/ActionScript has simular problems (aside from having a strong prorpietary touch to it).

              In the end PHP, with its neighbourhood to markup, is the web-eras basic. With way more succesfull and impacting open-source web applications than any other solution - Python included.

              I *am* a Python fan, but it just didn't have that critical mass of an install base back then when mod_php gained traction. And that the true King and ruler of all webkits, Zope, has had a backend that looks like shit for 7 years now didn't help it either. Nowadays nobody gives a hoot if Zope is lightyears ahead of Rails and a few years older - it's just a niche webkit for people who've bumped into it

              There are a lot of factors that make a language successfull, and PHP meets very many of those. Just because people rant about it doesn't mean it really is bad. Nobody I know would say that programming in C is really fun and modern and hip. And many people rant about it. Yet look how many mission critical work still is done with it - because the untested alternatives aren't any better.

              On the server-side I've been mostly doing PHP for last 3 years now and am now going totally OOP with the CakePHP Framework and a large international project. It works, is extremely neat and quick to develop with. So be it that PHP has a few bizarly named core functions and arrow->syntax. So *fucking* what? My friend who has a business aswell and is a Sun partner and Java fanboy just moved his webproject from Java to PHP so they could finish it faster.
              "Java Fanboy speeds up project by switching to PHP" - enough said.

              Slashdotters rant a lot, but reality is allways a tad different.
        • by nuzak ( 959558 ) writes: on Wednesday January 09, 2008 @04:17PM (#21974668) Journal
          > Zend is working hard to increase the level of professionalism of the PHP community.

          I'd be satisfied if they just worked to improve the damn language.

          no_i_really_mean_it_mysql_really_escape_strings()
          • Re:Hmmm (Score:3, Informative)

            by mysqlrocks ( 783488 ) writes: on Wednesday January 09, 2008 @04:33PM (#21974946) Homepage Journal
            Technically you're talking about the available functions, not the "language" itself. But, semantics aside, I would argue that your complaint is being addressed. The Zend Framework [zend.com] I linked to and the SPL [php.net] are PHP class libraries that you can use if you would prefer to work with PHP in OO way and (for the most part) forget about calling PHP functions outside of a class or object context.
            • by mr_mischief ( 456295 ) writes: on Thursday January 10, 2008 @01:39AM (#21980684) Journal
              The main library of functions in the core namespace along with the syntax rules for the language pretty much are the language. Having an extensible language with multiple namespaces is a much cleaner alternative to lumping so much into the core. That's the complaint.

              There are people who use PHP with proper modularization, but most of what people see isn't done that way. In a language that's largely used for Open Source software, the state of the code in those OSS projects will be what the language is based on, fair or not.
        • by DragonWriter ( 970822 ) writes: on Wednesday January 09, 2008 @06:54PM (#21977056)

          What's up with all the PHP haters on Slashdot?


          I tried PHP out for a while a couple years ago. Quite a lot of useful libraries, but the language itself didn't seem to offer much. For just gluing together the existing libraries with minimal new code, it seemed to quite usable (and a lot of web development might get by with that), but it seemed a lot less nice when there was more processing involved. Maybe I just didn't get it, or maybe its improved since then...

          For building most web applications it's the place to be.


          Why? Sure, it featured neat embedding in HTML before there were Python or Ruby templating engines that used Python or Ruby in HTML, but why would it be preferred now, for a new, ground-up web application, besides familiarity to the developer? (I'm not trying to be argumentative, just looking for perspectives on "why PHP?")

          • by mysqlrocks ( 783488 ) writes: on Thursday January 10, 2008 @10:24AM (#21984192) Homepage Journal

            Why? Sure, it featured neat embedding in HTML before there were Python or Ruby templating engines that used Python or Ruby in HTML, but why would it be preferred now, for a new, ground-up web application, besides familiarity to the developer? (I'm not trying to be argumentative, just looking for perspectives on "why PHP?")

            A few of the reasons:

            • proven scalability (Wikipedia, Yahoo!) - this is partly due to the "share nothing architecture"
            • great frameworks available (Zend Framework, CakePHP, Symfony)
            • lots of developers (and on the flip side, lots of jobs) - you could argue this is related to "familiarity to the developer" but from a practical point-of-view it is important
            • hosting is easy to find/setup
    • Re:Hmmm (Score:5, Funny)

      by reSonans ( 732669 ) writes: on Wednesday January 09, 2008 @02:19PM (#21972400) Homepage
      I'm hate python.

      Man, you take this stuff seriously. Changing your name is hardcore.
    • by Kymermosst ( 33885 ) writes: on Wednesday January 09, 2008 @04:33PM (#21974944) Journal
      Indents, makes the coder must use indents, which makes the code easier to read.

      Not necessarily. Especially if the application used to view the code is not the same one that the code was written on.

      List of annoyances I have with regarding Python and white space:
      • You can't just send somebody some Python code in a medium that isn't whitespace-safe.
      • Indentation preferences vary among programmers, are arbitrary, and some people feel strongly about 4-space, 2 space, tabs, etc. Python uses this as a syntax element and forces everyone working on a particular file to share the same indentation scheme or risk breaking the code. In free-form languages, one guy who forgets to change his 4-space tab into actual spaces isn't going to break things.
      • You can't use brace-matching.

      • by vrmlguy ( 120854 ) writes: <samwyse@COFFEEgmail.com minus caffeine> on Wednesday January 09, 2008 @05:31PM (#21975792) Homepage Journal

        Indentation preferences vary among programmers, are arbitrary, and some people feel strongly about 4-space, 2 space, tabs, etc. Python uses this as a syntax element and forces everyone working on a particular file to share the same indentation scheme or risk breaking the code.
        Some of use view this as a good thing. ;-)

        Personally, I hate tabs. Every editor I use seems to have the tab-stops set differently, and looking at 4-space tab code in an 8-space tab editor is not my idea of fun.
      • by SanityInAnarchy ( 655584 ) writes: <ninja@slaphack.com> on Wednesday January 09, 2008 @07:47PM (#21977734) Journal

        You can't just send somebody some Python code in a medium that isn't whitespace-safe.

        What medium?

        Indentation preferences vary among programmers, are arbitrary, and some people feel strongly about 4-space, 2 space, tabs, etc. Python uses this as a syntax element and forces everyone working on a particular file to share the same indentation scheme or risk breaking the code. In free-form languages, one guy who forgets to change his 4-space tab into actual spaces isn't going to break things.

        That's actually a feature -- it forces everyone to agree on a standard there, and use it.

        If, for example, one guy uses tabs and one guy uses spaces, and the tab guy has his tabstop set to 2 or 4, while the spaces guy has left it at 8... well, stuff is going to look weird. Forcing everyone to the same convention is something you should be doing anyway, and I'd rather it happen automatically (by breaking stuff).

        • by Kymermosst ( 33885 ) writes: on Wednesday January 09, 2008 @08:25PM (#21978180) Journal

          What medium?

          This one, for instance, when you use the HTML formatted option.

          Here's some code for you, from here [www.amk.ca]:

          (Yes, I used slashdot's ecode tag, which fails to preserve the leading spaces even though it is for inserting code snippets)

          #!/usr/local/bin/python

          import string, sys

          # If no arguments were given, print a helpful message
          if len(sys.argv)==1:
          print 'Usage: celsius temp1 temp2 ...'
          sys.exit(0)

          # Loop over the arguments
          for i in sys.argv[1:]:
          try:
          fahrenheit=float(string.atoi(i))
          except string.atoi_error:
          print repr(i), "not a numeric value"
          else:
          celsius=(fahrenheit-32)*5.0/9.0
          print '%i260円F = %i260円C' % (int(fahrenheit), int(celsius+.5))

          I am aware that the plain old text option mostly works nowadays, but there are sometimes problems with that as well. A few months ago, it was totally broken as well in this regard.

          Countless other forums out there have issues with preserving code formatting, not to mention some web-based chat systems where you might want to paste a code snippet.

          If, for example, one guy uses tabs and one guy uses spaces, and the tab guy has his tabstop set to 2 or 4, while the spaces guy has left it at 8... well, stuff is going to look weird. Forcing everyone to the same convention is something you should be doing anyway, and I'd rather it happen automatically (by breaking stuff).

          In languages that use delimiters as block and line markers, you can run a code beautifier to standardize the code, and even fix code that is horribly malformatted. If the white space gets screwed up really bad in a python program (line endings are deleted somehow), it will it not only fail to run, it will require a human to go in and unscrew it.

          • by SanityInAnarchy ( 655584 ) writes: <ninja@slaphack.com> on Thursday January 10, 2008 @03:36AM (#21981196) Journal

            It's worth mentioning that, at least in IRC, this [pastebin.com] is the preferred medium. It should work elsewhere, too, and there are scripts to assist in it.

            Your point is valid, but I don't believe I should constrain the format of a language because it won't work in some mediums. Should I not include []-bracketed arrays because bbcode might hate them?

            In languages that use delimiters as block and line markers, you can run a code beautifier to standardize the code, and even fix code that is horribly malformatted. If the white space gets screwed up really bad in a python program (line endings are deleted somehow), it will it not only fail to run, it will require a human to go in and unscrew it.

            Ah, but if the whitespace gets screwed up in a python program, that's equivalent to the bracketing getting screwed up in a C-style program. So the difference is that broken whitespace is not the domain of a code beautifier in Python, anymore than brackets and parentheses are the domain of a code beautifier in just about any language.

            Also, code beautifiers are still going to leave some things out of place, particularly comments which are spaced to match the code.

            • by DragonWriter ( 970822 ) writes: on Thursday January 10, 2008 @12:56PM (#21986888)
              The good think about having brackets as syntax and whitespace as formatting is that it is redundant, and mismatches between them may provide a way of catching thinkos. And it helps (in properly formatted code) readability: there is a reason natural languages tend to have quite a bit of redundancy, it aids comprehension.

              The bad think about having brackets as syntax and whitespace as just formatting is that it is redundant, and you can produce things that look wrong but are wrong but look right if you don't have something automatically formatting.

              Many programming languages lean toward the first factor outweighing the second. Python leans the other way. It isn't objectively one way or the other; which factor is a bigger factor in usability varies from person to person, and group to group.
                • by DragonWriter ( 970822 ) writes: on Thursday January 10, 2008 @05:55PM (#21992058)

                  Any redundancy in a programming language is a design flaw.


                  Perhaps. But we're really not discussing redundancy in a programming language, we are talking about redundant information in source code. There certainly is the point of view that any redundancy in source code is a "design flaw" (the theory that advocates that code should speak for itself and comments should not be used, as well as the theory beyond Python's whitespace handling, is an example of that.)

                  One of the redundant portions is 'real' and the other is typically a convention.


                  Convention is not a feature of the programming language, it is a feature of programming style (similar to conventions) that is irrelevant to the computer processing the source code but intended as an aid to the human reader. To a certain degree (certainly, where it comes to indentation and related formatting conventions) such convention can, in fact, be automatically imposed on code not written to the convention by automated tools. It is no more a language feature than syntax highlighting done by an editor is a feature of the language.

                  When the convention is easier to track and follow than the 'real' the design flaw is most obvious.


                  Since the convention is imposed on code for human readability and can be changed without changing the meaning of the code (just as syntax highlighting can be), I disagree. Indeed, the convention is entirely irrelevant to the design of the language, not a flaw in its design.

                  For example we use whitespace in every modern language to show how the structure nests.


                  More accurately, "it is common for people to use a whitespace arrangement that suits their personal tastes and those of their group to show how structure nests in most modern languages."

                  Any language that also uses symbols to indicate the 'real' is fundamentally flawed.


                  If its not "real" but convention the relation of whitespace to structure is not part of the language, any more than a conventional arrangement of comments to indicate function preconditions and return types is. If its not part of the language, it clearly can't be a flaw in the language.

                  While Python is far from perfect and has plenty of warts its use of whitespace is the correct choice.


                  No, its not the correct choice. It is a valid choice, and it aims to implement one subjective ideal of programming languages. Personally, I think that if you are going to use that ideal, though, it would be better to enforce a strict and consistent standard at the language level (e.g., "each new block level is indented by four spaces from the previous level") rather than "whatever mix of space and tabs you prefer, but each tab will be treated as if it were 8 spaces", so I wouldn't even say Python has a particularly well-chosen approach even given the guiding principal it has chosen, much less the one-true-correct choice.

      • by Verte ( 1053342 ) writes: on Wednesday January 09, 2008 @09:08PM (#21978626)

        You can't just send somebody some Python code in a medium that isn't whitespace-safe.
        True. I can only think of one example, HTML, and you can always programmatically insert non-breaking spaces in that case. You can do this efficiently in four lines of Python code, or a couple more in elisp when copying to the clipboard.

        Indentation preferences vary among programmers, are arbitrary, and some people feel strongly about 4-space, 2 space, tabs, etc. Python uses this as a syntax element and forces everyone working on a particular file to share the same indentation scheme or risk breaking the code. In free-form languages, one guy who forgets to change his 4-space tab into actual spaces isn't going to break things.
        That's why we have coding standards. The Python world settled upon 4-space indents a long time ago. If you're going to fly in the face of coding standards, expect to have to implement yet another four liner when you want to actually work with anyone.

        You can't use brace-matching.
        You aren't quite clear what you mean on this. If you mean you have no visual indication where a code block ends, you're a retard. Indentation is far easier to vgrep than braces. If you mean you have to think differently to write Python code programmatically, well yes, you do. Thankfully, there are simple libraries that do most of the work for you.
        • by Sentry21 ( 8183 ) writes: on Wednesday January 09, 2008 @11:47PM (#21979988) Journal

          True. I can only think of one example, HTML, and you can always programmatically insert non-breaking spaces in that case. You can do this efficiently in four lines of Python code, or a couple more in elisp when copying to the clipboard.
          Or wrap it in <pre>...</pre> tags
        • by Kymermosst ( 33885 ) writes: on Thursday January 10, 2008 @04:03PM (#21990180) Journal
          You aren't quite clear what you mean on this. If you mean you have no visual indication where a code block ends, you're a retard. Indentation is far easier to vgrep than braces. If you mean you have to think differently to write Python code programmatically, well yes, you do. Thankfully, there are simple libraries that do most of the work for you.

          For any machine-assisted use in general (yes, indentation is easy to use with a human brain, that's why almost everyone does it even in languages that don't enforce it). Here is an example: in an editor I use, when I close a block in a language that is similar to C syntax, it automatically flashes me for .5 seconds the context of the opening brace of the block, even if it is off the screen. I like this feature, though I am not entirely sure why.

          The editor has no clue that you are ending a block in Python merely because you back-tabbed. You could just be adding a blank line.

          Please understand that I don't dislike Python. I'm just pointing out my annoyance with white space as a syntax element.
          • by Verte ( 1053342 ) writes: on Thursday January 10, 2008 @08:47PM (#21994004)
            The simple solution is to leave your tabs on a blank line :) I'd believed that an indented block after a blank line was a syntax error- that back-tabbing always closed the block, except when in a parenthesized expression (it does in the REPL). It's probably better for your editor to scream at the practice, not that it helps with code that someone else has written.
          • by ricegf ( 1059658 ) writes: on Thursday January 10, 2008 @09:04PM (#21994124) Journal

            ...it automatically flashes me for .5 seconds the context of the opening brace of the block, even if it is off the screen. I like this feature, though I am not entirely sure why.

            I'm suspicious that you like it because it allows you to quickly check whether your indentation matches your braces That's why *I* like it, at least. Except when I'm writing Python, of course. ;-)

There may be more comments in this discussion. Without JavaScript enabled, you might want to turn on Classic Discussion System in your preferences instead.

Slashdot Top Deals

[引用]

There are never any bugs you haven't found yet.

Close
Working...

AltStyle によって変換されたページ (->オリジナル) /