9 ms·
Why PHP Is Fun and Easy But Python Is Marriage Material
- pmarin 16y agoYou have it doble posted: http://news.ycombinator.com/item?id=1840444 http://news.ycombinator.com/item?id=1840444 http://news.ycombinator.com/item?id=1840442 http://news.ycombinator.com/item?id=1840442
- jasonlbaptiste 16y agoWHOA, how'd that happen? pg ?
- udfalkso 16y agoGreat title.
- ryanwaggoner 16y agoSome languages, like PHP, have very low learning curves — it’s super-easy to get started. And, that’s awesome. It’s easy-going, fun, and you feel super-productive (especially if you’re making a big change to something new). But, once you get past that initial dating period, you need to think about your future. You want to forge a relationship with a language that will be long-lasting, rich and deep. A language that brings the best out in you — over the long-term...Since I'm going to get into a long-term relationship with a language, I figured Python's a pretty good bet. I started out as a PHP programmer and have loved it over the last few years, but after spending the last couple months playing with Python, this is exactly how I feel.
- Goladus 16y agoI think it's interesting that in the grand scheme of languages, Python has one of the gentlest learning curves. (I'd say as a general-purpose language rather than a web language, it's even gentler than PHP)
- fiveo 16y agoI was able to learn Python in 2 weeks (lazily) using just Byte of Python. Of course I can't build something clean and "Pythonic" with that kind of knowledge, but I managed to build a simple CRUD selling books online app using SQLAlchemy, CherryPy, and Genshi in 4 days (I need to build something for a scheduled interview). I'm not sure if I can do the same with PHP and some of the PHP libraries (like, for an example, using Smarty, PHP, and a whatever-lightweight-ORM in PHP).
- jasonlotito 16y ago> I was able to learn Python in 2 weeks Not to pick on you in particular, but comments like this are a pet peeve of mine. While Python is easy to learn, and most languages are, but even if I'd built a little application in Python as you had, and knowing what I know already, I still wouldn't say I know Python. Maybe I'm the exception to the rule, maybe my definition of knowing a language is much more strict then most, but I really don't think you can learn a language, any language, in 2 weeks. I've done apps in Java, C, C++, Python, Perl, PHP, and even Obj-C now. Real working apps that do things, but I'd feel very uncomfortable claiming to know all those languages. Oh, I know the syntax. Basic syntax is easy for any language (with my vast knowledge of C-style syntax languages providing a good basis for this assumption =)). But really knowing a language? Being able to create an application from scratch? I mean, really knowing, not just hacking together stuff you find from tutorials on line and running to SO whenever something happens a Google search doesn't solve. I fully realise that my standards might be a bit to high. I just don't know by how much? Am I really just not giving myself enough credit, or am I reading too much into this? Edit: fiveo, I'm not focusing this at you, obviously. This is merely a general observation. =)
- fiveo 16y agoI agree with you Jason. It doesn't mean I know Python. Perhaps I should use the phrase "basic Python" instead of just Python. But the point that I'm trying to make is that it's so much easier to learn and build something using Python, even if it's not top notch or following best-practice/patterns or trying to be Pythonic all the way. Of course this is not sufficient knowledge in the long term.
- forgotAgain 16y agoWhile I agree with the conclusion that the design of Python will over time make it the more productive language for development I don't agree with the importance given to Django. I find that more view effort is being placed in browser code (JavaScript) and the back end is becoming less presentation oriented. Therefore the need for a framework like Django is diminishing.
- SoftwareMaven 16y agoI disagree, though my use has changed. I recently worked on an app that only had a couple of views; almost everything else was handled by exposing APIs via Piston (which were consumed via jquery). Still, the value of the other features of the framework made it work using in the project.
- avdempsey 16y agoI liked this line: "Though Ruby/Rails would likely have been fine too, there’s something about it that I just found unnatural. If I had a dog, the dog would bark at the Ruby code." That's how I felt when I started learning Ruby after years and years of Python. Ruby has method names with question marks in them...my dog would bark at that.
- ScottBurson 16y agoYour dog obviously doesn't know Lisp :) Lisp allows any characters in a name (although some characters need to be escaped). So for example, I have a class called "2-relation" (because I thought "binary-relation" was too long). The use of dashes in names is routine in Lisp; names beginning with digits are not so common, but are perfectly legal. And yes, though it's not the traditional style, some Lispers (including me) end the names of predicates (boolean-valued functions) with question marks.
- paradoja 16y agoThe «?» ending is common in (at least some implementations/variants of) Scheme. In Common Lisp and other Lisps, on the other hand you'll usually see «-p» instead of the «?».
- seiji 16y agoI prefer free form function names when when parenthesis aren't required after the function name. Hyphens in function names are great too. (member? 'a some_list) member?('a', some_list) <-- ugly member? :a, some_list (check-user-credentials session user) (is-user-authorized? page user)
- avdempsey 16y agoTrue, not having parens on the end of the function call makes this look better (and those parens are optional in Ruby). Extra kudos to lisp flavors because you could argue they have even "purer" syntax than Python. Mostly, I'm just tickled by the idea of "would my dog bark at it?" as a mental test.
- citricsquid 16y agoSo a few people said that PHP will die in the next few years because of things like Ruby and Python becoming better and better, does anyone here feel the same? I argued that PHP has such a low barrier to entry and is so accessible that I don't think it'll happen -- at least not to Ruby/Python -- anyone agree/disagree?
- dshah 16y agoI don't think PHP will die in the next few years. For the same reason that C++ (and for that matter, even COBOL) haven't really died. There are enough people that need it kept alive that it will keep going for a while.
- okaramian 16y agoExactly, legacy code isn't going anywhere. If you keep your eyes open you'll see plenty of Classic ASP around. It's a lot of investment to refactor an application from one language to another, and it's a waste of time from a business perspective if "stuff works".
- nickik 16y agoi work with asp classic and that wont be thrown away in the next 10+ years.
- jamesbritt 16y agoPHP die? Unlikely. Among the people I know who are primarily Ruby devs I find some number who are looking at Haskell, Clojure, and JavaScript, and some may just move from Ruby to language X. Among the PHP people I know, some have an interest in Ruby, but few seem inclined to make the switch. Same goes for ASP/.net devs I know. And, overall, I get the sense there are more PHP developers than Rubyists (at least in my part of the world). I gave an intro Ruby class at a recent CodeCamp, and attendance was much lower than similar presentations I've given in previous years. (My intro Haskell presentation had more people.) All this is anecdotal, but PHP seems to work really well for solving enough problems for enough people. We can dismiss these people as lacking sophistication or 1337-ness but apparently they are quite happy, and there's something to be said for that.
- jacquesm 16y agoIf you are comparing programming languages and marriage then here is my advice: Stay Single. Don't get too hung up on any one language or framework. Stay flexible and hold the door open to something new and better if it should come along. Even python - without a doubt a more elegant better designed language than php - has its shortcomings. And php, for all its shortcomings has its clever bits too (except, that it didn't so much as go through a design phase as it went through growth out of necessity).
- cookiecaper 16y agoI don't think that the analogy has to be considered in the context of a monogamous relationship. Marriage has not always been monogamous -- in fact, almost exclusively in the Western Christian tradition has marriage been considered exclusively monogamous, most other cultures have allowed polygamous marriages. From that context, the headline makes better sense -- you are not necessarily considering Python as the only tool in your toolbox, but as something that is worth taking home and making a life with, i.e., using Python as a mainstay in your professional life. Python, like all programming languages, has its shortcomings, you are right. But potential wi(fe|ves) have shortcomings too -- in this mortal sphere, nothing is perfect, but we can't let that paralyze us.
- ErrantX 16y agoAmen. I started on PHP and still use/love it. Got into python for an entirely separate reason and still use/love it. Learned C then C++ for university, still use/love it. Picked Ruby up on a whim about 8 months ago... well, you guessed it. All the language wars make me smile; rather than complain about the shortcoming of X, just use Y to solve "that" problem.
- jpeterson 16y agoIn Python land, the clear web framework winner is Django. Is this really true? Personally, I prefer Pylons by a large margin.
- jamongkad 16y agoI rock it old school and still prefer web.py over anything.
- mhd 16y agoFor the big stack frameworks, it's quite major. As he said, without the sheer market share that Rails has for Ruby… That's true for big full stack frameworks, where most of the contenders disappeared. Real competition seems to happen mostly in the mini framework area, due to people being forced to ditch more and more parts of their full stacks and wondering why they couldn't instead build upon a small platform. Flask is gaining traction here. And then there's app engine, where things run a bit differently, and forcing django et al on top of it can feel a bit unnatural. Tipfy seems to be en vogue there. In Python country, you always had quite a number of projects that ran outside the mainstream, though. Tornado, cherrypy, web.py, web2py etc.
- sliverstorm 16y agoWell, let me just comment that I don't know a single line of Python, and yet I know what Django is (loosely) and have heard of it a lot. Never heard of Pylons.
- cookiecaper 16y agoI have used Pylons extensively, but not Django. I really prefer Pylons's packaging and methodology. Django seems more like a "classical" web framework where everything is included and much has been reinvented. Since my exploration in programming is often a matter of personal taste (i.e., not forced by employer to learn something very often), I have not really spent much time with Django as that style of framework does not mesh with my preferences. That said, I have recently been tinkering with a Satchmo cart. I am under the impression that Django apps that utilize the Django backends can be converted into plugins for other Django apps with trivial or near-trivial effort, and that gives Django-based applications a lot of power, because if both Satchmo and some Django-based forum use the Django admin and user database, I can plug in or replace forums really easily without creating a bunch of extra overhead for my users. That is very appealing to me, and the first reasonable use of a "big" framework (like Django, Rails, or Cake) as far as I am concerned. It has encouraged me to explore Django/Pinax more thoroughly.
- rick888 16y ago"The learning curve these days is not a new language (it takes a proficient programmer just a few days to get her arms around the basics of a new language). The learning curve is with the framework." This is my main problem with this line of thinking. Developers aren't actually developing anymore. They are mashing together frameworks. I've looked into frameworks like Django. It's not good because it abstracts away the functionality of the database. It's nice that everything is an object, but if you want to do something more complex and go around the framework, things get messy and start to feel hackish. I am a PHP developer and I generally don't use a PHP framework. I have my own set of classes that I wrote (and improve on). I have also used the smarty template engine in the past, which works really well for keeping HTML separated from the actual code (and it has built-in caching). Jquery is also great for the front-end. I started development with pascal, then moved to c/c++, and finally PHP. I like PHP because it is a high-level enough language that makes development easy, yet it's still powerful enough to allow for complexity and lower-level functionality. The c-style syntax doesn't hurt either. PHP 4 and below had many security issues (what were they thinking with register_globals?), but 5.1+ has made some major changes.
- commanda 16y agoYou say you don't believe that mashing together frameworks is actual development, yet you recommend the jQuery framework for front-end coding. Do you draw a distinction between front-end and back-end - is front-end work not really development? In my experience, the time it takes to become proficient with an existing framework is generally a lot shorter than writing a framework yourself. And, generally, the existing one will have been vetted by thousands of people before me.
- terryjsmith 16y agojQuery is nice because you can jump back and forth between it and "regular" Javascript. Inside your $(id).click() function you can just as easily call document.getElementById. jQuery even provides you access to all of the DOM level objects in case you want to escape outside of it for a bit. Most frameworks do not let you do this and you have to actually have to work at it/hack at it to use functionality that isn't provided by them.
- wenbert 16y agoI think PHP's strength is coming from the large amount of web hosting companies offering it. It seems to be the "default" they offer, along with MySQL. Also, those hosting providers are so cheap that for some it is the only choice that they have (including myself). While I have been learning Python for over a month now, I still do not have a server to run my stuff on. I run it on my local machine but it feels different when you have it "out there". After a month of looking at and learning Python, I fell in love with it. Bottom line, if web hosting companies offer Python as one their "default" installations, then I would directly jump right in. Python is nice because it has great web frameworks available - and at the same time, I can use it as tools to parse my huge CSV files (and other tasks) while I'm offline. Python is a very "comfortable" language to learn - I never had that feeling when I tried to learn Ruby.
- Yaggo 16y agoThere are plenty of Django-friendly hosts available with easy deployment options: http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts If your needs are more exotic, you can buy a VPS for $20 per month.
- wenbert 16y agoI still can't afford $20/month. :-| That is almost the same amount I pay for my hosting for the whole year. FYI, I live in the Philippines. If get a Linode, I will not be able to afford to pay for my internet connection hehe I am however planning to get a VPS though. I'll find a way :P
- Yaggo 16y agoI see, no doubt that's lot of money in Philippines. Even the typical smallest VPS (eg. from Linode) has so much power, that you can easily run multiple instances of various services on it (if we are speaking of hobby / small scale projects). Maybe you can share the costs with some friends? Or deploy your apps on Google App Engine! It's free (within the free quota), supports WSGI apps, so you can run Django-nonrel, Tornado, Flask, Pylon, Tipfy, or whatever your favorite Python web stack is.
- billybob 16y agoPoint #5 did a good job of addressing a debate we see here sometimes: "Language X serves our company well, but picky developers don't want to work for us because we use it" vs "I want to work in a job that uses Language Y because it's better." I think it's worth quoting: Lets say you’re something like me: You’ve learned PHP and used it to build and launch “real world” apps. For you, the cost of change is high (maybe even prohibitively high). Really hard to justify the change, because though you might grudgingly admit that Python is better, it’s not better enough to warrant switching. You’ve got a startup to grow, you can’t be bothered with trying to join the cool kids. But, I’m to advocate for some empathy here. Lets say you were on the outside looking in (i.e. you’re a gifted developer looking to join a cool new startup). Since you’re really good, and demand for great developers always exceeds supply, you essentially get to pick where you want to work. All things being equal, you’re going to pick the place that is doing Python vs. PHP. Of course, not all things are equal, and you might actually pick the startup whose business you think has the best chances of success or whose founders you like and respect. But, often, it’s hard to know that stuff upfront, so you focus on what you do know — that developing in Python’s a better “bet”. I wouldn’t fault people for solving for their self-interest and preference. They’re not trying to talk you into switching, they’re just saying that it matters to them.
- bergie 16y agoThe biggest issue with PHP doesn't really have anything to do with the language itself: there is a serious lack of ecosystem. Instead of sharing modules and libraries, every project seems to form an isolated environment where code from any other project is shunned. I've been thinking about ways to solve this, as the PEAR effort never really took off.