No announcement yet.

James Battersby Tutorial 03: Editors

  • Filter
  • Time
  • Show
Clear All
new posts

  • James Battersby Tutorial 03: Editors

    A few of these tutorials feature specific products and opinions. I do not work for any of the mentioned companies and these opinions (although shared by many) are my own. Take them as you will (visit my website for more information on my background).

    03: Editors

    There are quite literally thousands of editors out there and for every editor there are developers who swear by them. I've come across a few during my time, each providing their own advantages. At the end of the day what you need is a syntax-colouring editor. Syntax means structure and programming languages are structured so what you need is an editor that can understand the structure of a language and colour each component accordingly. If you just use Notedpad you'll be lost in a sea of black and white.

    Below are editors that I have used over the past few years and what I think of them. They are all free to download and use (at least for non-commerical uses) but they do range in features and complexity.

    I used this a little during my first role and it is a simple, no bells or whistles, editor. I didn't particularly like it but the Senior Developer at the time was adament about it.

    This is what Notepad should be like - I've begun using this more regularly and its great for simple editing. It recognises several languages and is very customisable not to mention robust and quick. I would recommend this for beginners. I use it whenever I want to make a quick mock-up web page, stylesheet or Javascript file.

    I used this for years before the author decided to go commercial which is a shame because its features are great for PHP developers. You can hook it up to your PHP installation and preview your web page inside the editor as oppose to opening a separate web browser. Aimed at PHP developers it does a good job for most languages. The free download version is only available for non-commercial projects.

    As far as I'm concerned this is the daddy of all editors. Its a huge beast of an editor, packed full of features and, with a massive community behind it, is continuously made better. Originally designed for Java development users have provided the PHP Development Toolkit (PDT) to create PHP projects. This editor is for advanced users working in teams - all developers should aim to use this at some point (but all in good time - it can be very daunting at first). This is the editor I currently use for my main projects.

    My Editor Preferences
    Often when you first use an editor the background of the text is white. I find this glares too much and makes reading code difficult. Something I ALWAYS do when setting up an editor is changing the background colour to a pale yellow. It has been scientifically proven (and by sports spectators) that text on a yellow background is more legible than on white. It also requires slightly less power from the monitor to create the colour. So do your eyes a favour and go pale yellow.

    Whilst you're fiddling with the preferences in your editor you should consider the following:
    • Line numbers should be present. These wont be printed but show which line in your code you are working on. This can be useful when you get a message similar to "Error detected on line 435".
    • Tabs should be made up of space characters (4 of them). Different editors interpret tabs differently which can mess up your code but they all understand what a space is.
    • Display the print margin at 80 characters. If you need to print your code it needs to be neat and tidy. 80 characters is the maximum a printer can take usually so aim to not write any further than that. I set my print margin to red to remind myself.
    • Make sure all the fonts are monospace. It makes aligning and therefore reading code a lot easier.
    Below is a screenshot of how my Notepad++ settings are set up. You do not have to set it up in the same way but it may help you during development.