total n00b question here

Jedi940

Member
Jul 29, 2007
42
0
0
I am interested in beginning to learn how to program but I don't know where to begin. I plan on being entirely self taught. The problem is I don't know where to begin. There are so many different programming languages out there that I don't know where to begin. I know the first question you are going to ask is what do you want do/create. Answer - everything.

Seriously though, I would like to be able to manipulate web pages but also create programs like networking applications (firewalls, security apps etc.)

I guess I would like to know where some of you started and how you learned.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Well, you said "I don't know where to begin" three times in one small paragraph, so I believe you! :)

Frankly, it's not as easy as it was when I started. We had ROM BASIC and about six other mildly different flavors, a very simple operating system and output metaphors (text, anyone?), and really very few other considerations. You could start the BASIC interpreter, type in...

LET X = 1
LET Y = 2
PRINT "X + Y = "
PRINT X + Y
RUN

And go "heh, cool!" and you were off an running. If you want to begin programming you need to find some relatively simple corner of the currently very complicated world to play in. I would suggest getting a copy of Visual Basic (you can download it for free as part of Visuall Studio Express from MS's site) and working through the "Hello World!" examples. Alternatively there are still some decent versions of BASIC out there, like PowerBASIC, and TrueBASIC. Essentially anything that lets you focus on getting the simplest statements entered and running is where you want to begin.

And naturally, feel free to post your questions here.
 

Aikouka

Lifer
Nov 27, 2001
30,383
912
126
For webpage manipulation, you may want to try something like PHP. It's not horribly hard, but quite useful. You can also do simpler client-based manipulation using Javascript.
 

Scarpozzi

Lifer
Jun 13, 2000
26,392
1,780
126
I second learning PHP script. It's really cool when you learn it with mySQL. You can pay a mere $10 or so for a yearly budget webhost somewhere and setup your mySQL database and get "REAL WORLD" experience by working with a live server...or you can simply download something like XAMPP and install it on your workstation.

http://www.apachefriends.org/en/xampp.html

XAMPP is a package that contains Apache, MySQL, PHP, and Perl and pre-configures the applications for you to work together. This is nice if you don't want to have to compile them and download additional libraries to make them work together.


From there, I recommend checking out some free PHP scripts that are available. Download them, edit them in notepad or vi and see if you can reverse engineer them. You need to understand some basics about databases, but it's pretty straight-forward stuff most of the time.

Things that you might want to do is:
1. Build a web authenticator by reading and comparing a Username/Password combination from a database.
2. Set a cookie and store a credential
3. Test the credential upon each page load to enforce authentication
4. Write to the database
5. Read from the database
6. Read from the database and allow entries to be edited.

If you're wanting to learn more Application level programming, I recommend starting with either Java or .Net. Neither are easy to grasp because they're overwhelming, but I almost want to say it's best not to waste your time with C++ or PASCAL (What I started with).
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
C++ would be a waste of time for you. It's not an easy language to get started with and as a beginner you wouldn't find any practical use for it.

PHP/MySQL/JS would be a decent start if you have an idea for an interactive page you'd like to build and can use that for your project.

For general programming, I would recommend Python - it's easy to get started with but it has plenty of depth so you can keep learning for a long time. You can also use it in many different contexts - desktop apps, web development, quick scripts etc. If you have no ideas for a project, you can try this: http://projecteuler.net/index.php?section=problems



 

Net

Golden Member
Aug 30, 2003
1,592
3
81
i had a high school class on visual basic. then went into C++ and later C. Out of all the languages I love C. try out the 3 I mentioned and see what one you want to dive more into. you don't have to just do one at a time.

focus on making programs instead of starting from the front cover of the book and moving to the back.

all in all, its whatever you enjoy more method of learning and language that you enjoy more.
 

Jedi940

Member
Jul 29, 2007
42
0
0
I appreciate all the replies. It is interesting to see what everyone's preferences are. I guess my biggest fear is that I will learn a language only to find out that it won't work with a project I decide to undertake. Is that ever an issue you have had?
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Yes, I've had that experience, but the simple truth is that the first language is the hardest. All subsequent languages are quite a bit easier.
 

Jedi940

Member
Jul 29, 2007
42
0
0
Well since many of you recommend php as a good place to start I think I will try that. I have heard that language tossed around as good for beginners elsewhere too. The other popular languages seem to be between java and visual basic. What is the difference between them and what applications do they have?
 

Net

Golden Member
Aug 30, 2003
1,592
3
81
visual basic is the easiest language i ever used. i've had a lot of fun with visual basic. you can draw the gui then put code behind it. very quick to make apps with.
 

Net

Golden Member
Aug 30, 2003
1,592
3
81
i hate java, it's slow. no offense to anyone who likes it. please don't quote me and tell me why java is good. this is just my opinion.
 

Jedi940

Member
Jul 29, 2007
42
0
0
I was doing some reading and found that visual basic is changing to visual basic.net
Have you worked with the new format? any thoughts?
 

Jedi940

Member
Jul 29, 2007
42
0
0
Ok, so I took your advice and started learning php. So far it is quite easy. however, because there are many references to html, I will probably start learning that as well.

Anyways, I was doing fine up until I got to functions. Now nothing will work!!
Am am using notepad++ with the PHP language selected. I have written as follows

<?php
function Adam(){
echo "My name is Adam<br />";
}
echo "What is your name?<br />";
Adam();
?>

According to my knowledge, this should display

What is your name?
My name is Adam

However when I save it and try to load it, I get the error message
Parse error: syntax error, unexpected T_FUNCTION, expecting ',' or ';' in C:\xampp\htdocs\test.php on line 2

Why?!?!?!?!
 

Fallen Kell

Diamond Member
Oct 9, 1999
6,249
561
126
The project determines the language in just about every case. There is no one best language in the world for everything, and as such, you need to know what you want to do as to decide what language you should be looking at. To be honest, the language that will probably help you the most in terms of learning about learning useful programming in general would be Java. Yes, Java guys. I know many people hate it, and I know it is almost never the right choice language for just about every project out there, but it is a very good language to learn on, especially since most programming will be in an object oriented fashion (at least most companies do this if the language they are using supports it). There are also many good IDE tools for Java, Eclipse comes to mind, which will allow you to easily learn many best practices type of things such as setting up try blocks and exception handling as in many cases Eclipse will warn you that whatever function you are calling can potentially throw certain exceptions, which makes you write code which handles those issues without crashing when an exception occurs which you didn't have a way to tell the code what to do if/when that exception happens.

While C and C++ are probably the most used languages, they are also very hard to just jump into because there are many different ways to do the same thing where almost all of them are the wrong way due to security issues, memory issues, or performance issues. This makes it a bad language to learn on because being self taught, you will not know what is the right way verses the dozens of wrong ways, since you won't have an instructor who will tell you.

Now if you simply want to do a website with all kinds of interactive things, well, that really means HTML, PHP, and databases (MySQL, or similar)... Learn perl if you want to do some even more complex website programs/pages. But the thing about perl is that once you learn a language like C or C++, or even PHP, you will already know a LOT about perl, because perl basically was designed by people who already knew those languages, and they simply kept the same lexicon/grammar from those languages and put them into perl, and in many cases made redundant things so that people familiar already with another language could do things the same way. For instance, you can do:

if ( $i == 1 ) then {
print "Value equals 1\n";
}

Or:
if $1 eq "1" then print "Value equals 1\n";

Or :
if ($i == 1) then
print "Value equals 1\n";

All of the above will do the same thing but they all have different grammar, some with ()'s, some without, some with new line after the then, some without, some with {}'s blocks, some without... See my point as to why perl will be difficult to learn as a starting language. But it is very easy to learn once you know another language, because more than likely you can code it the exact same way in perl as you did in many of the other languages (save object oriented, which is a whole different animal in perl).


As for PHP being top to bottom when read, well it is and it isn't, you can make your own functions, and call them, so the code would jump from the main execution block down to your function, and then back to the block that called the function to begin with. You can even have recursive functions in PHP...


Now I could tell you to be hardcore and simply go learn LISP, since with LISP you can program anything that is theoretically able to be programmed (since LISP is Lamda Calculus, and Lamda Calculus is the mathematical language which allows programming to occur in the first place). MIT for instance makes all their Computer Science students learn this language. I have used LISP a lot, and I will say it is amazing what you can do with it, but PAINFUL AS HELL to code and debug!!!! Talk about ()'s hell...

One of the great things about LISP is that LISP can re-write its own code on the fly! So you can actually have it learn things while running, like fine tuning different algorithms, learn different behavior, and develop better AI simply by having it interact with things (and having coded the underlying code base in such a way that it has a way to measure what is "better", and keep track of what worked and didn't work, and have different things that it can change so that it knows what portions of code it is allowed to change and how to change it).