6 ms·
I wouldn't put PHP close to Flask in the same sentence. Even though PHP has quite an extensive function library and is a template language in itself, it doesn't
by inDesperateZone 14y ago
I wouldn't put PHP close to Flask in the same sentence. Even though PHP has quite an extensive function library and is a template language in itself, it doesn't provide enough to compare even to a micro framework like Flask.
To come close you would probably end up using a framework written in PHP. At that point the language doesn't matter all that much.
I'm helping a friend writing a simple wiki-like application and due to him having to explain every part of the program we decided to write as much ourselves as possible and only use external libraries when absolutely necessary. Me trying him to explain what Django does and why it would help him didn't end well.
I'm not the absolute master of Python web frameworks, but I know enough to come by. But I tell you, writing clean, understandable, side-effect free and secure code in PHP is much harder in comparison than I expected.
There are thousands of tutorials on the web. But a lot of them show things done wrong, deprecated or blatantly insecure. The language is quite a mess and you can do the same thing 10 different ways, 8 of which are deprecated and maybe 1 that works with unicode. Not that you would know it's deprecated, the original mysql API is still not officially called deprecated, but it sucks big time.
I reckon knowing how to use Flask and Django makes it harder for me to write code the hard way. I'm replicating a lot of functionalty in PHP. But at the same time I know that I'm not good enough to do so.
And doing so costs time anyway. I would have probably finished his application in a quarter of the time using Django, heck, even Flask. And it might even hold up to industry standards. My PHP code not so much. Somebody would probably end up dead.
- debacle 14y ago> Even though PHP has quite an extensive function library and is a template language in itself, it doesn't provide enough to compare even to a micro framework like Flask. PHP and Flask are two completely different things. One is a programming language and the other is a framework. To say "PHP doesn't provide enough to compare" to a microframework shows a gross ignorance of what PHP can do and a grand exaggeration of what Flask is actually doing. > But I tell you, writing clean, understandable, side-effect free and secure code in PHP is much harder in comparison than I expected. If you were talking about Ada or a similar language, I might agree with you, but you're talking about Python. It's just as easy to write bad Python as it is to write bad PHP. From the rest of the post, it seems like the problem isn't that PHP is bad, but that you don't know (even remotely) how to write good PHP.
- inDesperateZone 14y agoPHP offers a lot of things that other languages provide trough the means of a framework. So I don't think it is unfair to compare it to a framework. The use of frameworks seems to be condoned. On my search for a template engine I passed by many articles of PHP developers saying they were unnecessary as PHP would provide all you could need. Flask doesn't do much. But that's exactly the point. Even though it's so simple it offers enough to write an application that shouldn't have to hide because it's amateurish. > From the rest of the post, it seems like the problem isn't that PHP is bad, but that you don't know (even remotely) how to write good PHP. That may be true. But it could also be true that writing good PHP requires far more skill and time. Skill I might not have. But I'm not someone blindly following tutorials or someone who tries to whip out a lousy program as fast as possible. Nor do I think PHP is a bad language is such. But I had a hard time.