PHP as first programming language?
Moderator: General Moderators
PHP as first programming language?
I am interested in learning programming and am trying to decide on which language to really dive into. I've narrowed down to Java, PHP, and Python. (others were Ruby and C)
I have pkayed around a bit with PHP (Wordpress) and Java. Now that I am more focused, here are my goals:
1. Learn good programming habits
2. Learn a language which is useful / practical
3. Server-side focues (not desktop / client)
My main concern is whether or not learning PHP will give me an in-depth understanding of programming that I will be able to carry over to learning other languages (some of my developer friends weren't sure how good PHP would be for learning OO techniques, multi-threading, and some things I don't think I will need to know for a long time
If you think PHP would be a good choice, I would appreciate if you would recommend a book or two for learning (remember, to learn not just PHP, but programming techniques in general).
Thanks in advance for your input,
-JR
I have pkayed around a bit with PHP (Wordpress) and Java. Now that I am more focused, here are my goals:
1. Learn good programming habits
2. Learn a language which is useful / practical
3. Server-side focues (not desktop / client)
My main concern is whether or not learning PHP will give me an in-depth understanding of programming that I will be able to carry over to learning other languages (some of my developer friends weren't sure how good PHP would be for learning OO techniques, multi-threading, and some things I don't think I will need to know for a long time
If you think PHP would be a good choice, I would appreciate if you would recommend a book or two for learning (remember, to learn not just PHP, but programming techniques in general).
Thanks in advance for your input,
-JR
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I believe PHP is a nice language to pick as your first. Diving into C or Java would quite possibly be a little disheartening if you're self-teaching and haven't studied programming before.
PHP can do OOP but it's not really an ideal language for programming this way, that said, it will give you the grounding to learn other OO techniques in other languages (Java, C++) - If this is important you'll want to learn PHP5 not 4 - there's a considerable difference here.
Multi-threading is not possible with PHP, since it's just loaded and interpreted in a linear fashion so I can;t really help you there.
I say go for it, and perhaps if you feel like you've grasped it nicely take a look at Java - they teach that in many universities as an introductory OO language.
PHP can do OOP but it's not really an ideal language for programming this way, that said, it will give you the grounding to learn other OO techniques in other languages (Java, C++) - If this is important you'll want to learn PHP5 not 4 - there's a considerable difference here.
Multi-threading is not possible with PHP, since it's just loaded and interpreted in a linear fashion so I can;t really help you there.
I say go for it, and perhaps if you feel like you've grasped it nicely take a look at Java - they teach that in many universities as an introductory OO language.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Consider this is the PH Developers Network forums, I would guess you are going to get a fairly positive outlook on our thoughts about PHP as a development language.
I will offer this much. With the exception of HTML, I had never 'programmed' a thing in my life. Three years ago I began to teach myself PHP so I could explore relational database interaction on the server (because the best I had seen up to that was Perl). Coming from a background of non-programming, PHP was insanely easy to learn. I am still learning some of the more intricate details of PHP (things that a regular developer/programmer would probably know from computer programming classes or programming training) and how it works on the server for tasks beyond simple server side scripting. However, when it comes to achieving a desired result, there has been no language easier for me than PHP. I looked into VB scripting, Server-side Javascripting (which I think is interesting), ColdFusion and C#.net. C# is the closest thing to PHP development for me, but the extensive Object Oriented nature of the language and the potential use of the language for non-web development confuses me still.
So from a newbie's perspective (at leasst from three years ago) PHP is the most developer friendly, easy to use, easy to support, easy to learn language avialable. PLus it is open source, commonly hosted, widely-used (by friendly people) and exhasutively taught about. It's hard to compete with all of that in my book.
I will offer this much. With the exception of HTML, I had never 'programmed' a thing in my life. Three years ago I began to teach myself PHP so I could explore relational database interaction on the server (because the best I had seen up to that was Perl). Coming from a background of non-programming, PHP was insanely easy to learn. I am still learning some of the more intricate details of PHP (things that a regular developer/programmer would probably know from computer programming classes or programming training) and how it works on the server for tasks beyond simple server side scripting. However, when it comes to achieving a desired result, there has been no language easier for me than PHP. I looked into VB scripting, Server-side Javascripting (which I think is interesting), ColdFusion and C#.net. C# is the closest thing to PHP development for me, but the extensive Object Oriented nature of the language and the potential use of the language for non-web development confuses me still.
So from a newbie's perspective (at leasst from three years ago) PHP is the most developer friendly, easy to use, easy to support, easy to learn language avialable. PLus it is open source, commonly hosted, widely-used (by friendly people) and exhasutively taught about. It's hard to compete with all of that in my book.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: PHP as first programming language?
Here's a breakdown:jdrietz wrote:I am interested in learning programming and am trying to decide on which language to really dive into. I've narrowed down to Java, PHP, and Python. (others were Ruby and C)
I have pkayed around a bit with PHP (Wordpress) and Java. Now that I am more focused, here are my goals:
1. Learn good programming habits
2. Learn a language which is useful / practical
3. Server-side focues (not desktop / client)
My main concern is whether or not learning PHP will give me an in-depth understanding of programming that I will be able to carry over to learning other languages (some of my developer friends weren't sure how good PHP would be for learning OO techniques, multi-threading, and some things I don't think I will need to know for a long time
If you think PHP would be a good choice, I would appreciate if you would recommend a book or two for learning (remember, to learn not just PHP, but programming techniques in general).
Thanks in advance for your input,
-JR
Java...is taught in many post secondary institutions because of it's intrinsic OOP support...and was intended to replace C++ (although it's perfect it does have it's problems
Java supports cross platform development and many other next generation programming developments. It influenced M$ into developing it's own language/technology C#
C is an excellent language if your interst is in writting fast, machine specific code (despite compliers for everything, the language still binds you to a target platform)...for instance...Kernel development, device drivers, etc...
C++ is the only way to go develop Desktop applications, as it doesn't require any byte code B$ they run fast...although like C your bound to a specific machine you are also bound to a specific OS. wxWindows is an example of cross platform framework, which resembles the Windows only frameworks OWL or MFC. This means you can easy port your applications from Linux to Windows, but the resulting binary will only run on a Windows or Linux...and specific hardware as well (desktop applications are usually safe to assume x86 family of processors will be used). Anyways the important thing to remember...yes it's machine/OS specific...but portability is possible...sometimes requiring changes in code but minimal to what it used to be...
C# is easy to learn and takes care of alot of B$ for you like garbage collection...and the code (as much as I hate to admit) is cleaner because of it's from the ground up OP nature...but it's sluggish and far from perfect...but eventually most Windows development will be done in C# (converting C++ developers to C# is the hardest part).
PHP/Python...It's to my understanding that Python is an excellent OOP supported language...but the problem is...for one reason or another...it hasn't really caught on...at least not like PHP
PHP is a crazy popular language...every hosting company on the planet likley supports PHP and/or ASP and that rat race between the two titans isn't likely going to change (making room for Python, etc)
PHP although far from perfect...is easy to learn, open source and well supported...also there is plenty of work to be found...both in customizing scripts, writting custom scripts...or building entire web applications...
For web application development PHP is by far the best...ASP proponents will argue there is to many options...and lacks framework support...but that simply isn't true...PHP has many frameworks...and thats the problem, but with experience it becomes a blessing...
For instance...PRADO is a ASP knock off written in PHP...not sure of where it stands right now, but last check...it was doing pretty good...
PHP gives you the ability to start from absolute scratch or start using a popular library/framework...that was it's appeal for me...when I leanred Window desktop development I started in just plain C using the SDK...then switched to writting my own classes and eventually made the transition into MFC and OWL....which made a huge difference in development times...
The point...PHP allowed to me learn from scratch and build on my knowledge as I went...decreasing the learning curve...
ASP does offer the benefit of having M$ behind it...so long as your willing to pay...you do gain access to a plethora of *well written* docs and power tools...something PHP can't compete with...yes there are IDE's but none as well done as M$...
I started web development using ASP but soon decided to go opne source and switched to perl...because at the time...the only way to extend ASP classic was to use ActiveX controls (or atleast thats what I thought) also Windows hosting is on average about double what PHP costs...
I used Perl for about a year or two...while also tinkering in PHP but PHP allowed me to quickly get things done as it's an embedded inside HTML pages...this make learning specifics about web development unessecary (headers, etc) which again shortens learning curve, but allows you to learn as you go...
So to recap...
If you want to learn something practical...and easy...PHP is great...practical I mean...you can make money at it...easily...
Java...good luck...you need years of experience or a degree in some school before you get a job doing anything there....same goes for C++ so practical...not really...
Although C++ is an excellent language to learn, as what you understand that...there isn't much you can't grasp fairly quickly...C++ is arguably the *most* powerful language in existance...as there is very little you cannot do with it once you understand it...
PHP/Python/Perl/ASP
ASP and PHP are practical again cause you can get a job easily with minimal experience...they teach you basics and let you get up and running real soon...expect to study C++ for at least 2-3 years before you can *really* do anything useful, especially in Windows development...
PHP and ASP don't even touch on advancefd subjects like process control, memory managment, etc...but they introduce new problems which come with a ocmpletely different paradigm...like application design, systems design (not OS but rather KBS, CRM, etc) they introduce you to design patterns...and make you more security conscience...but they hide from you many low level details...like again...memory managment...direct control over devices (printer, display, etc)...
Not sure what your after, but it's important to understand that desktop development and web development are completely different beasts...both require *very* different skillsets...almost everything I know from developeing desktop applications doesn't even apply when building web applications...
So you need to either decide for yourself or give me more of what you expect before I can answer anymore...
Cheers
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Thats what I was thinking...Consider this is the PH Developers Network forums, I would guess you are going to get a fairly positive outlook on our thoughts about PHP as a development language.
Not sure he'll get any PHP sucks type replies...otherwise...whoa...lookout...that'd be about the only time when I think we'd all agree in calling that person an idiot
Thanks for the feedback.
First, I intentionally posted to a PHP forum - I have talked to Java and Python "fanatics", but have had a hard time finding people who are PHP fanatics. I don't mean that in a derogatory way - I find that people who use PHP tend to see it as a good tool for web apps, and not for other projects, and therefore they tend to be less tunnel-visioned when it comes to programming languages.
Basically, as I said, my goals are to learn good programming habits (I am familiar with "spaghetti code" even in my short time playing around with PHP) and gain an understanding of programming that I can apply to learning other languages in the future (including OO). Secondly, if possible, I want to learn something that I can use for "real-world stuff" like overhauling my blog, building some simple web applications (maybe an RSS feed aggregator), etc. Eventually, I would like to gain the skills needed to do enterprise-size projects.
I'm not going to do Linux kernel hacking, device drivers, or anything that low level, and for the time being, I'm not interested in desktop appliactions.
Again, thanks for the input.
-JR
First, I intentionally posted to a PHP forum - I have talked to Java and Python "fanatics", but have had a hard time finding people who are PHP fanatics. I don't mean that in a derogatory way - I find that people who use PHP tend to see it as a good tool for web apps, and not for other projects, and therefore they tend to be less tunnel-visioned when it comes to programming languages.
Basically, as I said, my goals are to learn good programming habits (I am familiar with "spaghetti code" even in my short time playing around with PHP) and gain an understanding of programming that I can apply to learning other languages in the future (including OO). Secondly, if possible, I want to learn something that I can use for "real-world stuff" like overhauling my blog, building some simple web applications (maybe an RSS feed aggregator), etc. Eventually, I would like to gain the skills needed to do enterprise-size projects.
I'm not going to do Linux kernel hacking, device drivers, or anything that low level, and for the time being, I'm not interested in desktop appliactions.
Again, thanks for the input.
-JR
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Thats because it's designed to be used for web application development...not desktop application development...I find that people who use PHP tend to see it as a good tool for web apps, and not for other projects
Yes you can use GTK or whatever and create desktop applications...but that is less an ideal...
In that case...you can stay away from C++I'm not going to do Linux kernel hacking, device drivers, or anything that low level, and for the time being, I'm not interested in desktop appliactions.
I believe Java has JSP pages which I assume is like PHP...perhaps embedded in HTML pages like PHP and ASP....but using the Java programming language...
In which case...you'd likely be best off going the Java route...
Personally I never liked Java (although I have very limited experience) not so much because of the language...but because of it's aura...
Pascal was taught in post secondary prior to Java being adapted as the language of choice for education...mostly because PASCAL forced good programming structure...at least procedurally...
I hated PASCAL...I felt like my creativity was being robbed of me...and I assume most others did too as who the hell programs in Pascal these days???
Sure there is Delphi...but people use that only because it's not just a language but en excellent RAD tool...like VBasic...BASIC is a horrible language...but when combined with a power IDE you get one wicked RAD tool which makes it easy for any monkey to learn to develop software...
If you wanna Learn OOP...and I mean properly...PHP won't let you do that...so Java is likely a better choice...although it might also turn you into a OOP zealot and if you make the transition to PHP style interpreted languages...OOP isn't always a best fit for every solution...
Any language learned is a benefit to your personal toolbelt...but once you get the basics
Control structures, loops, etc....it's pretty easy to transcend into other programming languages at the basic level...
Many languages are tightly integrated into specific technologies...and it's usually the technology that takes time learning...not so much the language...
For instance...C++ again...is very powerful...you can do anything you can imagine in that language...the reason I started with it...
But to do anything neat...you need to also learn it's supporting technologies...
- MFC
- SDK
- COM
Learning and understanding Windows internals took me years...learning MFC took me more still...and COM even more...if I wanted to get into device driver development thats yet another SDK I would need to learn and a technology/system I would need to master...
PHP has a massive API and each one comes with it's own little caveats...for instance right now i'm hacking the session API....what a IUY#@($^$!!!
Basically what I'm saying is...you should remain language neuteral(sp.) as it's not *really* the language your learning, but rather the concepts (like OOP) or the technologies like COM, etc...
If you want to learn good OOP practice...try and find a book strictly on OOP which doesn't focus to much on any given language...
I'd love to offer a suggestion, but all books I've read on OOP have been focused around C++ but if you search for books on design patterns or OOP on Amazon I'm sure you'll find something...
Cheers
This is a tough question.... Personally I love PHP, but I wouldn't consider it a good "first" programming language. I am more of an academic than some, so my definition of practical is skewed, I know. But I'd consider some more like Pascal or C a better first language and C will always be useful... However C is possibly too low level to focus on some of the more important best practices/good habits from the start. I like Java, but its a little too "heavy" for a lot of small learning projects.
I love Scheme and think its possibly the best teaching language out there for computer science/theory, but its not too practical in most people's opinion. Python would also make a good first language I think.
PHP is a language of interesting compromises; this compromises make for a very useful, practical language but not for learning good habits.
I love Scheme and think its possibly the best teaching language out there for computer science/theory, but its not too practical in most people's opinion. Python would also make a good first language I think.
PHP is a language of interesting compromises; this compromises make for a very useful, practical language but not for learning good habits.
As I said, PHP developers are not language fanatics - nielsene's suggestion of Python proves the point!
I've done a little work in Java - VERY little, like a "Java in 21 Miliseconds" book
and I would have to say I actually liked the structure of the language. I understood most of the OOP stuff. The language is verbose, and I do wonder if it is overkill.
As far as Python, I have heard MANY good things about it, but I'm just not sure what I would do with Python. It doesn't seemed to be used widely for web app development, nor on the server side.
In any case, (again) the feedback is appreciated. More is always good!
JR
I've done a little work in Java - VERY little, like a "Java in 21 Miliseconds" book
As far as Python, I have heard MANY good things about it, but I'm just not sure what I would do with Python. It doesn't seemed to be used widely for web app development, nor on the server side.
In any case, (again) the feedback is appreciated. More is always good!
JR
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
they locked the thread long ago but it's related tow hat your talknig about and it's a good read, viewtopic.php?t=41259&highlight=teach+php
I think a lot also depends on exactly what context you want a "first programming language".
Three types of "first programming languages":
1. "Introduction to Programming" -- often not a class for computer science/engineering majors, normally targetting other engineers/scientists/whoever -- people who want to learn to use computers to help them solve their problems in their domain. A loosely typed, interpreted language makes a lot of sense in this setting: Python, PHP, Ruby, Matlab, Perl, etc. Of these, I wouldn't recommend PHP due to its web-centric world view (even though you can do non web-stuff with it) However, you also see C being used in a lot of these type course, especially if the classes need to interact with special custom hardware that's part of the engineering/science tools they regularly use. Java has been gaining ground in some of these classes, but normally when their isn't special hardware involved.
2. "Independent Study" -- someone wants to learn to program. Non-compiled languages are good as they have a easier learning curve. Simple syntax and minimal special forms are important, this would normally rule out Perl, in my opinion. Assuming web-programming is the area the person is interested in, PHP has a slightly higher learning curver to get a webserver, etc set up. However if that hurdle is handled either by a friend, a free host, etc, or just "toughing it out", PHP is an easy language to get started with and while its minimal, you can grow to good levels of sophistication.
3. "Introduction to Computer Science" -- this is a very different class than either of the above; its not about learning the "easier" problem solving skills of breaking a topic down into sub pieces and solving them, its about the "harder" side of learning to deal with different levels of abstraction; being introduced to data-structures, measures of preformence, understanding how compueters work at a lower level and how that influences data structures and algorithms at a low level and how more natural versions are built from these low level components. This is often C or Java; a few schools use Schema. All of them have strong/weak points, but I think they are the best choices for this kind of class.
Of course, I feel very strongly that you won't understand "programming" until you've used several languange, from drastically different designs, choose one from each:
Pascal, C, C++, Java, C# -- Compiled, strongly typed
Perl, PHP, Python, Ruby -- Interpretted, strong or loose types
Scheme, Haskell -- Functional
However, I'd probably strike Perl and PHP from the middle row, in terms of structure and syntax they are almost the same as the top row and are unlikely to give the "broad-picture" view that the exposure to multiple languages should. Throwing in some of the more "rare" languages like SmallTalk or Prolog for even more variety.
Java is probably close to the ideal second language; while some would argue that Java has past its "peak" its still the languange used in most discussions of patterns, best practices, etc. You need to be able to read Java if you want to be able to effectively understand a lot of various tutorials, etc even if you plan to apply the concepts to another language.
Three types of "first programming languages":
1. "Introduction to Programming" -- often not a class for computer science/engineering majors, normally targetting other engineers/scientists/whoever -- people who want to learn to use computers to help them solve their problems in their domain. A loosely typed, interpreted language makes a lot of sense in this setting: Python, PHP, Ruby, Matlab, Perl, etc. Of these, I wouldn't recommend PHP due to its web-centric world view (even though you can do non web-stuff with it) However, you also see C being used in a lot of these type course, especially if the classes need to interact with special custom hardware that's part of the engineering/science tools they regularly use. Java has been gaining ground in some of these classes, but normally when their isn't special hardware involved.
2. "Independent Study" -- someone wants to learn to program. Non-compiled languages are good as they have a easier learning curve. Simple syntax and minimal special forms are important, this would normally rule out Perl, in my opinion. Assuming web-programming is the area the person is interested in, PHP has a slightly higher learning curver to get a webserver, etc set up. However if that hurdle is handled either by a friend, a free host, etc, or just "toughing it out", PHP is an easy language to get started with and while its minimal, you can grow to good levels of sophistication.
3. "Introduction to Computer Science" -- this is a very different class than either of the above; its not about learning the "easier" problem solving skills of breaking a topic down into sub pieces and solving them, its about the "harder" side of learning to deal with different levels of abstraction; being introduced to data-structures, measures of preformence, understanding how compueters work at a lower level and how that influences data structures and algorithms at a low level and how more natural versions are built from these low level components. This is often C or Java; a few schools use Schema. All of them have strong/weak points, but I think they are the best choices for this kind of class.
Of course, I feel very strongly that you won't understand "programming" until you've used several languange, from drastically different designs, choose one from each:
Pascal, C, C++, Java, C# -- Compiled, strongly typed
Perl, PHP, Python, Ruby -- Interpretted, strong or loose types
Scheme, Haskell -- Functional
However, I'd probably strike Perl and PHP from the middle row, in terms of structure and syntax they are almost the same as the top row and are unlikely to give the "broad-picture" view that the exposure to multiple languages should. Throwing in some of the more "rare" languages like SmallTalk or Prolog for even more variety.
Java is probably close to the ideal second language; while some would argue that Java has past its "peak" its still the languange used in most discussions of patterns, best practices, etc. You need to be able to read Java if you want to be able to effectively understand a lot of various tutorials, etc even if you plan to apply the concepts to another language.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Killer thread Charles256. I thought it very peculiar... the differing views on learning PHP first as opposed to a 'hard-core' language first. As I said before my first real experience with programming was with PHP. And when it came time to learn VBScript, JavaScript, C# or any of the other languages, they came a lot easier to me.Charles256 wrote:they locked the thread long ago but it's related tow hat your talknig about and it's a good read, viewtopic.php?t=41259&highlight=teach+php
I guess the one thing I would throw out to the thread is that logic plays a significant part of programming. As I have progessed as a developer the one area I can say I have grown the most is logic. It is at the core of quite a few "How do I do..." threads around here. I think if you can get a handle on program logic you will have a much easier time with any language you choose to learn.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
I agree with nielsene...
Imho it's more important to focus on algorithms, programming logic etc instead of pure language syntax (and api) in the beginning.. Knowledge of language(s) and api(s) will at first a consequence of your searches to a good algorithm/logic for a given problem..
When i started i had a large course which focussed on object oriented programming (which used java as a tool), a course with projects where he had to perform forms of text manipulation (using perl as a tool) and creating a simple gui application to track laptimes at a running event (using visual basic)... But in essence they were all focussed on logic and algorithms and not on syntax...
Imho it's more important to focus on algorithms, programming logic etc instead of pure language syntax (and api) in the beginning.. Knowledge of language(s) and api(s) will at first a consequence of your searches to a good algorithm/logic for a given problem..
When i started i had a large course which focussed on object oriented programming (which used java as a tool), a course with projects where he had to perform forms of text manipulation (using perl as a tool) and creating a simple gui application to track laptimes at a running event (using visual basic)... But in essence they were all focussed on logic and algorithms and not on syntax...
Ditto Everah - that was a good thread, and I think it clearly depicts the debate I am having with myself (those voices in my head again!
) Do you start with a language that is easier to learn and allows you to focus more on program design / logic? Or, do you start with a language like C that demands you do everything and do it carefully, the benefit being that this will create good habits that you will then carry over to any other language you learn?
If you don't mind, let me take a slightly different approach to my question: Does starting with a language like PHP, which is perhaps more forgiving to the newbie, makes it more difficult to later pick up a language like C because things taken for granted before are now required (i.e. memory management, declaring types, etc.)? Another way to put this might be to ask whether using PHP as a first language is more likely to result in bad programming habits/styles versus starting with C because C demands stricter attention to detail?
JR
If you don't mind, let me take a slightly different approach to my question: Does starting with a language like PHP, which is perhaps more forgiving to the newbie, makes it more difficult to later pick up a language like C because things taken for granted before are now required (i.e. memory management, declaring types, etc.)? Another way to put this might be to ask whether using PHP as a first language is more likely to result in bad programming habits/styles versus starting with C because C demands stricter attention to detail?
JR