Showing posts with label self-improvement. Show all posts
Showing posts with label self-improvement. Show all posts

Saturday, February 2, 2013

How to learn a new programming language

Here's some tips on learning a new programming language. They aren't listed in any specific order. Hopefully you'll gain from this at least one new tip that will help you to become proficient in the next language you learn.

  1. Build something you actually need right now. This could be either a tool you can use in your day job, or something useful you can make use of at home.

    Consider these example projects ...
    • Write a simple unit testing framework. Many new languages don't have any unit testing frameworks available when they are first introduced. This project will force you to use areas of the language like reflection and meta-programming. Once completed, it becomes useful straight away, for unit testing your future work in the language.
    • Implement a disk usage tool; it summarizes the disk usage of all directories on a disk and outputs to the console. It doesn't require overly complex algorithms but touches a lot of the basics: recursion, filesystems, command line parsing and output formatting.
    • Implement a backup/archive script which has command line switches to exclude certain file extensions. It should place the backup into a single .zip or .tar.gz file. The project will touch on the following: recursion, filesystems, command line parsing, compression libraries and regular expressions.
  2. Port an existing, well known program to the new language. Since you are porting it, you already have the application design work done. This frees up your mind to focus on the specifics of the new language. After you've finished you'll then have a good reference to which you can refer back to, when comparing the old with the new language.

  3. Find a decent book on the language and read through it all as fast as you can. The goal is not to memorize everything, but to soak up the ideas and idioms of the language. Then write some small but non-trivial project. When you get stuck, hopefully it'll trigger a memory of something from the book, and you can go back to refer to it.

    Many of the "in a Nutshell" and "Head First" series of books, both published by O'Reilly, are highly rated by readers - they are available for many popular languages (C, C++, C#, Java, Python, JavaScript, PHP).

  4. Mix action with equal parts learning (reading books/tutorials). Too much action without learning, and you get a lot of poor quality code. Too much learning without enough action, and you fail to absorb the material to a deep enough level.

  5. Study reference works on public repositories. Find a medium sized project on GitHub which is written 100% in the language. Read though the code and try to understand it. Look for projects written by the language designers or an acknowledged expert.

    As an example, with Go, the standard libraries for the language are written in Go and are open source, e.g. here is part of the strings package.  In addition, Brad Fitzpatrick and other members of the Go team have several projects on GitHub that you can read and learn from, e.g. here is a Go client for Memcache.

  6. Devote large, uninterrupted chunks of time, at least half a day, to learning the new language. Brief, half hour sessions over the course of the week aren’t really useful, because most of the time would be spent just getting back up to speed on what you previously studied.

  7. Learning a language shouldn’t just be a solitary endeavor. There are plenty of people who have made the same mistakes that you have, so asking for help is a great way to overcome problems when you get stuck. Some possible sources of help online: Language-specific IRC channels, StackOverflow, Twitter, Facebook groups, Quora, Google+, Google groups. You can also submit your finished code to these forums after you've completed a project; people more experienced with the language than you will often be able to identify areas which can be improved or simplified.

  8. Use an editor with syntax highlighting. Perennial favorites such as Vim and Emacs, plus newer editors such as Sublime Text, feature support for most if not all programming languages and are available for all major operating systems. Some languages are often associated with specific IDEs; these are a good idea when learning a new language. These are generally ...
    • Eclipse IDE for Java and Android development.
    • Xcode for Objective-C and iOS development (on Mac OSX only).
    • Visual Studio IDE for C#, C++, VB.NET, F# (on Windows only).
    All of the IDEs and editors listed above are either completely free or have an unlimited trial version available.

  9. Working on a real project with real customers and deadlines is a white hot crucible for learning a new programming language. If you really need to learn a language quickly, then consider taking on a new job which requires it. Once you've got the job, you'll have no other choice but to learn it quickly.
     
  10. Finally, a tip from The Pragmatic Programmer, Tip #8 "Invest Regularly in Your Knowledge Portfolio":
    "Learn at least one new language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut. Additionally, learning many languages is far easier now, thanks to the wealth of freely available software on the Internet." 

Saturday, October 1, 2011

How to Become a Better Programmer

Here then, in no particular order, are twelve positive things that you can do, at any point in your career, to improve your programming skills. These will also have the added benefit of injecting additional passion into your programming ...

1. Never Stop Learning and Reading

Consciously try to improve yourself and the quality of code you write. Think about what you're doing, why you're doing it, and how you can do it better.  Look back at what you've done on previous projects, and how you might do it differently now, or where you could still improve on it.

  • Read books, not just websites.
  • Read for self-improvement, not just for the latest project.
  • Read about improving your trade, not just about the latest technology.

2. Work With People Smarter Than Yourself

Working with smarter and/or more experienced developers will teach you a great deal. You can learn a lot by reading their code, watching their practices and listening to their opinions and stories. Also, you should always listen to what others have to say, regardless of whether they're junior, intermediate, senior or guru-level developers.

3. Become a Polymath (or 'Jack-of-all-Trades')

Decide to be a 'Jack-of-all-Trades' - also known as a Polymath, Polyglot, Generalist, Renaissance Man or Multi-specialist. This will allow you to avoid becoming 'pigeon-holed' into one specialty, which can stagnate your programming skills, as well as hurt your future employment prospects if your 'specialty' suddenly becomes yesterday's technology. Something to keep in mind is 'the half-life of knowledge' law of technology; it tracks with Moore's Law: half of everything you know will be obsolete in 18-24 months. An expert who chooses the wrong discipline can easily be undermined by the press of technology; a generalist only has to add some more skills and remember the lessons of the past in applying those skills.

4. Read and Document Other People's Code

Read and attempt to understand code written by others. Plus, write documentation for code written by other people. Writing code is significantly easier than reading someone else's code and figuring out what it does. You can see how they do something - maybe they do it in a better way than you. And sometimes this can be one of the best ways to learn how not to do something.

5. Get Programming Experience on a Real Project

There is nothing like getting in and coding, especially under pressure - work on a real project, with real fickle customers, with real, ever-changing requirements and with real engineering problems.

6. Teach Others About Programming

Take a part-time job tutoring computer science students at a local university or college. This will force you to understand something at a completely different level,  since you have to explain it to someone else. As Douglas Adams wrote, "the best way is to try and explain it to someone else. That forces you to sort it out in your mind. And the more slow and dim-witted your pupil, the more you have to break things down into more and more simple ideas."

7. Learn One New Programming Language Every Year

One year gives you enough time to get past the basics - it pushes you towards understanding what's beneficial in that language, and to be able to program in a style native to that language. Each language will change the way you think about programming, and how they do things, to compare that to what you already know.

8. Complete One New Pet Project Every Year

Start a "pet" project and follow it to completion and delivery. A good pet project will push your boundaries and keep you interested; it may be something you have experience with and enjoy plus something you don't know about. E.g. if you know something about game development but don't know Ruby, a good pet project may be to develop a game written in Ruby.

9. Learn Assembly Language

Learning a low level language like assembly gives you insight into the way computers 'think' without any high-level abstractions; the elegance at this level is surprising. There are no wasted motions, no disposing of data, and bugs can have a far greater impact. Developing at this level will teach you efficiency and hone your critical thinking and logic skills.

10. See Your Application From the End User's Perspective

Step out of the echo chamber and improve your understanding of the end-user aspect of software development. Interact with the end-user to see, through their eyes, how they use your software. End users are typically not technical, and they often see software as a magical piece of work, while you see software as a logical set of steps. The two worlds are completely different - what seems easy and logical to you may seem cryptic and inscrutable to others.  You can also find out what kind of 'abhorrent' information they throw at your application. This will help you generate good test cases and stop assuming your program will always be fed the correct set of data.

11. Start a Physical Exercise Program

You work a whole lot better when you're in good physical shape - problems become easier and less overwhelming, wasting time is much less of a temptation, you can think clearer, and working through things step by step doesn't seem an arduous task. An old one but here it is: "Sound body, sound mind.". Regularly devote a bit of time to physical exercise - riding a bike, walking, running, swimming, whatever suits you best.

12. Learn Touch Typing

Typing for a programmer is essential. Everyone has had a coworker who typed using just two fingers and had to look at the keyboard for everything before pecking out their code one letter at a time! Learning to touch type is a quick and effective way to give your productivity a boost as a programmer.

Follow @dodgy_coder

Subscribe to posts via RSS