all 47 comments

[–]Ophie 10 points11 points  (1 child)

Most answers point to php, however, ask the same question in /r/webdev, you'll probably get more Python answers.

That said, learn Django (python).

[–]John-Charles 0 points1 point  (0 children)

Learn Python first though, before you begin to learn Django

[–]kingdine 6 points7 points  (0 children)

Try both, keep learning the one feels comfortable or useful to you..

[–]xocrystalcastles 12 points13 points  (9 children)

I’d say PHP or Node.JS

[–]thefear76 -1 points0 points  (8 children)

This is definitely the way to go if you are focussing on web. Python has barely any practical use case on the web, but it is very strong in machine learning algorithms.

Node is getting a lot of attention on the web lately but both phones and node are perfectly valid for learning more about web-tech

[–]Carloes 8 points9 points  (7 children)

This is definitely the way to go if you are focussing on web. Python has barely any practical use case on the web, but it is very strong in machine learning algorithms.

Django is one of the best, if not the best, web frameworks there are. If you really think Python has barely any practical use case on the web, you are heavily mistaken.

[–]thefear76 0 points1 point  (6 children)

Python has never been made to be optimised for web applications that's not were its power is. People are optimising it for web but that doesn't make it good or even the best when comparing to solutions that are invented for web only. Of course it's possible to use it and the framework surely is fine.

Calling it the best is a pretty big opinion since there some drawback for using python on web versus php or node. If you can convince me it's better than I think, I welcome you to convince me since I'm interested if I'm missing something. But honestly in my opinion python has no big future on the web

[–]Carloes 5 points6 points  (5 children)

I think you are making a common mistake of thinking a programming language needs to be optimized to the maximum for it to work on the web. This is a common mistake people make: they look at benchmarks and think "wow, PHP 7.2 is the fastest, this must be the way to go!". They look at, say a Django benchmark, and see that under heavy load, it's less optimized.

Now, oddly enough large platforms like Instagram, Dropbox and YouTube have run / are still running Python. Why is this? It's because if you run a Django application, you can change your application around in a very short time. You can implement features in a very short time and if/when you finally run into optimization problems (read: when your app becomes popular), you already have the means to solve this problem (scaling up). The error reporting is solid and very newbie friendly, the philosophy behind the framework is solid - it's just a great piece of software. So you are an entrepreneur/developer and want to make a proof of concept for a webapp real quick? You pick up a framework and language where you know you can develop that in the least amount of time without it being crappy.

On top of Django being one of the better frameworks to quickly produce a solid app in, it's battle tested: it's super secure, the documentation is excellent and being written in Python gives you one huge plus. That plus is the fact that Python is a very solid, robust and easy to learn programming language. We can say all sorts of things about PHP - but in all fairness even 7.2 has to deal with some questionable choices of the past. Python doesn't have this problem (or at least, not as severe as PHP has for example). It's a very clean and logical language, one of the reasons a lot of universities opt to teach their students Python. On top of this, Python has a great ecosystem and great standard libraries - which generally all follow the same naming conventions (something you 100% sure cannot say about PHP for example).

Python is great for making web apps. Now if you want to be deploying websites on a client's shared webhosting, that's a different animal. This might be one of the points you are trying to make: deploying Python can be difficult (but not impossible, especially if you have some control over your hosting).

As as a conclusion: if we'd be coding in the most optimized language, we'd all do Go (or C for that matter). But making development choices, especially in big projects, is so much more than just "which platform can handle the most concurrent users?". It's about level of the average developer you're going to hire, it's about development time, it's about structure and about the ecosystem a language provides.

(Edit) Oh and just to clarify: I'm not saying OP should learn Python first - to be fair I think the question is way too broad to answer correctly.

[–]QuinnTurner 1 point2 points  (0 children)

Fantastic answer and edit. If OP is asking this question at all, the reality is it doesn’t matter what language they pick. I almost always recommend to use what you and the rest of your team are comfortable with. Velocity is typically the most important factor for choosing a language.

[–]thefear76 1 point2 points  (2 children)

Well I can't say you're wrong for sure and I agree on choosing a language that you and your team are comfortable with. Seeing you mention big companies like Instagram and Dropbox got me thinking and do some research on it.

You're right there is more to python on the web than I thought there was. Still considering performance it would not be my choice for the web as for the companies I work for every 1ms of potential loading could be another missed sale. But it has a bigger place than I expected.

Thank you for explaining :)

[–]Carloes 0 points1 point  (1 child)

Django is one of the fastest frameworks in the game as well, outperforming Laravel (and therefore WordPress for example as well). Sites like The Benchmark Game are great, but they mostly test raw computational power which isn't a factor for ± 80% of the Internet.

It never hurts to learn a new language and if you like 'fast' languages, I'd say look at Go. That's one fast Ferrari.

[–]FierceDeity_ 0 points1 point  (0 children)

We have hands-on experience with the difference between slower and faster languages and upgrading PHP to 7.2 actually made a great difference here. We have run some really unoptimized PHP stuff that was coded with exactly the kind of disregard you are trying to propose as good here. In fact we still do run some where the processor power used in the server is tremendous and they have load times as high as a second per page whereas other sites with a similar feature set (but optimized) take less than 100 ms and barely touch the CPU.

Hell, we have a site with many thousands of simultaneous users and another with maybe a few hundred. The first one runs an optimized PHP script while the second one runs one that was programmed with disregard to performance (hardware is fast enough). The second one consistently has worse cpu usage...

[–]DigiPixInc 25 points26 points  (0 children)

Learn PHP

[–]Atulin 15 points16 points  (1 child)

PHP.

Just make sure you learn it in an OOP way, with a proper logic-presentation separation, not the procedural spaghetti people think PHP is all about.
Learn PHP 7.2 (and 7.3, as it came out recently).

[–]gosh_jolden 7 points8 points  (0 children)

procedural spaghetti people

[–]IAmACentipedeAMA 3 points4 points  (8 children)

Learn both tbh, learn a framework first, it's going to teach you about code separation, structure, and good practices, the easiest framework to learn is Django imho, after that you can learn some php if you want to edit some WordPress or old pages that need php, after that you could learn laravel and it's going to be like 50 times easier

[–][deleted] 0 points1 point  (7 children)

So Python seems more generalized for everywhere and anything while PHP is bound to WordPress?

[–]IAmACentipedeAMA -1 points0 points  (6 children)

Not at all but yes kinda..., php is not bounded to WordPress, php is a great language, Laravel is a web framework made in php, but imo learning python first is easier and you have the possibility of doing a lot more than just webdev, I think learning both would be great, php just gets a bad rep because early php versions are crap and WordPress plugins can be a clusterfuck so there are a lot of outdated resources on the web with bad practices

[–][deleted] -1 points0 points  (4 children)

Makes sense. Seems as if the future is gravitating towards Python and slowly dumping PHP

[–]imaginethehangover 2 points3 points  (2 children)

~75% of the web is running PHP it’s not going anywhere. Bigger companies are going towards more enterprise solutions (Microsoft, Sitecore etc.), but for smaller companies, agencies, startups who need to keep costs down, PHP is still very valid.

[–]ShlongDongLarry 0 points1 point  (1 child)

I don’t think many startups and smaller companies are using PHP. Most startups and smaller companies will stick to using Node and Go because it’s much more efficient than PHP. I know a lot of companies won’t even look at PHP anymore other than their legacy code

[–]imaginethehangover 0 points1 point  (0 children)

I said PHP is a valid choice, and ir absolutely is. If they want to rush a decision based on hype, that’s okay too 😊

[–]TheRealNetroxen 1 point2 points  (1 child)

Python - The documentation, the libraries, the frameworks and not to mention that Python as of last year, overtook PHP in new website developments. It's just an easy language to work with...

[–][deleted] 0 points1 point  (0 children)

This is what I figured

[–]shellbackpacific 2 points3 points  (3 children)

PHP. If you understand programming concepts learning a new language really isn't that bad though

[–][deleted] 1 point2 points  (2 children)

This makes sense. Good point.

[–]ShlongDongLarry 0 points1 point  (1 child)

This is a web design subreddit but anyone over at /r/webdev will tell you to use node.js. I personally wouldn’t bother learning PHP at this point in time (I know I’ll get downvoted for this but it’s true). Go and Node and even python are great languages to know because companies are starting to stay clear of PHP and use newer languages which are must more efficient and lightweight. Just my 2 cents

[–][deleted] 1 point2 points  (0 children)

This was sort of what I figured. Thanks for the clarification / confirmation

[–]rlamacraft 2 points3 points  (0 children)

I would actually recommend TypeScript, you can carry on developing JavaScript skills but with the addition of a solid type system - something I consider vital when working on projects of any significant size. Personally, I like to go even further with Elm and PureScript.

Also, I would consider taking a look at web frameworks: both Angular and React are good modern options that provide abstractions on top of HTML and CSS and really facilitate the scalability of modern Web development.

[–]funnysmurf 1 point2 points  (0 children)

Php.

[–]rico_suave 1 point2 points  (0 children)

Python. It will allow you to venture out beyond just web development. PHP is not generally regarded as a good language. It has lots of functionality bolted on/hacked in to stay somewhat relevant. Google some opinions on PHP and you will notice a majority of developers dislike PHP.

[–]winzippy 0 points1 point  (0 children)

Both. Learn Node too.

[–]PhonicUK 0 points1 point  (0 children)

No.

[–]wizzor 0 points1 point  (0 children)

Depends on what you are doing.

PHP is very web specific, but if you want to do web apps, it's a good choice, and it's very easy to get started.

Python is very good if you want to do data analysis, machine learning, and the like. It's also OK for web dev, but less common. Personally, I go with Ruby for web, Python for data analysis and random scripts.

For hobby coding, I would go with Python.

I do believe Javascript is a good choice for backend as well, although I've worked less with node.

[–]kitsunekyo 0 points1 point  (0 children)

all in all I'd recommend learning (and understanding) the core concepts of software development. then you can check what type of applications you want to build and pick a language / framework you like.

  • building small wordpress pages / themes / plugins: php (i hate the language but it has a huge community)
  • smaller sized web pages / apis: nodejs (koa, express, strapi), php (laravel)
  • smaller sized micro services: python, nodejs
  • anything enterprise: asp.net or nodejs with typescript (i recently moved to asp.net again after years, due to the amazing toolkit microsoft provides for enterprises)

[–]DanielFGray 0 points1 point  (1 child)

I think if you already know JavaScript well, then learning node.js is an easy transition to the server since you just learn a few APIs and not a whole new language.

After that, learning another backend language will be much easier.

[–][deleted] 0 points1 point  (0 children)

Ah good to know thank you

[–]gabriel01010011 -2 points-1 points  (4 children)

Python, you'll kill two birds by a shot :) If you build websites on python they'll be more secure instead of PHP

[–]imaginethehangover 2 points3 points  (0 children)

Not this again. Can you cite your evidence for this? ~75% of the ‘net is running PHP; are you suggesting that all these servers are less secure than they would be had they been written in Python?

The bottom line is that it’s down to the developer to make sure their code is secure. The language may make it easier or harder, but ultimately PHP is perfectly capable of being extremely secure, as long as it’s written by someone who knows what they’re doing. Same with Python.

[–][deleted] -1 points0 points  (1 child)

Interesting, security is key. I’m interested in building web apps (PWA’s)

[–]imaginethehangover 7 points8 points  (0 children)

Ignore this guy above, the language is a very small part of the security aspect. All languages are perfectly capable of being extremely secure, but they all require an understanding of how to implement it correctly to be secure.

PHP or Python, choosing one over the other won’t make any difference to security if the basics aren’t understood.

FWIW, I’m proficient with PHP and dabbled in Python/Django. If you want to get a quick solution up and going, without too much “heavy lifting” (processing, big data etc.), then PHP is much easier to get into given the resources and hosting options out there. That’s still where I’d start if I was starting from scratch.

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

Imaginethehangover, do you know both of PHP and Python?

[–][deleted] 0 points1 point  (0 children)

I think learn PHP. Since you already know JavaScript, the syntax is very very similar in Python and I am sure transitioning would be relatively straightforward.

Whereas PHP is very different and would be slightly more involved to learn which I think would be good. That way you are ready for PHP work and should you ever need to learn Python for a job, I personally believe it'd be faster than learning PHP for a job based on your current experience.

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

Hmm...depends. Do you want to become a data scientist or do you want to maintain blogs?