An Introduction to Programming, For beginners

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
thenicelordj
Lord of BJs
Posts: 2
Joined: Sat Nov 08, 2008 7:55 pm

An Introduction to Programming, For beginners

Post by thenicelordj »

I believe it's time for you people to learn something quite intresting.. Programming..

Introduction

There are two main types of "real" hacker in the true non-sensationalised sense: 1) Those who strive to write the leanest, most efficient code possible, coming up with new, more in genius ways of doing things and, 2) those who try to find exploits in other people's code, usually for privilege escalation. To be very good at either one you need to be able to think like the other (for example to write secure code you need to know how others will try to exploit it, and for exploits you generally have to write your own lean efficient code), but before you can even begin to think about trying either you need to build up sound programming skills ..which you're going to start learning right now.

Programming is basically just giving your computer a set of instructions that you want it to carry out, for example, you may want to tell your computer to add two and three together, multiply the answer by 15 and print the total to the screen. However, your computer doesn't understand English, it understands very little, in fact the only thing it does understand is machine language (machine language, or binary, is just a long series of zero's and one's). As you may think, it would be very hard to write anything meaningful in this way, where a misplaced one or zero would totally throw the program off.


Assembly

To counter this problem, people came up with the assembly language. It is just a human readable form of machine language, where the binary patterns of machine code are mapped directly to symbols called mnemonics (mnemonics is a system that makes it easier to remember things). However assembly programming is still far from intuitive and very dependent on processor's architecture (eg something written for the Intel x86 processor won't work on the Sun SPARC processor). This creates large problems as if you write something for an Intel x86 processor you will have to completely rewrite it if you then want it to work on a SPARC processor. Everyone learns in different ways, some people like to learn from the top down, having a large view of things not getting caught up in the nitty gritty. Others like the bottom up approach, getting in straight away with the nitty gritty and seeing how everything works on a very low level. If you fit into the latter catagory, assembly may be the language for you. Programming from the ground up is an excellent introductory text on assembly programming on a linux platform.


High level programming languages


To counter the problem of different processor architectures, people came up with high level programming languages. Assembly is known as a low level programming language as it is very close to the processor and highly dependent on the processor. High level programming languages on the other hand aren't processor dependent and are far more intuitive (its almost readable as normal English, just with some very strict rules so the computer will understand it). Once the program is written in a certain language it is then turned into machine code by being put through a compiler(a compiler is basically a program that turns source code into machine code so the computer can understand it). The problem where assembly was dependent on the processor is overcome by the ability to put the same high level language source code through many different compilers to suit the processor architecture required.

There are many different high level programming languages and there is no "best" one, they each were made to do certain things and anyone who says that a particular language is no good, you will generally find that it is that the person who is no good rather than the language. They either just don't know how to program at all, or are trying to use the language for something it wasn't intended for. Which language you should pick to learn depends on you and what your goals are. They all do the same basic things and its only when you get into more advanced practices that choice of language matters.

C: C was developed by Dennis Richie for AT&T in the 70's. It was developed as Richie wanted to rewrite Unix in a language that wasn't processor dependent and when he tried to do it in B he didn't succeed. As Unix became more and more popular, C grew in popularity along with it, as everyone who programmed on Unix, programmed in C. C is synonymous with programming operating systems and if you have dreams of writing your own OS or modifying your Linux kernel, C is the language for you. A lot of exploits are written in C as well.

C++: C++ originated from C and is similar to C with added functionality for object orientated programming (OOP). C++ was developed my Bjarne Stroustrup for AT&T in the 80's. C++'s use of OOP programming mean that if game programming is what you're trying to get into C++ is the language for you. The same compiler will usually work for both C and C++ so you can download the dev-c++ IDE (integrated developer environment) which includes a C/C++ compiler here.

It must be said that not all high level languages are compiled. There is also such a thing as an interpreted language. An interpreter is a program that executes either source code or byte code (byte code is intermediate code, not readable English but not machine code either). The interpreter takes each instruction from the source code or byte code, converts it to machine code and executes it immediately (as opposed to a compiled language where all instructions are converted to machine code before anything is executed). Interpreted languages are very portable, in that they can be run on any computer that has an interpreter on it, however they are typically slower than compiled languages as it takes time to convert into machine code (note: time = nanoseconds).

Java: Java was developed by Sun in the 90's and is an example of an interpreted language. Its motto is "write once, run anywhere", which was quickly changed to "write once, debug everywhere". Java is slightly easier than C/C++ as it handles all memory operations its self rather than leaving it to the programmer. This results in a loss of control that you would have in C/C++ but this kind of control wasn't what java was designed for. If you're interested in making dynamic website content then java is the language for you. Java is also the best example of an OOP language and thus is nearly always used as the first language for university courses. If you are considering doing a CA/CS (computer applications or computer science) degree, you should think about learning java as it will help you greatly when you start uni. You can download all the necessary software for java here. (you want the SDK part)

Visual Basic: Developed by Microsoft VB can only be run on windows which turns a lot of people off it, however, it does have advantages. VB is very simple, some say too simple leading to poor programming practices (and they have a point), however if you want to make something quick and easy, or if you want to make a GUI (graphical user interface) VB is one of the best languages for the job. Also if you want to link between other Microsoft products like excel, access and word VB makes this very easy. Learning VB means you also know VBA which is used in Microsoft's other products which means, for example, you can create very powerful excel documents easy. These are some of the main reasons that VB is used in many offices around the world, so if you're not doing a CS/CA degree but will use programming in the office you may be forced to use VB in the future, so learning it now would look very good on your CV. However VB isn't free, so if you want it you either have to pay for it.


Some advice:

1) There is no need at all to know how to program in 14 different languages. You should aim to learn one language really well(and its impossible to learn more than one language at the same time when you're beginning). When you know one language properly it is much easier to learn another one if you need to. If you're looking to take up programming professionally, the money is pretty good, but you should know that you probably won't have choice of language, you'll be part of a team and you'll have to program in the same language as everyone else, so its pointless learning a lot of languages that you may never need.

2) Programming is pretty easy, the hardest part isn't learning how to code, its learning how to think. There is no point in learning off anything when you're programming (algorithms or function names), the more you program you'll just pick those up naturally. The best way to learn how to think is to practice, write as many programs as you can, they don't have to do anything good, they just have to work and be in good style. You shouldn't aim or expect to be able do something spectacular when you're starting out, but to make many programs that do very simple things so you've have great knowledge of the basics - which is essential.


3) Online tutorials I've found to be very poor for people who have no programming experience, if you can find a programming class with a good teacher go to it, especially a university one if you can. If you can't find a good class - buy a book. Learning from a book is so much easier than trying to understand online tutorials that may be wrong, or are written in poor style, you've more chance of a book being correct. For java I recommend "Computing concepts with java 2 essentials" by Cay Horstman, for C I recommend "The C programming language" by Brian W. Kernighan and Dennis M. Ritchie and for C++ I recommend "The C++ Primer" by Stanley B. Lippman (don't be put off by the awful cover). I couldn't not mention "The C++ programming language" by Bjarne Stroustrup too, this is not a beginners book but if you're looking to master C++ and already know how to program it, read this book. You should be able to get all of those on amazon if you can't find them in your local bookstore.

4) Finally remember, its supposed to be fun! It'll get frustrating at times when you're looking at compiler errors and have no idea what they mean, but I suggest that you don't ask for help too soon. By all means, there is nothing wrong with asking for help, but you should try your best to fix your coding problems yourself before asking someone else, you'll learn at lot more. When you get frustrated just go do something else for a few hours, chances are the answer will pop into your head when you're away not thinking about it. We've all been there, we've all gone through the same things. So just pick a language based on what I've said above, download the compiler, find a course/buy a book and start learning.



General resources: (sites that cover all languages rather than specialize)

http://programmingtutorials.com/
http://sourceforge.net/
http://protools.cjb.net/ - Excellent tools site
http://stommel.tamu.edu/%7Ebaum/programming.html Over 3000 links
http://search.microsoft.com/us/dev/default.asp
http://www.programmersheaven.com/
http://freshmeat.net/
http://www.hotscripts.com/
http://www.scriptsearch.com/
http://tutorialized.com/
http://www.freeprogrammingresources.com/


C resources:

http://ctour.tonymantoan.net - A very good C tutorial, where I started C.
http://www.ecst.csuchico.edu/~beej/g...tml/intro.html - Winsock C tutorial, a very great site.
http://cprogramming.com/
http://www.cs.buffalo.edu/%7Emilun/u...ogramming.html Unix programming
http://www.erlenstar.demon.co.uk/unix/faq_toc.html Unix programming FAQ
http://www.manualy.sk/sock-faq/unix-socket-faq.htmlUnix socket programming
http://www.le.ac.uk/cc/tutorials/c/ Total beginners C course
http://www.its.strath.ac.uk/courses/c/ Entire university C course
http://www.eskimo.com/~scs/cclass/notes/top.html Another entire C course
http://www.cs.cf.ac.uk/Dave/C/ One of the best C courses out there
http://vasyaa.tripod.com/ Many C/C++ links
http://www.chris-lott.org/resources/cstyle/ C style guides (you must keep good style when programming)
http://www.cplusplus.com/doc/tutorial/index.html Basic C++ course


Java resources:

http://java.sun.com/ The home of java, best java reference guide
http://mindprod.com/jgloss/jgloss.html Java course
http://www.mindview.net/Books/TIJ/ Thinking in Java e-book


VB resources:

http://www.geog.leeds.ac.uk/people/m...080/lt0-ix.htm Uni intro to VB
http://www.vb-helper.com/howtobeg.htm Beginners VB site


ASM resources:

http://www.xs4all.nl/~smit/asm01001.htm Introduction to assembly
http://burks.brighton.ac.uk/burks/la...smtut/asm1.htm Another beginner guide to assembly
http://webster.cs.ucr.edu/AoA/DOS/ Free e-book "Art of Assembly"


Secure Programming & Exploitation:

http://www.l0t3k.org/security/docs/programming/ Brillient site, has everything
http://community.core-sdi.com/~juliano/ Lot of overflow article
http://www.dwheeler.com/secure-programs/ Writing Secure Code
http://www.secureprogramming.com/ Writing Secure Code again
http://nob.cs.ucdavis.edu/~bishop/secprog/index.html Writing Safe suid programs
http://community.core-sdi.com/~gera/...reProgramming/ Programs for you to exploit.
http://archive.ncsa.uiuc.edu/General...y/programming/ NCSA secure programmnig guidelines
http://www.linux-secure.com/endymion...des/index.html Quite large shell code archive
== Salzazar
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: An Introduction to Programming, For beginners

Post by Falco Girgis »

... :shock:

Stickied.

edit: Even though it's more than obvious that (as with everything you do), you plagiarized from http://www.criticalsecurity.net/wiki/in ... _Languages, I will still allow this, because I am posting the source for you, and it is a good article.
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: An Introduction to Programming, For beginners

Post by Arce »

Stolen articles eh?

Atleast it's useful. Has some good points.

My questions: Why'd you cut off the stuff about PHP, and ADA? Was it the inability to correctly rip content, or did you simply feel it to be not relevant/useful?
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
Levio91
Chaos Rift Regular
Chaos Rift Regular
Posts: 119
Joined: Thu Nov 06, 2008 9:50 pm

Re: An Introduction to Programming, For beginners

Post by Levio91 »

Oooh text havent read yet but i will!
"Criticism is something you can avoid easily by saying nothing, doing nothing, and being nothing. " - Aristotle

http://www.facebook.com/profile.php?id= ... ef=profile
Image
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: An Introduction to Programming, For beginners

Post by Arce »

ThenicelordBJ, you're fucking retarded. You copy this wikipedia article here in an attempt to prove to us that you're actually knowledgeable?

I call your bluff, good sir.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: An Introduction to Programming, For beginners

Post by dandymcgee »

Lol, wow. I thought this was going to be a random spam post, then I opened it. :shock: I wonder if this is really TheNiceLordJ? Either way the ripped content is certainly quite useful.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: An Introduction to Programming, For beginners

Post by Falco Girgis »

It's definitely him. Look at the email address.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: An Introduction to Programming, For beginners

Post by dandymcgee »

It's not public and I'm not admin :P
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
marmalade
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 10
Joined: Fri Jul 11, 2008 3:41 am
Contact:

Re: An Introduction to Programming, For beginners

Post by marmalade »

Image
User avatar
thenicelordj
Lord of BJs
Posts: 2
Joined: Sat Nov 08, 2008 7:55 pm

Re: An Introduction to Programming, For beginners

Post by thenicelordj »

Arce wrote:ThenicelordBJ, you're fucking retarded. You copy this wikipedia article here in an attempt to prove to us that you're actually knowledgeable?
I call your bluff, good sir.
Wikipedia article? Uhm, fail. It was originally posted on mpc forums by salzazar(me) dt0x from critical security stole it and published it on the forums.
== Salzazar
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: An Introduction to Programming, For beginners

Post by M_D_K »

Funny cause there isn't a user by the name Salzazar on mpc forums...so you fail!
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: An Introduction to Programming, For beginners

Post by avansc »

M_D_K wrote:Funny cause there isn't a user by the name Salzazar on mpc forums...so you fail!
well he might have another username. but yeah i dont think he is the original author. and thats fine, its just not cool when you try and sell it as your own.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: An Introduction to Programming, For beginners

Post by M_D_K »

avansc wrote:
M_D_K wrote:Funny cause there isn't a user by the name Salzazar on mpc forums...so you fail!
well he might have another username. but yeah i dont think he is the original author. and thats fine, its just not cool when you try and sell it as your own.
Totally agree about the weaselly attitude of stealing others work.

But I just find that amusing is that he thinks he is 1337( :lol: ) and yet failed. Seriously BJ does failing come as easy to you as breathing for the rest of us :)
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Re: An Introduction to Programming, For beginners

Post by Arce »

M_D_K wrote:Funny cause there isn't a user by the name Salzazar on mpc forums...so you fail!
Yes, there is. I took the liberty of looking it up in the "NiceLordBJ" movie...The account is highly popular, and admin, etc.

Except it's not thenicelordj. I PMed it and never get a witty "omg I'm the nicelord j how I said response." Plus, there was also a NiceLordJ account on the same forums with NEGATIVE ONE REPUTATION!?!?!

Oh, and the fact that the wikipedia article is IDENTICAL and has citations contributed by over 13 different members at different times kinda negates his "it was originally on my site" thing.

Fucktard.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
Andy K.
Chaos Rift Junior
Chaos Rift Junior
Posts: 262
Joined: Sat Nov 29, 2008 6:15 pm
Location: Winchester, VA

Re: An Introduction to Programming, For beginners

Post by Andy K. »

Arce wrote:
M_D_K wrote:Funny cause there isn't a user by the name Salzazar on mpc forums...so you fail!
Yes, there is. I took the liberty of looking it up in the "NiceLordBJ" movie...The account is highly popular, and admin, etc.

Except it's not thenicelordj. I PMed it and never get a witty "omg I'm the nicelord j how I said response." Plus, there was also a NiceLordJ account on the same forums with NEGATIVE ONE REPUTATION!?!?!

Oh, and the fact that the wikipedia article is IDENTICAL and has citations contributed by over 13 different members at different times kinda negates his "it was originally on my site" thing.

Fucktard.
If I could I would edit your post to include this at the bottom...

Image

Nicely, done! Don't take no guff from NiceLordBJ! :lol:
Post Reply