I did a search and browsed through the first 2 pages here, so don't hit me if such a topic has been raised before >_>
Basically, I want to learn how to program at a level where I can either become self-employed or a freelance coder... Really any kind of programming skill-set that would allow me to support myself in the long-term.
I just started a computer science undergrad program. My experience thus far has been limited to making programs on a TI83+ calculator and a cegep course on visual basic, so pretty minimal. One of my courses this semester is based around learning Java, and I'm loving it so far. But of course I want to go beyond what's being taught in the classroom, especially since the material being taught is pretty elementary (variable types, nested loops, etc).
So what should I be doing to learn some programming on my spare time? I'm going through some exercises from a site called Codeacademy but it's also fairly basic stuff. I've downloaded a few textbooks on C++ but they're about 1000 pages each and I'm not sure it would be practical to go cover to cover, probably a more efficient way to learn the stuff.
I mean, it's difficult to even decide what language to pick. I've been told Python and C are good choices.
Keep in mind that I'm pretty busy and the idea is to devote 1 or 2 hours a day to this pursuit so that in a year or two I can start programming as a job even without my undergrad degree.
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
If you want to be a good programmer, you should do 3 things.
1) Get a very good footing on understanding the various programming concepts, and learning how to use the tools in your tool box.
2) Learn how to write good clean maintainable code.
3) Master at least one language, so you can find plenty of work in it.
For the first part, it seems you're already there. What you need to do is think of some kind of software you'd like to have, or some relatively simple program you use on a day to day basis that you think you can do a more featureful version of. Then spend free time developing these programs. You need the experience. Finding something like this which motivates you is much better than trying some problems which are both too simple to give you the full grasp of a program and also too boring for you to spend a lot of time on.
For the second, I recommend you get yourself a copy of Code Complete. It's a fantastic book. You'll learn how to write code the way it should be written. Applies to any mainstream language.
For the third, pick the language/area which interests you the most. Write hobby programs in it. Find other people who are great with it and learn from them. There's chatrooms online where you can discuss your favorite programming language, or see problems people face and the various solutions offered. Reading the top 3 books on the language cover to cover helps too.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
I happen to teach undergraduate programmers, so I have some idea about this.
I'd start off by recommending against C for a first or second language; it's hard to understand and easy to get into bad habits about. It's definitely worth learning, but I'd suggest learning assembly language first (your choice of platform; the 6502 may be an interesting one if you're into TASing, because it's what the NES, and several other consoles of that era, use). Python, although I personally dislike it, is a reasonable choice; it's similar enough to Java that you can transfer your skills, but different enough that it'll give you a better-rounded view on things.
Don't attempt to learn C++ without professional help. (And even then, you need good professional help.) Few things are more scary than someone who's self-taught in C++ attempting to program in it. (I should know; that was me once. I know better nowadays.)
If all you care about is employment, Java is the language to learn. It's awful and has several issues, but it's the most in demand right now, and will probably be highly in demand for the next couple of decades (for much the same reason that there's still demand for COBOL programmers).
You might also want to look at some language which is very different from the other languages you've looked at so far. Typical off-the-wall choices include Prolog, Haskell, and Lisp. You're unlikely to get a job in these, but having them on your resumé will cause people to give you a second look (assuming you can back it up).
Finally, I'd suggest learning by trying to write programs. Aim slightly beyond what you think you can manage, and learn on the way there. (Aiming a long way beyond, you'll just fail and get discouraged; aiming within what you can manage, you'll get bored and won't learn anything.)
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
I disagree with this.
I think assembly language first is a bad idea, and that causes bad habits. You should understand programming constructs and tools before getting nitty gritty. Then when you need to get nitty gritty, you should be using your tools there to emulate what you know from higher level languages to keep your code clean. Otherwise you'll just write messy assembly.
As for starting out in general, I think it's best actually to learn two different languages simultaneously. Like Java and Python, or C and Visual Basic, or something along those lines, so you can understand what tools are important regardless of language, and what is shared between them. That way you can also learn to avoid language specific features until you have a better grasp of the language.
As for C. While it has complexities to it, if you learned how to write clean code by reading a book like Code Complete, you'll be avoiding the issues ais523 is describing.
This is true to an extent. If you read some of the top professional C++ programming books out there. Such as Effective C++, Effective STL, and a few others to master the language, that should be all the professional help you need. Be warned though, C++ is a HUGE language, which really consists of like 5 other languages, so if you want to go down this route, prepare to reserve a year for just reading a dozen books.
As for Java, it was the big boy on the block last decade. But I've seen usage of Java start to decline in the face of both languages from Microsoft, as well as languages specific for web development.
This might be insightful: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
There are still plenty of companies that use Java, and they will probably be around for a long time to come. If you're looking to join a new company though, that's building brand new software, you're a lot more likely to find a job with a Microsoft language, or PHP, Python, JavaScript, Objective-C...
I review resumés to hirer people. Seeing someone who has an off-the-wall language (and can actually write code with it) tells me that this person I'm reviewing is more than a guy who just took one class in school and thinks he knows everything. However, I will still refine my decision to hirer someone based on the general programming skills they have, and how proficient they are in the language/area I am hiring them in.
I can't stress this enough. If you can't write serious programs on your own, you can't go far.
Regarding the "long way beyond", I find that acceptable if that's in the "extra features" segment of the program you're designing. This way you can start with what you know and what you can manage, and add on new features as your skills develop.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Wow, such quick and informative responses!
I have Code Complete now. It’s ~900 pages, so I’m going to devote the next month to reading ~30 pages / day and leave other side-projects (eg/ learning html) on hold.
As for writing my own program, I’m thinking of maybe designing a simple pong/tetris game for starters. What else could I make that’s relatively simple but still more of a challenge than just outputting stuff on a console?
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
You can make some very complicated programs that output stuff to a console. Such as a console based web browser. It really depends on where you're pulling your data from.
Programming is about data processing, and doing stuff. So working with files, databases, networks, and doing all kinds of manipulation of data is where the real programming is. Outputting your data your screen is just a small part of what programming has to offer.
Of course data output to your screen takes on a whole new level once you learn 3D graphics processing.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Multiplayer pong/tetris.
You'll have to learn about sockets, abstracting the state of the game (so you can send and receive and respond to changes in it asynchronously), writing a netcode... etc.
At first I was like "yes, that's good advice..." Then I was like "What?!"
That's a bit like recommending someone who wants to learn painting to buy a book about chemistry. "After all, you need to know what the paint is composed of."
If C is a bad choice as your first or second language, asm would be like a hundred times worse choice. You don't need asm for anything, especially not at the stage where you are learning the very beginnings of programming. Even 99.9% of professional programmers who have programmed for the last 20 years don't need asm for anything. (If you were making an emulator then the asm of the emulated hardware would be quite relevant. However, that's most certainly not a project for someone who is learning the basics of programming.)
If you want to learn to program with something that's easy, safe and actually useful in practice, learn a scripting language such as JavaScript, ActionScript or Python. Another higher-level language with practical applications would be PHP (although the language and its libraries a design nightmare, but still.)
If you want to learn a compiled language that has even a modicum of efficiency, try Java or C#. (The latter might be even better as a language, although with the caveat that you will basically be programming for Windows only. Yes, there are limited ports to other platforms, but in practice you will be restricted to Windows programming.)
C++ is my personal love of my life, but it's quite a large project to learn properly, so it might not be the best first-time language.
(Good variants of) asm is actually a pretty easy language.
It's tedious and slow to write anything but very small programs in it, which is why it isn't widely used. But it isn't hard to learn, and it's a good way to get introduced to concepts like pointers and call stacks (and perhaps stack frames, too).
I'd argue against JavaScript (basically because the library support sucks; the language itself has a few flaws but is interesting), and against PHP (badly designed).
This thread is going to turn into a language flamewar, isn't it?
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
This is only good when taught/learned from the proper perspective.
If you want x86, this is a decent resource: http://cs.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html
Warp: I would slightly argue that even if you don't develop with assembly, it can still be useful to know when debugging an application. Granted it doesn't come up unless you're doing advanced stuff, but I've on many occasion ran into compiler errors, and it helps to be able to review if your compiler is handling your code properly, or how it's handling some particularly "interesting" code.
If you're going to do JavaScript. Stick to "JavaScript: The Good Parts".
Support library arguments are also rather silly. JavaScript is the only language you can really do client side browser software with. It's not like you have an option with a bigger library. And in cases where JS is used elsewhere, it generally is coupled with a nice library.
PHP is one of the worst designed languages I have ever seen. On the other hand, it's also the easiest server side language I've ever seen.
If you want the best designed server side language, Google Go looks way better than the alternatives, but won't be as easy as PHP.
You're the one who started it.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
I agree with the advice to learn two languages at the same time, and I recommend C and python as the pair. C is a good low-level language, and is what is used to implement python, which is a good high-level language. Not only will learning both cover a wide range of abstraction; there are also high-performance extensions to phython (like cython) that allow you to write tight, performance critical sections of your python files in inline C. So this pair makes sense in my opinion.
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
amaurea good point.
Furthermore, practically every mainstream language in existence can leverage something written in C.
C++, D, Objective-C, Java, PHP, Python, JavaScript via V8 or SpiderMonkey, Visual Basic, C#, Go, Pascal, Ada, Fortran, and so many other languages are all able to bind to code written in C.
Another important point to note is that almost every language allows you to launch an executable written in any language, along with command line parameters, and piped I/O. Using such, you could also gain advantage of programs written in something else, even if no language bindings exist.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
I think that you can do client side browser software in ActionScript 3 just fine.
I find it a good first language, since it doesn't bog you down with memory management, has an excellent graphical engine (unlike Java) and has classes.
Sure, the language has its fair share of idiosyncrasies, but it's nothing major. It's kinda like Java before it got generics and with a poorer standard container library.
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Not without a plugin you can't.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
A plugin which 98 % (not a made up number) of the web has installed.
Also, you say that like it is a bad thing to depend on a plugin. I say that it depends on the audience and the content.
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Quite the contrary, I was saying that there's only one client side browser language available. Sure you have other options with plugins, Java, C, C++...
Also, ActionScript is very much related to JavaScript, and with a larger library. Which helps to bolster the point I was making above, knowing JavaScript, or better yet - ECMAScript, which many languages are based upon is a fine idea to learn.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Search around the web for open-source projects written in the language of your choice (in this case, C++), and analyze the code to learn how other people program games, utilities, bots, emulators, etc.
I can see where ais523 is coming from regarding assembly. When I was learning to program, I had a horrible time trying to wrap my head around where stuff was coming from; it wasn't until I had a good mental model of how memory actually worked in a computer that I grasped how pointers work. Assembly is thus one possible way to establish that kind of fundamental understanding, and since the language is so simple there's basically no distractions.
That said, when I was taking college courses we didn't touch assembly until we'd already established a solid general-programming foundation. The lessons that assembly teaches can also be learned in other ways.
My personal suggestion for newbie programmers is to start with Python. It has the best combination of power (being able to do a lot of things) and expressiveness (not having to jump through a lot of hoops to do anything) I've ever seen. The reliance on whitespace puts some people off, but after having inherited a codebase from a previous developer, consisting of roughly equal parts C++ and Python, I can say with authority that it's much easier to make unreadable C++ than it is to make unreadable Python, and the whitespace requirements are a big part of that.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Picking a programming language depends what you want to make overall. If you are interested C++ be prepared to see a lot of errors, Programs freezing in loading 3D objects or assets, constant troubleshooting, and following books to the letter.
Is it worth it though. I'd say so
If you want to learn a programming language just to have the experience under your belt. I would go with JavaScript. It's a great language for beginners.
Emulator Coder, Site Developer, Site Owner, Expert player
(3574)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
I recommend learning C#, obviously though that answer is a bit biased ^_^
But it is a good OOP, OOP concepts being very important to learn if your goal is to make money. And like Nach said, "Microsoft languages" (C#, VB, J#, F#, etc) are high in demand. C# is the dominant one of this group, the highest currently in demand, and once you know C# you can easily learn the others.
I recommended those two languages not because they are masterpieces of computer language design, but because they are safe (you don't have to worry about segmentation faults and leaked memory and such things that are advanced stuff in unsafe languages), have immediate practical applications and because at least in the former case you can start immediately running your programs. In other words, with JavaScript you simply write your first "hello world" program and run it with a web browser. Nothing else is needed. No need to install IDEs, compilers, libraries... Everything you need is already installed in your computer.
In the case of PHP you of course need to install the development environment to run anything, but the thing with PHP is that, while it's quite a sloppily designed language (especially for its libraries), it's widely used and learning it has practical applications.
In both cases if you learn them well, you could even get a job. (That's hardly the case with more obscure languages like Lisp and Haskell, no matter how well designed and "beautiful" they might be.)
Even if that's so, it's a really advanced topic, hardly the first thing a newbie programmer should worry about. Also, it would only be relevant with low-level languages such as C and C++, not with higher-level languages like Java or C#. (In fact, they are so high level that they pretty much abstract away the whole concept of memory addresses and pointers. For example, references in Java are not what you'd think are just raw pointers. They are much more complex than that. They are much more complex to allow for garbage collection, memory compaction, runtime validity checks, and a bunch of other things.)
Even when debugging a C/C++ program, my experience is different than yours. While knowing what the compiler is doing behind the scenes helps understanding what's going on and aids eg. in memory consumption optimization (as well as other optimizations, such as minimizing memory fragmentation), I don't see how it aids in debugging.
I beg to differ. C is a horrible language and I wouldn't use it unless absolutely forced to. I would even use Java any day instead of C. Just because C is used in almost everything (and to implement almost everything) doesn't make it a good language.
This is one of the most common and by far the most misguided suggestions people make to learn programming.
Reading other people's code is one of the hardest and most inefficient ways of learning programming. It's like trying to learn how to cook by examining a ready-made cooked meal.
Suggesting someone to learn programming by examining other people's code is completely equivalent to telling someone who wants to learn to cook to "go to a restaurant, order a meal, and examine how it looks like".
The proper way of learning to program is to read books and tutorials, enroll in programming courses, etc.
Maybe if you are trying to learn C. Not all languages are C, nor do all languages use pointers or other low-level stuff. Learning asm is pretty much a waste of time if all you want is to learn, for example C# or JavaScript.
I'd agree that if you don't care about learning low-level languages at all, there's no point in learning asm or C. Just if you do want to learn them, do it in the right order :P
And about the "is C a good language" argument, my point of view is that it's clearly improvable but there have been no serious attempts to improve on it until recently. (Mozilla are doing interesting work with Rust, but it's still in early stages.) As such, it's still very widely used when a portable low-level language is wanted.
Re adelikat: I'd say that if you're learning Java already, learning C# too won't gain you much. The two languages are very similar, differing mostly in that C# has some extra complexity and more modern libraries. (And C# has much of the same problems as Java as a result.) It's best to have more variety in your first few languages. (Especially as if you know Java, it won't be hard to pick up C# if you need it for a job.)
For alternatives to C, microsoft has 'Managed C' where you can declare objects to be within managed memory and a garbage collector will be freed later. Much of the mental work in making a C program work is in handling memory yourself, so this helps a LOT.
Memory management is one of the biggest headaches in C (as it offers little to no tools to make memory management automatic or even less error-prone), but it's certainly not the only problem it has. (Therefore a "C with garbage collection", while better, would still be a pain to code with.)
Another big problem, from both a beginner's and an advanced programmer point of view, is that it lacks most of the useful standard library tools (such as data containers) that the vast majority of other languages offer. (The main reason why it lacks them is because the semantics of the language are so primitive that it simply doesn't allow creating good, efficient and high-quality generic data containers and algorithms.)
It's good to know how data containers work internally, especially when you become more advanced (because it's important to know which data container is best suited for the task at hand, and what kind of benefits and drawbacks it has). However, unlike many people advocate, there's no need to learn these internal workings the "hard way". Implementing a data container from scratch can be an interesting task, but hardly essential if your only goal is to know how a certain type of container works internally.
(There are other problems with C as well, but I won't start listing them here...)