Jump to content

Recommended Posts

Posted

Seriously, what's the best programming language to start with? I want to learn how to program, but I've got no experience. I can barely do the bastardized xml the forums use for text formatting.

Posted
try python, its pretty easy and is similar to C/C++ if you want to progress onto a more 1337 language.

 

So, python THEN C++?

 

Online resources would be great, also.

Posted

Yes, try Python, it's at a great level of abstraction for solving general problems.

 

After you've become proficient with Python and want to learn another language, I'd suggest skipping C++ entirely and learning C. C++ is at an absolutely terrible level of abstraction, heaping tons of complexity onto the otherwise simple language C was while not providing a whole lot of benefit in terms of making the language higher level.

 

C is a great, simple language which provides an excellent abstraction for how CPUs (i.e. Von Neumann machines) actually work, and for that reason is often referred to as "portable assembly language"

Posted
Yes, try Python, it's at a great level of abstraction for solving general problems.

 

After you've become proficient with Python and want to learn another language, I'd suggest skipping C++ entirely and learning C. C++ is at an absolutely terrible level of abstraction, heaping tons of complexity onto the otherwise simple language C was while not providing a whole lot of benefit in terms of making the language higher level.

 

C is a great, simple language which provides an excellent abstraction for how CPUs (i.e. Von Neumann machines) actually work, and for that reason is often referred to as "portable assembly language"

 

You can write segments of C code and put that in your python code, right? What would be the benefit of that?

Posted (edited)

C can run much faster, so if you're doing something processor intensive you might want to write that in C to make the best use of your CPU while keeping the overall program in Python to make the best use of your time.

Edited by javagamer
Incredibly minor punctuation thing
Posted
You can write segments of C code and put that in your python code, right? What would be the benefit of that?

 

As javagamer said, speed.

 

There's also Psyco which can compile a subset of Python down to native code.

Posted

On the other hand C++ is usually the language people choose when doing something serious, and unlike C it supports OOP and generic programing, something which makes my life a WHOLE lot easier. So I don't know if it's fair to completely shunt C++.

 

Anyway, since I only program in C++ (and C) those are the only two languages to which I can provide some links:

 

C Tutorial, one of the most thorough I found on the web back in my time:

Beej's Guide to C Programming

C++ Tutorial, the only tutorial I found on the web that seemed worth it, and IMHO it couldn't get much better. Also has a forum, although last time I checked (about half a year ago) it wasn't all that active. That maybe changed.

LearnC++

A C, C++, C# Windows, game and network programming board. Probably one of the best out there (not sure though, don't take my word for it), I usually get my answers withing a couple of minutes at most.

Cboard

 

Those are just tutorials to the languages themselves, but there's still lots to learn after that.

 

Wish you luck

Posted

I'm in a similar position and am starting with Python. I went to the used bookstore and got a book for $15 bucks, so I'm good to go.

Posted
I'm in a similar position and am starting with Python. I went to the used bookstore and got a book for $15 bucks, so I'm good to go.

 

I went to Barnes and Noble and most of the books were at least $45. Even the dummies book was >$25.

Posted
On the other hand C++ is usually the language people choose when doing something serious

 

If you're talking about writing Windows desktop apps, that still holds true. However, the role of Windows desktop apps in the totality of the software development space is no longer dominant and is a shrinking field.

 

Java has completely eclipsed C++ in the enterprise software space. C# certainly gets an honorable mention as well.

 

unlike C it supports OOP and generic programing, something which makes my life a WHOLE lot easier. So I don't know if it's fair to completely shunt C++.

 

Yeah, uhh...

 

Actually I made up the term "object-oriented", and I can tell you I did not have C++ in mind.

 

If you want an object oriented language, C++ is possibly the worst choice available. I am not a fan of Java but it certainly does a much better job.

 

That said, if object orientation is desirable, there are many languages which are substantially better than C++. Java and C# get an honorable mention, but if you'd like to leverage the full power of object orientation, Python or Ruby would be much better choices.

 

I suggested C because it gives a good model for understanding how CPUs work. It does not provide a good model for solving general problems. That was the goal of C++, but really, it does a terrible job. C++ succeeded in dragging legions of programmers out of C land and getting them to start thinking in an object oriented manner, but that's all its accomplished, and its time is over. C++ is not a growing language for a reason.

Posted
I went to Barnes and Noble and most of the books were at least $45. Even the dummies book was >$25.

definitely stick with the used book stores or, failling that, free online guides.

Posted (edited)

If you're partial to learning Ruby instead of Python, there's an excellent free online guide which won't bore you to death:

 

http://poignantguide.net/ruby/

 

Ruby and Python are effectively the same languages with some relatively minor semantic differences. Python has more uptake by quite a bit, but Ruby remains one of the top 10 most commonly used languages as well.

Edited by bascule
Posted
...If you want an object oriented language, C++ is possibly the worst choice available...

...That was the goal of C++, but really, it does a terrible job....

 

Why would so many people be using it if it were truly such a terrible language? I mean no disrespect, but you're the first person I know to say something like that, although the truth is I don't know that many people. Could you specify the reasons on which you base your opinions?

 

...and its time is over. C++ is not a growing language for a reason.

 

What's the reason?

 

Growing as in more people aren't using it, or growing as in updates to the language? If the latter, you've got C++0x which is supposed to be released in a couple of years. If the former...

 

tpci_trends.png

 

I'm not sure how accurate or reliable tiobe is, but it clearly shows that C++ has been the third most used language on the internet, and while its use has gone down, so has the use of other major languages.

 

Please understand, I'm not trying to prove you wrong, I'm just trying to understand your reasoning, since as I said, you're the first I've heard this from.

 

PS.: Mods, feel free to split this to a separate thread, I'm kinda going off topic here

Posted (edited)
PS.: Mods, feel free to split this to a separate thread, I'm kinda going off topic here

 

I'll just go ahead and respond in another thread. I'd like to avoid a duplication of ecoli's "what language should a beginning programmer use" that just devolved into a language war.

 

By the way yourdad, if you're looking for a good book for learning Python, Dive into Python is excellent and available for free online. However, it somewhat assumes you already have a programming background to begin with, whereas the Ruby book Why's Poignant Guide to Ruby (also available for free online) is specifically designed for people who have never programmed before and tries to make learning programming fun and interesting.

Edited by bascule
Posted
In my experience, it helped a lot learning how to program in an imperative programming language, rather than in an object-oriented language. Try C.

 

Imperative languages and object oriented languages are orthogonal. In fact the way most object oriented languages work is incredibly imperative. "Object" is just a fancy word for state and "calling a method" is just a fancy word for making a function call which may or may not mutate that state.

 

Perhaps you were meaning to say structured versus object oriented. I would very much not recommend learning a structured language as your first language.

  • 3 weeks later...
Posted (edited)

So, I just made my first program that actually does something. Input a number and it tells you if you guessed correctly and whether you need to guess higher or lower if you did not. Sure it's simple, but I just started learning today(I went underway the day after making this thread).

 

#!/usr/bin/python
#Filename: if.py

number = 42
guess = int(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\'s a little higher than that')
else:
   print('No, it\'s a little lower than that')

I'm working through A Byte of Python and this code came from there(and before you ask, the creative commons license allows posting any portion of the text as long as you properly attribute it). The pdf is available for free online, or you can buy a paper copy.

 

edit: if you're following along as well, you may notice I changed the program a little bit. This is also allowed by the license.


Merged post follows:

Consecutive posts merged

I started playing with the code and came up with my own take on it. This one keeps running until you guess correctly.

#!/usr/bin/python
#Filename: if.py

number = 42
running = True

while running:
   guess = int(input('What number am I thinking of?  '))

   if guess == number:
       print('Damn, you got me!')
       running = False #causes loop to stop
   elif guess < number:
       print('Nope, it\'s a bit lower than that.') #tricks user
   else:
       print('Nope, it\'s a bit higher than that.') #tricks user

Edited by ydoaPs
Consecutive posts merged.
Posted

Probably hurt a lot less than trying to open a window in c++......................... >:D

 


#include <Windows.h>


LRESULT CALLBACK WinProc(HWND han_Wind,UINT uint_Message,WPARAM parameter1,LPARAM parameter2)
{
    return DefWindowProc(han_Wind,uint_Message,parameter1,parameter2);
}

int APIENTRY WinMain(HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR     lpCmdLine,
                    int       nCmdShow)
{
WNDCLASSEX  windowClass;		
HWND		hwnd;				


windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = WinProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon(NULL, IDI_SHIELD);
windowClass.hCursor = LoadCursor(hInstance, IDC_ARROW);
windowClass.hbrBackground = NULL;
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = "NULL";
windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);

RegisterClassEx(&windowClass);

hwnd = CreateWindowEx(NULL,		
	"NULL",			
	"*****",		
	WS_OVERLAPPEDWINDOW |		
	WS_VISIBLE |
	WS_SYSMENU,
	0,0,			
	1600,1000,			
	NULL,				
	NULL,				
	hInstance,			
	NULL);				

return 0;
}

 

Just out of curiosity yo Daddy oaPs why do you want to learn to program? Aside from stretching the limits of your capacities to think and solve........ There are just a lot of threads about this right now and I don't see any indications as to why it would be such a great thing to do.

Posted
Probably hurt a lot less than trying to open a window in c++......................... >:D

 


#include <Windows.h>


LRESULT CALLBACK WinProc(HWND han_Wind,UINT uint_Message,WPARAM parameter1,LPARAM parameter2)
{
    return DefWindowProc(han_Wind,uint_Message,parameter1,parameter2);
}

int APIENTRY WinMain(HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR     lpCmdLine,
                    int       nCmdShow)
{
WNDCLASSEX  windowClass;		
HWND		hwnd;				


windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = WinProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon(NULL, IDI_SHIELD);
windowClass.hCursor = LoadCursor(hInstance, IDC_ARROW);
windowClass.hbrBackground = NULL;
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = "NULL";
windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);

RegisterClassEx(&windowClass);

hwnd = CreateWindowEx(NULL,		
	"NULL",			
	"*****",		
	WS_OVERLAPPEDWINDOW |		
	WS_VISIBLE |
	WS_SYSMENU,
	0,0,			
	1600,1000,			
	NULL,				
	NULL,				
	hInstance,			
	NULL);				

return 0;
}

 

Just out of curiosity yo Daddy oaPs why do you want to learn to program? Aside from stretching the limits of your capacities to think and solve........ There are just a lot of threads about this right now and I don't see any indications as to why it would be such a great thing to do.

 

I've recently spent a lot of time thinking about consciousness and how to give it to machines. Learning a program language or two seemed like a logical step. :P

Posted
I've recently spent a lot of time thinking about consciousness and how to give it to machines. Learning a program language or two seemed like a logical step. :P

 

Hey awesome................. that makes perfect sense! :P

Posted
I've recently spent a lot of time thinking about consciousness and how to give it to machines. Learning a program language or two seemed like a logical step. :P

 

You do know about NuPIC, right?

 

You can hack on it in Python.

Posted
I've recently spent a lot of time thinking about consciousness and how to give it to machines.

 

You know, that is exactly what I did when I started. I got stuck on emotions :D

Posted
You know, that is exactly what I did when I started. I got stuck on emotions :D

 

Emotions are necessary for intelligence. Now that you know that, keep trying :P

 

First one to make skynet gets to survive Judgment Day!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.