Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Programming basics for absolute beginners..


  • Please log in to reply

#1
DeathOutdone

DeathOutdone

    Member

  • Member
  • PipPipPip
  • 241 posts
I am starting this topic in the hopes of learning a little terminology and the basics of programming (not in any specific language, but overall terms used in the science).

What are some good terms to know? For instance, what is a compiler? Does it take the code written in a language and turn it into assembly language? How does one program in assembly language (the language the computer reads) and how does it work? Can you program in binary or in hexidecimal? Can someone please explain all of these things to me and possibly refer me to any good sites you know of?
  • 0

Advertisements


#2
W-Unit

W-Unit

    Member

  • Member
  • PipPipPip
  • 170 posts

I am starting this topic in the hopes of learning a little terminology and the basics of programming (not in any specific language, but overall terms used in the science).

What are some good terms to know? For instance, what is a compiler? Does it take the code written in a language and turn it into assembly language? How does one program in assembly language (the language the computer reads) and how does it work? Can you program in binary or in hexidecimal? Can someone please explain all of these things to me and possibly refer me to any good sites you know of?

Some good terms to know...wow...a lot. Maybe it's best to just pick one up and learn the terms as you go, but I'll try to give you an overview. I could write a whole full-length tutorial on this.
A compiler is a program that takes a bunch of chunks of code together and executes them. *nix comes with compilers for a lot of languages including the C family, Perl, and a few others, but on Windows you will usually have to download a compiler. A compiler can also piece together chunks of code into a finished product. You could think of it as taking the code and turning it into assembly language.
Honestly, I have no idea how to program in assembly. I don't think anyone really does it anymore except when absolutely neccessary; it's so amazingly tedious and the speed gained from using it is minimal.
Er...I guess you COULD program in binary...although I don't know of anyone who knows how. Hexadecimal...not really.
Good sites on programming languages are not too hard to find, but I don't know of any site that will just give you programming definitions.

Honestly, I'd just start learning Perl or Ruby or some object-oriented language other than Java (because nobody likes Java). I started with a pseudo-programming language that doesn't even really have a name; it's the language used by scripts in mIRC (although you would be surprised how much you can do with it; I've made games and an FTP server in it), which was REALLY easy and enjoyable, so if you find any difficulty with those languages you might try that.

Anyway, for all languages there are some BASIC terms I can give you...
String (abbreviation str)- A piece of text, which you will almost always enclose in quotes, espeically if it contains a space. For many languages, double-quotes cause certain flags in the string (such as \n for newline) to be evaluated and single-quotes makes the text "as-such". Example:
"Hello\n World!"
Means to a program:
Hello
World

Integer (abbreviation int)- A number, in some cases one that does not contain a decimal point. Example:
5034
-9438
2^5

Boolean (abbreviation bool)- A true or false statement. Pretty self-explanatory...

Variable- A user-defined space for storing either a string, integer, or boolean phrase. In some languages, the type of variable (string, integer, or boolean) must be given when declaring it ("declaring" a variable means to bring it into existence), in others they can be used interchangeably. The value of the variable is almost always represented by text on the right side of an = sign in the declaring line. In some languages, there is a keyword to define variables, in others, if a line begins with a word followed by an = and a value, it is assumed to be declaring a variable. Common defining keywords are "my", "var", and "public/private". Usage of variables varies greatly between languages. In many languages they must be preceeded by a certain sign, often $ or %.
In a language where the variable type must be given:
bool Happy = true;
str Blah = "Hello World"
Creates a variable named Happy whose value is true, and a variable named Blah whose value is Hello World.

In a language where the variable type is assumed:
Happy = true;
Blah = "Hello World"
Does the same thing.

Conditional- A logical check, consists of a conditional name, 1 or 2 arguments, and an operator. Common conditionals are if, elseif, else, unless, while, for, and foreach. Usually the logical check will be contained inside () parentheses, and often the actions are contained in {} curly brackets. The examples could be used in many different programming languages. Many object-oriented languages allow backwards conditionals, demonstrated in the last example.
if ( x == y ) {					   #An IF conditional; performs the commands inside the {} if the condition within the () (in this case if the variable x is the same as the variable y) is true.

  print "X equals Y\n";
}
elseif ( !def x ) || ( !def y ) {		  #An ELSEIF conditional; acts like an IF conditional, but will only be evaluated to true if all of the IF and ELSEIF conditionals preceeded it evaluated to FALSE.  This one contains two conditions, and an OR (||) operator, so if either one is met, the statement will be true.

  die "Either X or Y is nonexistant!\n";
}
else {										   #An ELSE conditional; performs the commands inside the {} if all of the preceeding IF conditionals returned false (in this case if the variable x is not equal to y).

  print "X does not equal Y\n";
  while ( x <= y ) {					   #A WHILE conditional; will continue performing the commands within the {} until the statement in the () is made true.

	x = x+1;
  }
}

#The following is a backwards conditional.
print "X now equals Y\n"; if ( x == y )
Note that the example pieces of code will probably not work unless you do a lot of stuff to them, but they should give you an idea.

Er... that's about all I think will help much, hope it did you some good.
Good luck programming!

Edited by W-Unit, 21 November 2005 - 12:41 PM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP