Before You Start To Code
When you first set out to learn the science and art of computer programming, there is a huge amount to learn and it can sometimes seem a little bit overwhelming. You are effectively learning a whole new language to write your code in, at the same time as learning a wide range of new concepts, principles, working practices, technical terminology, software tools and more. That's quite a lot to take in all at the same time.
Because of this I think that it is well worth taking the time to learn some programming basics before you even start learning the ins and outs of a programming language and writing your first line of code. These basics include common terminology, working practices, and software tools.Some Free Code Editors
- A Beginners Guide to Notepad++
A beginners guide to the free Notepad++ code editor, with everything you need to know to get started as a programmer! - DroidEdit for Android
A free app for writing code on your Android phone or tablet - Bare Bones Software | TextWrangler
A code editor for Macs which also has integrated FTP
A Beginners Guide to Code Editors
You can't write code in a word processor, because the document will contain formatting which itself is created using programming code. You can choose to use a basic text editor of the kind which comes pre-installed on most computers and which doesn't use any formatting, such as the notepad program, but it is much better to get yourself a proper 'code editor'. Don't worry - there are plenty of good ones available for free (I've include links to the right of this text)
Code editor software makes programming much easier, by making your code more readable and offering you a range of handy features. The first thing that you will notice when using a code editor is that each line is numbered. This makes it easier find things - including errors as you will often be told where in your code the problem has occurred when there is an error. Numbered lines mean that you can easily write a change log to keep track of exactly where modifications to a program have been made, and if you are collaborating it means that you can point a colleague to a particular place with ease.
When you start writing your code you will notice that the program adds colour coding to make it more readable. Because many types of code include the use of brackets, which are there to organise the code and which can cause errors if they are not opened and closed properly, many editors let will highlight the closing bracket when you click next to the opening bracket, and vice versa. They will also automatically indent lines of your code where appropriate.
If you look in the example picture below, you will also see a line down the side with little squares that feature either a plus or a minus sign. These can be used to collapse or expand sections of your code, which is useful when you are working on larger pages.
Most code editors also give you a button to you run your code in your choice of browser, allow you to add plug-ins to customize your editor, and use a range of advanced search features and more. Taking the time to pick out a good editor and explore its various functions before you actually need them is a really good idea.
Syntax
Programming languages are just like human languages - they have their own 'syntax', or rules to describe how statements should be written. You will find that many programming languages share a great many common features and functions, but each one will have their own syntax rules.
Getting the syntax right is very important, and as a beginner you will find that many of your errors end up being down to a missing semi-colon, bracket or apostrophe. The solution is to take your time, proofread as you go, and use a good code editor which highlights your syntax and gives each element a different colour.
Commenting, Indentation and Readability
When you are writing code it is very important to maintain readability. It is not just the computer that needs to be able to read your code and understand what it means - there is a good chance you will need to read back over your code at a later date to make changes (or to copy something for a new program!) and in a professional environment other people will need to as well.
Taking a bit of time to choose descriptive words as names for things like variables and functions can really help with this. Structuring your code with indentation is also useful, and you will learn how to do this alongside your language of choice. Each language will have its own format for indentation, but unless you are learning a language like Python where blank spaces are part of the syntax, this is just for your own benefit.
Commenting is also very important. Even when you are an experienced programmer you will find that some code is difficult to read and would take a long time to work through if you wanted to figure out exactly what is happening. Placing regular comments in your code to explain what it is doing is a very important habit, and one which you should work on developing from the very start of your programming career. Good commenting is an art form, as you need to include as much information as possible in as short a space as possible.
Do you ever read the instruction manual?
Documentation and Libraries
Being good at programming isn't like being good with gadgets - you have to read the instruction manual. The term 'documentation' refers to the instruction manual which will be provided for any language you learn, as well as for third part resources and for SDK's and API's (see below). As a developer, you will spend a lot of time reading documentation. And the more time you devote to this, the better you will be at your job.
The simple fact is that no course will teach you everything that you ever need to know about a programming language - and even after getting years of experience under you belt there will still probably be things you aren't sure about. Getting used to reading and using documentation is very important, and when you start to learn a programming language it is a great idea to browse through the documentation to complement any course you are doing - even if a lot of it doesn't make much sense to start off with!
Libraries are another very useful repository for information, and it is well worth finding a few good quality libraries and familiarizing yourself with them when you start to learn a new language. Essentially a library is full of pre-written code which you can use to implement common features without having to write a everything from scratch yourself. In Python you can use 'modules' to import a set of functions with a single line. A good knowledge of libraries and modules can save you a great deal of time and trouble!
Pseudo Code
Pseudo code is an informal general description of what a piece of code should or does do, written in regular English (or whatever your language is!). It is essential partway between code and human language. It uses a logical and even mathematical style to explain the purpose of a piece of code, but without any of the formal structure and syntax of actual code.
There are no rules for creating pseudo code, so you are free to use it however works best for you.
It is very useful for two reasons:
- Problem solving / knowing where to start: When you sit down to write a piece of code you often won't know how it is going to be structured, or even how to start. Writing down your intentions in a very logical way like this before you start can make it easier to figure out where to start with actually writing the code and what structures you will need to use.
- Commenting: Pseudo code can sometimes be used for comments to explain your code in a succinct and easy to read way. Sometimes you can even use the pseudo code you wrote when you started out as the basis for your comments (perhaps divided up and put in the relevant location) so that you don't need to write anything new for your comments!
An Example of Pseudo Code
Set score to zero while quiz is active if questions have been answered current score = 10 * no. of correct answers display current score else print 'please begin' if quiz has been taken print score else print 'test your knowledge!'
Popular Free IDEs
Integrated Development Environments (IDE)
An integrated development environment (IDE), sometimes also known as an interactive development environment, is essentially one step up from a basic code editor.
An IDE includes a source code editor, as well as 'build automation' tools to automate various tasks, a debugger to help you to identify and fix errors, and perhaps a compiler (see common terminology below), access to code libraries, and more.
If you are learning a common web language like JavaScript or PHP then you may well just use a regular code editor and won't need an IDE, but for more heavyweight languages they are essential.
Many popular IDE's support multiple languages, but you must ensure that your choice of IDE is appropriate for the language you are learning.
GIT Version Control and Collaboration
GIT is a term for a piece of distributed revision control software which is also used as a source code management system (SCM).
It is a commonly used tool for developers to keep track of changes that they make to their projects (revision control) - which is very important because if there is a problem with your code you will want an easy way to go back to a previous stable version. It is also used to store and share 'repositories' - libraries full of general code that can be reused on different projects, so you don't need to write common features all over again. Software such as the very popular GitHub also includes powerful collaboration features for teams to work jointly on a project, or for interested parties to contribute towards open source projects.
Software Development Kits
A 'software development kit' or SDK is a bundle of software tools for the creation of new applications for a specific platform or framework. For example, if you want to develop an app for Android smartphones then you will need to download and install the Android SDK on your computer. Often SDKs are free, but some companies will charge new developers for the download. There may also be a range of different license options - so make sure you download the correct SDK for your purposes.
An SDK will often include an Integrated Development Environment, libraries, tutorials and simple code examples.
APIs
An API is an 'Application Programming Interface'. They contain a set of rules through which your code can communicate with third party software or websites.
You can use API's to access content and features from, or develop apps for, popular websites such as Twitter or YouTube. This kind of API is generally free to use, as the development of third party tools and integration into other websites can be a very powerful promotional tool for a big site. Another kind of API is created by 'software as a service' companies to offer advanced functionality to your site. You will generally have to pay for access to these.
Some Other Common Programming Terminology
- Algorithm - A set of logical or mathematical procedures to solve a problem
- Compiler - This is a program which takes the code you have written and translates it into the binary ones and zeros of actual machine code.
- Concatenation - Combining two things together, such as two lists or strings of text.
- Control Flow - Controlling the order in which various sections of code are run or the rules by which they are repeated.
- Dump - a list of data which is saved if a program crashes, often as a text file. It is very useful for diagnosing problems.
- Floating point - A decimal number where the point can move, such as 1.23. The opposite is an integer, which is a whole number and cannot have a decimal place.
- Function - a set of instructions which are written once to obtain a particular result, and can then be used whenever necessary by 'calling' it.
- GUI - General User Interface, refers to 'front end' of a piece of software which the end user actually sees and interacts with
- Interpreter - Some languages do not need a compiler, but instead use an 'interpreter' which translates to machine code as the program is run.
- Iteration - A sequence of instructions which are repeated. For example, to perform an action for every item in a list you would 'iterate' over that list. Each time it is repeated is one iteration.
- JSON - A format for transmitting information between locations which is based on JavaScript. Many APIs use JSON.
- Logical Operation - The use of simple Bolean logical such as and, or andnot.
- Loop - a piece of code which keeps running until a certain condition is fulfilled - or isn't fulfilled in the case of an 'infinite loop' which will crash the system running it.
- Markup Language - A relatively simple language used to format pages, such as HTML.
- Nested - When one thing is contained within another it is said to be 'nested'.
- Recursion - When something refers to itself. For example a variable may add something to itself for each iteration of a code loop.
- Run time - The time during which a program is running.
- Sandbox - A place to run a program for testing, and for experimenting.
- Subroutine - a function or other portion of code which can be run anywhere within a program.
- Variable - A way to store a piece of data which can then be modified at any time.
0 comments:
Post a Comment