2011-08-09

So You Want to be a Programmer

So you want to be a programmer?

That is great! Programming can be very rewarding.

First of all, I'd like to to touch on why I am writing this. I see a lot of blog articles with titles like "10 Things Every Programmer Should Know." When I go to the post, I see a bulleted list of things which only five of which I agree with. There are a lot more things that I think programmers should know. This article is intended for the newbies out there, but I think some experienced programmers may get something out of this.

So you want to be a programmer?

My first question to you is simple: why? Are you doing it because you love computers? Are you doing it because you want to know how software works? Are you doing it because you have this cool idea for an app for your phone? Are you doing it for the money?

Only three of those are good reasons to consider programming. Software engineering and the medical professions are the top growth industries at the moment and also offer some of the best salaries, which is great to those of us in those professions. However, if you don't have any interest in how software works or in helping people, those are two professions you need to steer clear from. The last thing a programming team needs is someone who hates coding and the last thing a hospital needs is someone who hates working with patients. While programming can be very rewarding, it can be a lot of hard and frustrating work as well.

Personally, in my first years of college I was a Psychology major. I played with computers, tried different operating systems, and modded games as hobbies. I also worked as a tutor in the campus computer lab. Just before I graduated with my associate's degree my psychology professor sat me down and recommended I change my major when I go to a university. It's not that I wasn't good at my psychology coursework, but he knew I was better at computers, so he recommended I go into computer science. That was probably the best counseling I ever received at school.

That's enough about me. The point is, you need to be passionate about programming and computers if you want to be really good in the field. You also have to be really passionate about learning. Compared to other fields, the lifespan of programming languages, tools, frameworks, and development methodologies is similar to that of gnats. If you're not constantly learning, you're a dinosaur pretty quickly. Luckily, reading blogs (like this one), is a good way to stay up to date, and there are lots of resources and tutorials on the internet (Google is your friend).

So what is it that you really need to know to be a good programmer. Quite a lot, actually. First, it probably takes learning a programming language.

Learn a Programming Language

So which programming language should you learn first? It really depends on what you want to develop. Want to develop games for the XBOX 360? You should probably learn C# or C++ then. Want to developer enterprise level back end services? Want to develop Android phone applications? You'll probably want to learn Java. Want to develop a quick and dirty content-based web site? You'll want to look into Ruby and Rails. Want to develop iPhone applications? Objective-C is the language for you. Want to develop interactive web pages? The holy trinity of HTML, JavaScript, and CSS will be required.

It turns out learning a language is usually pretty easy. Once you have the concepts of one language down it is not hard to pick up another one (usually). The hard part is learning the libraries of another language. Libraries provide the meat of using a language. Some languages, such as JavaScript, provide very minimal libraries. Others, like Java, have thousands of commands in their standard library. Fortunately, for every language, there's probably only a subset of the libraries that you will be using. One of the best ways to learn a language is to read source code from an existing project. Search Google Code or Github for projects related to your interests and read the code for those projects.

In addition to a bread-and-butter programming language such as the ones mentioned above, you'll probably eventually want to learn a scripting language such as Perl, Python, Ruby, or Groovy as well. Scripting languages are good for small tasks and for performing maintenance, and in many cases for writing full applications (especially for the web: Ruby on Rails is a popular framework for running a website, and Groovy has an equivalent called Grails). For instance, say your program has a configuration file and the format of that file needs to be completely changed. You could manually change every single instance of the file (which would take a lot of time), or you could write an application that would change the file to the new format (which still make take a while to write). The other option is to write a quick script to make the change.

Learn how to Document Code

Another key point when learning a programming language is learning how to document code for that language. Javadoc (for Java), XML Commenting (C#), and Doxygen (C++) are a few ways that you can write documentation for you code so that it can be generated into human-readable documents such as web pages. Documentation is almost as important as the code itself is, especially if you are working in a team environment. While most programmers hate documenting, well documented code can reduce the confusion when reading the code for people who didn't write the code and might not know why it is doing something (or for you many years down the road when you don't know why you were doing something).

Learn how to use an IDE

Once you know the language, you next step is to learn the development environment for it. Modern software is usually developed in an IDE (Integrated Development Environment). For instance, as a Java programmer, I spend most of my day coding in an IDE called Eclipse. For Java there are other options like Netbeans as well. If you plan on writing C# applications, you'll most likely use Microsoft Visual Studio. If you're looking to write iPhone apps, then you'll be using XCode on a Mac. No matter what IDE you use, make sure you learn how to use it well. IDEs offer features like code completion which will show you what commands are available when writing code (great if you're first learning, so you don't have to look up everything on the internet all of the time or wade through gigantic documents). IDEs can also color code your code so you know what are reserved words, what are the variables, function calls, etc.

As well as learning an IDE, it is a good idea to have a good handle on a basic text editor (usually something better than Notepad though). For Windows, this could be Notepad++, TextPad, or e. For the Mac, the most recommended text editor is TextMate. If you're on Linux, welcome to the holy war between vi and emacs (I'm personally a vi guy). These editors are great for when you have to edit config files, HTML or XML documents, or make small code changes.

Learn a Version Control System

Another very important tool that you will need to learn how to use is a version control system. Version control allows you to save snapshots of your programming work at various stages in time. That way, if you break something, you can always revert it. The current top version control systems are subversion, mercurial, and git. Mercurial and git are very similar, but subversion can be quite different from the two. Git seems to be the rising star and the one you should probably pay the most attention to. There are numerous sites that will host your code for free (as long as it is publicly accessible) such as Google Code, BitBucket, and GitHub.

Learn XML

So now that you know you need to learn a programming language and have picked one and its IDE, there are a few technologies that pretty much go hand-in-hand no matter what language you are learning. The best example of this is probably XML (Extensible Markup Language). XML is the lingua franca of the web. It is the basis for XHTML, is used in configuration files, web services, data files, and even in some databases. No matter what language you choose, at some point you will most likely have to interact with XML documents. It is a good idea to at least understand the basics of XML. Another technology called JSON (JavaScript Object Notation) is making inroads on a lot of what XML is used for, so that's another one you should probably look into as well.

Learn Regular Expressions

Regular expressions are another feature that spans all programming languages and you will probably have to use at some point. Regular expressions provide a syntax used for searching text, replacing text, and ensuring that text is in a specific format. For instance, say that a user types in a phone number or credit card number and you need to validate it is formatted properly (has all of of the right digits, parentheses, and dashes in the right places). The easiest way to do this validate the text the user entered against a regular expressions representing a valid phone number or credit card number. Regular expressions are also useful for extracting values out of text, such as pulling just the area code from a phone number.

Learn SQL

Database interaction probably the next important thing you will need to learn. At some point in your career as a programmer you will most likely have to interact with a database. You may not be the one to set it up (there's usually "the database guy" on the team that does that), but you will need to learn how to query it and update it. Most databases today are "relational databases", and luckily there is a standardized query language called SQL (Structured Query Language) used for these interactions. While you might not need to know all of the details of how databases work, at a minimum you should know that basics of SQL (SELECT, UPDATE, etc.). Looking forward, a new breed of databases is emerging that don't use SQL (and are thus referred to as NoSQL databases). These databases don't have a standard query mechanism yet, and often use JSON for storing data.

Learn Web Technologies

Even if you're not working directly with the web, a lot of technology and applications are moving to web-based applications. It will be a good idea going forward to learn the basic web technologies (HTML, JavaScript, and CSS). HTML (Hypertext Markup Language) is a markup language used to display the structure of a web page. JavaScript is a programming language that controls the behavior of a page, and CSS (Cascading Style Sheets) define the style and look and feel of the page. If you will be doing any serious web page work, expect to have to learn additional libraries (such as jQuery or prototype) if you want your page to have any cool effects.

Learn a Unit Testing Framework

Another set of technologies you should learn is the *Unit testing framework that goes with your language of choice. Unit tests are pieces of software that are designed to test units of other pieces of software. Writing test cases for your code ensures that the code that is being tested is well designed and bug free. If you're a Java developer, you'll want to learn how the JUnit library works. For C#, it is called NUnit, and C++ developers will probably use CppUnit.

Conclusion

So that's just a taste of some of the things you will need to learn to be a good programmer. That doesn't even touch on the numerous design philosophies or development cycles that are also involved, but it should be enough to get you started. Pick up a few books on those subjects. Read some blogs. Read some code on GitHub and Google Code. Pick a few small projects for yourself to push your skills. Good luck!

2 comments:

  1. Very nice general idea of what you need to know to become a software guy. Good job.

    ReplyDelete
  2. Wow, very cool. Thx for this post.
    Hah, be a programmer it's not a job - it's destiny.
    I hope, y ok.

    Best regards
    Toby, virtual data room pricing

    ReplyDelete