Home > Learning To Code > Learn To Program 2: Ground Rules

Learn To Program 2: Ground Rules


Get tooled up

To write programs, you will need to install software on your computer that allows you to enter the code and run it. There are many different ways to do this, but beginners are probably best off with something called an Integrated Development Environment or IDE. This is basically a package of tools that gives you everything you need to write, test, run and debug your code from a single application, without having to worry too much about the inner workings of everything.

The IDE you choose depends on what language you want to prgoram in, and which platform (Windows, Mac, Linux) you are running. Here are some popular ones:

Visual Studio – the industry standard for developing C++, C# and Visual Basic applications. The Express Editions (which support one language at a time) are available for free and are more than enough for budding new developers. Windows only.

The Visual Studio .NET 2003 code editor and Wi...

The Visual Studio .NET 2003 code editor and WinForms Designer Window in VB.NET (Photo credit: Wikipedia)

Eclipse – allows you to develop in a wide variety of languages including C, C++, Python, PHP, Java, XSL and so on. Free and has a (slightly) simpler interface than Visual Studio, but doesn’t support .NET languages like C# fully. Windows, Mac and Linux.

NetBeans – this IDE is specifically for developing in Java and is probably your best choice if you really want to get into Java programming (if you want to write apps for Android phones, they have to be written in Java so this is a good choice for Android app development). Free. Windows, Mac and Linux.

ActiveState Komodo – this IDE can be used for most languages but is especially good for Python, Perl, PHP and Tcl programmers. It is quite expensive but my preferred choice when working with PHP and XSL. Windows, Linux.

Almost all IDEs (including those above) include editors for HTML, CSS and XML, so if you want to write web pages by hand, any of these will work fine, although there are specialist IDEs for web design such as Dreamweaver which may suit your needs better.

Learn the keyboard shortcuts

This may seem silly, but in real terms your programming will actually be slowed down quite considerably when you constantly switch back and forth between mouse and keyboard. An important skill in programming is to minimise your use of the mouse so that you can work faster.

First, learn the tricks of navigation. These shortcuts work in most IDEs:

Navigate:

  • Arrow keys – move one character or row
  • Ctrl+Arrow left/right – move left or right one word
  • Home / End – move to beginning or end of line
  • Home, Home – pressing Home twice will take you to the beginning of the line (pressing it once takes you to the beginning of the text on the line, which is different if you indent your code – as you should!)
  • Ctrl+Home / Ctrl+End – go to start or end of the current file you are editing
  • PgUp / PgDown – go up or down one page
Text editing:
  • Delete – deletes the character after the cursor (as opposed to Backspace which deletes the character before the cursor); this is useful for deleting things from the start of a line
  • Shift + any combination of keys above – moves as described above while selecting text at the same time (eg. use Shift + Arrow down and keep holding down Shift each time you press the arrow key to select several lines in a row)
  • Ctrl + A – select the entire document
  • Ctrl + X – cuts the selection onto the clipboard (removes it from the document but copies it to the clipboard first)
  • Ctrl + C – copies the selection onto the clipboard (without removing it from the document)
  • Ctrl + V – pastes the contents of the clipboard where the cursor is in the current file (Note: some IDEs let you use more than one clipboard; when you paste you will be asked to choose which item to paste in a menu)
  • Tab (with one or more lines of text selected) – indents the selection by one
  • Shift + Tab (with one or more lines of text selected) – un-indents the selection by one
Search:
  • F3 (Ctrl + F in some IDEs) – bring up the find window to search your files and projects for text or patterns
Undo:
  • Ctrl + Z – undo the last change you made to the code
  • Shift + Ctrl + Z (Ctrl + Y in some IDEs) – redo the last undo you made (in other words, if you undo a change by mistake, this reverses it)
    NOTE: All good IDEs have infinite undo, which means you can undo and redo as many steps as you want. Some IDEs retain the undo history (known as the undo buffer) for each of your files, whereas in others it is lost when you close the file. Be sure to check how your IDE behaves before relying on the undo history between editing sessions.
Files:
  • Ctrl + N – new file
  • Ctrl + O – open file
  • Ctrl + S – save the currently selected file
  • Ctrl + F4 – close the currently selected file

In Visual Studio only:

  • Ctrl + L – cuts the current line (the line the cursor is on) to the clipboard
  • Shift + Ctrl + L – deletes the current line
  • Ctrl + F5 – compiles (if needed) everything in the solution and runs the currently selected project if successful
  • F5 – as above but starts the debugger too
  • F7 – re-compiles (if needed) everything in the solution but does not run anything
  • F1 – brings up a help page about the item under the cursor. If you are confused about a keyword, function or library in your code, simply place the cursor on it and press F1 for help. Note, the help is often very technical.
  • F4 – steps through the list of compilation errors one by one, starting with the first, and takes you to the corresponding place in your code
  • Ctrl + H – bring up the replace window to search your files and projects for text or patterns and replace them with alternative text
  • F12 – goes to the definition of the item under the cursor

You’ll notice I’ve concentrated very much on text editing shortcuts here and the other most commonly used features: searching (find) and compilation (making the program run). There are an enormous amount of shortcuts in all of the IDEs, but learn these important ones you will use often, and you’ll be well on your way to Speedy Gonzales coding speed!

Pages: 1 2 3 4

  1. cheeseater
    March 15, 2015 at 20:20

    Thank you for this post, it is very useful.

  2. April 18, 2015 at 01:34

    To put in 0.02 cents from an old programming fart…

    I would add, be sure to have fun…try to find some small thing to start with, and ‘play’. Start with the old ‘Hello World’ in the language of your choice.
    DONT treat learning to code as ‘important’, its a hobby, enjoy it…its hard, but rewarding.

    Learning programming is just like learning anything else, its always ‘Hard’ at the start, then, IF you don’t give up, it gets easier, and when it gets easier, it gets funner, fun makes you want to do it more (called practice), doing it more makes you better, which makes it funner, recurse and before you know it your a programmer.

    Find a friend who also wants to learn and bounce little programs back and forth, always
    better to suffer with friends….and eventuallyl you’ll get good and its nice to not suffer with friends too.

    OH, and after your done and find it a little fun, look up Data Structures right away, they matter, and you really need to get those to do big stuff…and they are fun in their own right.

    All programmers look at existing code to learn stuff, I’ve been programming professionally for 35 years and I still look at others code (thats what drew me to this site btw good job Katy!) We all stand on each others shoulders, NO one is born knowing anything except how to eat poop and cry, we ALL have to learn everything we know, don’t get discouraged when you see someone who’s a ‘great’ coder, remember, they suffered too, and you’ll get there if you persist in your efforts.

    But most of all do it for fun, don’t waste your life trying to chase doing things for $$$…money will come if you just do what you enjoy.

    OH, remember, artists, good ones, make art for ‘fun’ its what they ARE artists. Programmers program for fun, because, well, its what we ARE, we do it for work, but we do it for fun, at least the good ones do.

  1. No trackbacks yet.

Share your thoughts! Note: to post source code, enclose it in [code lang=...] [/code] tags. Valid values for 'lang' are cpp, csharp, xml, javascript, php etc. To post compiler errors or other text that is best read monospaced, use 'text' as the value for lang.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: