View Full Version : Advice for a Programming Newbie
Clanan
12-14-2010, 07:14 PM
I haven’t been a part of the Qt3 community for long, but in the past year I’ve found these boards becoming an integral part of my online experience (for better or worse…). Also, I’ve realized that the IQ of the board seems to be pretty high and, thus, I would like your input.
Like many of you I’ve been an avid gamer for as long as I can remember. Now that I’m coming close to college graduation I’ve been doing a lot of thinking about my professional vocation and I’ve realized that I have subconsciously kept myself away from gaming careers. I was always told “I needed to do something grand, and videogames don’t offer any sort of real job”. As a result I stayed away from programming and similar endeavors as anything more than a slight hobby.
Well, I’ve since realized how false this is (thanks to my wife) and that I should really pursue something I am passionate/driven about. I love the idea of crafting something other people use, and doing it by hyper-focusing on interesting problems.
I have some experience with programming, mainly a couple college courses in Java and some tinkering in my spare time in years past. Basically, whenever I did program, I enjoyed it immensely and think I could enjoy a career in it. Perhaps this will someday be in a gaming-oriented position, but for now I’ll just focus on programming itself.
In summary, I request advice, that is-your pearls of wisdom for someone in my position. I will hopefully gain a full-time engineering job in May and will support my family. I am desirous of enveloping myself in programming in my spare time so that perhaps someday I can make it a career (even in gaming, if I am so blessed).
Some questions to get the juices flowing:
What languages would you recommend?
Any good books/websites/communities/blogs on the subject?
Thoughts on ways I can structure my projects to make sure I’m always advancing? I can’t get a degree in CS at this point (engi B.S. is already my second) so I’ll largely be on my own.
Good ways to get into game-oriented programming (e.g. modding, iPhone apps, etc.)?
Miramon
12-14-2010, 07:28 PM
There have been several threads like this in the past. I'm too lazy to look them up.
I'm old school. I recommend C to get some low level understanding of how things actually work. Pointer arithmetic, manual memory management, structs, data driven code. Good stuff. You don't have to code big things in it, and few people will want you to do so anymore anyway, but if you learn C first, your C++ will not be as awful as it would be otherwise. It will still be awful though, as that's pretty much inescapable. C++ is long in the tooth and has become rather complicated and huge, but at least you can still get a job on the basis of knowing it.
Java has a lot of utility and even now with all the crap that's been bolted on in the last few years is still easier than C++, but it teaches you almost nothing about how computers work, hence the C first (or concurrently) suggestion. Again, you can at least be employed on the basis of knowing Java.
There's lots of other fancy cool languages these days, ranging from quasi-scripting languages to pure OO to funky functional, but faddish as they may be, most are just not that popular for building real programs. Maybe Python is an exception that actually gets used; but the home page actually says "Python is often compared to TCL, perl, Ruby..." -- and those comparisons don't suggest what I'd say is a good basis for a first real programming language.
What's popular of course is web scripting stuff. That can get you employed -- Ruby, PHP, etc -- but if you learn it before you learn or relearn a real programming language you will damage yourself.
And oh yeah, Lisp is still, after all these years, the best programming language for general purpose applications as well as AI, not to mention for all kinds of other applications. Too bad you can hardly get a job anywhere anymore on the basis of knowing it, though it is used in core code for ITA.
But then, really, what do I know. I chose to stop programming professionally 8 years ago because I was sick of modern programming languages and worse, modern programming environments.
GatInDaHat
12-14-2010, 09:38 PM
Code Complete Microsoft Press. Encapsulation and modular design, stack vs. heap, generics, design patterns, and best practices. Google is your friend, and don't forget stack overflow for a great resource =) You'll want to study the separation of presentation/logic/data layer, keep in mind while you study the nuts and bolts that specifications and design are the key to success.
RepoMan
12-15-2010, 11:18 AM
If you want to start programming out of passion, then the first question is, what kind of program do you passionately want to write?
- A mod for some game you love? That's probably the best idea if you want to actually get right into game programming.
- Some kind of mobile phone app? Good place to start if you want to have an easy path right to selling your app through an app store. Mobile apps tend to be smaller, therefore less code to write. You can even hack on a mobile game, thereby combining this item with the last one.
- A web app of some kind? Can be fun because you learn a lot about network and multi-tier programming, and immensely useful to know if you want to get into the non-gaming programming industry.
- An old-school desktop app? Good plan if you want to build something with an ambitious GUI and/or something that uses a GPU heavily (for computation or just awesome graphics). Perhaps work on a demo, in the European sense of "the demo scene" (amazing graphics apps that basically just look cool)?
Basically, different kinds of software involve different languages, different underlying libraries, different hardware you're going to run the thing on, and different skill sets for programming those kinds of architectures. So starting from "what language should I use?" is putting the cart before the horse. The horse is what kind of software is going to be the most fun for you to work on. The cart is what languages, tools, and skills are best for writing that software.
You did ask specifically about writing mobile games. You can download the entire toolset for Windows Phone 7 -- Visual Studio Express, XNA, the Windows Phone 7 emulator, everything -- for free. (http://create.msdn.com/en-us/home/getting_started) That would certainly be one of the quickest paths to getting a full development toolchain for building mobile games.
To the "how do I make progress?" question: probably the fundamental skill of programming is decomposing large problems into smaller subproblems, and continuing that process until the subsubsubproblems are small enough to actually solve with a few lines of code. Large systems are made from smaller modules, which are made from yet smaller routines. So if you want to build a real app, you need to figure out how to construct it bit by bit, such that you have something small running as soon as possible, and you can build your real app step by step from there. Running code that does something interesting is the most motivating thing for a programmer; it's also essential in large projects -- the manager's nightmare is a programmer who goes off for two months furiously writing code, without anything to show along the way. Best case is that every couple of days, you get a little piece done that fits nicely into what you already have. That way you always know where you are. Look for books about "agile programming" for help with this kind of bit-by-bit, steady-visible-progress development.
Oh, yes: Perforce (http://perforce.com) has a free two-user evaluation version. You can run Perforce for free for individual development, essentially. Even for your little hobby project on your home PC, you really want a source code control system. That way, you can always check in your latest working code, and then you can go madly hacking around breaking whatever you want, secure in the knowledge you can always back up to the last working version. Source code control is indispensable if you want to build realistic programming skills.
Damien Neil
12-15-2010, 11:34 AM
You did ask specifically about writing mobile games. You can download the entire toolset for Windows Phone 7 -- Visual Studio Express, XNA, the Windows Phone 7 emulator, everything -- for free. (http://create.msdn.com/en-us/home/getting_started) That would certainly be one of the quickest paths to getting a full development toolchain for building mobile games.
The same goes for Android and iOS, you realize.
Not to mention Unity 3D
Edit: I've suggested this before and I'll do it again... If you consider yourself to be a visual learner, take a look at Processing: www.processing.org and grab a copy of this book: Learning Processing (http://www.amazon.com/Learning-Processing-Beginners-Programming-Interaction/dp/0123736021/ref=sr_1_1?ie=UTF8&s=books&qid=1292442266&sr=8-1), by Daniel Shiffman.
The book is a nice gentle introduction to object oriented programming AND one of the best ways to feel good about yourself when you're first learning to program (if you're interested in games) is to see SMOAS (shit moving on a screen). You'll be able to get some things moving around in less than 5 minutes and then use visual cues to help learn the fundamentals. There are hundreds of examples here: http://openprocessing.org/ and you can poke around until you find something that intrigues you and then dig into the code.
Miramon
12-15-2010, 12:24 PM
But if you really want a beautiful -- and more importantly short -- programming manual, you still can't do better than Kernighan & Ritchie. Well I guess if you don't want to learn C, there might be better alternatives.
WarrenM
12-15-2010, 12:57 PM
I hate these threads. I practically bite through my lip while reading the advice. The K&R book? To learn from as a beginner? Oy.
Lucidvizion
12-15-2010, 01:14 PM
http://lolcode.com/
Miramon
12-15-2010, 01:34 PM
I hate these threads. I practically bite through my lip while reading the advice. The K&R book? To learn from as a beginner? Oy.
Yes. He's not a beginner; he's coded in Java in school. Java is a much more complicated language than C.
mkozlows
12-15-2010, 01:55 PM
I hate these threads. I practically bite through my lip while reading the advice. The K&R book? To learn from as a beginner? Oy.
The most problematic thing I find is the "I didn't learn it this way, but when I read this later, I thought it was great, so you should start there." Like, the common "read SICP" recommendation that you see a lot (though I don't think yet here) -- not a single person in the entire world has ever had SICP as their first exposure to programming.
SICP is a book that people read when they've already been programming for years after learning it in the natural, organic way that people learn things -- by wanting to do something, and learning enough to get it done, hacks and warts and all. People learn to program by typing in GW-BASIC listings from magazines and then changing them to see what happens; by screwing around with Excel and realizing that you could make a text adventure with some seriously funky VBA; by using PHP to put up a web page that counts down to their birthday.
Only after they've done all that do they end up reading K&R or SICP and realize that they were thinking about things wrong, and get that clarifying burst of insight. And then they want other people to skip that preliminary fumbling around, but that's not how it's ever really going to work.
JoshV
12-15-2010, 02:01 PM
Yes. He's not a beginner; he's coded in Java in school. Java is a much more complicated language than C.
Err, what?
lesslucid
12-15-2010, 04:10 PM
The way I'd distill down the best advice I've had or seen is:
1) The most important thing in choosing a language is what resources are available to help you learn. The best possible resource is a live human being who knows the language and who is accessible to you and who will help you when you're stuck. Failing that, a good book, internet community, set of tutorials, &c, will do the trick.
2) The other thing you should do is make stuff all the time. Set goals based on what you can already do, or can almost already do, and work on making that stuff. So long as you're spending time actually coding, you're learning.
Clanan
12-15-2010, 07:12 PM
Thank you all for the great input; I definitely have lots to think about. Based on some of the responses I'll throw out a couple specific things: first, I do want to lean toward game programming. I'd like to one day be able to sit down and work on an indie game in my spare time. I'm of the obsessive type where I'll happily bang my head against a big project like that, just for kicks, so I'm not afraid of the intimidation aspect.
Besides game programming, the next priority would probably be desktop-ish applications and the website stuff, as I think I could generate many opportunities to apply these in the near future for some friends/small businesses (and because they look like fun).
The other things - iPhone apps, etc - I want to dabble in just to try them out. So right now, I'm really looking for advice on the fundamentals and where to begin. Maybe like Miramon said, starting with C so I can actually -understand- programming, and not just learn to mash out code.
Miramon
12-15-2010, 07:46 PM
Sounds like, after getting a little basis in building simple applications, that the iPhone or Android would be a decent target for getting into a complex messy environment.
Both those platforms are popular, don't have the world's worst underlying languages and of course are hot games platforms. I built a toy Android app for fun when it first came out a couple of years ago, and it seemed relatively easy to deal with. No doubt it's vastly messier now, but, still, how bad can it be.
All the hackers at work use Eclipse for Java, by the way, for what that's worth.
GatInDaHat
12-15-2010, 09:54 PM
Game programming requires a lot of technical and specific knowledge. However, when you're learning to program, it's the fundamentals that apply to all programming that will benefit you the most, after which you can hone in on your specialization. Just learn C++ imo.
RepoMan
12-16-2010, 03:19 PM
Personally I'm happy not dealing with C++, C, or any other explicit-memory-management language. These days I would personally start with C#, both because I am Borged, and because it's a useful language for the whole spectrum of desktop apps (obviously) / web apps (ASP.NET, etc.) / game apps (XNA / WinPhone7). But your mileage may vary.
Here are some suggestions on the best first C# book:
http://stackoverflow.com/questions/46048/what-is-the-best-book-to-learn-c
http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/9282a43f-ee90-4375-8ad1-0f3841194b68
C# is so close to Java that learning one will teach you a lot about the other. C# has some features that Java doesn't, but Java is fixing to add some of them in the next year or two.
Edit: However, if you want to do real game programming, like, programming game engines themselves, then C++ is definitely the right thing. It's also probably the most complex language mentioned in this whole thread, just so you know.
André Costa
12-17-2010, 11:49 AM
Yes. He's not a beginner; he's coded in Java in school. Java is a much more complicated language than C.
Err, what?
Yeah, Miramon, what!?! At least Java doesn't have all those retarded asterisks all over the code. I mean, what the hell are those .. they only ruin my beautiful code.
...
;)
Ezdaar
12-17-2010, 12:00 PM
The most problematic thing I find is the "I didn't learn it this way, but when I read this later, I thought it was great, so you should start there." Like, the common "read SICP" recommendation that you see a lot (though I don't think yet here) -- not a single person in the entire world has ever had SICP as their first exposure to programming.
SICP is a book that people read when they've already been programming for years after learning it in the natural, organic way that people learn things -- by wanting to do something, and learning enough to get it done, hacks and warts and all. People learn to program by typing in GW-BASIC listings from magazines and then changing them to see what happens; by screwing around with Excel and realizing that you could make a text adventure with some seriously funky VBA; by using PHP to put up a web page that counts down to their birthday.
Only after they've done all that do they end up reading K&R or SICP and realize that they were thinking about things wrong, and get that clarifying burst of insight. And then they want other people to skip that preliminary fumbling around, but that's not how it's ever really going to work.
To be fair, SICP is intended and used as a first year CS course book. I think it's focus is more theory of computing rather than programming though.
mkozlows
12-17-2010, 01:02 PM
To be fair, SICP is intended and used as a first year CS course book. I think it's focus is more theory of computing rather than programming though.
Right, at MIT. Every single person in MIT's CS course has been programming since they were in elementary school, I bet.
Ezdaar
12-17-2010, 01:19 PM
I'm actually reading SICP right now as I'd never done so before, and in the Foreword they mention that it's written with the idea that most of their students, even at MIT, have never written any code. Of course, this was in 1996, I'm sure it's changed. Obviously my opinion is perhaps not the most objective since I'm a mathematician, but so far I find it to be very simple and think it does a really great job in explaining how and why things work.
Jazar
12-17-2010, 01:27 PM
I always start a new language with online tutorials. Start very simple then start playing around yourself and see how far you can take things. Keep exploring tutorial documents. Standard programming manuals are sleep aids.
Tutorials are so damn fun whenever I dive in the hours fly by.
mkozlows
12-17-2010, 01:30 PM
However they wrote the book, I think they were wrong about what their students had done. I know even at a much less selective college, I felt bad for the people who were actually new to programming into the Intro class. That look of growing panic as the semester wore on was really something else.
But anyway, I think SICP is precisely the sort of thing that would appeal to a mathematician.
Timex
12-17-2010, 03:25 PM
Miramon's correct in that Java is more "complicated" than C, in that the core language has a lot more features, and largely requires a basic understanding of Object Oriented Programming.
However, Java is infinitely easier to actually make useful stuff in, for the same basic reasons.
Also, Java's got Sun (now Oracle)'s awesome online tutorials... and Android runs Java code (compiled into Dalvik).
With the most recent releases of Sun's JVM, it's become an extremely high performance language, so you can pretty much do anything with it nowadays.
And oh yeah, Lisp is still, after all these years, the best programming language for general purpose applications as well as AI, not to mention for all kinds of other applications. Too bad you can hardly get a job anywhere anymore on the basis of knowing it, though it is used in core code for ITA.
Now, I'm a huge LISP and Scheme fan... used it a lot... but calling it the best language for general purpose applications seems kind of wacky, unless you're defining general purpose application to mean something other than what I'm thinking.
While it traditionally has enjoyed a core following in the academic AI community, it's not really especially suited for AI, unless you're defining AI to specifically mean self modifying machine learning algorithms. In terms of AI that actually gets used for stuff, you're basically making a cognitive architecture and using that, so the language doesn't really matter that much.
What all of this stuff really boils down to though, is that these different languages are just tools in your belt. Any good computer scientist or software engineer should be able to pick up ANY language you give him and get a job done.
This is why I generally recommend that folks pursue actual computer science degrees, rather than just some kind of technology or programming focused school program. Actually understanding how the fundamentals of computation work, while seemingly abstract and useless at first, becomes very important once you start actually creating new technology rather than just using stuff other folks have made.
Miramon's correct in that Java is more "complicated" than C, in that the core language has a lot more features, and largely requires a basic understanding of Object Oriented Programming.
However, Java is infinitely easier to actually make useful stuff in, for the same basic reasons.
That's why I always suggest people check out Processing, since it is a superset of Java that is meant to ease non-technical types into programming. Once you get into more complicated Processing -- well, then you're programming in Java.
peterb
12-17-2010, 07:03 PM
But if you really want a beautiful -- and more importantly short -- programming manual, you still can't do better than Kernighan & Ritchie. Well I guess if you don't want to learn C, there might be better alternatives.
K&R is not the worst of all possible books for a beginner to C to use, but it's pretty damn close. Invaluable as a reference; close to useless as a teaching tool.
I'd suggest C Programming: A Modern Approach by K.N. King, instead.
GatInDaHat
12-19-2010, 12:37 PM
Yeah the reason for recommending C++ is for gaming. I do all my programming nowadays in C#, but the transitioning from C++ to C# is very easy, references are pointer to objects on the heap, delegates are function pointers, generics are effectively the STL.. There are plenty of C# developers out there that don't have a good grasp of the basics because .Net, through design, tries to abstract complexity.
Timex
12-19-2010, 11:14 PM
The thing is though, in the future, games aren't going to be built with C++. They'll be built with a modern language like Java or C#, because there won't be any huge benefit to writing them in lower level languages any more. The massive improvements to performance seen in recent years in languages like Java has largely eroded computational performance as a tradeoff worthy of the pain involved in writing low level language code.
Lower level languages will always have a place at the table when it comes to writing drivers and stuff, but for high level application programming? That stuff is almost certainly going to move to higher level languages, since the performance differences are eroding, while the massive benefits for things like development time will always be there.
RepoMan
12-20-2010, 12:58 PM
There will have to be some real advances in C#/Java toolchains before they can really compete with C++ for true, balls-to-the-wall, every-cycle-counts optimized game engine programming. Ask John Carmack when he plans to switch away from C++ and prepare to hear a bunch of loud laughter. When you are profiling your code with cycle counters, JITs are a horrible idea, because it makes it very hard to control exactly what your code is compiling down to.
Granted, the number of game engine programmers is a lot lower than the number of game programmers generally, and for indie games it's already a very C#-friendly world out there, at least in the Xbox world. And of course loads of games are programmed in Flash, a rather high-level language.
So arguably the AAA territory is becoming relatively less important already, and even AAA games all embed higher-level scripting languages to let level designers etc. do their thing. But a blanket statement that "Java and C# are superseding C++" is simply inaccurate.
lesslucid
12-20-2010, 02:19 PM
"have superseded" would be flat wrong, but I think "are on their way to superseding" is about right. There'll always be a place for C and C++ because anything else that's that close to the metal will just be another variant of C, and sometimes you need something that's really close to the metal for reasons of speed or something else... but for anything that's not speed-critical, it's going to be more and more the case that people will prefer to write it in a higher-level language.
chequers
12-20-2010, 02:57 PM
I don't think you need to start with lower level languages to get a "real" understanding of how to code.
Physics courses don't start with explanations of superstring theory. They show you how lenses work and say "light is a particle". Later on they say "we were lying, light is actually a wave" and show you the double slit experiment. It's a matter of starting high, and peeling back layers as you get more confident. You don't need to learn from first principles.
JoshV
12-20-2010, 03:02 PM
Wait, we have a checkers and a chequers? Or is that pronounced differently than checkers?
sinfony
12-20-2010, 03:03 PM
They are one and the same. Changed to avoid confusion with checker.
mkozlows
12-20-2010, 04:10 PM
The surest guarantee that Java/C# will eventually be used for games is the fact that everyone in this conversation keeps referring to C++ as "low-level."
(Because, of course, there was a time when C++ was the preposterous bloated thing that maybe was okay for toy things, but if you wanted to make a game where performance mattered, you didn't use C++.)
GatInDaHat
12-20-2010, 11:09 PM
The thing is though, in the future, games aren't going to be built with C++. They'll be built with a modern language like Java or C#, because there won't be any huge benefit to writing them in lower level languages any more. The massive improvements to performance seen in recent years in languages like Java has largely eroded computational performance as a tradeoff worthy of the pain involved in writing low level language code.
Lower level languages will always have a place at the table when it comes to writing drivers and stuff, but for high level application programming? That stuff is almost certainly going to move to higher level languages, since the performance differences are eroding, while the massive benefits for things like development time will always be there.
The point is, you learn C++ now and the transition to C# is elementary. I mean an interpreted language isn't going to hang with C++ right now for game development, and you get a better understanding of what's actually going on.
Chris Nahr
12-21-2010, 12:58 AM
C# still isn't interpreted. I agree that knowing the machine-level mechanics is extremely useful, though.
Damien Neil
12-21-2010, 04:17 PM
but for anything that's not speed-critical, it's going to be more and more the case that people will prefer to write it in a higher-level language.
Non-speed-critical code has been written almost exclusively in higher-level languages for a long time now.
Civ IV's game logic is in Python. Civ V's is in Lua. Epic uses UnrealScript. And so on.
And that's just games. Half the Web or more runs on Perl, Python, and Ruby.
psu_13
12-21-2010, 04:58 PM
1. People still teach SICP? That freaks me out.
2. Lisp is dead. Get over it.
3. Pick a problem you want to solve, an application you want to build, then look to learn the tools you need. Not the other way around. What is useful in one context is inevitably useless elsewhere.
That's all I got.
lesslucid
12-21-2010, 08:05 PM
Non-speed-critical code has been written almost exclusively in higher-level languages for a long time now.
Civ IV's game logic is in Python. Civ V's is in Lua. Epic uses UnrealScript. And so on.
And that's just games. Half the Web or more runs on Perl, Python, and Ruby.
I won't argue with any of that. I guess another possibility (although IANAE) is that what qualifies as "speed critical" may also be in the process of changing. ie, where once the game logic might have been in C++ and the enemy AI in lua or Python, now the whole game logic is no longer speed critical and "migrates" over into the higher-level category.
GatInDaHat
12-21-2010, 08:28 PM
C# still isn't interpreted. I agree that knowing the machine-level mechanics is extremely useful, though.
Well let's see, the code is compiled to intermediate bytecode, and then JIT compiled during runtime unless precompiled in the gacc. So you get the point, which is always important.
Chris Nahr
12-22-2010, 12:54 AM
Well let's see, the code is compiled to intermediate bytecode, and then JIT compiled during runtime unless precompiled in the gacc. So you get the point, which is always important.
Yes, but your statement is still wrong. Intermediate bytecode does not imply interpreted execution. Interpreters translate every bit of source or intermediate code every single time it is executed; run-time compilers translate it only once, just like static compilers. You'll notice a huge difference in performance whenever you execute any block of code more than once, i.e. loop bodies or subroutines. The performance of JIT compilers is much closer to static compilers than to interpreters -- that's why calling them "interpreters" is not just technically incorrect but also quite misleading. Someone who is proud of knowing what's actually going on under the hood should get that right.
GatInDaHat
12-22-2010, 03:53 PM
Yes, but your statement is still wrong. Intermediate bytecode does not imply interpreted execution. Interpreters translate every bit of source or intermediate code every single time it is executed; run-time compilers translate it only once, just like static compilers. You'll notice a huge difference in performance whenever you execute any block of code more than once, i.e. loop bodies or subroutines. The performance of JIT compilers is much closer to static compilers than to interpreters -- that's why calling them "interpreters" is not just technically incorrect but also quite misleading. Someone who is proud of knowing what's actually going on under the hood should get that right.
You can be a pratt and go on and on like you just did, or you can just present the jist.. It's slower because there's extra stuff that gets done at runtime... and that's really what the OP wants to know.. of course you wouldn't care about that because you're too busy googling and trying to feel clever.
chequers
12-22-2010, 07:39 PM
Just admit it, there's a third class of languages: Compiled, Interpreted, and Hybrid. Now die in a fire.
GatInDaHat
12-22-2010, 10:23 PM
Just admit it, there's a third class of languages: Compiled, Interpreted, and Hybrid. Now die in a fire.
gives a shit train just left the station
So, Gatindahat, you look like a person who might be interested in talking about Mass Effect.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.