New to programming, where to start?

rednal

Member
Dec 9, 2012
41
0
0
Hi, I have next to zero knowledge when it comes to programming and would like to start to get into it. I think it would be an awesome skill to learn and is limitless in possibilities. I would like to know where I should start to learn programming? Is there a specific website to try, YouTube videos, etc. Correct me if I'm wrong, but I believe the general consensus is to start with C++ for some reason. Thanks for any help/input you have!
Rednal
 

irishScott

Lifer
Oct 10, 2006
21,562
3
0
I'd say c++ is arguably the most useful language to learn (a TON of other languages use c++ style syntax and concepts that c++ pioneered, and the language itself is still one of the go-to languages for many applications). That said, it's also one of the most complex from a beginner's perspective, as it involves direct memory allocation/management and other highly technical/messy concepts, and some of its syntax is quite arcane.

I'd recommend starting with Python. It's a much more modern language, has automatic memory management, cleaner syntax (although with similar base concepts, if you can read python you can read most c++), and is overall much easier to learn and use. Don't mistake this for training wheels, Python is a widely used if still young language at this point and is backed by Google (in fact it was created by a Google employee).

Once you get the essential programming concepts down with python, you can move on to the messier topics of manual memory management and such.

I'd recommend finding a community college class to take as its very helpful to have an instructor, but if that's not an option this book seems to be held in high regard: http://www.amazon.com/Python-Program...on+programming

I've never read it, so take that recommendation with a grain of salt, but from all appearances it looks good.



And just to more clearly explain the differences between python and c++:

There are two distinct varieties of high-level programming languages (high-level meaning they have code that uses words you can actually read): Compiled languages and interpreted languages.

Compiled languages (like c/c++) start out as written code, then get run through a piece of software called the "compiler" that converts that code, all at once, into a binary file of ones and zeros that can be directly read by the computer. These languages usually offer the most powerful features from a hardware perspective, as you can literally manipulate individual ones and zeroes and tweak your program to technical perfection. They also run the fastest, as the binary file is fed directly into the hardware.

The downside is that a compiled program will ONLY work on the hardware it has been compiled for; and the power of its manual memory manipulation comes with the responsibility to use said power wisely. Memory errors are an everlasting bitch for someone who's not used to them; your algorithm can be logically perfect, but if you forgot to disallocate one byte of memory in its implementation, your whole program can spontaneously fail and you won't even know where to look right away. At least not until you've made enough such errors to get used to them. :p


Interpreted languages (like python, Java, Ruby) came about to address the problems of compiled languages. They utilize a piece of software known as an "interpreter", which translates code into ones/and zeroes on the fly, sometimes even line-by-line (as with python). The advantages are that such code is portable, it can run on any machine with the interpreter installed. Such interpreters also include automatic memory management, freeing the developer from chasing down near-invisible memory errors.

The downside is a loss of performance, as each line or chunk of code must be read, interpreted, and run in turn. In effect you're taking all the time a compiled language would spend compiling and inserting it into the running time of the actual program. Automatic memory management also requires intelligent algorithms of its own, which must be run concurrently with the program, further slowing performance.

This disadvantage (and correspondingly the performance advantage of compiled languages) has in many cases been mitigated by the sheer power of modern hardware. However there are still TONS of applications (such as satellites, mars rovers, cars, smart-phones, even fighter jets) where the hardware available is not the most powerful. Or there are more complex projects, where the sheer weight of computation requires the best performance out of the hardware. Here, compiled languages reign. In more general purpose applications where portability is a must (the cloud, data-centers, social networking, much of the internet in general) or where speed of development is more important than absolute performance, interpreted languages reign.



Anyways, hoped this helped, and I wish you many productive hours of banging your head against your monitor until you figure things out. (You'll be doing that a lot, but it'll be worth it.) :)
 
Last edited:

Cogman

Lifer
Sep 19, 2000
10,284
138
106
The best place to start, is to just start. You can use just about any language you like, C, C++, C#, Java, Python, Dart, Javascript, Whatever.

After you pick a language, the next thing to do is to make something, anything really. Start with the simple "Hello World" and work your way up from there. Make a program to say "Hello ?" where ? is something the user sticks in. Then try and do something like filter out and replace words. So if someone puts in "jim" replace it with "not jim" or something similar.

Then, try your hand at some number crunching. Calculate fibonacci numbers. All the primes up to 1000, and if you are daring, see if you can calculate the 100th digit of pi.

Then, maybe try some data structure and algorithm stuff. Make a Heap sort, quick sort, and merge sort. Make a Binary Tree, A B-Tree, a red black tree. A graph.

After that, try your hand at some more complex algorithms. Try finding the shortest path in a graph. See if you can detect cycles in a graph.

Or ignore all that and make a website that does something you like :).

The main thing is just to do something.


I first picked up programming by hacking a game called "Jedi Knight: dark forces 2". It had a simple scripting language that controlled a good portion of the game logic.
 

smackababy

Lifer
Oct 30, 2008
27,024
79
86
Can we get a sticky with a consolidation of starter information? A bunch of good information has been offered in these threads, but we get like one a week it seems.

I do agree with Cog's thoughts about just starting. I first learned got into programming because of a speedhack in Ultima Online (Gear). I was curious as to how it work and why it worked. Then I got into server emulation and the backend stuff for that and was hooked.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Can we get a sticky with a consolidation of starter information? A bunch of good information has been offered in these threads, but we get like one a week it seems.

I do agree with Cog's thoughts about just starting. I first learned got into programming because of a speedhack in Ultima Online (Gear). I was curious as to how it work and why it worked. Then I got into server emulation and the backend stuff for that and was hooked.

We absolutely can, if someone wants to write and post it :D.
 

Sheep221

Golden Member
Oct 28, 2012
1,843
27
81
It's important to learn one language and try to master it.
It's not really a good idea to learn basics of one language and than go to another.

I'm not a programmer myself, but if you wanna be a programmer you should decide what you want to program, what kind of projects you want to work on, it's good to have some ideas.

The posibilities of programming are virtually unlimited but you must choose a correct language for specific set of tasks you can create with it.

- PHP and HTML are exclusively used to program websites
- Java is widely used in mobile segment, car systems and various home appliances, phones, GPS navigations and music players have software programmed mostly in Java
- C++ is most universal you can create desktop programs in it as well as program firmwares for various electronics and machinery.
- C is predcessor of C++ abit simplier, less features but the idea and syntax is similar, most C editors are no longer used and even if you get any it will be probably only in DOS
- Pascal, similar to C was used at the time DOS was prevalent OS
- Python is used to create smaller desktop programs

The Python and Java, and probably HTML are easier to get into than C++ but I recommend to program in the one language for at least a year to build some programming skill before you can afford to change the language. The programming in principle is not very different but the syntaxes and some functions are different and if you would switch just like that it could turn out to be a mess for you.
 

Graze

Senior member
Nov 27, 2012
468
1
0
I would go with C# only because it forces OOP down your throat(kind of like Java...hmm)
I did C++ programming in college and wrote a few programs for fun over the years in it but I have never been paid for a C++ job in my life and probably don't see that happening either.
 

Jaydip

Diamond Member
Mar 29, 2010
3,691
21
81
C++ for systems programming(if thats the way you want to head) or Python( a good all around language)
 

Tweak155

Lifer
Sep 23, 2003
11,449
264
126
I will second C# but you can always start off with something much simpler. C++ helps you learn a lot of the nuances of programming and what to look for when you transition languages.

You may have heard once you know one language you know them all - this isn't necissarily true but toppling your first language breaks down all sorts of barriers for the next. And as you go from one to another, it just gets easier.

The only area I think this changes is when you change the type of programming you're doing such as going from desktop app to web or to database, etc. I'd probably pick what type of programs you'd like to see working and stick to that field somewhere early on.
 

smackababy

Lifer
Oct 30, 2008
27,024
79
86
C++ is probably the best language to learn. It is powerful enough to do anything you want and you can transition to another language if you'd rather do a different type of development with ease.
 

AyashiKaibutsu

Diamond Member
Jan 24, 2004
9,306
4
81
Assembly in my opinion. If you start at the ground level everything else is so simply : p That would be my choice if you want to do a lot of learning and are willing to dedicate yourself to it.

C# is really easy to learn/use; it's the best learning language in my opinion. It's good enough for a lot of applications and very good for learning. Syntax is very similar to java and c++.

C++ is really good at getting stuff done well. It's probably a lot easier to go from c++ to c# than the other way around so if you're willing to dedicate yourself to this first knowing it's harder and want to get started on some project that needs efficiecy quickly it's a good choice.
 

xalos

Senior member
May 31, 2002
292
0
76
The best place to start, is to just start. You can use just about any language you like, C, C++, C#, Java, Python, Dart, Javascript, Whatever.

After you pick a language, the next thing to do is to make something, anything really. Start with the simple "Hello World" and work your way up from there. Make a program to say "Hello ?" where ? is something the user sticks in. Then try and do something like filter out and replace words. So if someone puts in "jim" replace it with "not jim" or something similar.

Then, try your hand at some number crunching. Calculate fibonacci numbers. All the primes up to 1000, and if you are daring, see if you can calculate the 100th digit of pi.

Then, maybe try some data structure and algorithm stuff. Make a Heap sort, quick sort, and merge sort. Make a Binary Tree, A B-Tree, a red black tree. A graph.

After that, try your hand at some more complex algorithms. Try finding the shortest path in a graph. See if you can detect cycles in a graph.

Or ignore all that and make a website that does something you like :).

The main thing is just to do something.


I first picked up programming by hacking a game called "Jedi Knight: dark forces 2". It had a simple scripting language that controlled a good portion of the game logic.

This.

You'll be surprised how fast you can pick up additional languages after you learn your first one.

Edit: I think that I'd start with Python. It has lots of documentation, portable code, and
you can easily jump right into writing real programs with it.
 
Last edited:

JamesV

Platinum Member
Jul 9, 2011
2,002
2
76
Assembly in my opinion.

Ugh.

First proper programming book I bought was about programming video cards back in the early 90's, and it was assembly-heavy. Do yourself a favor, and not only don't start with assembly, stay away from it.

I've been out of programming for a while now, but I've always recommended starting with a scripting langue like JavaScript. They are easy to learn, and will teach the basics of programming that are used in all languages like variables and conditional statements.

Once you learn the basics, you can easily work with other languages, only needing the syntax changes, and not any logic changes. If I'm writing a program that needs to check if the current account is a savings, the pseudo code 'if AccountType = "Savings" return true', could be turned into a line of code in any language.
 

irishScott

Lifer
Oct 10, 2006
21,562
3
0
Ugh.

First proper programming book I bought was about programming video cards back in the early 90's, and it was assembly-heavy. Do yourself a favor, and not only don't start with assembly, stay away from it.

I've been out of programming for a while now, but I've always recommended starting with a scripting langue like JavaScript. They are easy to learn, and will teach the basics of programming that are used in all languages like variables and conditional statements.

Once you learn the basics, you can easily work with other languages, only needing the syntax changes, and not any logic changes. If I'm writing a program that needs to check if the current account is a savings, the pseudo code 'if AccountType = "Savings" return true', could be turned into a line of code in any language.

I wouldn't recommend starting with assembly, but being a Computer Engineering major it was part of our junior/senior curriculum. Given prior programming knowledge, it actually wasn't that bad. More rote memorization of commands than anything else. You get to see how a logically simple statement like a basic for-loop is actually implemented, and a lot of the "good programming practices" my previous instructors forced me to take at face value finally became clear in detail.

Granted I wouldn't recommend learning assembly with the intent of programming things in assembly, but it's good to know all the same. It's like how materials-science is to engineering. A lot of people can build a functional brick house, but the one who knows the details about how the bricks and mortar are made can make the best brick house.
 

OneOfTheseDays

Diamond Member
Jan 15, 2000
7,052
0
0
I disagree with some of the comments here. I would not recommend starting with a language like C++ for a beginner. It's a bit too nuanced and complex for a beginner to easily grasp the fundamentals.

I highly recommend starting with Java/C# and also C. Java/C# will do an excellent job indoctrinating you on basic OO design and principles in a way that feels very accessible to beginners and C will give you a strong understanding of the lower level aspects of programming (memory management, layout, etc.). You will need BOTH to become a complete developer.

Once you feel comfortable with both, THEN go attack C++. You will be in a much better position to understand its nuances and intricacies.
 

steelodon

Senior member
Oct 29, 2007
582
12
81
I disagree with some of the comments here. I would not recommend starting with a language like C++ for a beginner. It's a bit too nuanced and complex for a beginner to easily grasp the fundamentals.

I highly recommend starting with Java/C# and also C. Java/C# will do an excellent job indoctrinating you on basic OO design and principles in a way that feels very accessible to beginners and C will give you a strong understanding of the lower level aspects of programming (memory management, layout, etc.). You will need BOTH to become a complete developer.

Once you feel comfortable with both, THEN go attack C++. You will be in a much better position to understand its nuances and intricacies.

Good starting points.
 

Jaydip

Diamond Member
Mar 29, 2010
3,691
21
81
I disagree with some of the comments here. I would not recommend starting with a language like C++ for a beginner. It's a bit too nuanced and complex for a beginner to easily grasp the fundamentals.

I highly recommend starting with Java/C# and also C. Java/C# will do an excellent job indoctrinating you on basic OO design and principles in a way that feels very accessible to beginners and C will give you a strong understanding of the lower level aspects of programming (memory management, layout, etc.). You will need BOTH to become a complete developer.

Once you feel comfortable with both, THEN go attack C++. You will be in a much better position to understand its nuances and intricacies.

I beg to refuse.I started with C/C++ and I believe it was the best thing to do.The memory management system in Java is atrocious.Also people seem to forget that "STL" has taken C++ to a new level completely.
 

KentState

Diamond Member
Oct 19, 2001
8,397
393
126
Assembly in my opinion. If you start at the ground level everything else is so simply : p That would be my choice if you want to do a lot of learning and are willing to dedicate yourself to it.

C# is really easy to learn/use; it's the best learning language in my opinion. It's good enough for a lot of applications and very good for learning. Syntax is very similar to java and c++.

C++ is really good at getting stuff done well. It's probably a lot easier to go from c++ to c# than the other way around so if you're willing to dedicate yourself to this first knowing it's harder and want to get started on some project that needs efficiecy quickly it's a good choice.

We actually had to start with VB 3.0 to weed out the MIS people from Computer Science in college, then it jumped straight to assembly. At the time, assembly wasn't terribly bad as the x86 instruction set was straight forward while the books mentioned future instructions like MMX.
 

xalos

Senior member
May 31, 2002
292
0
76
I beg to refuse.I started with C/C++ and I believe it was the best thing to do.The memory management system in Java is atrocious.Also people seem to forget that "STL" has taken C++ to a new level completely.

I've never encountered any problems with Java's memory management. If you work with the minimum scope possible the GC works great. But, the OP would be able to learn a new language by the time he starts to encounter memory management issues...lol
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
I beg to refuse.I started with C/C++ and I believe it was the best thing to do.The memory management system in Java is atrocious.Also people seem to forget that "STL" has taken C++ to a new level completely.

Java has one of the best GCs in the business (Ok, Since there are multiple JVMs, I should say Oracle and the OpenJDK which I believe use the same GC algorithms). Pretty much every other GC is trying to copy what Java does (Love or hate Java, the JVM is really a pretty impressive piece of tech).

Honestly, The only languages that might do GC better are the functional languages, but that is more because they have vastly simple data models (Immutability makes things so much easier to deal with).

Depending on the use case, a GC language can often best a managed language in terms of memory allocation and freeing speed. In C and C++, if you are doing a ton of heap allocations, you end up needing something like a memory pool to keep from bogging down the program.

Where GC languages often suffer is memory consumption. However, we are in the day and age where phones have 2gb of ram often used for single applications... I think we can survive if my java app consumes 64mb of memory (even though the C++ version would get away with 1mb).

Sure, if you want to target an embedded system with 2mb of ram, then you are stuck learning C or C++. But we aren't talking about learning embedded programming, we are talking about just learning programming.

But, like I said, debating over "which language is best for beginners" is pointless to me. The programming language is pretty minor when it comes to learning how to program. Someone could start by learning COBOL and still end up being a decent programmer.
 

OneOfTheseDays

Diamond Member
Jan 15, 2000
7,052
0
0
I beg to refuse.I started with C/C++ and I believe it was the best thing to do.The memory management system in Java is atrocious.Also people seem to forget that "STL" has taken C++ to a new level completely.

What exactly in the "STL" makes C++ superior to any modern programming language? Java/C# both have far better native data structure support and are much easier to work with when dealing with higher level programming concepts.

If anything, each new iteration of the C++ standard is bringing C++ closer to Java/C#, not the other way around.
 

Jaydip

Diamond Member
Mar 29, 2010
3,691
21
81
What exactly in the "STL" makes C++ superior to any modern programming language? Java/C# both have far better native data structure support and are much easier to work with when dealing with higher level programming concepts.

If anything, each new iteration of the C++ standard is bringing C++ closer to Java/C#, not the other way around.

Performance of "STL" is very good.No high level and widespread programming language till day can't challenge C++ in runtime performance.
 

exdeath

Lifer
Jan 29, 2004
13,679
10
81
Assembly language.

Learn how a computer actually works first, then you'll intrinsically understand any language including new ones you've never seen before. Because in the end, they are all the same, carrying out the same operations on a super fast self running electronic abacus.

I know that's a little backwards and extreme, but I find leaning the most raw fundamentals of how something works first gives you the building blocks to easily learn anything built from those blocks pretty effortlessly.

Besides I'm personally tired of all the CS grads these days that dont know anything about basic programming fundamentals because they skated through university on training wheels aka Java. Do they not require even a single machine architecture and organization course anymore?
 
Last edited:

Tweak155

Lifer
Sep 23, 2003
11,449
264
126
Assembly language.

Learn how a computer actually works first, then you'll intrinsically understand any language including new ones you've never seen before. Because in the end, they are all the same, carrying out the same operations on a super fast self running electronic abacus.

I know that's a little backwards and extreme, but I find leaning the most raw fundamentals of how something works first gives you the building blocks to easily learn anything built from those blocks pretty effortlessly.

Besides I'm personally tired of all the CS grads these days that dont know anything about basic programming fundamentals because they skated through university on training wheels aka Java. Do they not require even a single machine architecture and organization course anymore?

I had to take Assembly before I graduated. I actually started to like it before the class ended.