How to Write Computer Programming Code

A sample program in the Ruby programming language that calculates Fibonacci to the nth number.
A sample program in the Ruby programming language that calculates Fibonacci to the nth number. | Source

What is computer code?

Computer programming code is a set of instructions that tell a computer what to do. Code is essentially just a recipe that your computer follows in order to complete a specific task.

There are a number of different languages code can be written in called programming languages. However, computers only know machine language. Code written in a programming language has to be interpreted or compiled into machine language so the computer can understand it.

Programming languages can be used to do/make all sorts of things. A group of programmers can work together to make an entire video game or one programmer can throw together a small script to solve a math problem.

Programming code is all the stuff behind major websites like Facebook, Google, and even here on HubPages!

Quick Poll

Why do you want to learn a programming language?

  • To write a video game
  • To write a few scripts
  • To make money
  • Just for fun
  • I have another reason
See results without voting

Choosing a Programming Language

Before jumping in and writing code, you'll want to select a programming language that's suitable for your task. Consider what kind of code you want to write.

If you want to make a video game, you'd be better off selecting something like C++ or Java. Java is fairly easy to learn. C++, on the other hand, has a learning curve, but it's almost considered a standard when it comes to writing video games (as it's faster than many other languages.)

If you want to create things like complex websites (Facebook), plug-ins, scripts, and apps you might want to consider learning something like Python, Ruby (my personal favorite), JavaScript, Perl, etc... (the list of suitable programming languages can go on for miles.) Languages like Ruby are high-level programming languages. Ruby is easy to learn and fast enough to perform many tasks (just not fast enough for something like a video game.)

If you're not quite sure which language you want to learn, the TIOBE Programming Community Index, is an awesome place to start. This is a regularly updated list of the most popular programming languages. I recommend looking up information on each of the language and selecting one that piques your interest.

Learn a Programming Language

Once you select a programming language, you'll need to actually learn it. There are tons of books and guides on learning how to program. Before investing money in a book, take a look at the version used in the book. For example, if you plan to use Ruby 1.9, don't get a book on Ruby 1.8.

I highly recommend using an online guide to learning a programming language. There are tons of free guides that do a fabulous job of teaching programming. Plus, when you're actually programming, you'll rely heavily on the Internet as a resource when you're having trouble figuring something out.

Spend some time looking at the "List of Freely Available Programming Books" on StackOverFlow. There is bound to be a resource that is written specifically for the language you've selected. In addition to this, StackOverFlow is an amazing place to ask questions regardless of your programming ability. There are ton of well-seasoned coders there that don't mind helping out a new programmer.

While you're following a guide, feel free to stray off the beaten path. If you're curious what'll happen if you do something, do it. Learning to program should be fun, so feel free to cave to your curiosity. If anything, you'll only learn more whether it's, "Oh wow! That's awesome" or, "Well, I know not to do that again!"

Keep practicing! Even if you're not working toward your major project, it's a good idea to write something. This can keep your skills sharp and may even lead to something new that you can tie into your main project (or, if you're like me, you'll find an additional major project!) If you're not sure what to write, programming challenges are a great way to hone your programming skills!

More by this Author


Comments 4 comments

cclitgirl profile image

cclitgirl 3 years ago from Western NC

My dad was a computer programmer before he retired. I only took one programming class in my school years and it took me awhile to get it because the instructor took a very mathematical approach to it and I'm definitely not math-minded. However, now that I purchased a domain and building my own website (not complex, ha!) I'm having fun learning a bit about HTML and even some CSS, but it's definitely not the same as C++ or Java b/c I know they have different purposes. Once I get the hang of those, maybe I'll venture off and learn a little more...like Ruby. :)


melbel profile image

melbel 3 years ago from New Buffalo, Michigan Author

Awesome! Ruby is a great language for beginners (and seasoned programmers as well!) I'm really happy you chose it. Let me know if you need help with anything. I'm pretty much always available to lend a hand when it comes to programming. :)


AlanRimmer profile image

AlanRimmer 3 years ago from Southwest UK

Interesting hub melbel. I have a keen interest in computers and have often thought about learning a programming language and started a couple of times but not stuck at it. Your hub has encouraged me to try again and the resource links are ideal because I was never really sure which language was right for me. Looks like I might try Ruby. Thanks for the great info.


iviskei profile image

iviskei 3 years ago from In your computer, stealing your internet.

Nice, informed hub. Computer programming is a lot of fun~

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working