Picking up another language
One of the great things about the Software Development industry is the diversity of technology that exists. I'm sure we've all heard the stats that PHP runs most of the web, but you shouldn't stop there if PHP is your primary language. I've always considered myself fortunate that my career didn't start in the context of a CMS or Framework; I was able to learn PHP. This isn't to look down my nose at those who spend a majority of their time working Drupal or Wordpress, but for me I needed more (and in some cases less). I've written some really awful code in my time; looking back, I shudder (which is a good thing by the way). Until recently though, I was happy to be comfortable working with PHP in the raw; it made it easier for me to discern when to use something like Drupal, ZF or Slim because I knew the challenges that lied ahead.
I've said for months that I wanted to learn Python, maybe it was because I wanted to be cool or because I wanted the challenge of learning something new, I don't really know; but I learned some valuable lessons in my quest to learn Python. By doing some of these things, I made the transition to actually producing something in Python easier than it would have been otherwise.
When I started PHP, I thought I was great! I was getting things done, they worked and my boss was pleased. A lot of it was hacked together and a lot of it could have probably been done a different way, but it was meeting the goals and objectives that my boss laid out before me. I'm quite confident that none of my code would have passed even the most lax code review. So when I started with Python about a month and a half ago, I had to take a step back.
I was a n00b again and one of the large parts of this journey, for me, was being ok with that.
This is by far, the hardest part of learning a new language. The internet is ripe with "Learn Python" type lessons and a lot of them are quite good. If you want to get into using Objects or Modules, external libraries and the like, they are good to have. The problem that I had was that they didn't give me any real practical application, or at least I didn't get any practical application out of them (the latter is probably the case). They seemed to me to be, "here's how you write a valid line of Python code", hello world! There is a huge leap from 'Hello World' to 'here is an application that does something', so I did what any normal person would do, I decided to write an IRC bot in Python.
I figured, I had bit off more than I could chew, especially being relatively new to IRC. I figured I'd make some small steps forward, some larger steps backward and eventually get to a point where I abandoned the project. I would have taken some knowledge out of it and done something that someone else actually cared about...luckily, I've found the process to be enjoyable and have even had some modest successes with 'frostillicus', it's encouraged me to want to learn more.
When I first started in PHP I was in the manual non-stop. I had written algorithms that duplicated functionality of things like in_array, array_key_exists, array_diff - it was silly. It took experience and knowledge to get past that point and utilize things that were available to me in the language itself. All languages don't do things the same way, which why it's important to start learning what they do. Learn about differences in data types, learn about the functions and methods that you can start using right out of the box and of course learn about the extensions, modules, gems whatever they may be called and how to use them.
While a good dose of theory can help, it's important to also start reading code. I looked at some Python projects on Github, and I admit, I was a little bit discouraged. It was a fount of working code arranged in a way that was foreign to me, using things I'd never knew existed in a language where I could execute 'Hello World' and some basic control structures. Even as I started, I found myself digging around in documentation and other people's code to see why my attempts were failing or if I could do something "better".
Talk to people
This is a hard one and for me became more difficult as I got further into my career. "Hey, could someone help me, I have no idea what I'm doing!" is a vulnerable thing to type into an IRC or Twitter client. What if my question is ignored? What if I'm insulted for not knowing how to do something so "simple"? How about this though? What if someone actually answers my question or volunteers to help? What if it's not the first person to respond? What if it takes a week of asking to get someone to help? Is that worth it to you?
Sometimes it's hard to fight the temptation that you should know everything but if you can find some helpful souls, it will make picking up the language in a pragmatic way much easier. "Hey you're smarter than me in this area, would you mind helping me?" That's not so hard, if your goal is to learn the language. If your goal is to learn the language while convincing others that you already know it, you're going to have a significantly rougher time.
So you have a project now, you have code, you've talked to people; show those people your code! Show other people your code, open source it and get it in front of people who use the language. If you have things to a point where they are working, a well-trained eye could go a long way in teaching you how to write your code more efficiently. Building off success makes learning fun! Even if your code isn't working, someone might be willing and able to help you get it working.
In my experience, learning and enjoyment go hand-in-hand; getting ahead of yourself can be a fatal bullet to your desire to learn something new. My journey has been one of incremental progress, small successes and small failures; I'd like to encourage you to seek the same. There's a lot of things out there to be learned and it's very rewarding to see a new found skill start to grow, get to it!
Huge thanks to Matt Turland for helping me understand the IRC side of things better, without his help, my bot wouldn't be able to make fun of me!