#1 Posted by krystians (409 posts) -

Hello GBers,

I am interested in learning how to code. I am obviously a beginner, but I want to see if it can be something that I can get into.

I don't know if there is any difference in coding a game or say a computer program, so I hope someone here can clarify for me. Coding a program is something I want to learn.

I am a Mac user, with no access to a PC so please recommend how I should start. I heard XCODE was a good Mac program so I downloaded that. But I need tutorials etc. I also know there are a few different types of languages to learn, which is one is used mostly?

Thanks you all in advanced, PM are more then welcome.

-Krystian

#2 Posted by Mastercheesey (220 posts) -

This is a good site for html and css if thats what your looking for http://teamtreehouse.com/

#3 Posted by predator (357 posts) -

@Mastercheesey: That's markup and style sheet language, not programming.

#4 Posted by SexyToad (2722 posts) -

I heard c++ is a good language. I'm also a begginner. That's what I've been studying. I've been reading a book so you can look online for a PDF.

#5 Posted by CosmicBatman (317 posts) -
#6 Edited by joemarch (25 posts) -

For anyone beginning I'd recommend either java or C to get used to the basic concepts (variables, arrays, if/else, functions) and then when you are more confident move on to c++

EDIT:

I hear Xcode is good for learning C

#7 Posted by AFunGuy (21 posts) -

You should start with some sort of object oriented programming languages, like java or C++. I would even suggest with something Python or Ruby on Rails. Those two are a little easier to grasp but not nearly as powerful or robust.

#8 Posted by GS_Dan (1397 posts) -

My advice is to learn a strict language first (that is, one which doesn't allow you to make syntax errors such as capital letters) as that will help encourage you to develop good coding style.

I'd advise learning Java first- it's fairly easy to read and learn and shares concepts with many other languages (it's VERY similar to C#, which is what 360/Windows Phone XNA games are written in, for example). Java also runs on lots of devices so is a very practical language- if you have an Android device Java is very easily adapted to write Android apps.

I'm going to start learning C++ soon and I hear it's a little more difficult to pick up.

#9 Posted by Falx (347 posts) -
#10 Edited by Bio2hazard (143 posts) -

Hey,

When learning programming, the language hardly matters: The main thing is wrapping your mind around the logic. Once you understand how things generally work, it's extremely easy to pick up a new language, as all languages follow the same logic. Sure, they each have their own unique traits, but once you learn one language, picking up another is easy as pie.

Personally, I started with basic HTML and CSS, even though yes, they are markup languages, then went to PHP and spent many years studying PHP, then got into Java, JavaScript, jQuery, C, C++, C# and now ActionScript3. Not saying that's a path you should follow, but it just goes to show that learning one language makes working in another fairly easy. :)

Now then, for your first real programming language: C++ is the most extensively used, and forces you to write proper code which is good. On the flipside, actually making a non-console (i.e. visual/GUI) program is fairly difficult in C++ unless you nab some classes. In some ways, I would say C++ is fairly complex. Normally, I would recommend C# but due to the mac thing, that one is out.

If you start with C++, start at the very beginning. Command line interface apps only. Start with looking up how to code Hello World in C++ ( make sure to find a C++ tutorial, as C and C++ have some differences in how to input / output text ). After you get text output ( like hello world ) to work, you should look into text input. Make a simple calculator where you give it 2 numbers and have it give you the result of adding the two together. Afterwards, you can try to even make the action you want the calculator to perform dynamic.

Next up would be learning about variables and variable types. Learn which variable type to use when. As a fun task, make a small program that reverserses any text you type in. Or have it apply ROT 13 ;)

The thing with C++ is that it gives you a incredible amount of power, all the way down to messing around in the machines memory, which many of the higher level languages don't allow you to do. Pointers are a blessing, but they can also be really complex and mind bending. But it's always good to know how to use these things in case you ever need to.

Another suggestion would be to start with LUA. It's platform independent, easy to learn and incredibly fast. It is also used as a scripting language in video games. ( For example, WoW addons are coded in lua ). While I personally have not worked with it, I keep hearing really good things about it, and if I had the time I would definitely check it out myself.

Ah yes, I'd like to add that, when learning ActionScript and the FLEX framework recently, I stumbled across the Flex in a Week tutorial series. I think the basic Object Oriented Programming lesson they offer is really helpful in grasphing object oriented concepts, which can be applied in any language that supports OOP, not just FLEX. So I would suggest giving it a looksie even if you don't plan on working with FLEX: http://www.adobe.com/devnet/flex/videotraining/_jcr_content/bodycontent1/modal_12.content.html ( For the general overview of all lessons: http://www.adobe.com/devnet/flex/videotraining.html )

#11 Posted by HelicopterSpy (148 posts) -

I'm currently learning Lua, just started like a few days ago, in fact. I've had a little experience making shitty flash games and shitty websites, but nothing too deep. If you're looking to make a game, Lua seems like a good introductory language. I'm using the Love2d engine as a starting point. It has a lot of documentation and a few video tutorials that are good if you know nothing about the language.

I've gone from almost zero to making a stupid Galaxian/Galaga type game in just a couple days, so I'd say start there.

#12 Edited by nobel (58 posts) -

@Bio2hazard said:

Pointers are a blessing,

Blasphemer!

Also, i agree with Bio2hazard's post. Picking a language is not that important as long as you get your head around the concepts, and C++ is a good, platform-agnostic language.

#13 Posted by Green_Incarnate (1791 posts) -

I'd say programming can be different depending on what you're trying to do, so yes, naturally game programming is different from coding an app or OS. The only thing I can think of that would be directly similar would be the GUI, and even then it won't be exactly the same. It's mostly problem solving. Now there are basic concepts that you'll be using throughout all your coding, and that's what you'll need to learn first (conditional statements, looping, types, objects, data structures). These things can be accomplished differently depending on the language, but you should be aware of their concepts and have experience implementing them in your language of choice. That's all you need to start programming.

#14 Posted by nobel (58 posts) -

@CosmicBatman said:

Good timing because starting tomorrow this is happening

That is pretty awesome. Khan does good work.

OP, you should keep an eye on this.

#15 Posted by Scrawnto (2466 posts) -

@nobel said:

@CosmicBatman said:

Good timing because starting tomorrow this is happening

That is pretty awesome. Khan does good work.

OP, you should keep an eye on this.

Yeah! Khan is awesome! I'm a professional software developer, but I'll probably go through some lessons just to see how they teach it.

#16 Edited by CosmicBatman (317 posts) -

@Scrawnto said:

@nobel said:

@CosmicBatman said:

Good timing because starting tomorrow this is happening

That is pretty awesome. Khan does good work.

OP, you should keep an eye on this.

Yeah! Khan is awesome! I'm a professional software developer, but I'll probably go through some lessons just to see how they teach it.

It's up now: Khan Academy

Very basic stuff but it seems cool.

#17 Edited by Puddlesworth (59 posts) -

Any language is probably fine to start with, however I think something easier like Python is better for beginners. C++ is a beast of a language, I won't say it'd be bad to start with, but It wouldn't be my suggested beginner language. The trick is, once you learn your first language it becomes much easier to learn others. C or C++ would be a great second language (again just my opinion).

Code Academy is a good place to start, you can learn Python or web languages/markups (javascript, html, css).

http://www.codecademy.com/learn

If you want a full academic class I recommend this: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/index.htm

It has lecture videos, and exercises (the class is taught in python so if you ultimately choose a different language it wont be as useful)

The new Khan Academy CS courses sound awesome and seems to be taught in javascript. I only know a little javascript, I think it could be a decent starter language but it has some weird quirks that might be annoying.

#18 Posted by Shivoa (645 posts) -

Good news, OS X comes pre-installed with Python and it's a great languages to dip your toes in the water. It is easy to understand (once you get that indentation is how it structures things rather than the more common curly brackets to denote sections), has a nice immediate interpreter (so it's like a command prompt, you just type and when you hit enter it executes what you just typed so this means you can build up line by line as you go, no compiler errors or so on), and is generally a decent start for a first language (before you start to have views about dynamic vs statically typed and how much hand holding you want and if Garbage Collection is worth it to never have a memory leak and on and on into details that you don't need to worry about if you're just starting out).

You may want to update to the latest revision if you're not running the latest OS X edition (and even if you are there might be a slightly newer version). I'm a big fan of 2.7.x (rather than 3) but that's because that's the version I'm used to and I don't see 3 as having a load of new things I really want to move to using. I'd recommend installing 2.7.3 (comes with IDLE, an alternative to XCODE) from the site and the going through the tutorial and then let your desires drive what you find out about going forward.

Bad news, you might be swayed by the voices saying the first language you ever touch should be C++. C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off. I'd rather new students don't end up missing limbs from their early experiments with coding, in a lot of ways C and C++ are harder than they need to be in a modern world where we have so much horsepower and have figured out some nice tricks to abstract further from the metal. Many coders will end up working in C++ but not a lot of coders start there.

#19 Posted by Mr_Skeleton (5154 posts) -

@CosmicBatman said:

Good timing because starting tomorrow this is happening

What is that?

#20 Posted by CosmicBatman (317 posts) -

@Mr_Skeleton:

It's up now: Khan Academy

Very basic stuff but it seems cool.

#21 Posted by Dagbiker (6978 posts) -

I learned C++, and My advice would be to start basic, don't go overboard with your first program. Dont aim for 3d graphics and ragdoll. Aim for a Text adventure, and expand on that, or aim for a dungen crawler like NetHack.

#22 Edited by theManUnknown (187 posts) -

I've always appreciated this following site. There's a lot of resources out there for learning programming, and this one does the best job of aggregating them all I've yet seen.

http://noexcuselist.com/

#23 Edited by Mushida (26 posts) -

Java is the most popular language, but not for games. I'd advise not starting with html. I think C/C++ are the most popular for games, But for a beginner they maybe hard to debug.

But start with the basics, No short cuts. Learn about data types, arrays, classes, structs, pointers, sockets and event handlers. When you have good grasp on those maybe then look a SDL and openGL.

@Bio2hazard's post is a good guide line.

If I was to give a class on beginner programming I'd go with Java.

Then move to Python, C or C++.

#24 Posted by Shivoa (645 posts) -

Another option (as SDL is either incomplete for the modern 2.0 flavour or rather old and crufty) for a C or C++ 3D experience is GLFW. I have rapidly iterated on a project using GLFW without finding anything annoying (but it is quite possible that SDL 2.0 is a lot closer to finished today than it was then - I will be giving SDL a fair shake because it definitely sounds like it is doing a lot of things right - great video if you want some ideas of libs to help making some game but I really should stress that month 1 in not when you start poking at OpenGL unless you're already ahead in maths and eat quaternions for breakfast).

#25 Posted by Mr_Skeleton (5154 posts) -

@CosmicBatman: I could have seriously used that three years ago >.<

#26 Edited by Rebel_Scum (769 posts) -

Yeah is on the money. Though I would suggest (from my own personal experience) starting with java to learn the concepts and java syntax. From there learning a different language will just require you to learn the syntax and the additional functionality the new language may posess. I would recommend C# after that but since you're using Mac I guess you can't use that language as its windows based but I could be wrong, C++ is what most modern games are coded in (Minecraft is all Java which still baffles my mind). Learning to code is the fun part but try not to neglect System Analysis & Design methodologies. Whilst it can be fun to write code, its very easy to write bad code too.

Ssearch for 'TheNewBoston' channel in youtube. That guy has got heaps of tutorials for different languages and they ain't boring.

Good Luck.

#27 Posted by Xeiphyer (5611 posts) -

Try learning Python or Java when you're starting out, especially Python. Its more modern and a lot easier to read and understand the concepts. Since those concepts are related to all programming languages, its a lot easier to move into an older and more versatile language like C++ after.

#28 Edited by RadixNegative2 (526 posts) -

Go C in my opinion. It is a small language that is easy to learn and many other languages are based off it's syntax. It is widely adopted for many platforms and you will potentially get a better understanding of the underlying hardware since it is slightly lower level than other popular languages. Also there is the benefit of the book The C Programming Language which is in my opinion one of the best programming books available.

For Mac development using xcode is a good idea. You can also use others such as Eclipse or Netbeans. There is also the option to use a text editor like Vim, but that will be frustrating when you're just starting, so try to avoid that for now.

This video should be helpful:

#29 Posted by Zelnox (395 posts) -
#30 Posted by TyCobb (1973 posts) -

Since you are on a Mac, I would recommend Java or some flavor of C since they are statically typed. I would not recommend a dynamic language for someone just starting out. The exclusion to that rule would be if you were wanting to do web programming and then I would recommend Python+Django.