I want to teach myself how to code, but I don’t know what language I should start with or the tools I’ll need. Any suggestions?
Step 1: Stop calling it “coding.”
The choice of language depends primarily on what you’re interested in doing. Do you want to write system applications, GUI stuff, data processing, web applications, or something else? Do you want to quickly get something working or have a real foundation in computer science? And how much Mountain Dew do you have on hand?
Done.
I have no preference or experience, but I do want a real foundation in programming (or as much as my spare time will give me).
Hrm.
I’ve always suggested starting with a scripting language. I would suggest PHP, at least to get down the basics. The biggest hurdle would be finding a webhost - hopefully free - that supports PHP. My reasoning is that the syntax is quite common, and there wouldn’t be a need to deal with compilers and all that.
At the same time, PHP is a scripting language - it could be argued that it isn’t true programming. If you really want to learn programming, as you say, go for low-level languages like C/C++. Or Java.
Java is probably the best option. It’s got a somewhat steep initial learning curve, but over the long run it’s better than, say, C++, whose intracacies can be killer. Java is definitely a powerful language, so it is something to consider. And it’s portable!
… On a side note, I personally call programming in “lesser” languages - for example, JavaScript, DHTML, etc. - as “coding”. YMMV.
Grab PHP from http://www.php.net
Grab Apache http://www.apache.org/ and run a webserver on your PC to run your programs.
If you want a good foundation in computer science, I reccomend avoiding scripting languages like PHP and Perl and object-oriented languages like C++ and Java. Instead, I would focus on C. It forms the syntactical basis for a great many modern programming languages (C++, Java, PHP, etc. all decend from it.) but it lacks the convenience that those languages offer. Therefore, you have no choice but to learn the details of data structures, pointers, memory allocation, logic, and so forth. An excellent book for learning C is Practical C Programming by Steve Oualline. It assumes a pretty basic level and there are tons of examples and exercises.
(There is a common school of thought that people new to programming should avoid lower-level environments like C since they’re “too hard” and insist that students start with something easier like Python or Java. I abhor this philosophy and think students should learn how software really works at a basic level before tackling environments with more advanced feature sets.)
I would start with something like Visual Basic .NET or Visual C#.NET (preferably the latter, but you should learn multiple languages for abstraction purposes - check them both out and see what you prefer, in .NET you can even mix and match).
The advantage of Visual Basic in its .NET form is that it retains the accessibility of basic but allows for the whole nine yards when it comes to correct coding principles, and good training material is available. Also the training version of .NET is really cheap and comes with a decent introduction manual.
Why? We always call it coding. It’s easier and more accurate than “programming.”
No it isn’t. It’s precisely the opposite of more accurate. Firstly, “code” is a noun, and unnecessary verbing weirds communication. Secondly, computer programming encompasses a great deal more than simply writing code, it includes design, engineering, philosophy, methodology, management and support, among other things. Being a programmer is about the continual study and practice of an artform, and only peripherally about the actual code.
-
-
- Software to program in Java is available free online: just download the Sun JDK. It is a number of command-line utilities, but you can also download free graphical front-ends for it such as JCreator or NetBeans.
-
- There are also free C/C++ compilers, the Bloodshed GUI is one front-end for the GCC copiler, that includes the GCC compiler in the download. Neither of these programs allow Visual Basic-style drag&drop coding, but they do have error reporting and color-coded syntax highlighting.
~
That was a beautifully-done Calvin & Hobbes quote.
Well, you’ve already seen a simple case of “I have a question, and want an answer” devolve into a pedantic discussion over the use of a single word, so I think that’s as good an introduction to the philosophy or programming as anything else.
Really, though: while PHP is a very neat language, the set-up can be a little daunting. And the biggest block to using one of these high-level languages (PHP, python, lua, or even Java) when you’re just starting out is that it can be kind of tough to conceptually separate the overhead of installation, support libraries, GUI, etc. from just the act of programming and getting a practical application up and running. Sure, you can get a “Hello, World” going pretty quickly in any of these, but it can be difficult to take that and then extend it to something else.
I always recommend C++ as the language for anyone getting started with programming. Yes, it’s huge, and over-powered for a “starter” language, and it has syntactical problems that can make it confusing, but the benefits outweigh that: It’s ubiquitous, so it’s relatively easy to find a package and get it up and running. You start out learning the concepts of object-oriented programming from the beginning. And it’s practical; you can start with the basics and build up conceptually as you go along and end up with real, useful knowledge from your first language.
My favorite development environment for C++ is still Borland’s C++ Builder. It’s a “dead” product, pretty much, but it’s relatively cheap if you get the personal edition (looks like you can get a CD of the previous version for $10) and it’s IMO the easiest way to get from scratch to a finished application when you’re just starting out. They also have JBuilder for Java, and Delphi for Pascal, but again, I recommend starting with C++.
Microsoft’s Visual Studio stuff is definitely more common, but it’s also more expensive. Visual Basic is another good starter environment, but it’s a little pricey if you’re just playing around, and the language is a little on the weak side. It’s also possible to find affordable personal editions of Visual C++, but I think it’s kind of tough with Microsoft’s stuff to go from set-up to completed application without having to jump through all kinds of hoops. (And I despise MFC).
The totally free route is gcc, which has already been mentioned. If you want, you can find a front-end for it, but when you’re just getting your feet wet, it’s easiest to do everything from the command line. Just do a google search for “gcc tutorial” and you’ll find all kinds of pages to help you get started.
Coding is the transitive verb form of the word code, the same way that programming is the verb form of program. Both words have a modern meaning of writing or revising a piece of software. Both are equally correct.
From here:
If you want to use programmer instead of coder, I have no problem with that, friedo. But to imply that “coding” or “coder” is somehow incorrect is false. You don’t have to go into details about what a coder/programmer does, I’ve been in the trenches for going on 15 years. I know what the job entails, and I know the words used to describe it.
Sorry about the hijack, Necro, but I’ve worked in plenty of software houses, and there’s no problem with calling yourself a coder as opposed to a programmer, or to refer to what you’re doing as coding or programming.
And to answer your question - IMO, I’d pick up something like Java, C#, or Visual Basic and a good book to teach you how to use them. C/C++ has a lot of “gotchas!” that can easily frustrate beginning cod… I mean, programmers :D, and is best left for later study.
php is nice, but like SolGrundy points out, the setup is daunting.
If you can get your hands on a copy of .NET, I’d get that and start with either C# or VB. Go to Amazon and research what are considered the best starting books for either of those languages.
I like friedo’s idea to start with C. Java is all well and good, but I get the impression that you can write with it for a long time without getting much idea of how it works behind the scenes. C/C++ do force you to learn at least a little bit of that stuff, and that’s where true programming skills come from.
-
-
- I have never seen that teaching a new user to use a command-line was “easier” than a GUI-style program. I have found quite the opposite, honestly. And the history of desktop computers backs up my observations–the desktop market exploded when visually-oriented OS’s and software became widely available. Using a command-line program requires that you know the command before using it, or know how to open the help file–which is usually not obvious. And the help file is not browsable while also viewing your work. For some tasks it is entirely adequate but it generally doesn’t help a new user. By the same argument, you should only program in machine code because “it doesn’t need to be compiled” and you should throw away your computer keyboard and only use punch-cards–because that way, you would never make a typing error.
~
- I have never seen that teaching a new user to use a command-line was “easier” than a GUI-style program. I have found quite the opposite, honestly. And the history of desktop computers backs up my observations–the desktop market exploded when visually-oriented OS’s and software became widely available. Using a command-line program requires that you know the command before using it, or know how to open the help file–which is usually not obvious. And the help file is not browsable while also viewing your work. For some tasks it is entirely adequate but it generally doesn’t help a new user. By the same argument, you should only program in machine code because “it doesn’t need to be compiled” and you should throw away your computer keyboard and only use punch-cards–because that way, you would never make a typing error.
-
Preach it brother!
Though object oriented programming is an important concept, it might be better if you read something about it so you could keep the principles in mind, but not start with C++. (I’m assuming you’re doing this for the learning experience, not to be ready for a job. If I’m wrong, check the want ads for the most popular language.) I agree that you should start with C. Though languages like Perl are very easy to get into, you might learn bad habits.
In my experience, the most important thing you should do is to decide on a set of programs to write, either from texts or something fairly simple that would be useful. When learning a new language, I can read the manual easily enough, but I don’t really learn it until I’ve written some decent-sized programs in it.
Do you know someone who can look over your code and help you find bugs? When I TAed a Pascal/Assembly language class, the students would often get stuck in a misperception, and would need to be nudged in the right direction. Symptom: there must be a compiler bug, since this program has to be right.
I just meant for gcc in particular. For gcc, you can either find a suitable GUI front-end, figure out how it handles files, try to conceptualize which part is specific to the front-end and which is general C++, and then come up with a Hello World! application.
Or, you can just type
#include "stdio.h"
void main()
{
cout << "Hello, World!";
}
into a text file, save it as hello.cpp, open up a command prompt, enter “g++ hello.cpp” and see your results.
That’s the reason I like C++ Builder so much, and wish it had caught on. It’s IMO the perfect level of abstraction, where you’re working with a GUI and creating real applications with real GUI’s, but at the same time you’re really using C++. You’re not bogged down under layers of setup and support libraries.
That’s a very interesting idea, and probably not a bad way to go about things. What sorts of programs do you use?
(bolding mine)
And I think that’s exactly why you start with C++ and C. Object-oriented programming and design is here, and it’s not going anywhere. And if you start programming using a functional language instead of an object-oriented language, you might learn bad habits.
Starting with a functional or procedural language while figuring “I’ll pick up the OOP stuff later” is just a bad idea. You have to re-train yourself to do things the “right” way. Since C++ is a superset of C, then as you learn the language and get deeper into what it can do, you naturally get deeper into what OO programming can do and its advantages.
That is definitely true. The best way to learn how to program is by starting out with some application in mind. (For me, I got extra-double-word-score Geek points because I wanted to write a database to organize my comic book collection). Any book you find will have examples in it, but I’ve never ever been able to find a book that has examples that are actually useful or practical.
Since I do it for a living, I learn a new language when I have a work related type of job that can best be done with a new language. These days I only program as a tool, and my attention span is short enough so that I usually use Perl (which is good for writing a small fragment, testing, and writing more) but which is not a good language to learn with. Most of the bugs I create are stuff that a C or C++ compiler would catch, but which are legal in Perl.
What I would do is to look in a bookstore at programming books for whichever language you choose, and jot down an exercise or two from each chapter that looks interesting to you. Once you learn the language, you can make up your own, but you might find that problems that seem really simple turn out to be hard to code. One of the things you’ll learn eventually is how to evaluate the difficulty of a job - I’ve seen non-programmers think of simple programs as really tough, and very difficult programs as very simple.
I did a C program to solve the puzzle where you have a grid with various arithmetic operations, and you need to assign numbers from 1 - 9 to make all the equations work. That wasn’t to learn C, but just for fun. That was fairly simple for me, but involved recursion, some reasonable data structures, and little I/O. (this was pre-web.) Whenever I have time I want to write a program to solve those color by number puzzles in JavaScript. I don’t think it will be that hard from a programming point of view - I’ve been proving theorems about them to get ready. The reason exercises from books are good is that they are contained - and they probably have the answers too.
Don’t underestimate the time this will take. That’s why I suggest finding interesting problems - at least you’ll like the results.