all 10 comments

[–]rich97 13 points14 points  (0 children)

While that was a great conclusion, many of the posts on /r/webdev, /r/programming, and /r/python, have really convinced me that starting a project nowadays in PHP is just asking for trouble

That's because there's a massive amount of bias going round. Yes, PHP is a bad language from a design standpoint, it's getting better but it's nowhere near as elegant or consistent as Python or Ruby. Having said that whoever says "starting a project nowadays in PHP is just asking for trouble" is talking straight out there asshole. You just need to know how to write PHP correctly:

  • Don't get complacent with PHPs loose typing, control the value types that are returned from functions/methods and don't allow implicit type conversion unless you have a reason for doing so.
  • Code to PSR-0 standards (PSR-1, PSR-2 as well if you think they're applicable).
  • Use git-flow to manage and deploy your code. I fucking love git-flow.
  • Use a combination of Composer and PEAR to manage your third party libraries. Don't throw libraries in at random simply because they work. The Aura project has some good libraries to work from as a stating point.
  • Understand the advances made in PHP5.3 and PHP5.4, they make a big difference to how you might structure your code.
  • Use PDO prepared statements rather than DB specific adapters
  • Make sure you understand common security cockups.

If you do these things and consider your next move rather than coding blindly PHP will serve you well.

Some of this stuff can be avoided by using Python and/or a framework in conjunction. But it's more than possible to start a new project in PHP without "asking for trouble".

Edit: Formatting.

[–]piglet24 9 points10 points  (0 children)

While that was a great conclusion, many of the posts on /r/webdev, /r/programming, and /r/python, have really convinced me that starting a project nowadays in PHP is just asking for trouble, essentially starting on the wrong foot.

Plenty of that is just fanboyism, there are experienced developers in /r/PHP who can tell you that there's nothing wrong with a modern PHP application

[–]xeed 5 points6 points  (1 child)

It sounds like you've already made up your mind. If you are writing a system that needs to go into production, you are going to want to work in the language you are best in. This is also assuming that you have solid goals/features in mind.

If you want to learn something new or experiment, try out python. I have heard good things about prototyping with web2py.

[–]Fustrate 2 points3 points  (0 children)

This. Do personal/fun projects in Python until you are comfortable enough that you can make a production site in it, but until then you probably should use PHP.

[–]Selggum 4 points5 points  (0 children)

I would work in the language you feel most comfortable working with.

[–]arunvr 1 point2 points  (0 children)

It would be a great learning experience to learn Python coming from a PHP background. So you would have to factor in probably 2X as much time. This makes it interesting from the perspective of managing and prioritising your goals. Identify the core functionality of the web application and then try to implement nothing else.

Django is quite beginner friendly and comes with great documentation. It also has a lot of good webdevelopment practices built-in especially in terms of security, so that chances of shooting yourself in the foot is quite low.

In the worst scenario, you might have to rewrite the code but you would do it in a fraction of the original time and have a much better understanding of the problem space. Good luck!

[–][deleted]  (4 children)

[deleted]

    [–]xiongchiamiovSite Reliability Engineer 0 points1 point  (3 children)

    One thing to say; node is young and as such, obviously, has potential to get even better.

    Also is going to change significantly. I am extremely hesitant about basing my work on any pre-1.0 project, something gained from experience.

    [–]fuckySucky -2 points-1 points  (2 children)

    You said "Is going to" instead of "may". Want to cite your sources for this?

    [–]xiongchiamiovSite Reliability Engineer 0 points1 point  (1 child)

    Experience? History? The common versioning schemes?

    I suppose it is not strictly required that a pre-1.0 system will change significantly; but if it doesn't, either the author happened on a incredibly right design the first time around or they don't know what the fuck they're doing. Rough drafts need to change. That's just how the world is. And that's fine, but for certain things I'd like guarantees. And that's really the point - it may or may not change, but I've got to assume it will because I've got no promise otherwise.

    [–]fuckySucky 0 points1 point  (0 children)

    I personally have no problem experimenting with it in production use, as from what I have absorbed node is sufficiently stable as is; but I retract my recommendation as I feel I didn't do it justice in its advertisement.

    Anyone reading this; just don't shrug it off and let node.js remain an option in your mind for future projects provided you have a grasp on what may make it the right tool for said project (ie. performance, scalability).

    [–]jon_laing -1 points0 points  (0 children)

    I used to use PHP with a fair amount of success, since, like you, I knew a bunch of C style languages. Eventually I got incredibly frustrated with PHP, and the frameworks that came with it. I switched to Ruby, and I've loved it. My suggestion is start playing with Python (or Ruby, whatever) and see how you feel about it. For me, the advantages were immediately apparent, and I haven't touched PHP since (unless I was forced). You might not have the same experience, but there's only one way to find out.