views:

538

answers:

16

I'm reading The Pragmatic Programmer and I'm on the section where the authors suggest that we learn a new language every year. I'm currently a PHP developer and I'm wondering, what should I learn next?

I'm looking for a language that will help me improve my skills and help me with my daily tasks. Something useful.

Any suggestions?

[Edit] Awesome answers guys! Thanks. I'm still contemplating your answers and I'm leaning on studying Python or a functional prgoramming language as you guys have suggested (maybe Lisp).

+4  A: 

Python and Ruby seem to be a relatively painless transition to/from PHP.

Mike B
They also look like languages which are popular and useful!
Anna
A big advantage of these languages is they have Java and .Net implementations, so you can learn the languages interactively, but then apply the skills broadly.
Jason R. Coombs
+5  A: 

I'd go for Java or C#, so you learn something that is not another scripting language.

ammoQ
+1 for an OO language. I find myself floundering with some of the upper level OO concepts that were never learned in school or on the job (programming in straight C).
espais
+11  A: 

Going for the option of learning something new, rather than something a bit like what you have done before.

C++ or C
A low level language that requires manual memory management and teaches you how things work at a lower level. Good community base and is one of the languages that a programmer should learn.

I would suggest one of these over assembly as although assembly is even lower level it is pain to produce a project. Learning a language like C or C++ will have the bonus of allowing you to learn assembly very fast if you ever want to do it, as there are relatively few new concepts compared to going from Java to assembly.

Haskell
A purely functional language that totally changes the way you look at some problems. It takes a lot of effort lean if you are already used to a imperative style of writing code.

It has the great advantage of teaching you the joys of recursion, and even if you are never payed to write a line of Haskell it should impact the code you write in other languages, allowing you to see better and cleaner solutions.

Java or C#
If you don't use PHP in an Object Oriented way (Not just using classes, but features like inheritance as well), then these languages force you to write in a OO style. I wouldn't recommend these if you are happy with OO programming.

Yacoby
+1 for things which are not like PHP.
Dominic Rodger
C++ or C, or Go!
hasen j
Why the downvote?
Yacoby
Vasiliy Stavenko
A: 

Not sure if you are programming PHP under the MVC model? But if you are not that is another good methodology to learn.

Examples: Zend or CakePHP

meme
Yes I've been programming PHP under the MVC model
+1  A: 

Whilst I agree learning a new language is a good idea - make sure you are learning them and not just collecting them. For example - I come from a Java background and I keep catching myself writing in other languages in the way I'd write something in Java and not taking advantage of the new language's facilities. I'm sure you wont - but just be aware that it's a natural thing to do so keep an eye out for if you start doing the same!

As for which I'd learn; I'd second learning Ruby (plus optionally Rails if you want to do web apps) - it's a very nice language and quite an easy transition from PHP. The "Pickaxe" book from pragmatic programmers is a good place to start.

If you have access to a Mac - I very much recommend learning Objective-C and Cocoa. I certainly learnt a lot by studying these - I think more than any others I felt that understanding these made me a better all round developer. As for books - start with Kochan's "Programming in Objective-C" for the language side, then progress on to Hillegas' "Cocoa Programming for Mac OSX" for the GUI side.

Good luck!

Ash
It's nice to see answers with a "further reading" information. Thanks :)
A: 

It totally depends on what you want to do. I don't think anyone can say what you should learn next, but rather share you with our experiences that will help you make your mind. After all, the decision for your next language should be based what what kind of applications you want to develop (desktop, mobile, web, etc).

I'll share you with my experience. I used to be a PHP programmer and I faced the same question, what do I want to concentrate on. I ended up to learn Java and I've been happy with my choice. Here are some of the reasons why I think it was a good choice

  • Java is a widely used language in the corporate world. This means that with good Java skills you'll be likely to find (more easily) a (better) job, more so than with Python or Ruby skills (disclaimer: this can of course vary between regions and countries, this was the case in my area)
  • I had done lots of web sites and applications with PHP and I've loved the web as an environment. Still, I felt that PHP wasn't quite the language to create full blown enterprise applications - that was something I also wanted to do - to be part of making large enterprise applications. Luckily, with tools like GWT or Vaadin I've been able to create enterprise applications which run in the web environment - all in Java. That was like a win-win for me, I was able to create large software for the web.
  • Java has forced me to think more Object Oriented, something I've benefited when writing PHP as well.
  • Java is multi-platform, so it is easy to write applications for linux/mac/windows or even for mobile devices (Java ME)

My two cents.

Kim L
Our experiences are much alike I think. The problem with Java is it's hard to get enough experience to find a job for it. With PHP you could do web apps and host it cheaply as well as easily find freelance jobs. Would you care to share how did you get enough experience to land a Java job? Thanks
Actually, I didn't have any Java knowledge part from what I had studied at the university - still I was able to get a great job as a Java developer.
Kim L
What made the difference was that I had experience as a PHP developer and was able to show that I was a good programmer. I'm a quick learner so it didn't take long to learn the language.If I were you, I'd probably learn Java, do some hobby projects to learn the language and to show potential employers that you know what you're doing + gather general work experience, eg as a PHP developer. After all, you'll have the same problem no matter which language you choose.
Kim L
You have a point. Thanks for sharing your experience man
+1  A: 

I started off learning PHP after C. Then I discovered Perl and I never looked at PHP again. The reasons? Perl, like PHP, was dynamically typed, but far more modular. The Camel book about Perl was a delight to read. Running a Perl script from the command line was far quicker than PHP which needed all possible libraries loaded - Perl permitted me to choose what extra functionality I wanted at run-time keeping simple scripts light-weight. The Perl community is relatively advanced compared to other languages. The Perl language lets you program in a variety of styles, from procedural, to OO.

PP
+1  A: 

Functional languages seem to be gaining interest I'm planning on looking at F# primarily because I'm working with the Microsoft stack most at the moment.

I'd also recommend looking at topics that aren't language specific such as improving OO skills, using design patterns, and anything else that helps refine your skills as a developer to make you more of a craftsman rather than collecting languages that you won't get to use on substantial project and therefore will never really master.

Alan
Yes!. I don't think you need to be language specific. I have found learning rails is helping me with best practice skills and I pick up some Ruby too.
Rimian
+2  A: 

JavaScript.

And I mean really learn it, not just "enough to get by" the way the trend seems to be. I've seen otherwise-great (on the server side) web developers that can waste 2 days on a trivial JavaScript problem because they don't understand it at all.

I don't think there is a language that a developer will come across more often than JavaScript, and when you need to use it, you need to use it: you won't have the freedom of picking some other language to run on the clients browser. The good news is that it shouldn't take very long to grasp when compared to some other programming languages.

A good place to start is with JavaScript:The World's Most Misunderstood Programming Language

TM
I know jquery and I've used a lot if it. Now I'm thinking, isn't it enough? Do I really need to master pure javascript first?
@heyjude no, you definitely don't need to master pure JavaScript, but it still goes a VERY long way to understand the language itself even when you only use jQuery (and by the way, I pretty much only use jQuery as well). I've fixed (and avoided) a lot of bugs in my jQuery code (and my coworkers) that come down to details of the language, not necessarily jQuery.
TM
+1  A: 

Python + Django if you want to stay in scripting.

C if you want to understand how it works behind the scene.

Nicolas
+2  A: 

I believe it would be strongly beneficial for you to try and pick up on one of the popular functional programming languages as they require a completely different mindset and methodology for solving problems. They really allow for you to program elegant yet minimalistic solutions to difficult problems. Some of the more common languages include:

  • Erlang
  • Haskell
  • Lisp
cballou
+1  A: 

C (as in C, not C++) would be my suggestion. It will instantly make you appreciate just what interpreted or higher level languages actually do for you (or save you from, depending).

It is also the first logical stepping stone to C++, though I know a lot of people who just dived into C++. Learning C first will (as above) either make you appreciate, or hate C++ even more.

To be a really well rounded programmer, you need to deal with managing types on your own, as well as managing memory without the safety net of a garbage collector. It used to be that those two were prerequisites for being a programmer at all.

Besides, think of all the fun you could have writing your own PHP extensions :)

Tim Post
A: 

It depends on your motivation for learning the language.

If you want to learn a new language to do your day-to-day work more effectively I would suggest Python or Ruby. They are popular languages that are both highly productive to work in, and can be applied to a wide range of programming tasks. As someone else has pointed out there are versions for both the JVM (Jython and JRuby) and for .Net (IronPython & IronRuby) so if you want to learn either of those platforms they are a good way to start. They are also both easy to learn and fun to use. My preference is for Python, but that is probably because I have been using it for many years.

If you want to increase your employment options then go with the most popular languages used in business - this means either Java or C#.

If you want to expand your mind then I suggest a version of Lisp. I recommend Clojure - it is a dialect of Lisp that runs on the JVM and gives access to all the Java libraries. There is an excellent introductory book in the Pragmatic Programmers' bookshelf.

Dave Kirby
+1  A: 

This could turn into a debate.

My suggestion is to learn a new language that has something to do with your existing skills.

My "first language" was C, which brought me to C++ and Visual C. When I took on consultant jobs I enter the realm of PHP.

Starting from here, I am collecting skills in Javascript and jQuery, since they are tightly coupled with PHP. (DOM, CSS, and HTML aren't languages, so they don't count here.)

Or maybe you want to take another direction and go for SQL.

Choices is yours and crossroads are everywhere.

Guitarfox
A: 
  • JavaScript (preferably through jQuery and Ext.js)
  • RegExp (preg_match flavour)
  • SQL (MySQL, PostgreSQL, SQLite dialects)
  • XSLT (and XML)

Each is very different. Each serves different purpose and each is very useful for PHP web developer.

If you want to try something different I'd go with

  • ActionScript (great opportunities)
  • C# (great IDE)
  • Python (complex ideas, misleadingly simple syntax)
  • Rebol (fun of having strange constructs work flawlessly on first guess)
Kamil Szot
A: 

Lisp.

(Or some other functional language.)

I coded in PHP for years and then took a (functional) Lisp class. It was four weeks of wtf %@f pain and then pure joy. Understanding functional programming, and especially recursion, really gives you and edge when coding PHP (or any other solution-oriented business language).

matiasf
I'm curious, how does functional programming and recursion give an edge when coding in PHP?
Lots of problems have a natural recursive solution. For example directory searching/traversal, array/list processing etc.
matiasf
I'm leaning towards Python at the moment, wouldn't it teach me the same thing or Lisp forces me more to think that way?