The mindless banter that is,

AlexGeek's Web Design and Development Blog

Getting Started with Programming (Beginners Guide)

07 Jan 2008 - Category: Web-Development

Where to start with progamming / developing?

A question asked frequently by computer users that have mastered using and configuring an Operating System and want to get into thecoolside that isprogramming and developing.

Don't jump in at the Deep end!

A few years ago I made the mistake of diving straight into complex programming languages before learning something basic like a language markup. Python is advertised as an easy to learn language for users that have never tried programming before.. I've had first hand experience with this and I can tell you it's not the best language to start on.
I suggest starting with the basic markup that the web thrives on –HTML. HTML is as simple as it gets really, although not strictly a programming language it's start. From learning HTML you can understand the hierarchies involved and pick up on some coding techniques. If you'd like to learn HTML, I suggestWebforumz, a web design and development community. They'll point you in the right direction!

Recommended First Programming Language

I recommend for a first programming language,PHP. PHP is a dynamic language of the web, if you don't understand what that means I'll sum it up. Do you use Facebook? That particular social networking site uses the language PHP this allows users to enter informatiom into forms and post comments etc. Without a dynamic language like PHP this wouldn't be possible.

PHP will output HTML for your side of the transaction (known as client–side) however on the server where the PHP files are (Server–side believe it or not!) there can be a lot more happening. The PHP file could write yourIPaddress to a file or take information from a form and put it into a database (more on databases in another programming article or read myMySQL Learning Resources Thread).

The hardest thing to grasp with PHP (and all dynamic languages) is that it's stateless. This means that once the page is sent to the client you have no control over it (At least not with out a special thing called AJAX but that's a little complex!). So once it's sent that's it, you cannot then edit the page with PHP. I will explain later about JavaScript (I'm sure you would of heard about it), this allows editing for the client side (that's the side receiving the page remember?).

Why I recommend PHP as a first programming language, is that it is loosely typed. This basically means that you can codelazilyand it will still work. An example of this would be declaring a variable, in PHP you simple say the variable name and it's value. With other languages such as C#, you must declare what type of variable you are using (like an integer or a string of text), this enforces strict rules that can be cryptic and overwhelming for new programmers.

Getting started with PHP

Then easiest way to test PHP is to downloadXAMPP, this basically installs a server on your computer that you can use to test PHP. If you have trouble setting up XAMPP, ask for help atWebforumz; We find that a lot of users either have trouble or it installs without a problem.

Once you have installed XAMPP you should be able to access the default site by visitinglocalhost, you will have to configure XAMPP now. It's not too difficult, but yet again if you get stuck you can visit Webforumz.

Once you know how to setup a small site to test PHP files on, create a file calledinfo.phpand place it in the folder that holdsthe files you can see by visitinglocalhost. Open upinfo.phpwith notepad (do not use MS Word!) and place this code inside:

<?php phpinfo(); ?>

Then visitlocalhost/info.php, if you see a purple table with the PHP logo then PHP is working! Give yourself a pat on the back for getting this far! Okay, done? Right.

Now the world is your oyster, you can experiment with PHP for a while! Here is some code to get your started.

The opening tag for PHP

<?php

The closing tag for PHP

?>

Everything that you want PHP to do you put between those two tags.
This example is a HTML page that will just say hello world (the cliché first script that you will become too familiar with)

<html>
<head>
<title>My First PHP Script!</title>
</head>
<body>
<?php echo 'Hello World!'; ?>
</body>
</html>

Save this as whatever you like, possiblyHelloWorld.php. Then visit it via yourlocalhost. If you get a page with a title ofMy First PHP Script!and a body ofHello World!then you've successfully created a PHP script. Exciting ey? Well not really, you could of easily done that with HTML right? Okay let's try something to add dynamics to the script!
Try this new script, you can save it as a new file or just replace the contens ofHelloWorldwith this.

<html>
<head>
<title>My First PHP Script!</title>
</head>
<body>
<?php echo rand(0, 100); ?>
</body>
</html>

Run it, you should see a number between 0 and 100. Okay, refresh the page! Different number ey? So what happenned? Basically PHP has a function called rand(), which you may have guessed returns a random number. The 0 and 100 are known as the function's parameters. The function takes the first parameter and the second then generates a random number between the two. This function doesn't seem to be that useful at the moment but it is extremely useful when you get into more complex programming!

This article could go on forever about the aspects of PHP but instead I'll leave you to learn by yourself. I have a sticky thread at webforumz.com forPHP Beginner's Resourceswhich lists the best places to learn PHP. You can find help by searching the manual at php.net, or just simply by googling your problemm! Good luck!

What next?

Here you have a choice, if you're enjoying web design and development and would like to stick with it I recommend JavaScript to enhance the users experience on your site. If you are not fond of this web stuff and would rather somerealprogramming then I recommend to you Visual Basic or C#.

Learning JavaScript

Javascipt is a great tool to have that can really help enhance the users experience on your site. But it's important to remember that JavaScript is only to enhance.. not to replace. Quite a lot of internet users disabled JavaScript, so you really cannot rely entirely on it. However if you don't care about the ~20% that disableJSthen use it, but I recommend using the <noscript> tag to tell them that they are missing out! You can learn more about JavaScript via myJavaScript resource thread.

Desktop Programming Languages

These are the languages that make you feel like a real programmer! They may look intimidating but basically it's like PHP with stricter rules. I recommend purchasing a book to help learn desktop programming, they really do make a difference. Now here you have a choice as there are quite a few programming languages but I recommend one of the MS .NET 2.0 languages that have a Visual Studio. Another words you can drag and drop buttons and text inputs onto yourforms(an application window is called a form, e.g. notepad is a form) then you can double click on the button for example and this will allow you state what happens when the button is clicked. You can choose a programming language at theVisual Studio download page.

C#, J#, C++ or VB!?!

It can be hard choosing which language to choose but I think if you choose from the following which is most likely suited to your character it will be easy for you to choose a programming language.

VB – Visual Basic
As the name suggests, it's very basic! Apparently users find this language very easy. Similar to PHP it has few strict rules. So if you are the type of person that would like something that's easy to code in this is the programming language for you. I personally find the language is to wordy, i.e. it uses many words where it could use a symbol making the code very hard to read. This language is similar to ASP I feel.

J# – Java Sharp
J# is an okay language, it's similar to C#(below) with some minor differences. It's entirely Object Orientated and nearly everthing is done with functions.

C# – C sharp
C# is my favourite desktop programming language. It's similar to J# but more is done with variables than functions. Entirely Object Orientated, very neat clea to understand.

C++ –
This programming language is great as it's similar to many other languages such as Python, PHP and GTK. It's quite complex but doesn't have to be object orientated. Good for the developer that wants to branch out

I hope now that you have an insight on programming and that it will be a lot easier for you to learn than it was for myself (the hard way!).

AlexGeek

Post A Comment

Name:Email:

What is 1 + 17?

No comments yet! What do you think?