Starting programming

Talk about computers, hardware, applications, and consumer electronics.
User avatar
Lifer
Posts: 1066
Joined: 2008.09.26 (18:37)
NUMA Profile: http://nmaps.net/user/EdoI
MBTI Type: INTJ
Location: Zenica, Bosnia and Herzegovina

Postby EdoI » 2009.06.10 (17:35)

I was working with Game Maker, enjoyed programming a lot and I also worked with Visual Basic (but just basics really). VB seems very limited to me, Game Maker is awesome... beginner program. I think that it's time to get on something else, in my mind I had Python, Pascal, C++ or C#. What to choose? How to start? Suggest.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2009.06.10 (18:23)

I'm really a fan of people starting with Python. I've used it extensively where I work, and I even use it semi-regularly for random things that have nothing to do with programming simply because it's just that goddamn useful. I really think that universities should convert their Introduction to Programming courses to use Python, and then move on to something more low-level and classic like Java or C++ for people who are serious about careers in computer science and engineering.
So yeah, I highly, highly recommend Python for a beginner.

If you want a tradeoff with something better suited for heavily resource-intensive tasks (if you're going into academic research or hardcore video game design, or if you are interested in low-level stuff like robotics or operating system design) but more of a pain in the ass to learn and use, go for Java or C++. The one you pick will in all likelihood come down to a style choice, although I personally would recommend C++ over Java.

If you're interested in a career in software design, .NET is the wave to ride, so you should very definitely go with something like C#.

My advice would be to go with Python, toy around enough to see where your interests lie, and then migrate to another language from there, if you insist on migrating at all.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Lifer
Posts: 1066
Joined: 2008.09.26 (18:37)
NUMA Profile: http://nmaps.net/user/EdoI
MBTI Type: INTJ
Location: Zenica, Bosnia and Herzegovina

Postby EdoI » 2009.06.10 (18:53)

Tsukatu wrote:My advice would be to go with Python, toy around enough to see where your interests lie, and then migrate to another language from there, if you insist on migrating at all.
What to download, Python 2.6 or 3.0.1? Does Python make executable files?
Oh, and if I downloaded Python doesn't mean that it's definite, or that Python will be the only language that I'll (try to) learn, so continue suggesting.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2009.06.10 (23:45)

EdoI wrote:What to download, Python 2.6 or 3.0.1?
For learning purposes, it really doesn't matter. Both are very recently-updated production versions that will have support for a good long time. I'd go with 2.6, though, because if the need arises for you to use Python on a computer you don't own, it's likely they're not going to be bleeding edge on their Python install. Hell, most production machines still have Python 2.3, or 2.5 for newer machines.
Also, there are some extremely useful and common add-ons that only have stable versions for 2.6.
I'm going to assume you're using Windows.
Have some direct download links for 2.6 (I don't know what kind of CPU you have):
Windows x86 MSI Installer (2.6.2)
Windows AMD64 MSI Installer (2.6.2)
EdoI wrote:Does Python make executable files?
Crash course on two categories of programming languages:
  • Compiled languages run your code through a compiler, which creates an executable file. The executable file is machine code specific to your processor. To run a program written in a compiled language on a different machine, you need to recompile the code on the new machine.
  • Interpreted ("Scripted") languages are run by giving your code to an interpreter, which runs all of the code as though reading it like a movie script or to-do list. To run a program written in an interpreted language on a different machine, all you need to do is move the code you wrote, and that's it, assuming that the interpreter is installed on the new machine.
Compiled languages are often used for resource-intensive applications because they run more efficiently, and interpreted languages are arguably more portable and are famously much more easy to code in.
Python is an interpreted language. So no, you will only be making files that have source code as plaintext. If you're gung-ho about compiling your programs for some weird reason, there are ways to do this with Python.

When you install Python (in this example, in the default directory of C:\Python26\), you run programs by giving them to C:\Python26\python.exe on the Windows command prompt.
For example, here's your classic beginning program:
  • open Notepad, or some other plaintext editor
  • type this code:

    Code: Select all

    print "Hello, World!"
  • save as C:\Python26\hello.py
  • open the command prompt: either Start > Accessories > Command Prompt, or Start > Run > type "cmd" and press Enter
  • cd C:\Python26
  • python.exe hello.py
  • do a dance
If you just run python.exe in the command prompt without a script after it, or if you do Start > Python 2.6 > Python (command line), you'll have a line-by-line interpreter. This lets you test out code by seeing the results immediately, and is one of the most totally awesomestest features of interpreted languages that you'll find yourself wishing all languages had. The line-by-line interpreter is the main reason I think Python is an ideal language for beginners.
(Other interpreted languages like Ruby have line-by-line interpreters, too. I wouldn't recommend Ruby only because it's so new and retardedly slow for some resource-intensive tasks you may randomly find you need, and because it seems to me to be more of a proof-of-concept language than something generically useful. It is a breeze to use and learn, though, so I encourage you to have a brief affair with it.)

Other cool optional stuff to pimp out your Python install.

IPython: A particularly user-friendly interface to the line-by-line interpreter. Extremely useful in aiding you in writing your code, if you have it on the side as you're writing your code in a text editor. To install IPython, you need two installers (both of which install very smoothly; just hit Next a bunch of times and you're set): ipython-0.9.1.win32-setup.exe and pyreadline-1.5-win32-setup.exe. To run, do Start > IPython > IPython. Use it instead of Start > Python > Python (command line).

Numpy: The "Numerical Python" package. Has more functions for all flavors of math and levels of interaction with your operating system than you can fit into your brain. Probably the most commonly installed 3rd party Python package. Get it here: numpy-1.3.0-win32-superpack-python2.6.exe

Scipy: The "Scientific Python" package. Has generally useful functions for your science classes and/or post-graduate level academic research. Get it here: scipy-0.7.1rc2-win32-superpack-python2.6.exe

[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Lifer
Posts: 1099
Joined: 2008.09.26 (21:35)
NUMA Profile: http://nmaps.net/user/smartalco
MBTI Type: INTJ

Postby smartalco » 2009.06.11 (15:49)

Processing (<-that is a link) is an amusing language to experiment with. Not that entirely useful; entertaining though.
Image
Tycho: "I don't know why people ever, ever try to stop nerds from doing things. It's really the most incredible waste of time."
Adam Savage: "I reject your reality and substitute my own!"

User avatar
Lifer
Posts: 1066
Joined: 2008.09.26 (18:37)
NUMA Profile: http://nmaps.net/user/EdoI
MBTI Type: INTJ
Location: Zenica, Bosnia and Herzegovina

Postby EdoI » 2009.06.11 (19:41)

About Python:
I've been playing around with code following a tutorial, here's what I've wrote:

Code: Select all

number = 23
guess = int(raw_input('Enter an integer : '))

if guess == number:
	print 'Congratulations, you guessed it.'
	print "(but you do not win any prizes!)"
elif guess < number:
	print 'No, it is a little higher than that'
else:
	print 'No, it is a little lower than that'

print 'Done'
Runned through the Command prompt normally (note that I've already runned the hello thing normally), and the CP returned this:

Code: Select all

File "test.py", line 1
Python 2.6.2 <262:71605, Apr 14 2009, 22:40:02> [MSC v.1500 32 bit <Intel>]
on win32
                 ^
SyntaxError: invalid syntax
Problem?

P.S. that reminds me, it would be useful that text in a code box has "Select all" function.

User avatar
Damn You're Fine
Posts: 384
Joined: 2008.09.19 (01:47)
NUMA Profile: http://nmaps.net/user/littleviking001
MBTI Type: INTP
Location: Southern California
Contact:

Postby LittleViking » 2009.06.11 (20:21)

SyntaxError: invalid syntax
I *believe* in Python 2.6 that print is a function. One of the most noticable changes between Python 2 and Python 3 was that print changed from print "my string here" to print("my string here"). And since 2.6 is meant as a stepping stone between the two, it might have print in the second form there.
Image
The last Metroid is in captivity. The galaxy is at peace...

User avatar
Lifer
Posts: 1066
Joined: 2008.09.26 (18:37)
NUMA Profile: http://nmaps.net/user/EdoI
MBTI Type: INTJ
Location: Zenica, Bosnia and Herzegovina

Postby EdoI » 2009.06.11 (20:53)

LittleViking wrote:
SyntaxError: invalid syntax
I *believe* in Python 2.6 that print is a function. One of the most noticable changes between Python 2 and Python 3 was that print changed from print "my string here" to print("my string here"). And since 2.6 is meant as a stepping stone between the two, it might have print in the second form there.
Line 1 says "number = 23", no printing.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2009.06.11 (21:07)

Weird. It works perfectly fine for me when I copy/pasted.
And it seems to be pointing to a completely blank line. o_O
The caret on the line all by itself usually points to the place in a line where the problem is.
For example, if you had left off the last quote on one of these lines:

Code: Select all

  File "test.py", line 5
    print 'Congratulations, you guessed it.
                                          ^
SyntaxError: EOL while scanning single-quoted string
But your line 1 didn't show up there, which makes me think that something's up with your editor.
Which editor are you using?
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


Plus (Size) Member
Posts: 42
Joined: 2008.09.27 (02:56)

Postby taaveti » 2009.06.12 (02:51)

The "Python 2.6.2 <262:71605, Apr 14 2009, 22:40:02> [MSC v.1500 32 bit <Intel>]
on win32" in the output is a little suspicious. Are there any other arguments in your command line, or are you just running "python test.py"?

[edit]Also, if you don't have any other command line arguments, is it possible that the aforementioned line is actually the first line of test.py? It seems to me (I don't have a python interpreter on this computer to confirm) that the colon where the caret is pointing is, in fact, the first syntax error in that line.[/edit]

Ice Cold
Posts: 202
Joined: 2008.09.26 (11:49)
Location: Australia
Contact:

Postby mattk210 » 2009.06.12 (09:19)

I can say with certainty that python 2.6 does not use python 3 syntax for print. As for selecting everything in a code box, every GUI I've used has allowed ctrl+a for that purpose (can't help you in command prompt though)

The only thing I can think of in line 1 is that:
- maybe there's a weird Unicode character that snuck in that looks like ASCII (sometimes when copypasting code, especially from foreign sources, I get that)
- maybe the variable name "number" is reserved somehow; try myNum or something
Although, neither of these problems should cause a syntax error, and the entirety of the code has no problems on my computer...

Anyway, in relation to the original question, although I totally agree with Tsuki on python, I can also suggest C# because it's easy to use and easy to migrate to C++ when you need more speed, and Flash, for ridiculously easy programming with graphics, and browser-embedding-ability (somewhat lacking in the speed department though).

User avatar
Lifer
Posts: 1066
Joined: 2008.09.26 (18:37)
NUMA Profile: http://nmaps.net/user/EdoI
MBTI Type: INTJ
Location: Zenica, Bosnia and Herzegovina

Postby EdoI » 2009.06.12 (13:10)

I've solved the error today. So far I've used Python Shell that comes with Python, and I saved the file using that. Now, I just copied the code in Notepad, saved as .py file, and it works. Obviously, I'll need Notepad for this.
Matt, what's easier, C++ or C#?

Edit: What's an integer?

User avatar
Semimember
Posts: 22
Joined: 2008.09.28 (14:06)

Postby ZZ9 » 2009.06.12 (16:02)

EdoI wrote:Matt, what's easier, C++ or C#?
C++ leaves a lot more up to the programmer, such as clearing up memory that's no longer being used. Since C# does this automatically, it would be far easier to write if you're just beginning to program. It's also far easier to use the libraries included with C#.
Edit: What's an integer?
An integer is a positive or negative whole number.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2009.06.12 (21:25)

C++ is a slut.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Albany, New York
Posts: 521
Joined: 2008.09.28 (02:00)
MBTI Type: INTJ
Location: Inner SE Portland, OR
Contact:

Postby jean-luc » 2009.06.13 (05:34)

As a note, remember that with the introduction of .NET Visual Basic now has access to all the same libraries and functions as C$ (or VC++ or J# &c.). Both are compiled to CIL, so performance is identical (different approaches to the same problem will result in performance differences, but averaged out it's zero). So, the difference between Visual Basic.NET and C#.NET is now purely a matter of style. Visual Basic is BASIC-style and as such is very readable and arguably easier to learn, while C# is more similar to C-style languages.

That said, C# is the most popular .NET language, so as you search around the internet most of the examples you'll find are in C#. Converting from C# to VB isn't that hard but doing it all the time gets annoying.

I sometimes recommend PHP (via the command-line interpreter) as a first language because it's C-style, but very simple and quick to learn. You can go from PHP to something more complex like Perl and then go to taking on more exciting/terrifying languages like C.
-- I might be stupid, but that's a risk we're going to have to take. --
Image
Website! Photography! Robots! Facebook!
The latest computers from Japan can also perform magical operations.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2009.06.13 (18:51)

jean-luc wrote:Visual Basic now has access to all the same libraries and functions as C$
Zing!
Was that a typo, or were you being awesome?
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


Ice Cold
Posts: 202
Joined: 2008.09.26 (11:49)
Location: Australia
Contact:

Postby mattk210 » 2009.06.14 (11:52)

It's been a while since I used it, but C# is definitely easier than C++. The reason I suggested it is because they have similar syntax so if you learn C# it shouldn't be too hard to move into C++ if you need finer control and speed. Mare and Raigan also advocate C# for easy, rapid prototyping and tool creation.

User avatar
Depressing
Posts: 1989
Joined: 2008.09.28 (01:10)
NUMA Profile: http://nmaps.net/user/UniverseZero
Steam: www.steamcommunity.com/id/universezero/
MBTI Type: ENTJ
Location: The City of Sails, The Land of the Long White Cloud
Contact:

Postby Universezero » 2009.06.16 (11:52)

I've always wanted to program, but if I did all I would probably make is small flash applications. What would be best for me to start with, Python, Java, or C++?
Image

User avatar
The Konami Number
Posts: 573
Joined: 2008.09.29 (22:27)
NUMA Profile: http://nmaps.net/user/_destiny%5E%2D
MBTI Type: ISTJ
Location: UK

Postby Destiny » 2009.06.16 (13:05)

Universezero wrote:I've always wanted to program, but if I did all I would probably make is small flash applications. What would be best for me to start with, Python, Java, or C++?
I believe the second post in this thread deals directly with that qustion -.-
Image
Image

User avatar
Albany, New York
Posts: 521
Joined: 2008.09.28 (02:00)
MBTI Type: INTJ
Location: Inner SE Portland, OR
Contact:

Postby jean-luc » 2009.06.20 (04:43)

Tsukatu wrote:
jean-luc wrote:Visual Basic now has access to all the same libraries and functions as C$
Zing!
Was that a typo, or were you being awesome?
I'm afraid it was just a typo.
All them M$ languages!
-- I might be stupid, but that's a risk we're going to have to take. --
Image
Website! Photography! Robots! Facebook!
The latest computers from Japan can also perform magical operations.

User avatar
Antonio Banderas
Posts: 1703
Joined: 2008.09.26 (13:56)
NUMA Profile: http://nmaps.net/user/donfuy
MBTI Type: ISTP
Location: port

Postby Donfuy » 2009.06.22 (14:29)

I started learning Python for two days, some months ago, and it's pretty easy, following some tuts.


I guess I'm not a programming guy.


But yeah, HELLO WORLD :D
Image

Beyond a Perfect Math Score
Posts: 829
Joined: 2008.09.25 (21:35)
Location: England
Contact:

Postby Luminaflare » 2009.06.23 (20:32)

Universezero wrote:I've always wanted to program, but if I did all I would probably make is small flash applications. What would be best for me to start with, Python, Java, or C++?
Flash applications as in what's on the web? if so actionscript is the language used.

User avatar
Global Mod
Global Mod
Posts: 1416
Joined: 2008.09.26 (05:35)
NUMA Profile: http://nmaps.net/user/scythe33
MBTI Type: ENTP
Location: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Postby scythe » 2009.07.02 (18:00)

Universezero wrote:I've always wanted to program, but if I did all I would probably make is small flash applications. What would be best for me to start with, Python, Java, or C++?
ActionScript 3, of course, though Flash requires a heavy investment to get started.

You could look at PyGame (python) or löve (lua) which are free but don't work in the browser, if paying a license fee for Flash isn't an option for you. You could also make browser-based 3d games with Google's o3d, which uses JavaScript.
As soon as we wish to be happier, we are no longer happy.

Ice Cold
Posts: 202
Joined: 2008.09.26 (11:49)
Location: Australia
Contact:

Postby mattk210 » 2009.07.03 (06:29)

IIRC, you can develop in flash without paying anything using flashdevelop/flex. (I believe the "porting n physics to AS3" thread in the old forums was done this way). On the programming side there's almost no difference, the advantages to buying the full software are mainly related to animation and graphics.

User avatar
Semimember
Posts: 23
Joined: 2009.06.17 (19:54)
NUMA Profile: http://nmaps.net/user/MattyMc13
Location: Western Civilization

Postby MattyMc13 » 2009.07.07 (18:52)

EdoI wrote:I was working with Game Maker.
If you are interested in game programming, then I suggest flash, as that would be a good start. There is these video tutorials somebody found for me and they make it easier to learn it. I also agree with you about Game Maker.


Who is online

Users browsing this forum: No registered users and 11 guests