Blogger Carl Cheo, who maintains a website providing numbered lists of tips for maximizing online productivity, has pulled together an easy-to-follow graphic answering the newbie question "What programming language should I learn first?" (pdf here). Cheo chose nine commercially viable languages as possible destinations as the viewer navigates the flow chart. Further down the page, there are tabs with annotated links to educational resources for each language. So what's in it for Soylentils, most of whom I'm guessing were programming newbies in the previous millenium? Well, maybe you have nephews or nieces who chose the wrong major in college. Besides, the graphic is amusing and clever, though probably not the last word on the subject.
(Score: 3, Insightful) by Marand on Saturday January 24 2015, @04:19AM
If I could change anything about what I've learned, it would be to pick up Ruby a lot sooner than I did. I kept avoiding it because I already knew Perl inside and out, and OO-heavy languages like C++ and Java never really clicked for me, so the idea of "it's sort of like Perl or Python, but fully OO!" just didn't seem compelling.
As it turns out, Ruby's approach of making everything in the language an object, along with the Smalltalk message-passing concept, is what finally made OOP click for me. Being able to poke at the insides of all the data types, getting info about the objects, and doing things like 10.methods.sort and seeing all the methods, including operators like + and -, helped make OOP make sense to me in a way that all the inane examples in books and tutorials never did. (Like Java's "imagine a class as a bicycle, and a subclass as a specific type of bicycle, blah blah blah" shit.)
It seems like it'd be a good language for beginners to start on, though I don't see people suggest it. It's always Python for some reason.
---
I don't get why people are so hung up on Python being such a great beginner language. It even shows up in that infographic, with "I prefer to learn things the [easy|best] way" suggesting Python, and a bit about "widely regarded as the best language for beginners". The syntax is alien compared to other languages and encourages you to not think about closing blocks, so if anything, it seems like it would teach bad habits. But hey, at least the code will be indented nicely, I guess.
I would think that something with a more flexible syntax and clear block beginnings and endings would be more useful when getting started. Perl gets you closer to a C-style syntax while being lenient, for example, or Ruby for more flexible block structure using real words instead of curly braces and a better introduction to OOP. Not the only examples, of course, but the point is that a bit of lenience is good at the start, and they're both very forgiving, with a lot of punctuation (periods and parentheses especially) frequently being optional.
During learning/testing, I tend to slam out some quick test code first, then indent it after. One focus at a time. Even after knowing other languages, I found Python's insistence annoying. If I'd had my first programming language harassing me for not indenting to its preference, interrupting me from picking up basic language concepts, I probably would have said "fuck this" and found something else to do instead.
It's not just about Python, though. Like you said, you started with C++ and it could have been detrimental, and I've had the same experience with Java (hate hate hate). When you're first starting, a language being "good" is less important than the language being easy to get something useful out of with as few barriers as possible. As a beginner, you're either doing it because you want to make something or because it seems fun. Not because you want to sacrifice boilerplate code and syntax errors to the compiler gods.
(Score: -1, Troll) by Anonymous Coward on Saturday January 24 2015, @04:53AM
So basically, you're retarded.
(Score: 2) by M. Baranczak on Saturday January 24 2015, @02:46PM
"Flexibility" is not a good thing for beginners, because it makes things more complicated. When there's 20 different ways to iterate over a list, it means you have to learn all of them, otherwise you won't be able to read other people's code. And having the freedom to indent however you want is a detriment for people who still haven't learned the importance of proper indentation.
Ruby and Python are both good choices for beginners, I just think Python's better. It's simpler, and it teaches good habits.
(Score: 2) by Marand on Sunday January 25 2015, @02:47AM
And having the freedom to indent however you want is a detriment for people who still haven't learned the importance of proper indentation.
Ruby and Python are both good choices for beginners, I just think Python's better. It's simpler, and it teaches good habits.
I get the reasoning, I just don't entirely agree. What good habits does Python teach? You get indentation at the cost of not learning to close blocks properly, that's a wash at best. You also get taught that if you aren't doing it the way the devs like then you're wrong. I don't see how that's a good habit, either. The forced indentation also interferes with code sharing unless everyone indents the same (usually PEP-8) way, going back to "do what the devs like or GTFO"
Good formatting is important, yes, but shouldn't be the primary reason to teach a specific language, especially in a controlled environment where you can have the instructor kick your ass for poor coding practices.
I'm not saying it's a terrible choice, and it's definitely far better than diving right into C or Java as a starter language. It's just that I don't think it's all rainbows and unicorn farts and the best teaching langauge ever like the smug pythonistas seem to think.
"Flexibility" is not a good thing for beginners, because it makes things more complicated. When there's 20 different ways to iterate over a list, it means you have to learn all of them, otherwise you won't be able to read other people's code
What? No it doesn't. It means you can learn all of them, not that you must. Certain ways are more common and, especially if you're using something like Perl's camel book or Ruby's pickaxe book, the style should be consistent throughout. Realistically you'll only be learning one way, at least at first.
I wasn't talking about Perl-style "there's 50 ways to do it, all of them unreadable" anyway. That's why said flexible syntax, and mentioned optional parentheses as an example of what I meant, though it also includes things like requiring semicolons at end-of-line. I think reducing unnecessary punctuation is a good thing, especially when it allows English-like constructs. For example, a Ruby if/else without parentheses:
if a == b then
print "match"
else
print "no match"
end
Even without more than the vaguest understanding of programming it should be readable and can cleanly parsed in English. "if a equals b then print 'match', else print 'no match'. End." Python get some of it (no semicolons), but it's more strict about parentheses in other places and makes you litter colons around instead of sticking to words.
It doesn't seem like a big deal if you're already familiar with other languages, but if you're picking up these fundamentals for the first time, it helps if they can be represented in an English-like way. (I happen to like Perl's "unless" statement for if-not-equals stuff for similar readability reasons, but wouldn't necessarily throw it at a newbie right off)
(Score: 2) by Magic Oddball on Sunday January 25 2015, @07:12AM
You also get taught that if you aren't doing it the way the devs like then you're wrong. I don't see how that's a good habit, either.
That's what I was originally taught about C in the class I took back in college — if we didn't write code in the same nebulous style the instructors preferred, we'd only get partial credit for our work even if the program performed perfectly. Our final exam was even multiple choice, with "which of these is written the right way" type questions with a partial focus on style. (Suffice to say I felt lucky that I got a C in the class.)
(Score: 2) by Marand on Sunday January 25 2015, @08:51AM
At least with an instructor, after the class is done you can adjust your style to your liking. In that way it's sort of like martial arts; while learning, you have to do what the teacher wants, but inevitably it gets changed to suit you, sometimes only slightly, sometimes greatly. It's harder to do that when the "my way or the highway" is baked in, which is what I don't like about Python. There's plenty to like about the language, but it just has this authoritarian feel to it in some ways that I don't care for and would find unappealing as a learning language.
(Score: 2) by maxwell demon on Sunday January 25 2015, @11:31AM
Of course you got a C. It was a C class, after all.
The Tao of math: The numbers you can count are not the real numbers.