The Beginners Guide to Coding for SEO

 

Back in the year 2011 we all made promises to learn to code. Some of you may have kept those promises while others haven’t. If you have already started learning to code then Cheers. I have tips for you which will make you a better coder. If you have not started coding yet then here is your chance to rise and shine.

Why you need to learn to code?

There are four strong reasons for that:

1. You get a better understanding of the technical side of a website which hones your SEO skills.

2. You can speak to your developer in his language and he can’t take you on a ride with any ease.

3. When you learn to code, you are in a position to translate any SEO problem that you need solved into a format that a computer application can understand and process. This SEO problem can be anything from automating/speeding certain part of your SEO process through APIs to building a custom tool which can do tasks like data scraping or manipulating data in a desired format. Granted there are plenty of third party tools out there which can do such tasks for you. But they are pretty standard. They may not always meet your special requirements.

4.  The barrier to entry is high for coding. Not everyone has the capacity or the inclination to learn coding. So when you learn it, you stand out. You stand out in your career, among your peers and in your industry. Strong coding background can become your strong USP (unique selling proposition) which set you apart from competition as you can do regular SEO tasks with lightning speed and automate processes which can otherwise take several hundred man hours. Coding can also make you very rich if you can come up with a tool like ‘open site explorer‘.

 

The Foundation Course

Following are some terms which i think will help you if you are brand new to programming:

Computer program (also known as software, or just a program) is a sequence of instructions written to perform a specific task.

Source code- It the human readable text which is written using the format of a programming language. A source code can be written in one or more programming languages.

Example of a Source code written in’ C’ Programming language:
#include<stdio.h>
void main()
{
int i;
printf(“Please enter an integer number\n”);
scanf(“%d”, &i);
}

Example of a Source code written in ‘Java’ Programming language:
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello World”);
}//End of main
}//End of HelloWorld Class

 

Professionals who write or edit source code are known as computer programmers (or coders) and the process of writing or editing source code is known as computer programming (or coding).

Machine code- It is the language used by computers internally to execute the source code. Machine code is written using a binary numeral system (0 and 1). Computers can’t understand the source code. So they need to take help of computer programs called ‘compiler’ and ‘interpreter’ to translate source code into machine code. Here is how a machine code can look like:  00101010 11011010

 

System Programmers vs. Application Programmers

Before I give you more coding tips, let me give you a brief intro of my coding background. I grew up learning programming languages like C, C++ and VC++.  I hold a bachelors degree in computer science; have 5 years of hand on experience in C and C++ and 1 year of teaching experience. I am not a web developer. Not all programmers are web developers. Web developers are application programmers who write code to build web applications which provide services to an internet user like me and you. I wrote code to work for computer hardware and processes which put me under the category of system programmers.

 

System programmers are the guys who develop and maintain your operating system, develop windows and Linux applications. They are rare breed of programmers. You won’t find them in regular offices or companies. They are generally employed by computer manufacturers (like Microsoft, IBM) and systems software houses. They code the operating system you work on and the programming languages you code in. Without system programmers there will be no operating system (OS) or programming language. Without OS and programming languages there will no internet, no smart phones & no computers. Sounds terrifying?

 

Application programmers on the other hand develop non-system applications. They write programs to manage a specific task like tracking inventory within an organization, developing games, custom softwares or building the front end and back end functionality of a website. Web developers are subset of application programmers. Programmers are often known by the language in which they have developed expertise. For example: a programmer who codes in Java is known as ‘Java Programmer’, a programmer who codes in ‘VB’ is known as ‘VB programmer.

 

How programmers work

A senior programmer/ system analyst interacts with clients to understand their requirements. He then plan out solutions (which includes coming up with flow charts, database design etc), recommend software and system, write technical specifications and do all the cost-time analysis.

Junior programmers write programs according to the specifications determined by senior programmer / system analyst. The programming language that will be used in the project depends upon the purpose of the program. For example programming language called ‘Fortran’ can be used to build scientific application or programming language called ‘PHP’ can be used to build web applications.

 

Programmers often copy paste codes from pre built modules, libraries or the source code developed by them (in the past ) or by other programmers to partially or fully solve their problems. There is in fact a term for such type of practice known as the ‘copy and paste programming‘. Copy and pasting is also done by novice programmers as writing a code from scratch is difficult for them. The programmers, SEO usually deals with are known as Web Developers. Web developers do not have truly deep specialization in any one programming language. They are more a generalist. They posses knowledge of various languages used in web programming:

 web programming

 

Scripting Languages

A scripting Language also known as script or extension language is a programming language that is usually interpreted (i.e. carried out by another program) than compiled (i.e. carried out by computer processor).

 Note: The Computer processor also known as central processing unit (CPU), processor or microprocessor is the brain of your computer. It is the hardware device which executes most of the commands from computer hardware and software. Without CPU, your computer is merely a piece of metal junk.

Scripts (like Javascript, PHP etc) are slower than compiled programs as in script each instruction is being executed by an external program which results in additional instructions being processed. Whereas in case of compiled programs (like C or C++) the instructions are executed directly by your processor. Scripting languages are easier to code in than compiled languages. Scripts are often embedded within a text file (saved as HTML, .php etc). Such scripts are known as inline scripts. They may also be contained in an external file which is then called from within a document. Such scripts are called external scripts.

 

Types of scripting languages

 

Client Side Scripting Language

 

Server Side Scripting Languages

1

In case of client side scripting, scripts are executed by a user’s web browser rather than by a web server.

In case of server side scripting, scripts are executed by a web server rather than by a user’s web browser.

2

Programs run on client’s machine (Note: your website user is your client). Which means your user might experience error if his browser doesn’t support your script or execute it differently.

Programs run on a web server. Which means the script performance does not depend upon a client’s machine.

3

A website can use one or more client side scripting. For e.g. a website can use both JavaScript and Flash.

A website generally uses one server side scripting.

4

You can see client side scripts used on a web page by checking out its source code.

You can’t see server side scripts used on a web page through its source code via a web browser. For example you can’t see the PHP code used on a web page through your browser.

5

Examples of client side scripting: Javascript and Flash

Examples of server side scripting: ASP (Active Server Pages), PHP (Personal Home Page), JSP (Java Server Pages), Cold Fusion, Ruby on Rails, Perl etc.

 Note: Ajax uses both client side and server side scripting. It is a client side script that calls a server side script.

 

Markup Languages

A markup language contains a series of instructions for displaying a text. There are different types of markup languages like:

1. Document markup

2. XML markup

3. Content Syndication markup

4. Lightweight markup

5. General purpose markup etc

The most popular markup languages are ‘Document Markup’ languages like HTML, XHTML and RTF (Rich Text Format)

 

Stylesheet Languages

Also known as style languages contains a series of instructions through which you can control the layout and look of your web documents. The most popular style language is CSS (Cascading Style Sheet). Other popular style language is XSL (Extensible Stylesheet Language).

 

To be good in technical SEO, you must have at least working knowledge of all the web programming languages. Out of all these languages, you may find server side scripting languages to be the most challenging and difficult.

Now the billion pounds question

 

Where to Start?

Often people ask me how to start learning to code. The answer is Learn ‘C’.

‘C’ is a programming language developed by the greatest programmer of all times: ‘Dennis Ritchie‘. All the modern day programming languages (from Java, Python, Perl to PHP) are partially or fully written in ‘C’. All the modern day operating systems from Windows, UNIX to Linux are majorly written in ‘C’.  So it will not be an exaggeration to say that ‘C’ is mother of all programming languages. ‘C’ lives in every programming language in some form or the other.

Unless you have strong basic background in ‘C’ you will never truly understand the actual language elements used in complicated programming concepts like classes, objects, inheritance, polymorphism, exception handling etc. So it is imperative that you learn ‘C’ before you migrate to C++, Java or web languages like PHP. Once you known ‘C’ and ‘C++’, you can learn any programming language with relative ease.

What i think you need to get familiar with, in ‘C’ or any other programming language are syntax, semantics and paradigm. Syntax is like spelling and grammar of a programming language. Semantics is the meaning of a programming language and paradigm is the style of programming. Different programming languages use different syntax and paradigm to solve same problem.

 

How to start and where to stop

I want to be honest with you guys. ‘C’ is one of the most difficult programming language in the world and is like a bottomless pit. One needs a lifetime to become a good ‘C’ programmer. Programmers who are really good in ‘C’ have been doing programming for the last 10-15 years.  So it is important to be very selective here.

Try to stick to understanding the basic concepts and refrain from too much coding. I know, for some of you it may be tempting to learn this and try that. But coding is not going to make money for your client, activities like link building will.  So don’t get carried away and just focus on the core concepts. Following are the topics which I think you must get familiar with, in ‘C’:

1. The C Character Set
2. Constants, Variables and Keywords
3. Compilation and Execution
4. Receiving Input
5. C Instructions
6. Type Declaration Instruction
7. The Decision Control Structure
                 a. The if Statement
                 b. The if-else Statement
8. The Loop Control Structure
                 a. The while Loop
                 b. The for Loop
                 c. The do-while Loop
9. The Case Control Structure
                 a. Decisions Using switch
                 b. switch Versus if-else Ladder
                 c. The goto Keyword
10. Functions & Pointers
11. Data Types
12. Arrays
13. Strings
14. Structures
15. Console Input/Output
16. File Input/Output

 

Once you have got a basic understand of these concepts then proceed to C++ (extension of ‘C’ programming language) and get a basic understanding of following concepts which are unique to ‘C++’:

1. Object Oriented Programming (OOP)
2. Classes
3. Objects
4. Data Abstraction
5. Data Encapsulation
6. Inheritance
7. Polymorphism

 

Book to Learn ‘C’: Let us C by Yashavant P. Kanetkar

Book to Learn ‘C++’: Let us C++ by Yashavant P. Kanetkar

These are the best books to learn the basic ‘C’ and ‘C++’ programming and I can personally vouch for them because I have read these books page by page at least 10 times.

Once you are familiar with the basic concepts of ‘C’ and ‘C++’, migrate to PHP.

Why PHP? PHP is the most widely used server side language in the world (followed by ASP.Net) and it will help you greatly in your day to day SEO tasks. Again refrain from too much coding and focus on the learning the syntax, semantics and paradigm. The goal here is to understand the code and how different web elements interact with each other. That’s it. Unless programming is your bread and butter don’t spend too much time on learning to code.

 

Where to go next?

If you are an experienced programmer who wants to take his technical SEO skills to the next level or a business which develops and sells  ‘SEO Tools’ then I would suggest learning Python, jQuery & JSON.

Why Learn Python? Google uses Python. Google App Engine which lets you run web application on Google infrastructure is written in Python (besides ‘Java’ and ‘Go’). Python supports multiple programming paradigms.  You can use it as a pure object oriented language or as a powerful scripting language. It is easy to learn and use.  Even kids code in Python. Ok, that last one was a joke.

Why learn jQuery and JSON? Both jQuery and JSON are commonly used in API calls.  If you wish to use APIs to speed up your SEO tasks then you need to be familiar with these languages.

 

If you like this post then you should subscribe to my blog and follow me on twitter.

 

Other Posts you may find interesting:

 

 

Himanshu Sharma About the Author: is the founder of seotakeaways.com which provides SEO Consulting, PPC Management and Analytics Consulting services to medium and large size businesses. He holds a bachelors degree in ‘Internet Science’, is a member of 'Digital Analytics Association', a Google Analytics Certified Individual and a Certified Web Analyst. He is also the founder of EventEducation.com and EventPlanningForum.net.

My business thrives on referrals, so I really appreciate recommendations to people who would benefit from my help. Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from SEO, PPC or Web Analytics.

 

 

  • https://twitter.com/#!/sajeetnair Sajeet Nair

    Hi Himanshu,

    Truly an informative post, i agree with you on the part that SEOs need not be a programmer but should at least know the syntax.

    If i may, it would be great if you can write a post on different GA code customization/modifications that one may use to get optimized data in Google Analytics.

    - Sajeet

  • Anand

    Great post. Definitely sums up programming well. The overview and framework is great!

  • http://www.11-internet.nl Jan-Willem Bobbink

    Great take away post for beginners in the SEO industry. Most marketing graduates don’t know any programming, so this is a good start.

  • http://www.mommatown.net Sally Lancaster

    I’m a programmer looking to hone more SEO skills and your article even helped me! So, it is a good one, thanks for the info. I will definitely be keeping an eye on your blogs!