views:

467

answers:

13

i personally started learning php as my first language and then went on to Java and VB.

but is it a good start up language? because although its syntax is laid back and "simple", i picked up a few bad habits.

I didn't really learn the important of classes at the start (this could be partly due to me teaching myself).

but then again there is a vast library of support and predefined functions and can easily be linked to virtually any thing like flash, sage, MySQL, curl, SOAP, creating BOTS which i have found very useful

+1  A: 

PHP is not recommended as a first language, because it's far too relaxed in its requirements and includes many caveats that a new programmer cannot identify.

Ignacio Vazquez-Abrams
+1  A: 

If you liked Java & VB and want to learn more OO programming, C# is very OO heavy. Since you learned VB, it would be advantageous to learn C# because they utilize the same Base Class Library. The library is also nice because it abstracts a lot of functionality as well.

C++ is another good choice but you have to do a lot of memory management, where languages like Java and C# automatically manage memory. This isn't always the best but in programming you're always choosing trade offs.

jlafay
A: 

This is a question which will spawn a slew of subjective answers. Programmers are very proud of the language we, ourselves, use (exceptions confirm the rule).

I suggest people to orientate themselves around a few of the contenders (read their tutorials) and see which community or style they like the most and pick on their personal preference after that.

The ones I suggest in the PHP usage-domain (but not tied to that domain) being: Python, Ruby, PHP and Perl.

ikanobori
+19  A: 

My view (and I do PHP 90% of my work time) is that PHP is not a good language to start programming with. It is too relaxed; OOP support is still not 100% complete; you don't learn to declare variables and deal with strict typing.

For new programmers I recommend at least playing with a "classical", strict, compiled language with fully matured OOP principles - Java, C#, C++, Delphi/Pascal... It may be boring as hell at times, because results are not as immediate as in a PHP script, but it provides good groundwork you'll be grateful for.

It is possible to become a good programmer with PHP alone, though: A natural talent will develop the desire to do things "better" step by step, and discover advanced programming principles, no matter which language. But the process becomes easier and faster if you have some of the classical programming languages and know how they do things.

Pekka
I found C++ too big and to have many inconveniences due (in part) to the fact that it has to be backwards compatible with C to be good for a starting language. I'd rather combine C and Python to learn both the low-level and the high-level aspects of programming.
Adriano Varoli Piazza
As a programmer who started off with PHP, that last paragraph brings much joy to my heart.
BoltClock
C++ is not for beginners, I can tell. It is too complicated especially on the concepts of memory address, pointers, references, etc.
Shivan Raptor
I don't agree, the languages you described are great for learning OO, but that is something that comes way down the road for someone starting out. Teaching OO before variables is (IMO) the wrong way to go, and that is what has to happen for languages like this.
Matt Briggs
@Matt yes - but I would say learning programming basics *is* possible even inside a heavily object oriented language, even though the learning curve is admittedly steeper.
Pekka
@Pekka: Please explain the 'OOP support is still not 100% complete' statement, I'd like to know little more about this.
tomp
+1  A: 

Not learning classes is a great thing if you don't know what control structures and variables are yet. Using something like Java or VB.net as your first language usually involves a lot of "you need to type these ten lines, but just ignore them for now, we will explain them fully later"

My first language was perl. My first class in perl came years later when I went back to it.

Matt Briggs
+1  A: 

PHP is easy to pickup. But you learn more about object orientation in Java, more about memory management in C, more about scripting in python, ruby or perl.

Most PHP code I've seen wasn't good for educating me on readability, style or idioms, while I could name a couple of projects in the other languages, which are just great reads.

The MYYN
+5  A: 

If you care for your sanity, don't go for PHP.

I'd recommend learning Java or C# instead.

h00gab00ga
These aren't good for web development, unfortunately.
Delan Azabani
@Delan Azabani - What about ASP.net?
Paddy
benefits to java and c# are execution speed, which is usually the last thing that is your bottleneck for the web. downside is it takes 4-5x as much code to write as languages like php, perl, ruby, python, etc (and the complexity is usually higher too)
Matt Briggs
@Paddy, I dislike ASP.NET because of being Windows-specific, and very locked-in to Microsoft products. As I use Linux and Linux servers, interoperable languages are important to me (and most other server admins, who use Linux servers).
Delan Azabani
@Delan Java and C# are not good for web development? Java? C'mon!
Adriano Varoli Piazza
A: 

PHP is good as Pretty Home Page hobby-level language. The best I'd say.
But it's bad for learning programming. Only BASIC probably can be worst.

Col. Shrapnel
Cobol. Fortran. classic ASP. Perl. Great languages in their domain, and perhaps great after you have acquired good habits, but as learning languages? I don't think.
Adriano Varoli Piazza
I guess facebook is Mark Zuckerbergs hobby pretty homepage? -1 for dismissing the language that powers most of the internet.
Matt Briggs
@Matt LOL. You're funny guy :) Actually, while watching usual PHP fan here on SO, i think it's devil's craft.
Col. Shrapnel
@Col. Shrapnel: read www.codinghorror.com/blog/archives/001119.html and understand why Matt has a point
Adriano Varoli Piazza
@Adriano I am a PHP programmer for 10+ years. JFYI
Col. Shrapnel
And for the record, I don't like php at _all_. But the reality is that its the most successful server side language for the web by a wide margin.
Matt Briggs
So you've been a php programmer for 10 years, and dismiss it as a hobby-level language? Are you sure?
Adriano Varoli Piazza
@Adriano I give PHP 1st place on that ground :) Bot honestly, when it come to play big toys with big boys, PHP isn't that good. Perl was a king once but now it's gone. And PHP will go. PHP is like football - every boy in the town able to play it, and thus we have several mastered players. Just because of big numbers. PHP's main advantage is it's ease of use and, therefore, many players. That's why it's a hobby language indeed :) I hope you see my point. But god, these little boys here on SO (who don't even understand what is programming stands for) are killing me.
Col. Shrapnel
What you just said is "PHP will in the future disappear, same as everything else, and everyone uses it, and it's easy to use, and that's why it's a hobby language". Your logic is really hard to follow.
Adriano Varoli Piazza
@Adriano oh really? That's PHP's influence ;)
Col. Shrapnel
I have to agree with Adriano and Matt. The original answer isn't useful and the additional comments are confusing and hard to follow. PHP is hardly a hobby language, in spite of it's shortcomings. I can find one point of agreement with Col. Shrapnel, and that is that PHP's main advantage is it's ease of use, which brings a LOT of players to the field, many of which are bad coders -- and probably always will be if they never use anything besides PHP.
bogeymin
ahh those cute little php monkeys...
stereofrog
+4  A: 

For me, the main advantages of PHP are:

  • its pervasiveness,
  • its ease of learning,
  • its ease of coding,
  • its array data structure covers most of what you want to do in its domain,
  • it doesn't force you to program with classes, but you can if you have to.

Its disadvantages:

  • it's inconsistent: similar functions take similar parameters in different order, because of historical reasons,
  • it's not so much been designed as cobbled together,
  • its object-oriented aspects have been unstable until recently, so if you have to deal with old code you have to remember that.

As a web language, I like it a lot. It's the language I code most in. But for learning, there are better languages. I'd recommend Python: it's expressive, popular, clean, well-designed, has a strong OOP implementation but you can also program in other paradigms with it.

More than the language, I'd recommend a good book or resource. I don't like Java the most, but reading Learning Java, by Bruce Eckel, has made me a much better programmer, because it deals with a lot of important stuff, and it does so clearly and at a good pace for me.

Adriano Varoli Piazza
And yes, I said 'PHP is easy to learn'. It's real easy to pick up bad habits in it, too.
Adriano Varoli Piazza
I can deal with inconsistent parameter orders. To me, the main flaw of PHP is the lackluster scope system and lack of first class function values.
Alex JL
A: 

yes it's bad, I recommend Java maybe you first want to learn http://processing.org and then later the full Java language.

Nils
Shivan Raptor
Probably but processing was designed for learning, it enables you to visualize an algorithm very fast and comes with simple example and easy to understand literature, so it fits for learning.
Nils
+9  A: 

I have used all of the languages mentioned here -- even Pascal -- and I submit that Python is the middle ground.

  • All you need is a command prompt to get started (no IDE, web server, etc.)
  • You don't have to deal with memory, linking, compilers, make, etc.
  • Code structure is enforced, variable typing is sensible, OOP is strong.

Things learned coding with Python can easily transfer to other languages.

bogeymin
+1: Python is one of the best language to learn programming.
Yorirou
+1, definitely python. It's disappointing how many people recommend rubbish langs like java or c++ (they probably have no experience with).
stereofrog
@stereofrog: your comment is disappointing. Dismissing Java and C++ as rubbish in a pithy two-liner is juvenile.
Adriano Varoli Piazza
@Adriano, don't take it personally. The fact that you're programming in a rubbish language doesn't mean you're a fool.
stereofrog
@stereofrog: I didn't. I don't code in Java or C++. I just think dismissing java and C++ as rubbish is foolish (same for almost any other language). Don't take it personally.
Adriano Varoli Piazza
@Adriano, so you came to this old thread, picked up my humble comment and decided to tell me it's "juvenile"? What's up with you man? How it can be useful to anyone? Attacking people at random doesn't make you appear smarter, really.
stereofrog
This site is about pruning bad advice and polishing good advice. I'm saying your comment is useless, and bad advice. I said the action is foolish, not that you're a fool. Blindly attacking incredibly useful languages doesn't make you appear smarter, really. And your comment was not humble at all.
Adriano Varoli Piazza
@Adriano: hey, i really don't want to make a long argument out of this. Unlike you i did code in java and i do know what i'm talking about, believe me. And if you think it's not correct to refer to something as rubbish, you're probably never heard of Sturgeon's Law.
stereofrog
A: 

I think PHP is a little too specialized for being the first language learned (yes, I know you can do almost anything with PHP, but its roots as a web UI building language run deep). To be honest I'm not sure if the lack of static typing is good or bad for a beginner: it certainly can lead to disconcerting runtime errors but on the other hand it frees you from the declaration ceremony of Java or C#.

Perhaps a nice middleground are languages like F#: it's strongly typed yet type inference makes it look as streamlined as Python. So, it's unverbose, has a syntax simple enough to pick up, and makes you use functional concepts from day one. And the functional paradigm, solving a problem by chaining simple transforming functions, is actually easy to understand when you are not pre-wired in imperative languages.

Edgar Sánchez
A: 

My university taught us C++ almost exclusively, and I believe I'm a much better programmer for it. It forces you to do everything yourself, so when you move on to another language you're not spoiled by the features of the previous language.

However, your frustration threshold must be very high when learning this. C++ does absolutely nothing for you, and it will let you break your system. If you sufficiently hardassed, I highly recommend C++. If not, I hear Python is also very good.

Twoquestions