Rambling On [PHP] Internals
131–140 of 169 posts
Re: Rambling On [PHP] Internals
#132I recently started learning PHP as my first programming language and I love it so far. But the amount of negativity and hatred I see towards PHP on the internet (even among so-called PHP lovers) makes me question my decision of learning PHP. My main purpose for learning PHP is for web-development. I have looked into java code and I felt like I am going to shit pants if I have to learn that. 2 questions. - Am I wastin…
PHP is mostly ok as tool to get shit done with but it is one of the worst possible options for something to learn as a first programming language for many reasons, including:
- you will not learn how most real programming languages are, as PHP was not designed or engineered as a programming language, instead it is a collection of tools and commands that mutated and evolved into a programming language
- most code you will encounter written in PHP is very bad code (not all, but most), so you will find it very hard to learn from other people's code (this is the main reason to stay away from PHP imho!)
- it either lacks or has weird variants of the constructs that permit certain very useful styles of programming: no real closures until 5.3 and the need for the `use (...)` syntax to have them behave like in other languages, it has two namespaces for functions and variables (not other common language has this - yeah, there's Perl and Common Lisp, but...), weird stuff when it comes to namespaces, weird rules and stuff like autoloading, more weird stuff around the OOP features...
- so it leads to you learning all sorts of details that are basically untransferable skills - i.e. they won't make you a better programmer in general they will just make you a more effective PHP coder
I seriously recommend you to learn Javascript as a first language, as it has all the important constructs needed to learn programming in a sane way and it will also help you on the front-end side. It's just as simple as PHP to learn (I'd say simpler, because it doesn't have all the weird stuff in PHP) and later it will allow you to learn the basic concepts of both OOP and functional programming without much pain. Whereas coming from PHP, lots of concepts will be difficult to learn because "your mind will be twisted the wrong way". Javascript just feels natural for a beginner with no preconceptions: you can just assign a function to a variable and pass it around as a variable to other functions, then slowly learn what objects are by using them as "arrays" at first, then as arrays that have a special "prototype" (and with this, boom, you will have learned the simplest way to implement what in OOP is fancily called "inheritance" and you are in OOP land now).
Python is cool too, and it might be easier to find webhosts with python support than with Node (this is for Javascript running on the server, like PHP). Ruby too, but it too has "weird stuff" in it so I wouldn't recommend it as a first language, but it's still a better option than PHP. You can easily learn PHP in the future if your job will require, but don't start with it.
Re: Rambling On [PHP] Internals
#133I recently started learning PHP as my first programming language and I love it so far. But the amount of negativity and hatred I see towards PHP on the internet (even among so-called PHP lovers) makes me question my decision of learning PHP. My main purpose for learning PHP is for web-development. I have looked into java code and I felt like I am going to shit pants if I have to learn that. 2 questions. - Am I wastin…
If you are learning PHP in 2013, yes, you are wasting your time. PHP's killer feature was (not any more) $5 web hosting, where you could upload your index.php with FTP and you're done with deployment. This is no longer the case. PHP stands for (at least used to) "Php is a Html Preprocessor", but at some point it turned into a general purpose programming language, largely as an afterthought.
Yes, you can learn web programming using PHP and that skill won't be wasted. But a lot of the PHP specific issues you'll be dealing with is just going to be a waste of time. There is a lot of WTF issues in PHP that you'll inevitably stumble into. This will be a major factor in the time wasted.
In addition, the world is full of bad PHP code. Yes, there is good PHP code too but the proportion of bad code is probably larger than in other languages. This will mislead you and make you learn bad practices more than you would perhaps do if you'd be learning another language. These are cultural, not technical issues.
For a beginner, I would recommend Python or JavaScript. Neither of them is my favorite language, but Python is rather beginner friendly and JavaScript has a special role since it's the language that web browsers use. Ruby is popular too, but in my opinion it has more traps a beginner could stumble into (not so much for an experienced programmer).
For learning purposes (not production code), I would perhaps even recommend staying out of big monolithic frameworks like Django and Rails and learn how things work internally. You'll get a better idea from HTTP and other web technologies if you build your own "framework" from building blocks like WSGI, SQL alchemy and a templating engine like Mako or Mustache (these are Python-specific, for another language, you'd pick other tools).
This is my recommendation for a beginner looking into web programming and my motivation is to keep a beginner away from bad technologies that may teach bad practices.
Re: Rambling On [PHP] Internals
#134Re: Rambling On [PHP] Internals
#135I recently started learning PHP as my first programming language and I love it so far. But the amount of negativity and hatred I see towards PHP on the internet (even among so-called PHP lovers) makes me question my decision of learning PHP. My main purpose for learning PHP is for web-development. I have looked into java code and I felt like I am going to shit pants if I have to learn that. 2 questions. - Am I wastin…
I am taking a risk here and going against the popular opinion. Note that this is my opinion , not a hard fact. If you are learning PHP in 2013, yes, you are wasting your time. PHP's killer feature was (not any more) $5 web hosting, where you could upload your index.php with FTP and you're done with deployment. This is no longer the case. PHP stands for (at least used to) "Php is a Html Preprocessor", but at some poin…
Re: Rambling On [PHP] Internals
#136Re: Rambling On [PHP] Internals
#137The author is complaining about lack of vision, leadership and regulations. And most of us can perfectly understand that, except: those are exactly the things that set PHP apart from most other major open source projects. It is by far the most anarchic and disorganized major OSS project and yet it still thrives . It still moves forward, it still gets better. Yes, it's design foundations as a language are not particul…
Killing PHP dead would be as hard as killing IE6 was.
Re: Rambling On [PHP] Internals
#138Earlier quoted context omitted.
I am taking a risk here and going against the popular opinion. Note that this is my opinion , not a hard fact. If you are learning PHP in 2013, yes, you are wasting your time. PHP's killer feature was (not any more) $5 web hosting, where you could upload your index.php with FTP and you're done with deployment. This is no longer the case. PHP stands for (at least used to) "Php is a Html Preprocessor", but at some poin…
So brave. Trust me, on hackernews you are not going against the popular opinion. Actually you'd be hard pressed to find any decent programmer community in 2013 that advocates PHP for beginners.
Re: Rambling On [PHP] Internals
#139Earlier quoted context omitted.
Most common thing that seems to come out is using string concat for sql queries.
Yes, 8 years ago ... PDO and prepared statements is the quasi-standard since the release of PHP 5.1
Re: Rambling On [PHP] Internals
#140I recently started learning PHP as my first programming language and I love it so far. But the amount of negativity and hatred I see towards PHP on the internet (even among so-called PHP lovers) makes me question my decision of learning PHP. My main purpose for learning PHP is for web-development. I have looked into java code and I felt like I am going to shit pants if I have to learn that. 2 questions. - Am I wastin…