What to learn first?

Posted by Landus on Mon 02 Jan 2006 05:56 PM — 14 posts, 54,571 views.

USA #0
I've been a 'computer geek' since I was four. I had a 26 MHz Packard Bell with Windows 3.1 to fool around it.

Now, I'm 17. I know alot more, but more towards the hardware found inside a computer and anything on that topic. I can't code at all.

I've recently had people ask me if I could learn, but I don't know where to go, more or less, what language I should learn first.

If anyone could help, it'd be appreciated.
USA #1
I'd say it mostly depends on what you're trying to learn programming for. If you're looking to code for a mud, C is a pretty good starting point.
Australia Forum Administrator #2
Or for beginners, download Lua and do some simple programming in that. Being interpretive it tends to catch most egregious errors and simply give an error message, rather than a crash which can be hard for beginners to work out the reason for.

There is a stand-alone Lua that will run under Windows, and you can edit the programs in any text editor (eg. Notepad) and then try them out using the Lua interpreter.

For example, download this file from the Lua site:


lua5_0r2_Win32_bin.tar.gz


Extract out to get lua50.exe, which you can copy to your Windows directory or somewhere in your path.

Then, start it up:


lua50


Try a "hello, world" program:


> print "hello, world"
hello, world
>


Do a "2 times table":


> for i = 1, 10 do print (i, i * 2) end
1       2
2       4
3       6
4       8
5       10
6       12
7       14
8       16
9       18
10      20
>


And so on. Have fun!

USA #3
I would definitely second Nick's suggestion to start with Lua. When you feel like you have a good grasp and wish to move on try C. Once you have a good understanding of C you can move to C++. Of course at your age you will probably be able to find some college classes to aid you in your studies. Java is also quite common on the college scene (at least at my local college).

Some people don't prefer the C to C++ approach, but I'll stand by my argument that learning C can only help you learn C++. They really arent different languages like many people make them out to be (in my opinion).

Lastly, I would recommend getting a book on the language you choose. Books can be very nice to have, even if it is just for a reference. The internet is not always available and sometimes you don't have a computer near you to look up things or just read on topics.

You can find other various advice by searching the forums as well.

Good luck :)
USA #4
I do play one MUD, but the coding knowledge is just for being able to possibly help code simply programs for myself and friends.

My desktop computer is running XP, but my laptop is currently running Ubuntu, because I couldn't find a better package manager, and I kept getting a BusyBox shell when I tried Arch Linux.

And Gentoo is just plain crappy now.

When I get home from school, I'll get to work on getting what I need to learn Lua.
Australia Forum Administrator #5
You will be able to run Lua under Ubuntu, since it (like many applications) are readily available for Linux. The nice thing is that any programs you write in Lua will be able to be run *unchanged* under Windows Lua, unless you use some of the obscure "os" commands (like os.execute, which will do operating-system specific stuff).
USA #6
I ended up looking at Lua, and it would be something I could learn, but, I've been helping a friend work on a healing system/auto-mapper for the MUD Imperian.

The project is on sourceforge under the project name IMTS. It's all open source, and from what my limited coding knowledge, it's coded in either C or C++.

Because of this, I rather I learn this language first. I have had experience in other language, and know how to go back and fix syntax errors and the such.

The problem with C/C++, I've never found anything that I can understand. I've got once C/C++ book from Borders that bascially has you type in code, then explain it. Problem is that I don't explain how it works once I get halfway into Chapter 1.

Has anyone had this problem, or know how to help?
USA #7
Anyone?

Or did I say something wrong?
Australia Forum Administrator #8
It's hard to know where to start. IMTS seems to be a custom client interface to MUDs, correct me if I'm wrong. According to its page on SourceForge it is indeed written in C.

It is great that you want to learn to program, programming is fun and rewarding.

My advice to you, or to anyone else, however is that trying to modify a MUD client or server is not the best place to start, if you are just learning programming, let alone C.

You are much better off getting to know the basics, loops, variables, assignments, if tests, storing data in things like tables or arrays, and so on. If you learn C you pretty soon have to look at pointers, which are complex for a beginner, which is why I recommended Lua.

Quote:

I've got once C/C++ book from Borders that bascially has you type in code, then explain it. Problem is that I don't explain how it works once I get halfway into Chapter 1.


What can I say?

  • Find a different book that explains it better.
  • Get a friend to help explain the examples to you. Often a "real" person explains better to a book, as you can explain what you don't understand.
  • Take a programming course, at school, or adult-education, depending on your age.
  • Look for "how to program in C" web sites. There must be hundreds of them.


Quote:

Has anyone had this problem, or know how to help?


This question is so general it is impossible to answer. We all have had problems in the past, sure.

If you post a specific example (of code), and ask a specific question, I am sure someone will try to help.
Amended on Mon 09 Jan 2006 06:39 AM by Nick Gammon
USA #9
I couldn't find a Windows version of Lua at all.

Appears to only have it available for *nix.
Australia Forum Administrator #10
http://luaforge.net/frs/download.php/788/lua5_0r2_Win32_bin.tar.gz
Australia Forum Administrator #11
Use Winzip to unzip that file. It has a handful of files in it (in a subdirectory):


05/05/05  23:32                 36,864 bin2c50.exe
05/05/05  23:30                106,496 lua50.dll
05/05/05  23:32                 20,480 lua50.exe
05/05/05  23:32                 20,480 luac50.exe
               6 File(s)        184,320 bytes


To play with Lua, just run lua50.exe.
USA #12
Now to find out how to code in Lua.
USA #13
I strongly recommend the book 'Programming in Lua': http://www.lua.org/pil/. While it doesn't teach programming per se - it teaches Lua - it should be enough to get the hang of some basics.