PDA

View Full Version : Programming Language



Kutux
July 21st, 2011, 09:20 PM
Hi everybody!

I am a high school student and I think its time to learn a programming language . What do you suggest to improve myself?

Thank you.

Firecast
July 22nd, 2011, 02:20 PM
Obviously, the first language that a beginer must learn is C. Then my suggestion would be python mainly because it has diverse range of applications and the fact that its not too complicated.


Hope this helps..

MG&TL
July 22nd, 2011, 02:30 PM
I would suggest that is not absoluteley necessary to learn C-it is quite annoying at times and the error checking is not as good as it could be. I would suggest a derivative, such as C++ as this is more logical and is now something of a standard.

However, programming can be very daunting, and I would suggest the 'Processing' language-it has similarities to Java and C++, and produces quick, visible, graphical, interactive results, as well as setting you up to learn Java or C++. It exports Java applets, and the IDE is available for linux.

The IDE, tutorials, an exhibition, and example code can all be found here:

http://processing.org/

I've had a lot of fun with it, and even began to program games, although this was laborious, before I moved on to 'serious programming' with C++.

I'm not saying that C is not worth learning, but I would also say that I find it out of date, and C++ is faster growing, and I would say better supported.

JASONFUSARO
July 22nd, 2011, 02:41 PM
Probably it would be best starting out with basic, you wouldn't have to worry about trying to understand the compile process at first and you would get your feet wet with logic, syntax, structure, variable usage, then maybe C++, or fortran to experience the difference. Write some software in basic and then duplicate it in the other languages. All have a Hello World example do that in each.

I have used Visual Basic extensively, had Cobol, Fortran, C++, RPG, Assembler.


Experiment and jump right in to one have fun with it.

Simian Man
July 22nd, 2011, 02:42 PM
Obviously, the first language that a beginer must learn is C. Then my suggestion would be python mainly because it has diverse range of applications and the fact that its not too complicated.
Why should someone "obviously" learn C as their first language. It would be my second to last suggestion.


I would suggest a derivative, such as C++ as this is more logical and is now something of a standard.
And there is my last suggestion! While C++ is a bit more bearable to program in than C, I'd argue that it is an even worst first language since it is more complicated and has more dark corners. Neither language is really good for teaching programming concepts as you will be more focused on irrelevant low-level and doesn't offer any useful abstractions.

I would recommend Python as the best option for beginners. It is a great language with lots of support, lots of libraries, and will let you learn programming without getting in your way too much.

I've never heard of Processing before, so I can't comment on that, but it is an interesting idea.

cgroza
July 22nd, 2011, 02:43 PM
I have started with Python. But I recommend any scripting language such as Ruby or Perl.
These languages kind of get out of your way and let you focus on the concepts.

kellemes
July 22nd, 2011, 02:48 PM
Just a suggestion.. (Object) Pascal.
It was the first language I learned and I still often enjoy using it.. there is a very cool (Delphi-like) cross-platform Rapid Application Development Environment available.
Free Pascal (http://www.freepascal.org/)
Lazarus (IDE) (http://www.lazarus.freepascal.org/)

Have fun whatever choice you make.. :popcorn:

MG&TL
July 22nd, 2011, 02:55 PM
Of course, it rather depends on what you ultimately want to do...many young programmers want to make games, but you may not.

Volens
July 22nd, 2011, 05:13 PM
I don't have much programming experience, but as you can tell from a few of the previous posts: Focus on Structure.

I recently took an Intro to C course and many kids struggled because they failed to structure their programs well and sort of modularize parts of the problem they were solving.

Not to boast (I don't even claim to be good), but the professor was awfull and most of the kids I knew said they learned more from me than from her. I'm dreading next semester, I have data structures and algorithms with the same prof because there was no other option.

I found that when I focused on structure, the rest flowed from there. This may change with more advanced programming however, IDK.

With that said, I would start with a simpler language/scripting (Python, Perl etc.). I haven't really used either of those, but after using C, anything I did with BASH or PHP was relatively easy because I had focused on structure.

roololing
July 22nd, 2011, 07:12 PM
I'm currently in high school on the robotics team (shout-out to team 2460!), and even with all of the simpler options we were provided with, our teacher strongly suggested we use c and c++. We learned relatively quickly, but we had an experienced programmer to help us along the way.

To start with learning structure, I would suggest something easier, such as Python. Once you learn the basics (if statements, while loops, and things like syntax and sequencing), you'll probably be able to decide for yourself which direction you want to go.

snip3r8
July 22nd, 2011, 07:33 PM
C++ !!!!!!!! ,ive tried VB,C#,Python,java and then i tried C++.I regret not just learning C++ from the beginning,its so much better than pretty much everything out there.

The Cog
July 22nd, 2011, 08:08 PM
Moved to Programming Talk.

I suggest that you read the stickies at the top of this forum. Especially the programming guides and basics. You will get more and better thought out answers there than posting this question (re reading the replies to previous postings of this question.

stchman
July 22nd, 2011, 08:45 PM
I recommend Java. Java teaches good programming habits, is VERY well documented, and if properly written will be platform independent.

JupiterV2
July 22nd, 2011, 08:52 PM
No Tcl or Scheme suggestions?

rcktsingh
July 22nd, 2011, 09:59 PM
I would say Verilog-HDL or VHDL. Welcome to hardware !!!

ve4cib
July 22nd, 2011, 11:06 PM
Oh, look. This thread again...

The way I see it there are two major schools of thought when it comes to teaching/learning programming (and both have already been brought up in this thread):

1- Start off with very low-level stuff (memory management, pointers, etc...) and keep the programmer very close to the hardware. Once you understand how to do all that low-level stuff then you'll have a very good understanding of how/why higher-level languages do what they do. Proponents of this approach will usually suggest starting off with C or C++, and then branching off into other languages like Java or Python.

2- Start off with the high-level, abstracted languages so you can focus on learning about code flow, data structures, and algorithms, without worrying about how every piece of memory is managed internally. Once you understand how to write high-level code you'll have an easier time learning the low-level stuff, since you've already gotten your feet wet with some basic coding theory. Proponents of this approach usually go for Java, C#, or Python as the first language, and then introduce C or C++ later.

Neither approach is "wrong." Different schools/universities use each approach, and all seem to produce capable programmers in the end.

Personally I subscribe to option #2, simply because that's how I was taught.

Learning C first (option #1) really throws you into the deep end right away, and seems like it could be quite bewildering. The initial learning curve is harder, but once you get past the first few weeks you'll probably be able to pick up Python or Java very quickly.

Option #2 on the other hand has a somewhat gentler, longer learning curve. It's a much more gradual way to learn how to program. Start off with the easier languages that do a little more hand-holding, and then slowly add more and more complications.

This is of course assuming you'll eventually want to learn multiple languages -- something I endorse. Learning multiple languages makes a good programmer even better, and gives you a much broader set of tools when it comes time to solve any particular problem.

Think of programming languages like a surgeon's set of scalpels. They all do the same thing generally (make a computer do what you want it to do in the case of programming, or they cut through tissue in the case of a scalpel), but each one has a specific niche where it performs best. You wouldn't write an OS kernel in Python, but you probably wouldn't write a database backup & compression program in VHDL either.

MBybee
July 23rd, 2011, 12:06 AM
I also subscribe to the first method - learn *why* it works, then learn how to do it.

If you're just hacking around instead of learning to be a real dev (like you already have a job, just need stuff to work), I recommend Perl.

Starting with either C or Basic is always good in my opinion, since they are good foundations for almost every other language.

As for Java? Never, ever, ever learn Java. I'd rather hold a sign by the freeway than code in that again :)

CptPicard
July 23rd, 2011, 12:15 AM
You misunderstand the issue, sorry. :)



1- Start off with very low-level stuff (memory management, pointers, etc...) and keep the programmer very close to the hardware. Once you understand how to do all that low-level stuff then you'll have a very good understanding of how/why higher-level languages do what they do.


I understand that you're just representing a position, but... no, you will not. The whole point why approach #1 is wrong to begin with is the expectation that you would actually learn from the low-level languages themselves "why" and "how" the high-level languages do things. They are equivalent, and the mapping between the two (the compiler/interpreter) is just a translation problem that has absolutely no bearing on any specific particular problem at hand. If it did, we no longer would be dealing with universal programming languages.


Once you understand how to write high-level code you'll have an easier time learning the low-level stuff, since you've already gotten your feet wet with some basic coding theory.

I'll have to take issue with you mentioning the word "basic" here. Lisp for example may be both very abstract and minimalist, but the ideas therein are not necessarily "basic". The reason why you can move to the lower-level languages is that you've have already been exposed to programming in general, period, and that something like a programming model based on imperative state-changes will be, conceptually, a subset of what you've been doing already. Plus, you have had a lot of other stuff to play with that has shaped your ideas of what you will want in a program.



Learning C first (option #1) really throws you into the deep end right away, and seems like it could be quite bewildering. The initial learning curve is harder, but once you get past the first few weeks you'll probably be able to pick up Python or Java very quickly.

Option #2 on the other hand has a somewhat gentler, longer learning curve. It's a much more gradual way to learn how to program. Start off with the easier languages that do a little more hand-holding, and then slowly add more and more complications.

Here's the assumption again that C is somehow the deep end and Python (say) just hand-holds. It is not this trivial. C is, as a language, simple just as much as Scheme is simple -- they just do the simplicity differently. The difference is in the relevance of the things that the languages make you do, and what they give in terms of ideas. Pointer arithmetic is not nearly as enlightening in general as closures are.

JupiterV2
July 23rd, 2011, 02:14 AM
...
Here's the assumption again that C is somehow the deep end and Python (say) just hand-holds. It is not this trivial. C is, as a language, simple just as much as Scheme is simple -- they just do the simplicity differently. The difference is in the relevance of the things that the languages make you do, and what they give in terms of ideas. Pointer arithmetic is not nearly as enlightening in general as closures are.

+1

Completely agree with this statement. As an aside, closures, and by extension currying, blew my mind.

ve4cib
July 23rd, 2011, 02:55 AM
Here's the assumption again that C is somehow the deep end and Python (say) just hand-holds. It is not this trivial.

No, it's not that trivial. But I think we're using "deep end" and "hand-holding" to mean different things.

I meant to say that learning C first tends to require a lot more initial effort. The first few programs you write (hello world, some basic file I/O, loops, conditionals, maybe a little recursion) are going to be the same between the two languages.

But doing something as simple as reading in a line of text from the console in C is just harder and more complicated in C than it is in Python.

Imagine you know nothing about programming. You want to read in a line of text and print it out again.

C


#include <stdio.h>

void main()
{
char inputBuffer[255];
printf("Enter some text\n");
fgets(inputBuffer, 255, stdin);
printf("%s", inputBuffer);
}

Then execute "gcc main.c", followed by "./a.out"


Python


#!/usr/bin/python
input = raw_input("Enter some text\n")
print(input)

Then execute "python main.py"


Obviously the C program should use a #define instead of throwing around a magic "255," but that just adds another line that a complete beginner will scratch their head at.

I call C the "deep end" because to write something as simple as echoing a string on the console you need to know about:

- header files (stdio.h?)
- variable types (what's a "char" and why are there square brackets?)
- variable declarations (and C strings to a certain extent)
- format strings ("%s", "%d", etc....)
- the compiler (gcc)
- an external debugger if you run into issues (e.g. gdb)

That's a lot of stuff to throw at a beginner right away, and -- if they're anything like me -- they'll feel confused and overwhelmed right away. If you stick with it things get easier very quickly, but the initial hill you need to climb is steeper with C.

Python on the other hand abstracts away much of those problem areas, leading to a gentler learning curve. The Python version you only need to know about:

- variable declarations (but not types)
- the interpreter

If the program crashes Python spits out a nice stack trace with a line number, instead of the useless "Segmentation Fault" (and occasionally "Core Dumped") message C gives you.

Obviously if you want to do anything more complicated in Python you need to learn more. Variable types become an issue eventually (and are arguably harder since there's no explicit types to declare), and variable scope can be a mess.

With C the next few programs you'd write don't really introduce anything new; they'd just expand on the same areas we've just covered.

To make it clear, this is largely my own personal views on the subject, and people are more than welcome to disagree with me.

But personally I think that learning Python first is the equivalent of walking slowly away from the beach, with the water getting higher and higher. You learn to swim eventually, but it's a slow, steady process.

C on the other hand is like diving right into the deep end of the pool. It's a shock, and you flail around for a little bit at first, but it eventually clicks and you can start swimming laps.

Once you learn either one, the other is relatively easy to pick up. So really it just comes down to personal preference and teaching style.


_____________________

PS: I agree that closures are WAY cooler than pointer math. At some point every programmer on the planet really should take the time to learn to use Lisp and Prolog. Every year I encourage the undergrads at university to take the third-year "Programming Language Concepts" course for exactly this reason.

slavik
July 23rd, 2011, 05:01 AM
at this point, most languages under the sun have been suggested.

OP, please pick one and we can leave this thread. After all this time, nobody here (as far as I am aware) is a professional educator.

Just because one language has simpler use in some situations than another language, does not mean that it should be the first language that should be learned. After all, Vietnamese is a very difficult language as far as pronunciation, it doesn't stop the newborns in Vietnam from learning it in ~2-3 years.

TL;DR: We are done with language suggestions here. We are also done with the discussion on which language should be first to be studied.

nvteighen
July 23rd, 2011, 06:17 PM
at this point, most languages under the sun have been suggested.

OP, please pick one and we can leave this thread. After all this time, nobody here (as far as I am aware) is a professional educator.

Just because one language has simpler use in some situations than another language, does not mean that it should be the first language that should be learned. After all, Vietnamese is a very difficult language as far as pronunciation, it doesn't stop the newborns in Vietnam from learning it in ~2-3 years.

TL;DR: We are done with language suggestions here. We are also done with the discussion on which language should be first to be studied.

I love you.

Simian Man
July 23rd, 2011, 08:55 PM
1- Start off with very low-level stuff (memory management, pointers, etc...) and keep the programmer very close to the hardware. Once you understand how to do all that low-level stuff then you'll have a very good understanding of how/why higher-level languages do what they do. Proponents of this approach will usually suggest starting off with C or C++, and then branching off into other languages like Java or Python.
The problem with this mindset (and I realize you weren't espousing it yourself) is that the operational model of C and C++ is nothing like the way computers actually work nowadays.

In between your program and the hardware is the compiler which does a lot more to your code than they did when C and C++ were developed. This makes some keywords of C and C++ such as inline and register totally useless because compilers are so much better at optimizations than humans are. Additionally there is the operating system which implements virtual memory (you think pointers are actual memory locations???) and context switching. Lastly advances in micro-architecture such as micro-operations, superscalar and out of order execution and register renaming mean that even your compiled assembly instructions will not execute in an at all straightforward way on the target machine.

With all of that, the additional abstraction of a virtual machine, just in time compiler and garbage collecting runtime is minimal. Saying you should learn C or C++ to be closer to the hardware is like saying you should move from Philadelphia to Boston so you can be closer to London :).

Basically C and C++ were "close to the metal" in the 70's and 80's, but will teach you close to nothing about how computers operate today. If you want to learn how computers work, read a book about computer architecture or operating systems or digital design, don't learn C. If you want to learn to program, learn a language that will let you learn programming by offering availability of high level constructs without bogging you down in minutia.

There are reasons to learn C and C++ such as when you need performance at all costs, need to interact with existing code or need to write extensions for another language. But none of these reasons is valid for somebody just starting out.


After all this time, nobody here (as far as I am aware) is a professional educator.
I've actually taught C++ at a major university for a few years :). Not that that gives me any more authority than the other good programmers around here.

slavik
July 24th, 2011, 12:55 AM
we're done here.