Editors

Recommendation

The Atom editor is (mildly) recommended

If you are happy to accept that, fine - it will help us to help you in the lab if most of you use the same editor

Otherwise, choosing an editor is a matter of taste, but to understand how to make a choice, and how to configure the editor you choose, read on

IDEs

An IDE (Integrated Programming Environment) is a specialist tool for programmers

As well as providing an editor, it compiles and runs programs, helps with debugging, looks after projects, handles syntax-colouring, provides documentation-based completion, has teamwork features, integrates with other tools, and so on

So, why isn't one recommended?

Beginner problems with IDEs

IDEs will be valuable later, when you are programming full-time and working in a team

Of course, if you are already familiar with one, or are keen to try one out now, go ahead

Word processors

You should never use a word processor such as Word or Wordpad for writing programs

It adds formatting information to the text which the compiler won't understand

It is just about usable if you remember to "save as plain text" all the time, but that's very fussy and time consuming

Text editors

There may be a plain text editor such as notepad, emacs, vi, ... available on your computer

These provide no help, or limited help, for programmers, or have too high a learning curve

For example, notepad can't even properly open a non-Windows file - don't use it

Some editors that you may come across such as gedit, notepad++, geany, sublime, brackets etc. are OK, but they are typically not ideal because of platform dependencies or other reasons

Programmer's editors

The ideal is an editor which:

That has led us to Atom, though other programmer's editors may be as good

Personal choice

I have niggles with every editor or IDE I have ever used; my personal niggles with Atom are:

Configuring your editor

An editor needs to be configured properly to be suitable for programming and computer science work

The remaining slides discuss the most important things that need to be configured properly - check them carefully in your preferred editor

In almost every case, Atom does the right thing already

Colouring

A programmer's editor uses colours to make programs easier to read

To do that, it has to 'understand' the programming language

Atom understands many languages straight away

Newlines

As explained in aside: characters, every line of a program or text file should end with a newline

Some editors do this by default, but for many you have to find the option "add final newline" or similar and switch it on

Tabs

Tab characters in files are obsolete, ambiguous, and can cause a lot of trouble

Although they seem like a good idea for indenting, a good editor can simulate them with spaces to give the same effect

Some editors do this by default, but for most you have to find the option "soft tabs" or "use spaces for tabs" or similar and switch it on

Indents

Almost all editors provide some sort of help with indenting - it is worth seeing if you can increase the support, to help you with consistency

The indent width should be set to 4 spaces (4 is the most popular, 8 is too much, 2 is reasonable, 3 is perfect but not supported by many editors)

Some editors have this as the default, for others, you have to find and change the setting for "indent width" or "tab width" (or sometimes both!)

Character encoding

The editor's character encoding should be set to UTF8

This is important for programs containing foreign language strings, data files, web pages, etc.

As usual, this is sometimes the default, but often needs to be fixed

The Snipe editor

Because I have niggles with every editor, I have started developing my own editor in C, to be cross-platform and fast-loading

See Snipe and feel free to download and try the most recent pre-release

It is under-developed, lacking undo and search for example, but illustrates fully automatic indenting (which no other editor has)