Ask HN: Help me convince a teacher we should learn Python (vs VB.net)

43 points by newsisan ↗ HN
For a high school class.

He's a great teacher (from what I hear, and my conversations with him), though the current plan is to use VB.net, while me and a few others would much prefer Python. Key requirements/comparison points for him are that it should be easy to learn (17 year olds new to programming), and for me, I'd like to learn it as with LPTHW we can go along ahead of the class.

79 comments

[ 1108 ms ] story [ 1392 ms ] thread
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. - Edsger Dijkstra
1. VB.net ain't your daddy's basic

2. I respect Dijkstra, but I think he was wrong on this

It says a lot about our knowledge about teaching and learning programming that pithy quotes from 35 years ago are still regarded by many as being relevant.

I mean, has anyone actually studied the academic outcomes of programmers who started on BASIC or VB, versus those who started on other languages? Has anyone determined if programmers who start out in VB make more errors than programmers who started out in say, assembler, or C, or Python, to any statistically significant degree?

Undownvoted for being somewhat relevant. We are really talking about different languages though.
I taught myself programming in QBASIC in third grade (gasp, 20 years ago) and my favorite languages now are ocaml and haskell. Doing ruby, python, java, and c#/vb.net at work, all production code. It's the concepts, not the language. ;)
I've always found this quote (apparently originally from 1975) somewhat strange, having grown up in 1980s, when BASIC was pretty close to the only game in town for a decade for home users. I still ended up seeing a lot more skilled programmers get started by early tinkering rather than through dutifully attending a college course in the formal derivation and verification of software constructs after having carefully kept themselves unsullied of writing programs without being absolutely sure what they are doing.

There may be a point in the underlying sentiment, but the thing as a whole just rings false in the post-microcomputer age. The big difference might be that the people Dijkstra was thinking of probably had had BASIC taught to them as university students, instead of tinkering with the BASIC repl of the 8-bit microcomputer they got their hands on as 9-year olds.

You and the others should just get together and learn Python. No need to have a dependency on your HS class.
Exactly. It's not like you can only learn one language in your life, learning them both will give you a different outlook.
To the OP, if you want a career in coding, get used to learning.

This year I've got node.js, rails 3, html 5, mongo db down pat, all in my own time. Its a fair bet that 90% of HN readers have done the same amount and way more.

Languages and frameworks are not important. Communication, problem solving and productivity skills are important.

Plus, learning more stuff = more fun.

From the little I know about VB.net, it's much more approachable for people not cut out to program (ie non-engineer types) then any other mainstream language on the back-end.

Don't forget - the high school education system is set up so you learn what you have to in order to tick a box and pass your exams, the fact that something might be relevant/useful to your career is an accident.

From that perspective, the teacher probably just wants to teach lowest-common denominator easy programming to tick the box.

I agree with Ryanto - if you want to learn Python (or any other language) it's better to do it in your own time.

It might also depend on how well he knows VB.net... learning that from someone who knows it well would be better than learning python from someone who's just picked it up to teach a class...
It might also depend on how well he knows VB.net... learning that from someone who knows it well would be better than learning python from someone who's just picked it up to teach a class...
Python is an awesome language, but in a HS class you probably won't get past simple scripting paradigms. If you guys were already CS students with solid programming experience as well as the theory behind it, or if you were just science students wanting to hack around, then python would be a great choice.

However, I think it would be more beneficial if you guys were to learn (sorry) Java and OO knowledge so that you could take the AP test and perhaps save time and money if you decide to move on to college.

Either way, VB.NET would be at the bottom of my list. C# would be great, but the professor might find the C-style coding too overwhelming for the students. And F#, being functional, is probably out of the question for a number of reasons.

VB.Net is far closer to C# or Java than VB6. It's like a real grown up OO language now.
Definitely. .NET is .NET and especially being imperative, VB is mostly just syntactic differences over C#. But neither of those languages are tested on the AP exam ;)
To be honest I think VB.Net is a decent choice for a high school level course. It's an approachable modern language backed by a huge framework with easy access to web, Windows and console programming. The IDE is free and relatively user friendly for someone familiar with Windows, which is much more likely than anything else.

Don't underestimate VB.Net. It has a terrible history but most of that ended with VB6. Another bonus is that once you know VB.Net the jump to C# is trivial and now you know 2 in demand languages. You can also compile the same code into a program along side F#, IronRuby and yes, IronPython.

You aren't there to learn syntax, you are there to learn to program. You should absolutely learn Python on your own as well, knowing one will make the other much easier to pick up anyway. Once you've done that go and learn Scheme, or Ruby, or Scala, ir preferably all of the above.

Although I should point, C# is my language of choice on .Net.
I don't mean this as flamebait at all.. Really. I very much respect the .NET platform... but honestly, something really bothers me about the idea of teaching a proprietary language & platform in public schools when there are sooo many amazing open source options available..
Fair comment and I kind of agree in spirit. Java hasn't really been living the dream lately though.

At my high school we were taught to use Word and Excel because those were considered essential skills. We could have learnt Open Office or something else but really, how often are we going to encounter that in the real world? In terms of practical use, .Net is not a bad choice.

Personally I would like to see Python for getting started and practical use and maybe Scheme for going deeper.

We could have learnt Open Office or something else but really, how often are we going to encounter that in the real world? In terms of practical use, .Net is not a bad choice

I'd say let's take practical-business-relevance out of it (even though I'd argue the relevance of Java, Python, and Ruby to be plenty comparable to .NET).

We're talking about high school students, not trade-school students. I think the curriculum ought to be about opening their eyes to this really incredible world of solving problems with computers and logic. I also think a bit part of the key to that is to make sure we don't saddle them with skills that can't afford to develop. You know how bummed I was after taking AutoCad or using Photoshop in high school only to find out that I'd have to mow lawns until I was thirty to afford to use them at home? That's just stupid, and spirit-breaking for interested kids that don't have 800$ (or whatever) for Visual-Studio-Enterprise-Resume-Edition.

That's why it's nice that everything you need is free including web, Windows and even SQL. http://www.microsoft.com/express/

I think the best argument here is regard students running Macs at home which I have no reasonable counter to.

Proprietary or not, it is an accessible language and IDE. The idea of learning an open language is a good one. But, I think at the high-school level, it would be more important to expose students to something with a low barrier of entry. I don't mean the language, but the entire package. With VB you install one application, and you get an environment where you basically type code and press a play button to get it to run.
How accessible is VB.NET for all those kids who own a Mac?
Fron what I read the Mono compiler for VB.Net is reasonably complete so to answer your question, it's there but more difficult than it should be.
I hear Mac's run Windows pretty well.
And how much does the non-upgrade copy of Windows cost? I suppose kids could download an unregistered copy and use that for 90 days or whatever the period is, but that may not be enough to last the school year. No doubt schools won't encourage kids to use unlicensed software that they "borrowed" from somewhere.
MIT teaches it as its intro now...

http://news.ycombinator.com/item?id=602307

and Norvig uses it...

http://www.norvig.com/python-lisp.html

I mean what more endorsement is needed? How about something really eloquent...

http://norvig.com/spell-correct.html

(tl;dr: VB.NET can be every bit as expressive as Python. See my translation of Norvig)

Here's a line-by-line translation of Norvig's code into VB.NET. Exactly the same number of lines, unless you count the block terminators like `End Function` and `End If`.

https://github.com/stevecooperorg/Norvig-Spelling-Corrector-...

The translation was fairly straightforward; I'm not a regular VB.NET programmer but I cut and paste Norvig's code into Visual Studio and did some pretty trivial rewrites -- 'def train(features)' -> 'Function train(features)' -- and that got me most of the way there.

I translated idiomatic python (list comprehensions) into idiomatic .net (linq expressions) but the translated code is almost identical in structure and number of code points.

Don't worry about it. You may hate vb.net, you hopefully won't care all that much. Either way, if your teacher wants to teach it, there's a reason (probably he's familiar with it and not with python, or he's on the MS payroll). It doesn't matter to you.

You sound like you want to learn about programming. "Programming" is a different discipline than "programming in vb.net" or "programming in python" or "programming in lisp". Learning about programming is a multi-step process, in which you first learn to define a problem in a sensible way and create a set of instructions for solving it, then write it in a language a computer understands, and then learn how to figure out any one of a million other ways to write it for a computer to understand. The first and last steps are the most important and can take years, the middle one usually takes a semester or two at the most.

Let your teacher walk you and the rest of the class through the middle one with vb.net, then go home with your smarty-pants friends and start slogging away at the other two steps. Every time you get a programming assignment, do it in vb.net. Then do it in python. Then figure out what they have in common and where they are different. Explain it to your friends, and listen to their explanations. Then do it again in all the other languages you can find.

Well, both have enough documentation that you can learn them without the need for a formal curriculum, and both are certainly worth learning - the .net VM is among the best of its kinds. Since a lot of VB.net documentation is in the form of expensive books, while Python documentation can be had for free, convince your teacher to use VB.net, and use your school as a resource to pay for your books.
You could always write a vb.net interpreter in python :-)
I don't think Python is a good idea for a high-school class (where a big bunch of the people don't really care about programming anyways). Hell anyone that already knows a bit of programming will be completely thrown off his chair by the whitespace constraints, while new ones will probably have an awful time trying to debug anything.

Python is a great language and it certainly is 'easy' in contrast to a bunch of other languages, BUT a high-school class is to learn to program in general, and Python doesn't strike me as a good language to learn to do so from scratch.

Ruby is a bit better, but I'd argue the same thing. VB.net really is a better suited language to learn to program, and although I don't really like it myself, I agree with everyone saying it's a great language to start with. You can always learn Python on your own time, and I'd even argue that with what you'll cover in a high-school class, it really doesn't even matter since you'll be ahead of the whole class (not the people, the curricula) in a month if you learn Python on your own.

I'd argue that Ruby is a bit harder to learn, specially for someone with no background in programming.

While Python tends towards clarity and predictability, Ruby tends more toward conciseness and power. That means some things are not as straightforward to figure out.

Ruby's syntax is also far more opaque at first glance than Python's is. Ruby in my experience isn't any more concise than Python, and often falls into the same trap as Perl of having "more than one way to do it"
I never said otherwise. I meant both are 'easy' languages, and though I'd fathom beginners being more comfortable with Ruby (because it has a more forgiving syntax IMO) I still think they're not languages you should begin programming with. We might disagree on which language from the bad languages to start with is better, but that doesn't mean they're any good to learn to program anyways!

I started with C when I was 12 years old, and I'm sure that has made me a much better programmer than I could have been had I started with something easier like Php. In that aspect I think VB.net (which is NOT the same as VB6) is a good language for high-school kids to start with and learn the ropes.

and I started with Java at 11. What you learn on is irrelevant as long as the basic concepts are taught well. Neither Python nor Ruby are ideal for teaching pointers, but for explaining assignment, boolean logic, basic control flow, etc the only better candidate I can think of is Scheme, and VB is far down the list of replacements.

I'm also a bit confused about your statement about Ruby having a more forgiving syntax and taking that in a positive light. For an Intro to Programming course rigid syntax is ideal as it helps to avoid atrocities against whitespace and other crimes of legibility.

That's just not correct. What language you learn on does have an influence on what languages come easier to you as a second or third language. Also some languages make programming concepts and paradigms easier to learn than others. Any way, giving an introductory high-school class in Python, Ruby, or Lisp is IMO counter productive because of the whitespace requirement, the flexibility in syntax, and the amount of parenthesis on their respective languages.

I said two things:

1) I think Python is not a good language for high school because of it's syntax which is not directly translatable to the bulk of other programming languages (and I say the same thing about Lisp now that I'm on it). At this point I made a comment that I would find Ruby a little tiny bit better (but not suitable either) because of it's forgiving syntax, not because of the flexibility aspect of it's syntax (as omitting parenthesis and comas would probably lead to confusion). Python is not forgiving in it's whitespace requirements, while Ruby can make use of blocks and curly brackets in a way that translates better to other programming languages.

2) That I learned C at an early age and it had a big impact in the way I developed as a programmer, to which you responded that you learned Java a year earlier than I did C without making a point out of it. What is this a competition now to see who learned to program earlier?

What language you learned on makes no difference 5 years later, but it does have a big impact on the first, maybe second year. As such, it should be a language where the knowledge and workflow is easily transfered to other languages. VB.net (which I actually dislike anyways) is a pretty straightforward language from which you can move to a plethora of other languages easily. Neither Ruby or Python are suitable for this.

I think there are a couple of idioms which are a bit more concise in ruby ( <something> unless <condition>, or some of the stuff with blocks), but it's a matter of personal taste, I think. I do agree on the "opaqueness", Python does tend more towards "runnable pseudocode" :)
Why?

1) Your teacher cannot learn a new language well enough to teach a bunch of high school students in time. Have some consideration for him.

2) Your goal when starting to learn programming is not to learn the syntax of any one language, it's to learn to solve problems using programming. - Learn about P-code ( or psuedo code ) - Learn about Simple Data Structures. - Learn about conditional( if-then-else ) constructs - Learn about iterative( for-while ) constructs, - Learn how to declare variables and initialize them; - Learn how to edit-debug-run code - Learn how to version-control code (any file in general) - Learn how to write functions/methods/sub-routines. - Learn how to comment your code for future debugging

These are fundamentally the same in almost all modern programming languages. The syntax changes from one to another is mostly cosmetic. The key is good coding and problem solving habits and attitudes.

3) It's easy to spend time on the internet and be anamored about a particular language, particular OS, particular editor etc - but in the long run, they are commodities; there's no great big differences between them

4) If you really want to work in python, do so. Finish your problems in VB.NET and re-write it in python. Just don't impose your preferences on your teacher and entire class. It would detract from the goal of the class.

I completely agree on all counts.

On top of that, VB.NET makes it almost trivial to transition to C#, which is a hugely important language right now.

VB.NET can also give you a hint of mix-ins (through interfaces and extension methods) and functional programming. Not saying you'll get there in the class, but it's out there. The .NET platform gives you a taste of almost every programming paradigm out there. It's very versatile.

If you want to go through LPTHW, nothing is stopping you. In fact, you don't even have to wait for the class to begin. Just start.

The answer is "none of the above" for a high school CS class. The reason is that the computer science advanced placement exam is in Java. Until that changes (and until college-level CS stops using Java), you should be learning Java.
You won't like the answer but don't convince, VB.NET is much easier to learn your younger crowd, .NET has more job opportunities and switching to F#, C# from VB.NET is much easier.
I came here to see a list of why Python is a good choice and instead the answers surprised me in a good way. Indeed it's not about the language - it's about programming. And although Python is a great language you should keep your options open and learn other tools as well. After you LPTHW - on your own - you'll have a perspective on both languages. You are not a "hammer carpenter".
One thing that you guys are forgetting is that Python is completely portable while VB.net requires Mono at the least on non-Windows systems. In a learning environment I think this is more than trivial.
It depends if the learning environment is already all Windows or not. I don't hold much hope for a high school being anything but.

The other thing people are forgetting is that starting with VB.Net gives a nice predictable IDE which any student can replicate at home with a simple installer. Anything like python comes with so many options and opinions that it can actually be a distraction from learning to program.

Ah, but there's no guarantee that the students have Windows machines at home. I agree that replicating a development environment in one's own system is important -- which is why it's important to take into account households (like mine) where all the computers run OS X.

Windows is not as dominant as it once was.

There are quite a few things you need to learn to be able to program well. One of the easy ones is syntax, which is what you have to learn to go from one language to another, in addition to the names of variables/functions.

What is much harder to learn, and is largely language independent is: 1) Problem solving - the ability to break problems down into simple task that then can be trivially solved. 2) Data structures - programs are unless unless they have data to work with. Knowing how to best represent it is vital, do you use an array, linked list, tree etc. 3) Algorithms - known ways of operating on data to produce some out come. Everything from using a loop to add numbers, to sorting lists, or adding a node to a red-black tree. 4) Design Patterns - know ways to structure code, in a tried and tested fashion. 5) Architecture and Interface design - how to structure your project as a whole (what goes where) and how to set how one portion interacts with all the others.

Along with many other things. Point being the first language you learn matters little, if you learn to program that cross any language barrier. I have not touched the first language I learned for almost a year, but have learned 2 others in that time.

Having said all that, I am most at home in Python because there I know many of the language specific features.

It's a bad sign that most of these comments (about 20, as I'm typing this) are trying to talk this kid out of his enthusiasm for Python in defense of -- heaven help us -- VB.Net. Come on, people. If we can't do better than that on Hacker fricking News, perhaps the doomsayers are right after all and this neighborhood is done.

Hold on, newsisan, there are thousands of Python hackers here. Let's see if any cavalry ride to your rescue.

I'm not a Python guy so this will be weak, but I'll do my bit.

1. Community. Python is far more widespread in the web, open source, and scientific communities. It will be much easier to find interesting projects to play with and libraries to build on.

2. Simplicity. Contrary to what your teacher may have heard, Python is an excellent beginner language. VB.Net is actually way more complicated. It's Microsoft propaganda that positions VB.Net as the best language for beginners. (Edit: it seems nearly everyone here disagrees with this. Am I crazy? Let's hear from some Python people.)

3. Quality. Python is far more organized around clean programming constructs and practices than VB.Net, which is an arbitrary mess.

4. Openness. Python gives all the advantages of an open codebase and platform. I suppose I should list some, but I'm tired.

5. The REPL (http://en.wikipedia.org/wiki/Read-eval-print_loop) is hands-down the best technique for playing with programming concepts, trying out ideas and getting feedback, learning, and coming up with the building blocks for programs. Once you've gotten comfortable with the REPL you'll never want to live without it again. No one should learn programming without this invaluable resource, which Python has and VB.Net does not.

5. Cool. VB.Net is the ultimate in uncool. Python holds its own just fine. Frivolous? Yeah, but there are deep reasons for these things. Learn Python so the other programmers won't smell VB on you and peck you to death.

Good luck!

p.s. A simple additional principle you should know: never try to talk a programmer out of their favorite language. It can't be done. If your teacher is deeply attached to VB.Net, just go with what he wants and enjoy the positive aspects of the class (if he's a great teacher, that's the most important thing anyway and you're lucky to have him). If he doesn't care that much, though, maybe you can wear him down with your enthusiasm. :)

pp.s. Worst case scenario, write all the programs in Python and then rewrite them in VB.Net to hand in. You'll have more fun and learn more.

I'd say there's likely more VB jobs around. Secondly, learning a crap language first is often a really good idea. It shows you what not to do. It's like having a failed startup and then having a success - you learn from that failure.

And thirdly, it just doesn't matter that much. You should be learning programming. Not <specific language> programming.

And thirdly, it just doesn't matter that much. You should be learning programming. Not <specific language> programming.

That is precisely why it matters so much. There's a general misconception that somehow, programming languages are fundamentally equal; that there's nothing specific a programming language brings to the table. I think that's false.

VB.NET is a relatively shitty language, and will make many essential programming concepts more opaque than something very clean and straightforward and transparent like Python. (Also, on a somewhat unrelated note: I'd say that on average, the VB.NET jobs are a lot less interesting than the Python ones.)

Programming concepts matter, but languages don't.

You can do closures in any language under the sun. They might not be called closures, and you might have to type more characters in some languages than others, but they're still closures.

My personal stance is that all languages are pretty much equal. The only real difference that matters is syntax and that's largely a matter of taste. Don't get me wrong, some languages are sane, some are insane, some are ugly, some are beautiful, but they all do the same thing - function as an intermediary language between us and a CPU.

There's so much snobbery around language choice, and so much fashion following which I think is a shame. Also identifying oneself as a "<language> programmer", rather than "a programmer" is sad.

Practically though, you get down to libraries, probability of creating bugs/typos, speed of runtime, 'community' etc if you care about those.

Community is surely the big win for Python. If you manage to get a 17 year old interested in programming, then where better to take the next step than start hacking on some open source projects written in Python?

Where does a 17-year old go next with VB.net?

You'd throw a 17 year old with 40 hours worth of 'introduction to programming with Python' into hacking on Django or Scons? Good luck with that.

(not that I know of any open source projects in VB.net, but still)

No, but if a 17 year old chooses to start looking at the source code to work out whats going on, then I think that would be great.
"talk this kid out of his enthusiasm for Python in defense of -- heaven help us -- VB.Net."

I don't think that's the point nor is it what most people are doing. In an introduction to programming course, the language is a tool in which the concepts taught are illustrated. Letting the teacher use a tool that he is comfortable with will by far outweigh any advantages that using another language will bring.

Think about it this way: to learn how to drive Formula 1, does it matter if you learn how to drive a stick shift in a Ferrari or a Toyota Corolla? IMO no. (in this analogy it would be safer to learn in the Toyota, but I won't take it that far in the programming case...).

As one of those defending VB.net -- let me be clear: Newsian should go and learn python. Go and get something like this: http://greenteapress.com/thinkpython/ and go learn it.

But Newsian's teacher -- they should teach what they know.

VB.NET is a solid language saddled with a terrible pedigree -- VBA macros, VB6, classic ASP. All nasty. But VB.NET now is an entirely different beast which happens to share the same name. It's like being the kid called 'Adolf'. It's not really VB.NET's fault.

Having used both languages, I've not seem any serious language features that one has that the other doesn't. What is missing in VB.NET, or made very difficult, that Python makes easy? Or vice versa?

VB isn't easy like basic was easy. It's not hard mind you, it's just not VB. VB.net is trying to be a basicish language that's good enough for enterprise development.

Python is used at many top colleges as the into course (Georgia Tech and MIT are ones I know off the top of my head) and additionally, Zed Shaw has written an excellent first text on the language downloadable for free (http://learnpythonthehardway.org/index)

Additionally: Nothing is stopping you from ALSO learning python at the same time.

1. Python is Free (Free as in Freedom vs. free as in beer debate) 2. Python teaches you the importance of whitespace 3. Python forces clarity in your coding 4. Python is blackboard-compatible, it's a great pseudo-language. 5. Python has a great REPL 6. Python is great for both scripting and OOP 7. Real Hackers use it ;-)

Good luck! Just curious: do you guys have whiteboards or blackboards in class these days? Somehow teaching programming on a blackboard seems more appropriate & terminal-like to me.

I would be making the same fuss in your position, however your teacher might not feel confident teaching a language he doesn't know, despite all the good talking points raised here. If he sticks with VB, I would ask him to spend some time later in the course making students aware that there are other languages, styles and platforms. Offer to help - write him a couple of pages on it, or pick a simple program from his course and translate it into Python/Ruby/C/Scheme/etc for him. Good luck.

Edit: To the person who disagrees with my advice, could you please let me know which part and why.

I went to a school where OO was taught with Smalltalk (late 1990's). The pressure had been on the school for a few years to switch to Java, because that was the language of the future, and Smalltalk wasn't used in the industry anyway, and why were they sticking with such an old-fashioned language, and were the teachers too stupid to learn anything new.

So in the end they caved, and I was in the first class that was taught the Java curriculum. The teachers had spend the larger part of their summer at Java courses and writing a syllabus. The result was a bunch of people who barely knew the language they were teaching, causing most of the time in class to be lost to mundane details like working with the JDK and API issues. (I remember asking how to execute an external program and nobody being able to tell me).

YMMV etc., but my advice: please let the teacher decide for himself what he feels most comfortable teaching and focus on programming fundamentals rather than complain about not being able to use a tool that is hip and cool in some circles. (read the 'the scene will kill you' article that was on here a few days ago, it holds for not only 'the startup scene' but also for pretty much all niche programming scenes, forum scenes like slashdot, reddit, HN; actually it holds for pretty much every scene in the world).