Ask HN: Where to start? Am I on the right track?
9 comments
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.
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.
> 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.
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.
PHP 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.
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.
>"Between PHP or Flask, would one be better suited than the other to start with?"
IMO, it doesn't matter if your goal is to have a business. What matters is the problem you are going to solve and how solving that problem turns into money.
On the other hand, if your goal is to learn another programming language or improve your programming skills or learn a web framework, then it's really just a matter of personal preference...so again, it doesn't really matter.
Finally, if your goal is to get a job, there are lots of them for PHP. Some for RoR, some for Python, and probably not all that many for Flask.
IMO, it doesn't matter if your goal is to have a business. What matters is the problem you are going to solve and how solving that problem turns into money.
On the other hand, if your goal is to learn another programming language or improve your programming skills or learn a web framework, then it's really just a matter of personal preference...so again, it doesn't really matter.
Finally, if your goal is to get a job, there are lots of them for PHP. Some for RoR, some for Python, and probably not all that many for Flask.
I'd avoid PHP (because there's so many that start from scratch with PHP and make a bad name for themselves and the language). Python and Flask are a good place to start and Python is a "respected" language. So without experience and PHP on a resume puts you'll be lumped in the same group as all the awful programmers that think PHP is bees-knees (Even if you're not awful).
Plus, there's this. http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...
Plus, there's this. http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...
In general though as long as you learn good learning skills you'll be fine. It doesn't matter what framework you choose in two years or less the stack will be very different (with a high likely hood). Learn good software design, databases, cacheing, javascript, basic html, css and you'll be solid no matter the details of how it's accomplished.
Thanks for the input! Didn't someone make the hammer you described above?
Use what you know best right now. But keep learning other things on the side.
Forget about choosing frameworks. Pick the one with good documentation (code igniter in PHP) and hack away. Build it already.
The more time you waste "deciding", the less time you will be able to program. Jus tpick something anfd run with it.
Forget about choosing frameworks. Pick the one with good documentation (code igniter in PHP) and hack away. Build it already.
The more time you waste "deciding", the less time you will be able to program. Jus tpick something anfd run with it.
A little about me: I'm very unhappy in my current field of computer & network support and need a change. I'm 24 and hate what I do. I'd like to eventually generate some passive income/break even and then grow from there if this seems like a good fit for me. I've dabbled in c++ a couple years ago and created simple LAMP based intranet site. Recently I've started working on the website of the company I currently work for, mostly some basic PHP. I'm ok in HTML and CSS.
Choosing a language and/or framework has been difficult. I've narrowed it down to either PHP or Flask. PHP because that's what I have the most experience with. I have a couple development books on it. Flask because it looks like a minimal framework and something I'd be able to understand in a shorter amount of time compared to something like Django. There are some useful looking plugins to get myself started and between Python and RoR, Python seems more attractive to me. I have a little experience in MySQL so would probably go with that to start with.
Am I on the right track? Between PHP or Flask, would one be better suited than the other to start with? I'm afraid of doing the majority of my learning ahead in a language or framework that could be damaging in the long term of a possible development career. I don't want this to be a lang vs lang post but I value the experience of the HN community and would love to hear your opinions and experience. Email is visible in my profile if you'd prefer that.