Php or Python or both?

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

37 Replies - 1243 Views - Last Post: 01 September 2017 - 01:07 AM

#1 nesir28  Icon User is online

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 11-August 17

Php or Python or both?

Posted 15 August 2017 - 10:19 AM

As my question suggests what would be the more suited language to spend time on from a web developers perspective? Function wise are they the same or too diffrent for one to be excluded? i know python is rated as easy to understand and code, this makes me weary of it ....
Is This A Good Question/Topic? 0
  • +

Replies To: Php or Python or both?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13346
  • View blog
  • Posts: 53,152
  • Joined: 12-June 08

Re: Php or Python or both?

Posted 15 August 2017 - 11:01 AM

Why not try out both and see which you prefer?
Was This Post Helpful? 1
  • +
  • -

#3 nesir28  Icon User is online

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 11-August 17

Re: Php or Python or both?

Posted 20 August 2017 - 08:52 AM

Well my fear was i would be spending time on learning a markup language when the other was more capable or had exclusive use of certain web development functions.I was hoping to skip that learning curve but seeing as i already have some php knowledge i think thats the way il be heading , even though the general consensus among web developers seems to be that python is better.
Was This Post Helpful? 0
  • +
  • -

#4 jon.kiparsky  Icon User is online

  • Screw Trump (before he screws you)
  • member icon


Reputation: 10603
  • View blog
  • Posts: 18,116
  • Joined: 19-March 11

Re: Php or Python or both?

Posted 20 August 2017 - 10:38 AM

View Postnesir28, on 15 August 2017 - 12:19 PM, said:

As my question suggests what would be the more suited language to spend time on from a web developers perspective?


In my view, PHP is a dead language that hasn't stopped twitching yet. There are many web frameworks in many respectable languages, including python, which are worth your time. The main reason to learn PHP, as a new developer, is if you're really excited about the idea of maintaining archaic sites while they're waiting to be ported to a modern language or decommissioned. This is honestly what the future offers for the PHP developer.

Quote

Function wise are they the same or too diffrent for one to be excluded?


I would say that they are not the same - although they're both technically Turing complete, in practical terms you can do everything with Python that you would do in PHP, and there are many things that you can do in Python that you couldn't do in PHP.

Python has two web frameworks that are in common deployment, django and flask. You can use either one to develop anything that you could do in PHP, but if you're just getting started django is the easier way to go - it has more "batteries included" than flask, which is intended as an extremely lightweight framework, and the documentation and stack overflow trail on django give you a lot of support as you're ramping up.
Django is also very security-aware. While every web site is vulnerable to attacks, and every web developer has to be thinking about security, django takes care of a lot attacks for you. You can allow, for example, SQL injection or cross-site scripting in django if you try, but it would take a lot of work and there would be no reason to do it. PHP, on the other hand, is traditionally security-optional. You have to invent your own security measures and remember to apply them. Note: there may be frameworks in PHP that are better about this, I'm mostly thinking about raw PHP which is what I've worked with most.


Quote

i know python is rated as easy to understand and code, this makes me weary of it ....


Python is a remarkably well-designed language. This is why it ate Perl's lunch as a scripting language for dev ops work, for example. It does have some gotchas, but they're pretty rare and they're not things you're likely to run across regularly. This is a feature, not a bug.

Quote

Well my fear was i would be spending time on learning a markup language when the other was more capable or had exclusive use of certain web development functions.


Django does have a templating language, which is probably the weakest part of the framework. Oddly enough, it's the part that behaves most like PHP, in that it mixes styling and calculation and forces you to think about two distinct but interacting syntaxes. I've often thought about trying to replace this with something more reasonable, but time so far says no.
That being said, django templates look a lot like HTML with some inserted execution and variable interpolation syntax. If you work in a disciplined and reasonable fashion, this won't cause you problems. Just remember to use a strict formatting standard and hold to it. (eg, break lines on all structural tags and hold to 80-column lines)
Was This Post Helpful? 1
  • +
  • -

#5 nesir28  Icon User is online

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 11-August 17

Re: Php or Python or both?

Posted 25 August 2017 - 10:55 AM

First of all id like to that you for taking the time to explain this in such detail to me.

I am glad that i have no committed to php fully as of yet after what i just read. I suspected php was falling into one of the old languages categories. I however dared not ask any web developer about it (made this mistake with c+ once) lol.

Now the thing is and i know this might be unrelated but if i look at tools like wix , weebly , wordpress all designed for ease of use by the user and "developers" to me they fall far short from traditional ways of creating websites. I guess i wrongly applied this logic to the python language as well. Although WordPress does scramble to make up for its shortcomings.

So i guess im dipping into Django. I am just glad i have directive now.

Thanks Again
Was This Post Helpful? 0
  • +
  • -

#6 ge∅  Icon User is offline

  • D.I.C Lover

Reputation: 173
  • View blog
  • Posts: 1,108
  • Joined: 21-November 13

Re: Php or Python or both?

Posted 30 August 2017 - 09:23 AM

Before you jump with both feet in python, I think it's important to note that it is a niche https://w3techs.com/...ng_language/all

Now, don't get me wrong, I am not sure it would be detrimental for your career. To the contrary, if python back-end programmers are more rare, it will make you stand out in the crowd. How many companies need you, I don't know, but you only need one ;)

I use to hate PHP, I haven't tried PHP7 but it looks like the community has awaken. They have dropped support for a lot of rubbish stuff, they have added features generally associated with more serious languages (things like return types for example). Just as Javascript, the development rate of PHP seems to have accelerated lately and I am confident this language is not going to die, it is moving its digital ass.

There are lots of widely used, more or less clean and active frameworks / CMS built with it, and it is true that the clients who already use them are unlikely to change.

I don't think it is fair to talk about the templating capability of language. Every serious back-end programmer uses a templating engine with PHP, and since templating engines are just parsers, you can find any syntax and every feature you like, and many of them exist in other languages.

I am a front-end dev and graphic designer so I'm not in my comfort zone here but I wanted to balance jon.kiparsky's answer which I find a bit extreme.

This post has been edited by ge∅: 30 August 2017 - 09:26 AM

Was This Post Helpful? 0
  • +
  • -

#7 jon.kiparsky  Icon User is online

  • Screw Trump (before he screws you)
  • member icon


Reputation: 10603
  • View blog
  • Posts: 18,116
  • Joined: 19-March 11

Re: Php or Python or both?

Posted 30 August 2017 - 10:16 AM

I don't know where those folks are getting their data, but it's clearly not reliable (notice that they're lying to you about the date, so you should assume they're lying to you about something else as well)

Python is in no way a niche language - these days, it's the default language for general-purpose work and scientific computing, and new web development is largely split between python and ruby.
If we're just talking about web, PHP has a ton of installed stuff, but that's largely a legacy effect - for a long time, PHP was the go-to for dynamic sites, and there's a lot of hobby sites and stuff out there in PHP. Also, that 82% surely includes every WordPress site out there, which is a pretty dodgy way of counting. If you're talking about work that you can get hired to do, new sites are largely python or ruby, and your PHP work is mostly maintenance work, or sometimes porting PHP sites into a real language.

Sorry, but PHP is dead, and it's not coming back. Cope.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13346
  • View blog
  • Posts: 53,152
  • Joined: 12-June 08

Re: Php or Python or both?

Posted 30 August 2017 - 10:51 AM

Har-har.. I think calling PHP dead is a far reach. Plenty of jobs for new development, it is being consistently updated, and as you pointed out there is a ubiquitous base already out there the industry.

Of course I am not one to put all my eggs in one pascal basket so again.. permute - do both.
Was This Post Helpful? 0
  • +
  • -

#9 ge∅  Icon User is offline

  • D.I.C Lover

Reputation: 173
  • View blog
  • Posts: 1,108
  • Joined: 21-November 13

Re: Php or Python or both?

Posted 30 August 2017 - 11:09 AM

They don't lie about the date, they update it daily. The methodology of the survey is explained.

It is certainly biased, as is any tech survey, especially for server-side things: it is very hard to detect and self-assessment is biased too (it depends what community you ask), but you can't deny the web is dominated by PHP today.

Now, you have a point when you make the distinction between what is online today and what is being made from scratch today, but there is no way you can show us non-biased data showing that Python and Ruby are first ranked, because there is an even bigger community bias for this category of websites and it's even harder to sniff, and your personal experience has no statistical value.

Moreover, clients have a preference for the environment they are using now, because it doesn't require a formation to modify what you do for them in house, and if the environment is as standard as Apache + PHP + Drupal or something, they know they will always find a company to update it if for some reason they forgot to pay you and you are cross with them ;)

There is no doubt Python is a very popular language by itself and a very popular scripting language within applications, but it tells nothing about its chances to take over the web in the future. I am not saying PHP is a safe bet because it has a very bad reputation, but they are working on it. Look at Javascript : People like Google thought in 2011 they could replace it with Dart some day, but ECMAScript evolves so insanely fast that it is less and less likely.

Again, it's not my field, you must have a better feel of it, but you are just as biased as me. Most of my clients use Java today which could lead me to believe it is more representative than it really is. I also read a lot about Node.js, which could influence me into thinking it is the future of the web (it makes sense: one language to rule them all - why not?) but I am not this naive.
Was This Post Helpful? 0
  • +
  • -

#10 ArtificialSoldier  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 1769
  • View blog
  • Posts: 5,640
  • Joined: 15-January 14

Re: Php or Python or both?

Posted 30 August 2017 - 11:12 AM

There's nothing dead about PHP. If anything, it's getting away from the low barrier of entry that it used to have. Trying to navigate around the code base for a large Zend Framework 2 or Laravel application, for example, is a far cry from looking at even something like Wordpress. But speaking of Wordpress, they now recommend PHP 7, even though they have out-of-life versions that will work on PHP 5.2.4. Even the mainstays like Wordpress or phpMyAdmin have vastly improved their code bases. The PHP community has come a long way, and rumors of its death are premature.

Quote

there's a lot of hobby sites and stuff out there in PHP.

There's also a lot of professional sites and stuff out there in PHP. The fact that the installed base is so large as to encompass large groups of both hobby and professional sites should be a testament to its usefulness, not an indication of its demise.

Quote

new sites are largely python or ruby

Is there non-anecdotal evidence to support that claim? I'm assuming that you're claiming that there is a larger number of new sites running python or ruby (or hell, both combined) than new sites running PHP, and I don't think that's true.

There's nothing wrong with learning Python, Ruby, C#, or any other language. There's nothing wrong with learning a new language, period. There's also nothing wrong with learning PHP (assuming, of course, that you're learning modern PHP, not using some 10+ year old resource to learn). PHP is not going anywhere whether people accept that fact or not.
Was This Post Helpful? 0
  • +
  • -

#11 jon.kiparsky  Icon User is online

  • Screw Trump (before he screws you)
  • member icon


Reputation: 10603
  • View blog
  • Posts: 18,116
  • Joined: 19-March 11

Re: Php or Python or both?

Posted 30 August 2017 - 11:31 AM

Wow, hit a nerve there. Whatever. In the real world, PHP is a doornail. The people that use it are the people who haven't got around to getting rid of it yet.

When I say dead, I mean that the language is not used by serious developers, because it's a completely broken language. The only way you'd use the language is because you need the money and you can't find another gig, or because you're maintaining a site that's not worth porting to a real language.
It cannot be made into a working language without breaking backward compatibility, and breaking backward compatibility would break the only remaining use case for the language, which is legacy sites, so it's never going to be fixed.

The language was an interesting experiment that has way outlived its useful lifespan. Let it die. It's crying out for release, let it go. Say your goodbyes, have a little party, and turn off the life support. You're doing it no favors by prolonging its agony.
Was This Post Helpful? 0
  • +
  • -

#12 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13346
  • View blog
  • Posts: 53,152
  • Joined: 12-June 08

Re: Php or Python or both?

Posted 30 August 2017 - 11:42 AM

Oh come on now jon - I know you really really dislike PHP because it shot your dog and left it confined to a wheelchair growing up, had it's dad tear down the rec center after beating you in a skii race, and totally crashed your first house party, but it's a little silly.

Quote

The people that use it are the people who haven't got around to getting rid of it yet.

... or, you know, it is a tool that fits the functionality needs of a web site for a given company.

Though I like that line and may cite it for a sign when I troll the functional programming quarterly regional meetup.

Quote

When I say dead, I mean that the language is not used by serious developers,

Ah yes.. *stroking my chin* The _SERIOUS_ developers. :D/>

(づ。◕‿‿◕。)づ

Was This Post Helpful? 0
  • +
  • -

#13 ArtificialSoldier  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 1769
  • View blog
  • Posts: 5,640
  • Joined: 15-January 14

Re: Php or Python or both?

Posted 30 August 2017 - 11:42 AM

Quote

Wow, hit a nerve there. Whatever. In the real world, PHP is a doornail. The people that use it are the people who haven't got around to getting rid of it yet.

Yes, it gets on my nerves when people make statements like that, as if their experience is relevant but mine is not.

Quote

When I say dead, I mean that the language is not used by serious developers

Or like that. Now I don't work in the real world, I just haven't gotten around to getting rid of it yet like I'm not doing my job, and I'm not a serious developer. Yeah, those kind of statements get on my nerves because of the egotism.

Quote

The only way you'd use the language is because you need the money and you can't find another gig, or because you're maintaining a site that's not worth porting to a real language.

Ah, I'm also unemployable and the application I designed is not worth porting to a "real language", the definition of which I'm assuming is also left up to you, since it appears that your experience is the only one that matters.

It's the egotism shown in the above statements that gets on my nerves. I don't really care whether a given person likes PHP or they don't, but when someone who doesn't know me or my work starts talking shit like it's a universal truth, it makes them look like an ass. But, based on the egotism, I bet you're convinced that this is also my problem and that there's nothing wrong with any of your blanket statements.

My recommendation still stands. There's nothing wrong with learning any new language. If someone wants to learn PHP, find a good resource and learn it.
Was This Post Helpful? 0
  • +
  • -

#14 ge∅  Icon User is offline

  • D.I.C Lover

Reputation: 173
  • View blog
  • Posts: 1,108
  • Joined: 21-November 13

Re: Php or Python or both?

Posted 30 August 2017 - 11:47 AM

They are breaking backward compatibility and some PHP CMS are dropping support for PHP5 for their next iteration. PHP is going forward. And legacy sites don't run on updated servers anyway.
Was This Post Helpful? 0
  • +
  • -

#15 jon.kiparsky  Icon User is online

  • Screw Trump (before he screws you)
  • member icon


Reputation: 10603
  • View blog
  • Posts: 18,116
  • Joined: 19-March 11

Re: Php or Python or both?

Posted 30 August 2017 - 12:07 PM

View Postge∅, on 30 August 2017 - 01:47 PM, said:

They are breaking backward compatibility and some PHP CMS are dropping support for PHP5 for their next iteration. PHP is going forward.


Not sure why you'd bother, to be honest. If you're going to go to all the trouble of rewriting, why not just do it in a sane language?

I mean, I know PHP is cute and all, but let's be realistic. It's a language designed by amateurs for amateurs. It was made by people who didn't know what they were doing and they built failure in from day one. Why wouldn't you move on?
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3