I'm only now, after nearly 21 years of life, getting interested into computers in a way that goes beyond novel tricks and applications. I mean, I want to start learning to program, to actually be able to work with computers in a way below the 7th tier. Beyond my GUI tricks and mild CLI uses.
That being said, I have no idea where to begin. I have no idea where to begin though. I don't really like the idea of learning basic coding commands, syntax etc. on a language I won't even use after a while, or even enjoy.
As I understand this is a relatively heated issue, but I was hoping that maybe I could get a singular good answer.
I want to begin with a language that's intuitive, easy to use, but simultaneously very rich and capable. By intuitive I mean not so many obscure rules and functions that don't even make sense, and seem like they were fit in after the code was finished.
So... What am I gonna do?
Posts
To put your fears to rest, most programming languages I've learned used the same basic concepts, commands and logic, and only had minor differences on how you write the commands. So once you get the hang of one language, you should be able to easily move to another one. Knowing C++, I had no problem doing Java, Python, Matlab and JavaScripts, to name only a few off the top of my head.
You could try HTML and Javascripting to start with, since javascript has a lot of the syntax of C++ and Java and is simpler, but if you really wanted to learn programming instead of scripting, start with Java. It forces you to learn the concepts of Object Oriented programming and will get you used to syntax and conventions without getting bitchslapped by C++'s pointers and references.
EDIT: Best thing to do is buy a book to get started. Something like Sams 'Teach Yourself X in 21 days' (Replace X with language of choice). You don't necessarily have to do the entire book, but the first few chapters will get you through the basics of programming. Then use websites like www.cprogramming.com for C++ and Sun's Java forums for Java once you start working on concepts you come up with yourself.
Don't be afraid to try stuff - but at the beginning, don't get too ambitious. You NEED a structured base of knowledge to build off of, so some kind of structured lesson is a good idea (Like the books I recommended).
I like C# over Java because of the syntax and the superior performance. C# is also tightly integrated with the very excellent Visual Studio, which makes it drop dead simple to construct nice-looking GUI apps. Though if you need to do cross-platform stuff, Java is the way to go.
(edit) BUT WHATEVER YOU DO, DO NOT USE VB, EVER.
AND you have to PAY for Visual Studio. (I was gonna mention the whole, and you're completely locked into using a Microsoft platform if you do C# or .net in general, but you kinda said that). Java is completely free with a community developed IDE (Eclipse) that is also fantastic.
If you want to learn programming without spending hundreds of dollars, the any MS solution is not for you. Which is to say, learning how to program shouldn't cost you hundreds of dollars.
EDIT: Also, superior performance? How so? Java approaches C++ in terms of performance.
Did you even LOOK at reality before posting a comment that seems more at home on /. than here? There are free versions of VS specifically geared towards hobbyist/new developers. and there's also Mono if you really want to avoid MS.
Anyways, I would not recommend C++ for a starting programmer, if only because it's too easy to get into bad habits in it.
It is, and you won't find a singular answer. Almost every single person that has gotten to somewhere in programming, even if that somewhere is writing 11 lines of code maintains that the way (s)he learned is the one to follow.
The educational language per excellence is C as it teaches pretty much the most basic form of programming - imperative. Many would argue that it's outdated and they'll certainly have a point. I'd still say that the best you can do is get a beginners C book that would start you not only in programming languages but into programming practices, and then jump with another book into a more modern language. People here have said C# & Java(I'm a huge C++ fan but there is really no reason to go with it). I'd say Python is what you want. It's a very clear no nonsense syntax(although that's personal opinion) and it has most of the modern features used in programming nowadays. Add a very nice GUI toolkit and you have a language that is perfect for a casual programmer as it could simply be all he ever needs to learn.
Edit:
Linky link: http://en.wikipedia.org/wiki/Python_%28programming_language%29
Also, I believe that there are several free online resources that serve as an excellent introduction to Python, but they all assume some past programming experience.....
Edit2: Also, that thread screams of H&A....
This sort of question pops up in H&A rather often, and usually degenerates into a debate.
As far as first languages go, there isn't a right choice, but lots of good ones. VB is a language that is very likely to lead to bad habits. I really prefer Java to C++, but it is only a preference. So long as you learn things like variables, data structures, loops, expressions, methods/functions and parameters, et cetera you'll know how to program. After you pick up your first language, the rest won't be too difficult.
Also, there are a lot of first year computer science course notes online. You should take a look at those too.
Oh, if you're a masochist, I'd recommend Perl ;-)
If you ever need to talk to someone, feel free to message me. Yes, that includes you.
Lies. Python is far superior to both of those for OO goodness.
Personally, I'd recommend either C# or Java for getting started. Both languages are fairly high level with objects, classes, garbage collection, etc.
I haven't worked in much for the past year or so, but Eclipse is an incredible IDE for working with Java programs. I used it for a university class where we got to write a compiler, and it was great to have the IDE constantly suggesting fixes for my code (surrounding code blocks with try/catch when some of the code throws exceptions, extracting code blocks and turning them into methods, etc.). Also, it comes with unit testing built-in, which comes in handy on larger projects.
Currently, I'm mostly working with C# using Visual Studio, and it works very well. Sometimes there are a few quirks here and there, but it's a very powerful tool. I have the Express version installed at home for C# development, but I haven't used it much so far. It should give you all the capabilities of the full version that you'll need though.
With Visual Studio and C#, I'd recommend making a simple Console Application project to start with. This will give you a simple class and a Main method that will generate a program that can be run from the command line. From there you can learn the basics of working with variables, arithmetic, looping, etc.
I'd recommend staying away from C initially. It's definitely an important language to study if you're going to advance very far in programming, but there are some concepts in there that you won't need quite yet. C works much closer to the hardware itself, which gives you a lot of power, but it's very easy to shoot yourself in the foot. Java and C# take care of a lot of the basics for you until you're ready to move on to more advanced topics.
Also, Python is a lot of fun, but I'm not sure how well it would work for a starting language. It has a lot of nice elements that make things very easy to quickly develop programs, but I'm not entirely sure how the language's dynamic typing would impact someone just starting out as they move onto to other languages.
Mainly, you'll want to find a good book or set of tutorials on a language that you're interested in and follow all the examples. I liked the Teach Yourself [Java / C++ / etc.] In 21 Days books myself, but there are plenty of others out there.
Learn the most basic stuff (memory, data types, maybe a bit of history), then find a language and get a hang on its syntax, then start memorizing its libraries (STL for C++, .NET for C#, etc).
Most of the basics are the same. They all have the same concepts (do .. while loops, for loops, switches, and so on) with few exceptions - they're just interfaces to a library. You're probably going to end up learning more than one in the long run.
You can grab free editions of VS programs here (and you can use these to develop commercial stuff):
http://msdn2.microsoft.com/en-us/express/default.aspx
A lot of people will say to stay away from VB, but most of the differences between C# and VB.NET relate to legacy stuff from VB6.
I'm good with the fundamentals of programming in object-oriented languages and stuff, since I've played around with other languages a lot; now I just want to settle down and learn C# inside and out.
Eventually you should learn those, yes. But I hardly think that C/C++ are the absolute best to learn out of the gate if you want to learn to develop software. If you're doing more of a general self-education in computer science, that's a different matter; C++ is great for that.
It would help in readability and facility to program and probably make them realize that they've actually started in the language they want to stay with.
As I said, I believe that Python should be the 2nd language to stick with, and not the first, but Java and c# are both way way worse as a first language than the snake.
I'm also a firm believer that knowing about memory management is important for your programming practices but at the same time often people make assumptions about the way a VM manages memory or code by their C or C++ experience which can not only be wrong but harmful.
Not everyone needs to learn a low level language to grasp those concepts, and not everyone needs to manage memory manually. For the vast majority of programming tasks, there's absolutely no need for lower level resource management.
Is that even necessary to learn, though? The ONLY time I've used what I learned in C++ in terms of memory management is when I was messing around with game design in C++. In my professional career I've yet to use C++ in any meaningful way.
Which is not to say that you wouldn't or that it's not important, but it's a bit arrogant for you to say that C/C++ is the only way to REALLY learn. My course at a tech college didn't teach C++ at all, it taught exclusively in Java and it was THE course geared for programming. They didn't switch to Java spontaneously, but because the people who hire their students said they'd much rather graduates know Java than C++.
As far as the free version of VS goes, that's great. I didn't know that. When I was looking into development on a MS platform, the cheapest way I could find to do it legally was $250.00 for Visual C++. There was no free implementation of .net back then.
EDIT: Out of curiosity, why is the idea that programming shouldn't be limited by a person's finances something that belongs solely on /.?
Which doesn't mean that you shouldn't know how the memory is managed by the machine you're programming for. I have a very special word for Java programmers that have never read the manual of their virtual machine of choice. The impact it can make on the code you write is sometimes bigger than the choice of algorithm.
"Not everyone needs to learn a low level language to grasp those concepts" != "You do not need to grasp the concepts".
What is the difference between my bold and what you're saying?
Definitions I guess. What are you calling low-level memory management?
When I say it I mean manually freeing and allocating memory, not knowing why it's a bad idea to convert a string from input to an int with every iteration, or why computers process numbers faster than strings.
If the OP wants a simple language to start off learning correct programming concepts, I'd say Python is the most obvious place to start.
(note that I have Bachelor's degree in Computer Science. Many of the people here are probably more qualified than I am at suggesting languages for you, but at least I have a valid base from which I can make suggestions to you.)
1- You never said what you wanted to accomplish. "I want to learn to program a computer" is not a valid goal in itself. Do you want to program games? Websites? Tools for whatever personal projects you may be working on? Something else? Your real goal would help us pointing you towards a good language.
2- I would avoid C++ as your first language, since you mention that you're 21 and have no real programming experience already. C++ is a good language for "serious" programming, as in, most of the big applications and games you use these days were programmed in C++. For someone like you who seems to want to learn more as a hobby, you're going to find it way too difficult, especially when there are other languages you can learn that will let you do most of what you probably want to do, much easier, and with less pain.
3- Java is a good idea, but for certain types of things it's still a little hard for someone who's starting out. At least, its tools do more hand-holding than C++, and performance should not be a factor unless you're aiming for something that needs to crunch loads of data extremely fast (or if you're looking to program professional-looking games, which you shouldn't if you're only starting out.)
4- I'd recommend you stay away from any forms of Basic, including Visual Basic. Basic in all its forms tends to cause programmers to develop major bad habits that are hard to get rid of, later on. VB is only good if you know you're never going to progress to anything better. It was developed as a language and environment so that non-programmers could quickly build applications, but any serious programmers will tell you to stay away.
5- C#: proprietary Microsoft language. If you're looking to create games for Windows and XBox360 Live Arcade, this could be an interesting path, as the tools are free to download (as long as you're running Windows) and the language is closer to Java than to C++, so it's less of a pain. A good alternative to VB, but at the same time, probably not a good choice for a "my first computer language" type of thing.
6- PHP (along with HTML, and maybe mySQL): PHP is my favorite language to program in, so I'm kind of biased. It's ridiculously easy to start making things, as all you really need is to install one of the free web server packages that contain Apache, mySQL and PHP in one swoop (I like Uniform Server, look for it on sourceforge.net) and figure out where to drop your .php files. There's no compiling, and you get all your results in your web browser. There are tons of available functions you can use as part PHP, and they're all pretty well documented on www.php.net. Although you're not going to be making games on the level of what's being sold for PC an consoles, you can make certain types of browser-based games if you work at it. Also, the error messages in PHP tend to be really helpful in pointing out precisely where the error is and what it is. Just remember that the point of PHP is to be the basis for websites, so it's kind of specialized.
Anyway, I hope the discussion you've triggered is not going to turn you off of learning to program.
Check out my new blog: http://50wordstories.ca
Also check out my old game design blog: http://stealmygamedesigns.blogspot.com
Mainly my concern is that there might be some trouble with beginning programmers catching type conflicts. Python is still great in this regard since it's still using strong typing and will notify you if any conflicts occur, but it seems like forcing someone to explicitly write out what the type of each of their variables are and having the compiler notify them at compile time might help a bit more.
Python definitely has cleaner looking code when compared to C# and Java though. While working in C# I reeeeally want the ability to work with lists, regular expressions, and lambdas like I can in Python instead of having all the extra code bloat of C#.
One thing that I'd love to see though is stuff like functional programming going a bit more mainstream. ML and Haskell type inference is a beautiful way to handle typing for the most part. I love not having to define the type of anything beyond what's necessary, and the compiler / interpreter still catches all type conflicts immediately. Also, the ability to pass functions around / create lambdas is very powerful and fairly easy to understand.
As for what I ever intended to accomplish, the truth is, very little. Only after reading "program a computer" did I realize how vague and idiotic that sentence sounded. I want to learn computing languages as, in part, an ongoing quest to learn everything in the world. I want to get a better idea for all the technology and software that I'm surrounded by constantly. I miss so much being as ignorant as I am towards any sort of code, and it's frustrating. I have a previous post where I was asking a more basic question, "how do computers even work?" and, having now a better idea of how computers turn basic electrons into video games, I'm more interested in learning more complicated things.
Realistically, any application or work I need to get done can be accomplished by downloading someone else's application. But I'd still like to know, and be able to make my own, have the general know-how even if I need to go online all the time to find a certain tip.
I suppose for actual creativity, I'd be better off getting into real-world engineering, messing with minor electric motors at first, and finally building my own car. That's more realistic, and more helpful. I can't just download a car when I'm looking for one.
That being said, I would *love* to make a game for Xbox Live. The only two dreams I have right now are to either become an accomplished and developed writer/novelist, or a renowned game designer. I can write all day long to myself if I want, but the joy of having thousands or hundreds of thousands or millions of people reading and loving my own work is unimaginable. I get thrills when just one person likes what I write.
And games, what can I say? I read online constantly, and if I didn't have the internet I would surely own more than just one gaming magazine subscription. I love playing different games, and at least rent everything I can, but I wouldn't want to stop there. I always have so many ideas, and not just like "It'd be cool to have a game in space, with zombies!" I have those sorts of ideas too, but I daydream constantly about other, equally important interesting factors. Control schemes, for instance. Methods of control for games is so important, and yet I think too underrated often enough. Right now a game's control scheme can be measured by how it fits the status quo. Anyhow, the point is that I would kill (not really) for a job in game design, but I'm morbidly afraid I'll never achieve that sort of position without major computer experience.
Plus, it's not going to kill anyone to learn even a proprietary language as long as it holds to the same concepts they'll encounter elsewhere.
C# is just one of an entire family of languages that all use very similar concepts. Translating from C# to Java is fairly simple. C# to C++ requires a bit more knowledge, but objects and other basic concepts are still there.
Most of the time it's just a matter of learning a new keyword or way of structuring the same kind of information between each language. The concepts are the important part.
The real shock comes in going to something like assembly or jumping to another paradigm like functional or logic programming. Assembly isn't terribly hard though if you're coming from C though since C maps onto assembly without much trouble.
The compiler project I did my senior year of college was a great way to cap off my CS classes. It filled in one of the last holes in understanding the different levels of computing. It's really cool to see how a higher level language is easily translated into assembly.
Edit:
Just thought I'd add a bit of a basic idea of the different levels of programming (Low to High Level):
Hardware - even this involves some "programming" in that chip designers have to layout the basic logic in circuitry to handle everything that a computer needs to do
Binary - basic patterns of bits that a computer can understand as a series of instructions and related data
Assembly - human readable code that works with ideas like the CPU's registers, memory, the stack. This code is translated directly into binary code for single type of processor architecture / instruction set
Higher level general purpose languages - This is a broader category. Languages like C are very close to assembly language while languages like Java and C# are higher in the spectrum because of the more abstract concepts they have (objects, classes, etc.)
Domain specific languages - These are languages that are very far from the hardware that runs them. One of the best examples here is probably SQL. SQL code is meant for performing database operations / searches and not much else. These languages can do what they're meant for very well, but they don't have a very broad range of use.
I'd recommend starting out with the high level general purpose languages since you'll be able to do the most with these from the start. From there you can move on to learning stuff like SQL if you're interested in working with specific technologies that have such languages. Assembly is great for getting to know how software works on a very low level.
This!
Programming isn't like learning to speak foreign languages - you don't learn one then start over from scratch when you learn another. The important thing is to learn the concepts behind programming, and imo the choice of language is pretty arbitrary (as long as it's not Basic). Once you've wrapped your head around the concepts then the langauge itself is arguably just syntax and you can pick up new languages in a short time.
While you might not need to deal with things like manual memory management or pointers in many newer languages (especially OO ones) I do think it's important to understand the low-level concepts, and for that reason I recommend starting with C, even if it's just for the initial learning phase.
Once you've got the basics down you can progress to C++ (object-orientation is the way to go for any non-trivial project), and you'll understand what the compiler is doing for you behind the scenes with regards to memory management etc...
It wasn't that, it was (what I perceived as) a kneejerk reaction against MS that I was commenting on.
Huh? C# has a regex library built in (it's System.Text.RegularExpressions), and Orcas has lambdas.
For starters... VBA is not a language in itself. VB6 is about to be unsupported, and it's not true OOD. I can't speak for VB.net, I understand it's much better in the OOD department.
That being said... It's relatively easy to pick up, and you can do as much with it as the casual hobbiest normally needs. On the other hand, if you're wanting to actually write anything serious, you probably want Java some flavor of C++ / C#.
And I'll second (or third, or whatever) whoever said that when you first learn to program, it's structures and habits that are most important, not the specific language. I've got a MS in Computer Science, and the first language I learned in college was Pascal, which was designed specifically for teaching people to program and was nearly never actually used in the real world. Don't worry about learning specifics that you're never going to use again... once you've got your first language, it's tons easier to learn the next one.
You do need to be careful, though, to make sure you separate scripting languages (Perl, JavaScript, etc.) from programming languages (C++, Java, etc.). I've seen both suggested here, make sure you pick the type that you are actually interested in.
The topic is superbly broad. But if you want to use a normal programming language, I'd suggest C++ or Java. New age languages like python are decent as well.
B.net: Kusanku
Out of pure curiosity what is it that you're wanting to do with lists, regex, and lambdas that C# won't do? Or at least what is it about the first two, as C# 3.0 isn't really out yet to handle the lambdas...
[edit] Also, this:
I have nothing against MS for the most part - I just thought you were recommending they shell out 2 - 3 hundred dollars for something they want to check out. Seemed excessive, but the free version of VS made that inaccurate.
Isn't this the truth. Syntax is relatively easy. Semantics is where I still get tripped up. I'd give my left nut to take a class that really got down and dirty with OOP. Right now, it's all still black magic to me.
And suddenly, I hear in my head "You down with OOP? Yeah, you know me!"
God, I'm old.