Learning Programming In a Post-BASIC World
ErichTheRed writes "This Computerworld piece actually got me thinking — it basically says that there are few good 'starter languages' to get students interested in programming. I remember hacking away at BASIC incessantly when I was a kid, and it taught me a lot about logic and computers in general. Has the level of abstraction in computer systems reached a point where beginners can't just code something quick without a huge amount of back-story? I find this to be the case now; scripting languages are good, but limited in what you can do... and GUI creation requires students to be familiar with a lot of concepts (event handling, etc.) that aren't intuitive for beginners. What would you show a beginner first — JavaScript? Python? How do you get the instant gratification we oldies got when sitting down in front of the early-80s home computers?"
And why doesnt BASIC still work? Any reason they can't still use BASIC?
Off the top of my head, three languages and platforms with which one can quickly produce GUI based apps. Android's Java is very approchable and you can do your "hello world" type app in a few lines of code. Likewise, Flex (aka Flash for apps) is for lack of a better word, flexible and lets you use a nice combination of Actionscript and XML to build apps quickly. And finally, Objective-C is very user friendly and can be found bundled with OSX or you can get a copy of Borlands C++ Builder.
"Have you ever thought about just turning off the TV, sitting down with your kids, and hitting them?"
It's lightweight, portable, and has a ton of interesting projects for learning. Start here at http://www.ruby-lang.org/en/ Check out the "Try Ruby in Your Browser link" on the right hand side.
Agile Artisans
wxWidgets and Python are a good combination of easy to learn and visually satisfying results. The later being for positive reinforcement. Oh. And using it to write more practical programs in the future isn't hindered by a boat load of patents.
Having to work for a living is the root of all evil.
... (ba)sh? ;-)
I reserve the right to be wrong.
I wouldn't call VB.NET a starter language. Maybe for someone who wants to get a bit more serious, since you have the visual designer and it'll generate skeleton event handler functions for you to fill in.
Beginners should not start with creating GUIs in the first place. (Neither did early BASICs support such a thing)
CLI paste? paste.pr0.tips!
http://ask.slashdot.org/story/08/07/22/0452225/How-To-Encourage-a-Young-Teen-To-Learn-Programming
http://ask.slashdot.org/story/10/07/30/2150208/How-Should-a-Non-Techie-Learn-Programming
Someone should keep track of them. Maybe stash them in some "Learn to Program" folder on Slashdot?
I'd say go for the JavaScript. The learner already has the instant gratification of an HTML document. Then add a button whose onclick handler changes the button's value to "Hello World".
How is event handling unintuitive? "When this happens, do this and this and this."
Python or JavaScript or whatever maybe be currently in vogue but the act of programming transcends languages. Just pick one and do it. Python can be used with or without the "back story" depending on what you want to do. Once you are in the GUI world it is pretty much all back story.
Palm trees and 8
http://processing.org/ it's easy and gives immediate gratification.
It all starts at 0
Google it. Especially if you like the Sims, try the 3.0 beta. Other than that I'd second HTML + Javascript. You can very quickly get up an running with something fun and interesting.
Hi! I make Firefox Plug-ins. Check 'em out @ https://addons.mozilla.org/en-US/firefox/addon/youtube-mp3-podcaster/
The only thing it will do for you is give you serious brain damage. Python is widely recommended as a good starter language that is also good as a serious language. Following from that you can easily branch to Perl, Ruby, Haskell, even C (which I recommend learning after Python if you can).
Alright, so I'm willing to accept that this is a strange position to take...but if I was asked to teach my girlfriend to write code, the first thing I would do would be to try teaching her Powershell. Powershell, for those of you who have never heard of it, is a sweet scripting language introduced by Microsoft in Windows 7 (although it is available for Vista and XP). I've heard it compared to Perl a bit; there's dynamic typing, little scope, and access to the lion's share of the usefulness of the .NET framework. I figure that if I gave her some of the basics (here's how to do some math, here's how to do string operations, here's how to find more information about this stuff) she'd be able to use the built-in help (it can be used as a command line or in an ISE, both installed by default in W7) and my advice to get her started. I just find PS to be incredibly simple to write in- not the command line stuff or their cmdlets so much as the basic math/string/IO crap that I find myself doing most of the time.
Personally, I find VB.net a good choice for learning It's easy to use and gently teaches the fundamentals you'll use in all object oriented programming. Visual studio does most of the heavy lifting for you allowing the GUI to be drag and dropped into place. Double clicking on a button creates the event for it's click. Once you start building your app you can get into objects and events at a slow pace while focusing on the basics. It also has extremely forgiving syntax compared to many other languages. I've had to learn coding twice... 10 years ago I started coding with VB5 but ended up doing support instead of development so it had to put it away. Now, my support career has come full circle and I'm helping build the software I've been supporting this whole time. 10 years later I find myself re-learning all the basics in VB.net.
I can fault MS for a lot of things, but C# is nice, and their interface builder is a piece of cake that takes the agony out of building a UI. I'm pretty sure that Hitler and Stalin are building Java UIs by hand right now...
You could always get a Commodore 64 and learn BASIC on it. But what an awesome project that could be for an IT class. Find a PC at least say 15-20 years old and write a program on it.
I think the language doesn't so matter so much as the time that is put into it. In the summary basic was given as an example, and I'm sure the basic he's talking about isn't considered good code these days. No object orientation, plenty of gotos and so on. The thing is he spent time on it, and from that language went to others.
With this in mind I would say that today there are plenty of good starter languages. My suggestion would be python, which introduces a number of good habits. It also has the advantage of being able to import loads of goodies which allow graphical programming.
Another suggestion is Delphi Pascal or C-Builder which allows you to quickly create windows applications. I hear that Microsoft has something similar with C#.
Any language is good, as long as time is spent playing with it. That's the thing that is important.
Although I had QBASIC as a child, I also learned on VB and I think an "industrious" young person would have no problem picking up the basics in today's world of languages.
I've never met a programmer that did not end up being better at their craft after spending time writing Ada. Some did not like it and shun it but even they seem to be better programmers in their language of choice after using it. (Though of course it is not magic and if you are not cut out to be a software developer, it is not going to fix that).
--- Liberty in our Lifetime
Ruby.. easy to learn.. lightweight.. works on most platforms.. etc..
I recently heard (though not used) about Alice, which sounds interesting for at least introducing programming concepts.
// file: mice.h
#include "frickin_lasers.h"
God no. Visual basic is a very syntax sensitive language with huge libraries. It is like the anti-beginner language. Even microsoft's other major .NET offering(C#) is better.
My reccomendation is python, with a lean towards using graphics libraries like vpython. Being able to go mysphere=sphere() is glorioiusly simple and have it show up in 3d is grand.
Python has the following features that are great for learning:
interactive debugger- type your program line by and and see what each line does.
english-like syntax(except elif). As much as possible, python is designed to be written as it would be read out loud. eg: for item in array: print item
at the language level, absolutely no machine restrictions. Integers can get as big as your ram, no pointer math,
It's almost certainly the best choice.
Just use BASIC, or an older version of VB(VB3 comes to mind). Simple, little required in the way of GUI(even VB3 is extremely simple with GUI), and enough to teach the basic concepts. The fact that they're old doesn't mean that they aren't useful.
"How do you get the instant gratification we oldies got when sitting down in front of the early-80s home computers?"
By using a language that has lasted through that time to this one: Fortran.
Fortran is still one of the most widely used languages in scientific applications, and is a great starting point for beginners.
Yeah, so day one you're not going to put together a GUI. Is it that big of a deal? You're not going to be programming the next big FPS in two months either. I know it sucks to hear this but it's true.
Dumb little programs like "Hello World!" serve a purpose. If people with an interest in programming didn't think they were going to jump right in to making a functional program that served some greater purpose there would be a lot less let downs. Your average Sam's "Learn [insert language here] in 21 Days" book isn't going to get you writing any new and innovative code. It's there to introduce you to the basics.
Sorry guys but it probably takes *at least* 100 hours of banging out dumb little programs to get to doing a program that actually does something productive for you and even in that case there are probably 300 programs that are doing the same thing out on some programming tutorial site.
I really don't know what people expect out of their first few hours of coding. It's going to be limited. It's not going to produce anything useful. If you're not satisfied that you got it to work, you're not going to be satisfied by anything else in that starting stage.
When I was a kid, the computer i programmed for (trs-80), was one of the first computer I ever saw. There were not that many programs for it. So it was easy to get excited about almost nothing.
Now all the kids have been exposed to all sort of technologies. They'll never get excited by very simple things like I have been. The thing to remember is that it will never be has rewarding has it was at the time for such simple things and no language is going to change that.
In my experience backstory is important to put languages and learning in context. A lot of students are just running head-long into Java but if they started with C++, and were explained why it's important to start with C++, then many of the OOP concepts would come more naturally when learning something like Java. Then things like Python or PHP would come like second nature since their more complicated aspects are the OOP concepts they implement.
I think a main problem in making programming fun is that it's always so monotone and repetitive. I say if you learn OOP concepts when learning C++ why re-learn those concepts when learning Java? Get to the good stuff! Teach about what is unique to Java, the syntax difference, and move on! That's what we do at http://wibit.net/ and it's working for us.
Otherwise I'd say there is just a lack of creativity overall in programming learnin'. It's always the same "Hello World" projects teaching you how to build a Fibonacci sequencer or a tic-tac-toe game. Let's get real about this stuff and get linear and highlight the fun parts of development for the kiddies! Again, that's what we do at http://wibit.net/
Python has always been trivial to get started in. I taught my 9 year old to program in python in a few hours.
Java is easy to use, and the syntax is clean.
C# is basically a clone of java, so the same applies there.
You don't need to learn object orientation to use any of these languages. Sure, you probably SHOULD, but you can learn java programming solely in the main() if you just want to learn the basics. Even moreso with python, you can program in the interpreter at first, then move to running the code from files, then later migrate into an object oriented approach.
- Vincit qui patitur.
To start with, teach PHP and HTML. These are good ways to get people used to the idea of GUI design and basic programming without needing to worry about complex event handling. When they are ready to move onto this you can introduce JavaScript and database integration through MySQL.
HTML/CSS takes care of the looks, and you learn about functions using PHP. It is easy to set up something 'live' that people can play with.
Throughout this they will be learning elements of C-based languages and it will make the transition to C++ and other languages that much easier.
I am teaching a friend the basics of programming, and Python is what I have chosen. Books such as Learn Python the Hard Way [found its ref on StackOverflow, and liked it] are very good for someone who wants to learn programming on their own time.
That said, I think a lesson in the basics of flowcharting (inputs, outputs, conditionals, loops using counters and conditionals) goes a long way to prepare the student for programming languages.
HTML/CSS+JS is relevant given
The above is from feedback from my friend. YMMV.
-A
"- What's so unpleasant about being drunk?"
"- You ask a glass of water."[from h2g2]
Have them learn LISP.
"The mind works quicker than you think!"
If anything, the post-BASIC world is far, far, better supplied with both explicitly pedagogical languages, application-specific rapid development tools(Processing, for instance), and fairly mature options that allow you to do anything from what is essentially shell scripting to full application development.
However, you run into the rather messy problem that off-the-shelf examples of software have(both in terms of software complexity and in terms of ancillary stuff like graphics and sound assets) Vastly increased in number, sophistication, and availability. This makes it harder to engage any would-be-learner who isn't explicitly interested in programming by sucking them in with the cool results.
Back when daddy borrowed the company Compaq Luggable so that he could work on spreadsheets on weekends, your choices for computer entertainment were pretty much "Lotus 1-2-3" or "Make your own damn fun with basic". Option two was pretty attractive even if you really just wanted some games and only became interested in what made them tick later.
Nowadays, when we have all removed the onions from our belts, hypothetical kiddo is enormously better tools and documentation at his/her fingertips; but is also comparing the rudimentary results of a beginner against products of 2-3 years of effort by a professional design team, backed by artists and sound guys, available for 20-50 bucks off the shelf. Even the sort of flash games that will load about as quickly as the Python 3.2 reference manual will are comparatively polished and intimidating.
Arguably, it might actually be better to start beginners out with more physical projects: Sure, robotics has also increased enormously in sophistication and power; but high end robots are still expensive and uncommon, and there is a more visceral "wow" factor to "Hey, I hammered out the feedback logic that allows my little *duio bot to follow lines" than there is to "Oh, I've just produced 10% of Zork; but less witty and 25 years late. Let's go play Medal of Life Half-Gear Assault 2011."
Grab a TI calculator. Learn the slightly weird version of BASIC installed on them. That's where I got my start.
You can write an actually useful program in just a few lines. It's got a few simple data types (floats, strings, lists and matrices), has a few basic functions (Disp, Input), and all the common language constructs (If-Then-Else, For, While, Goto). There's a few oddities (assignment is reversed, instead of "a = 2" you have "2 -> a"), and there's no proper way to declare a function (you can either make another program and call it, or use goto), but you can do a surprising amount with it.
I programmed those for a year or so. Tried learning assembly to get around the limits of Basic (mostly the speed), couldn't do it. But I did get into C++, and later all the other "real" languages, and am now pretty much a real programmer.
When my daughter is old enough I think I will introduce her to the applescript gui tool - where you can simply stick together existing applications into small macros, where the output of one application is piped into the input of the next. It is like visual shell scripting...but even simpler. You can include your own more complex shell scripts as steps in the overall script and really go nuts with it. I'm sure I'll get flamed for this, but to me it is a great way to introduce a (very) young person to the concept of input, output, and the foundations of procedural programming.
I have heard the argument that functional languages should be used to teach young minds how to program, but I just don't think a very young child would grasp the recursive nature of it.
while [ 1 ]; do echo -n -e "\xe2\x95\xb$((($RANDOM&1)+1))"; done
Microsoft makes a free beginner's or kid's version of visual basic called Small Basic. It's a Visual Basic .Net compatible version with a subset of the full Visual Basic command set. It's really good for a young person to start out with and the programs created will work in the "Grown-up" version. http://msdn.microsoft.com/en-us/beginner/ff384126.aspx
With the understanding that I have no knowledge of this language outside of it's name... How about Haskell? :P
Are you implying that my habit of using "elif" in natural-language conversation may be marking me out as some sort of deviant geek weirdo?
I learned BASIC first. When I was shown LOGO, I wrote a few lines of code to draw a Sierpinski triangle, and thought to myself: there is no fucking way this can be this simple. It worked, though, and sure got me to appreciate the weird academic languages.
Tsunami -- You can't bring a good wave down!
Agreed. I suggest Python to any aspiring programmer who asks me.
Here's a great place to start.
And another good one.
A kid who isn't satisfied with very basic accomplishments is one who will never have a shot at writing a 3D game. I had to explain this to a younger guy the hard way a few weeks ago. It requires real work, drive and willingness to learn. If you can't delay gratification or find gratification in simple accomplishments along the way, you're not even a candidate for success.
MIT's Scratch ( http://scratch.mit.edu/ ) has gotten my kids started with programming. It's fun, and teaches all the fundamentals necessary for learning programming logic.
Sorta. I dunno about others, but what got me interested in programming when I was a wee little lad was that I could make something fun and immediately see the results. All games on my parents' old ZX-81 with 1K RAM (yes, 1024 bytes of RAM, total) were really far more primitive than your typical cell phone game these days. It wasn't hard to get ideas like "I can do better" and actually do so. I actually invited a few friends to play my own primitive strategic bombing "simulator", and they actually found it fun.
But therein lies the rub. It wasn't just the possibility to use BASIC as such. BASIC was just a tool, and the Sinclair BASIC was a piss-poor tool at that, being easily the slowest BASIC of that era. I actually "graduated" directly to machine code after a year, because ZX-81 basic was just too slow, and 1K RAM wasn't enough to run an assembler or compiler.
What mattered was seeing some fun results.
Think of it, dunno, like the quests on WoW. Nobody would run across half the continent and back just for the sake of running across half the continent and back. But throw in a reward, and it becomes fun.
Similarly, nobody learned BASIC for BASIC's sake, and I can assure you that nobody who's not terminally schizophrenic would do something as horrible as converting assembly to hex codes by hand, just for the sake of converting opcodes to hex codes by hand. We did it for the sake of seeing some results at the end.
I'm not sure most of the BASICs around can work like that. I most certainly wouldn't have learned BASIC for the sake of programming a fucking spreadsheet or a Word macro. When you're a kid and do that in your free time instead of playing something or hanging with some friends, if your dream in life is to make a better spreadsheet macro, you need professional help. Plus, it's not the kind of thing you can brag to other kids about.
But I think all is not lost. If I were to get some kid interested in coding these days, I'd get them a moddable game. Scripting a new NPC or quest in Fallout New Vegas gets one a tangible reward in a reasonable amount of time, and some bragging rights after you upload it to a couple of mod sites. Or there are several games that are scripted in Python these days, which also has the advantage of being a skill you can take with you to the next game that uses Python for scripts.
A polar bear is a cartesian bear after a coordinate transform.
I too started with basic in middle school but it did not teach me much. In high school we did fortran, which taught me mad skills, then I taught myself C and C++. I still think C is important for people who want to do serious programming as it does not have the cruches of the other languages, is simple enough to be put in a two hundred page book, and will teach everything one needs to know about debugging and basic design.
In terms of instant gratification, I would suggest writing web apps in python. Most of the GUI stuff is taken care of by the browser, Python takes care of parameter passing to and from the user, and one can teach all the concepts, aside form parralel programming. A kid can write any number of games and if one has access to a web server, it can be run anywhere there is internet access. Such a thing can be great motivational tool.
"She's a scientist and a lesbian. She's not going to let it slide." Orphan Black
I think everyone should start with C and C++ and move on.
http://www.wibit.net/curriculum/the_c_lineage/programming_in_c
http://www.wibit.net/curriculum/the_c_lineage/programming_cpp
I got my start in BASIC when I my mom bought me a book on the topic. However, what really got me into it was modifying games. At our school's computer lab we had a set of games created in BASIC. I would get into the code and make modifications to these games. Back then everything was simple enough I could find my way around as a kid. It was also simple enough I could look at the code, compile it and run it all on one machine without the need to download a bunch of software. I have no clue how to recreate such an experience in today's world.
A unique way to learn a language: http://languageloom.com
It's still important to get a good base going I think. Start with languages that did it first and understand the concepts then you're in a better place when you get to the more complicated functions.
http://wibit.net/
There is Small Basic from Microsoft. http://smallbasic.com/
From the website FAQ:
Who is Small Basic for?
Small Basic is intended for beginners that want to learn programming. In our internal trials we've had success with kids between the ages of 10 and 16. However, it's not limited to just kids; even adults that had an inclination to programming have found Small Basic very helpful in taking that first step.
You should definitely look at Scratch, which is designed for kids, even (especially?) kids who don't type very well yet, yet it teaches them programming skills. This is the same crowd who initially did Logo all those years ago, and they think this is better...
- "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
Definitely agree with Python.
In addition to all the points you made, there's one other that I find to be a great help for newbies: the sheer volume of libraries available. When 99% of the low-level stuff can be done with existing libraries, it allows the newbie to focus on the big picture and slowly work down into the details.
Python is not a good solution. Especailly if you are worried about syntax sensitivity as your parent poster was. Sure white space is a good thing to organize your code, but the actual execution of your program shouldn't be changed by the lack of whitespace. Python is a pretty good language overall, but forcing beginners to understand that whitespace makes a difference in how something executes is asking for trouble.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Last I heard, PowerBASIC was still going strong.
It seems like a version of this comes up on /. at least every quarter. What does it say about programming that so many people look back at BASIC with a mix of nostalgia and disdain? What paradox is embodied in the idea that BASIC isn't good enough for any 'serious' programming and yet nothing else is as good as BASIC in providing an easy to use interpreter that introduces programming concepts and structures in a way that satisfies the neophyte?
Sure, everybody will trot out supposed successors like Python or JavaScript, but the fact that we still ask ourselves the same question, 'is anything as good as BASIC', every few months betrays the fact that many people must not accept that these successors accomplish the same results for whatever reason.
No other language I know of has the same instant gratification as BASIC. The strength of BASIC for me was if I wanted to draw a box, all I had to do was set the screen resolution and the coords of the box. That was it, two lines. I didn't have to load a bunch of libraries or write a bunch of arrays or design some placeholder interface to put the box into. I don't think any language will be able to take BASIC's mantle until it regains that level of simplicity and the ease of running and testing what would be to most other languages wholly incomplete or broken programs. There's a lot more opportunity in BASIC to just ask oneself 'what would happen if I did this?' without worrying about creating some huge framework just to test one concept.
From the age of 12 to about 15 I was really into QBASIC, but all the bad habits I learned from not having to structure things made it basically (heh) impossible for me to move into a 'real' language. I don't know that the paradox can be reconciled that BASIC's strengths are its weaknesses and vice versa. With 'successors' like Python there is an intent for the language to be 'valid' as a 'real' programming language, so it has to be structured in a less forgiving way than BASIC which makes it less approachable, but it makes it easier for those who do work with it to transition to other languages.
Maybe its better to accept the barriers to entry than to try to come up with another language that is a fun dead end. In some ways BASIC is a trap that should be avoided.
I support the Slashcott and will not be reading or commenting from 2/10/14 to 2/17/14. Beta is steaming pile of dog shit
These are all languages which can be easily approached. They all can be run from the command line and have a fairly simple syntax for beginners. They allow to start with a simple one liner 'hello world', and can go all the way to OO concepts, database connections, web dev, interaction with other languages/concepts, etc...
Also, they provide the instant gratification needed for the beginner as it's easy to find simple projects that would satisfy the needs of a newcomer (creating a simple web form, a script to list all their mp3s, an equation solver, a graph plotter, etc... )
Personally, I started with BASIC (before I had a computer, writing programs on paper...) and if I had to do it all again, I'd probably go with PHP
How do you get the instant gratification we oldies got when sitting down in front of the early-80s home computers?
Well I have a working Apple ][ around so that's not a problem to fix.
I've been teaching some kids how to program simple games using Python and the Pygame module (wrapper for SDL) with some success.
One problem I've noticed is that the kids aren't all that interested in programming the simple exercises, such as the "guess the number" game or programs that generate simple ascii art -- all stuff that was exciting to program in BASIC back in the day. I had a promising 12 year old student who was making good progress and had successfully made (with help) a side-view tank shoot-em-up game with two players. Guess what he wanted to do for his second project?... a StarCraft clone.
He was able to produce a random ground texture and to control a single "dot" to move where he wanted it via mouse clicks, and then he bogged down. He gave it a good try but the project was a bit too complex to provide easy progress.
I need to come up with some simpler project ideas that are still fun to create.
Religion is poison to rationality, and we lose sight of that at our own peril. -- Lurker2288
Backstory: I learned to program at age six on a Commore Vic-20. I decided to learn because games on the Vic sucked and programming was the only thing interesting one could do on it (even for a small child). Commodore BASIC was limited and quirky, but provided me with hundreds of hours of fine entertainment. One could pick it up quickly thanks to the programming manual that was bundled with every computer (take note).
When somebody asks me who had the most influence on me on my career choices and inspired me, I don't tell them it was Bill Gates or Steve Jobs, but Jack Tramiel. "Jack WHO?" "Never mind..."
If I had a kid and she told me she was interested in learning to program, I would pick Python. It is easy to learn and very deep, which good support for imperative and functional programming, other than OO. First thing, I would buy her a book. There are plenty around that start from the basics and work their way up to a simple but rewarding game using PyGame or Pyglet.
Back on the Vic I could only choose between BASIC (mediocre and slow) and Assembly (obscure and arcane). Today beginners can choose from so many options. The important thing is not knowing "where" to start, but "how". Buy a good book, and if you love what you learn, you'll never stop as long as you live.
Hack your mind out of its sandbox.
Don't laugh!
W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
For anyone suggesting VB, or Visual C#, or any of the other "Click to build the framework then fill in the back end", this is the worst possible thing an actual beginning programmer should be looking into.
I would assume from the OP that we're talking about people with no programming background. Taking someone like that, giving them a button to click to generate a UI, then having them fill in the blanks is #fail. They don't already know how to program. It would be like asking someone to complete a puzzle, in a dark room, where they don't know what shape the blanks are in the puzzle, or what colors they should be, or even where the front or the back is.
Interface builders are nice for people that already know how to program, because while creating UI's is tedious, it's also about the 10th thing to be done when building a program. People who have been programming for years can work backwards (Yes, UI to logic is backwards in all cases except for programmers-who-specifically-design-UIs, but that's not what we're talking about here) from the UI to the underlying program logic and the flows between UI elements, but someone new shouldn't be developing in this direction. They should be understanding how the logic behind the program works, in many different variations, before they go putting a pretty button in front of that logic to show the result in pretty graphical ways via some rendering library call..
BASIC, Lisp, Perl, Python, Java (not javaw or AWT), all are useful for the basic understanding of what a program is, what control and input and output logic is. As people have mentioned, Python and Java both have graphical toolkit extensions that can eventually extend your development to pretty pictures and not input/logic/output. If you really want some sort of "visual" developer to put in front of this person, go look into some of the "Blocks" development tools, like Google AppInventor, for example. These use interfaces analogous to puzzle pieces to represent the code in the application, and you can drag and drop inputs and outputs to hook into control statements to do things - sorta like the virtual programming equivalent of everyone's favorite Radio Shack 160-in-1 Electronics kit.
For the love of god, though - don't "teach" someone to program by putting them in front of a framework generator and having them "go at it".
This space for rent. Call 1-800-STEAK4U
I've been teaching 10 9-year-olds Kodu Game Lab this week in my home and they love it and are understanding the concepts of event oriented programming while creating computer games. We tried Small Basic but they are all just learning typing and that was a bit of a barrier. Kodu is extremely easy to learn and very fun for kids.
http://charette.com/blog/fairfax-computer-camp-day-1-kodu-game-lab/
http://charette.com/blog/fairfax-computer-camp-day-2-small-basic-and-turtle-programming/
http://charette.com/blog/fairfax-computer-camp-day-3-small-basic-and-kodu/
http://charette.com/blog/fairfax-computer-camp-day-4-building-and-testing-kodu-games/
Disclaimer - I work for Microsoft, the creator of Kodu Game Lab and Small Basic.
Michael S. Scherotter
Work as if you might live forever, Live as if you might die tomorrow.
It's cool to make fun of PHP here. *shrugs* It's making me a fair bit of money to ignore them. ;^)
It's better to vote for what you want and not get it than to vote for what you don't want and get it.
- E. Debs
Huh? Why? I don't use Python, but I just don't see any basis for your assertion. Whitespace is how we arrange natural languages when written, so why not programming languages? It's perfectly intuitive, especially to visual thinkers.
My daughter (8 years old) will be learning Etoys this summer, and when she's grown tired of that, Python.
The Navy did an exhaustive study of programming languages a little while back, and recommended Python as the best teaching language for high-school level computer programming.
I hope she doesn't stop there, but seeing as I haven't written any VIC-20 assembly, Apple ][ BASIC, or Turbo Pascal in nearly two decades, I don't think the languages are really what's important.
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
I'd recommend Brainfuck. It has no library at all to confuse beginners and only 8 commands.
Python, Perl, Lisp, Scheme, BASIC, Java, JavaScript, shell... it doesn't matter. Pick up whatever feels most comfortable, or whatever tool is most readily available. Learn the basics of flow control, data structures, and the most fundamental algorithms. Learn how to debug, document, log, build, install and maintain.
Once you've mastered these basics, move immediately to C (not C++). Programming in C will teach you what it is that you're actually doing in that high level language, and force you to manage everything that you want to do. You don't just instantiate a new class to get a thread or forget about that variable's storage when you're done with it. You have to think about the details and understand them, and even if your entire career is spent writing Python, you still need to understand these things. I'd recommend assembly, but there's a lot more well documented sample code in C to work from, and getting larger projects done in C is still practical, if somewhat painful.
Once C is something you're comfortable with, trying out C++ is an excellent next step, but that's probably best determined by what you want to / have to work on.
All the fun and cool stuff that is easy enough for a beginner is off-the-shelf these days. Why bother learning to program? The interesting stuff that is not off the shelf is no longer easy enough for a beginner who knows "X" to write programX.
python would be the best imho, you don't even need to write the code on a file, just start the python shell and play with it, for the gui use pyqt4 signal and slot are easy to understand, ruby might also be good, I think it has a shell too .NET it's easy to create gui interfaces, AFAIR event handling is quite easy too you just need to click on the object and select the event from a list and it will automatically create the function, one of the best thing about C# if you use visual studio(all versions) is intellisense, you don't have to waste time looking at the api to find a function
Another good "all in one" option might be C#
It isn't as much the languages today but our level of instant gratification.
Back in the old days.
10 PRINT "HELLO"
20 GOTO 10
was considered kinda cool for your first program.
Or if you wanted to make a game...
10 PRINT "Your are in a room labeled Center where to go (N,S)"
20 INPUT $D
30 IF $D = "N" THEN GOSUB 1000
40 IF $D = "S" THEN GOTO 2000
50 PRINT "I do not understand your request"
60 GOTO 10
1000 PRINT "A Monster eats you... Your dead do you want to play again? (Y,N)"
1020 INPUT $D
1030 IF $D = "Y" THEN GOTO 10
1040 IF $D = "N" THEN GOTO 3000
1050 PRINT "I do not understand your request"
1060 GOTO 1000
2000 PRINT "You Escape and you win!! Want to play again? (Y,N)"
2020 INPUT $D
2030 IF $D = "Y" THEN GOTO 10
2040 IF $D = "N" THEN GOTO 3000
2050 PRINT "I do not understand your request"
2060 GOTO 2000
3000 PRINT "BYE"
Today Instant gratification requires cool GUI drop pictures multiple form input and you better be able to use your mouse or no deal.
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
Whitespace is how we arrange natural languages when written
If I resize my browser window so that your post linebreaks at "when written" instead of "especially to", the meaning of your post doesn't change.
Ruby.
Kind of surprised it's not getting more love here.
(hey, not everyone's into the Python philosophy)
sic transit gloria mundi
Agreed. I would format my code the way I write it in Python anyway for readability, so why not? Forcing better code readability is a fine tradeoff for me. I might think a beginner would have more trouble understanding that nicely formatted code block A is the same as code block B with completely random indentation and line breaks, even though they look totally different. On the other hand, this doesn't apply when dealing with lists, tuples and dictionaries, where whitespace doesn't matter until you actually close it, so maybe there might be an issue there. Overall though, Python is a simple language with a very strong standard library that I would absolutely recommend for beginners. Hell, I'd recommend it for basically anyone. We do 99% of our code in Python at my workplace (web pages, cron scripts, network applications, etc.) and I personally find it fantastic to write in.
I like to think of online DRM as something akin to a college -- you pay for lessons until you learn something.
Just fyi, any Python experience will serve them well when they reach high school and university calculous courses. The Python & Cython based Sage CAS is displacing Mathematica for calculous courses. There is also an LLVM based Cython & Python compiler that's helping liberate Python from various interpreted language bottlenecks.
I'd actually seriously consider some reduced subset of Haskell myself.
The Christian religion has been and still is the principal enemy of moral progress in the world. -- Bertrand Russell
What I find amusing is how completely Pascal has disappeared from both historical memory and current usage. Some of you may remember the 80s for Basic on a C64, but I remember a huge bandwagon for Pascal both as a teaching language and as a working language. (I am not advocating Pascal, just reminiscing.)
Start with what ever you have.
RosettaCode has a ton of different tasks for 385 (and growing) languages. Find one (python, perl, php, bash, c, c++) that you can get for free and then
The biggest problem isn't syntax (IMHO) it's that people (at least mechanical engineers) don't grasp the concept of what a for loop, while loop, if statement, etc DO. If you break it down and explain it to them they "get it" a bit, but most are lost on their own. So pick something that you 'get'. Find a language that you think makes sense in your head and go from there.
I cut my teeth on TI-89 Basic. That's where I 'learned' to program. From there it was MATlab, Java, PHP, C, C++. I still use most of those rather extensively.
As in what, 1987 and onward?
If you want instant "wow" gratification, the closest I've come to that lately is with LSL, the second life scripting engine. Which affects the objects you make in the Second Life Virtual world. The interface is easy to use and the syntax is really approachable.
Second to that I'd say Python, mainly for its easy to pick up syntax, ubiquitous nature and the capability to do actual 'real-world' stuff with it as you develop skills.
"Enjoy what you're doing! If it becomes drudgery, you're doing it wrong!" - Jim Butterfield
There are a number of universities using Haskell for their intro to computer science courses. Haskell is a lovely language but maybe second only to C++ in complexity. You need not use all that complexity however.
The Christian religion has been and still is the principal enemy of moral progress in the world. -- Bertrand Russell
Think about the project rather than the language. For example, a simple off-the-shelf robot kit with an embedded high-level programming environment may capture a newbie's imagination. Raise/lower the arm once. Then five times. Then with a five-second pause in between. Then when it's sound sensor kicks off...etc.
A suitable kit would have a fairly abstract library (and likely a language like C or Basic).
If you liked BASIC for learning why not install an interpreter and use that? It isn't state of the art by any means, but it would be a very simple introduction to the concepts. Once someone has some feel for that then you could move on to something modern if you felt they couldn't handle that right away.
Alternatively, my university uses Java for our intro to programming classes for people with no programming experience at all. The environment we use for it is DrJava which is free and designed around being a learning tool. Better still, there are tons of CS 101 course syllabi out there that would give you a very good lesson plan to start with in that environment if you wanted to teach with that.
Personally, I'd say the tool to use depends on the student and the purpose. If it is someone just looking to understand a little bit about programming but won't be doing more, then let them play with BASIC since that is really easy to get into. If it's a child you are introducing to the concept or someone who wants to eventually get to advanced things, go with the DrJava route.
Since I can't tell them apart, I treat all ACs as the same person.
I'll even link them since the poster can't do basic research before Apple-bashing
I do not own an iOS device with which to do research. In what way should I do the appropriate research next time?
You obviously don't know what you are talking about since both VB.NET and C# use the EXACT SAME libraries.
What makes Visual Basic an excellent place to start is the environment. Code completion, instant error/syntax checking, code reformatting, and a real debugger. All of which is integrated, easy to set up, and easy to pick up quickly. Although, C# is also a good choice, I'm not sure learning when and where to use curly braces and semi-colons is easier than putting each statement on it's own line.
I think that as long as you avoid BASH-like "fi" and "esac", you're probably safe.
As of Postgres v6.2, time travel is no longer supported.
As far as non SL virtual world languages - Alice would be another good contender.
"Enjoy what you're doing! If it becomes drudgery, you're doing it wrong!" - Jim Butterfield
All interpreters are banned [...] they run javascript sites just fine
How do iPod touch, iPhone, and iPad devices run JavaScript sites without a JavaScript interpreter? The answer to this question helps explain why I recommended JavaScript over BASIC in another comment.
How about starting with assembler?
http://altdevblogaday.org/2011/03/24/machine-code-is-for-kids/
Mada mada dane.
Someone forgets trying to do things in BASIC, only to find it's too slow, and being forced to learn assembly/machine language.
Someone forgets the hours of pouring over hardware manuals trying to figure out the right registers and addresses to do anything so simple as getting keyboard input.
Someone forgets that in the '80s, computing was about anything but instant gratification.
I do not fail; I succeed at finding out what does not work.
sentences are delimited by punctuation, not white space.
Small basic is the version of basic without all the more difficult concepts to master (http://msdn.microsoft.com/en-us/beginner/ff384126.aspx). There is nothing wrong with python per se- I do not think it is as readable as basic however- consider a simple adder function:
class adder:
def __init__(self, value=0):
self.data = value # initialize data
def __add__(self, other):
self.data += other # add other in-place
I would add Java. The Java haters will hate but Sun created a great set of tutorials to teach people how to use Java and they are still available on the web. Eclipse.org and Netbeans are great free IDEs that you can download. I would also suggest Squeak. If you are on the mac Objective C is available but may be a bit much for people just getting started. You also have Ruby, Perl, and Free Pascal which is really a good choice as well.
Of course you could go with the real replacement for Basic.
PHP!
Easy to use and abuse and will do nothing to teach you good programing skills just like basic.
Truth is that back in the C-64,Apple II, TRS-80, 99/4a, Atari 800/400, Coco, and Sinclair days we all used Basic because that is what we had. Some times you could find an Assembler or believe it or not a machine language monitor but real programing languages where expensive and hard to come by. I was so excited when a friend gave me a copy of COMAL. Now you can get just about any language you want.
See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
How is C# "better" with regard to syntax sensitivity or library size? They are the same libraries. And VB is far more forgiving syntax wise with allowing case insensitivity, automatic type casting between select data types, not getting caught up with a statement like
if (foo = bar) {...}
when it should have been
if (foo == bar) {...} .
It's forgiving nature can be a mixed blessing as it can also foster poor practices when transitioning to other languages that aren't as forgiving.
My first exposure to programming was typing in the line PRINT "HELLO" on a Burroughs B6700 terminal and seeing it reply back HELLO. How it could do that intrigued me so much that I HAD to figure out how it worked. Perhaps that triggered some latent OCD I was unaware of at the time, but that was over 35 years ago and I haven't been the same since. The need to understand, all the way down to the level of how the electricity coming out of the wall socket was transformed into what seemed to me at the time, an intelligent machine, has driven me throughout the years. Though I understand much more now, and the "ghost in the machine" gave way to simple logic and algorithms, the curiosity that my first encounter inspired has never left me and I still have the need to understand how every new technology that's been layered on top continues to drive me on.
I've since tried to instill this same inspiration in other people, including my children and anyone else who will listen, but I've not met with much success. Most people I encounter who've come to programming over the last 25 or so year don't seem as "curious" about the inner workings of the machines. Perhaps it's because they grew up with already sophisticated computers and the "magic" is just taken for granted. Perhaps it just takes a particular form of OCD to appreciate it. I don't know. What I do know is that it's hard to get someone inspired using a language like standard BASIC because they won't get excited about something as simple as PRINT "HELLO". They expect, within a few minutes to be able to create some fantastic, world changing first person shooter, and when they find out how much work is involved they soon lose interest. Try to explain a modern language like Java, C# or even VB to them and they begin fidgeting and looking for the door.
The bottom line is, I don't think the language is that important - just about any language will do. Instilling the interest and desire to learn is the hard part and frankly, I've haven't figured out how to do that yet.
Sometimes the light at the end of the tunnel is the headlight of an oncoming train.
Icompletelyagree,punctuationisthedelimiterforsentences;spacesarenot"Whitespaceishowwearrangenaturallanguageswhenwritten,sowhynotprogramminglanguages?"isjustasillyassertionbytheoriginalposter.
Bash isn't an especially pretty language, but it allows huge flexibility, by chaining together all the CLI commands.
This makes it really easy to program quite advanced behaviour. Things like:
echo hello | festival --tts
or
zenity --info --text "`fortune`"
or
cat document.pdf | ssh hostname lpr
Nothing better than assembler to teach what is really going on with a computer.
The old 8 bit micros were easy to come up to speed on (Z80, 6502).
My first class was assembler on Z80. First assignment was write an editor we were required to use for all our text editing for the rest of the class (you could tell who used theirs, as our editors kept acquiring features as the semester progressed), second assignment, write a dissassembler (also handy), last assignment write a compiler. Very useful class. After that semester, self taught 6502, then 8086 over the summer.
ARM is supposed to have a pretty clean instruction set, so maybe even use ARM instead of an old 8 bit micro. x86 is ugly-- as a beginner, would stay away from it.
Assembler leads to understanding at a deeper level, this deep understanding transfers to better use of compiled / interpreted languages too. E.g., on modern CPUs with deep pipelines, branches are very expensive. Most folks who cut there teeth on basic and python type languages are ignorant of this. Once you _see_ this happen, you are motivated to find out, "Is putting the more common code path as the default in a conditional better optimized by this compiler/interpreter?" The result is a lot less of the crappy code that is so common today (regardless of language).
Now get off my lawn.
Ithinkthatmaybeonlypartiallytrue.
Certainly by the time you're dealing with paragraphs and multiple sentences, whitespace actually does become significant.
I've never been a fan of whitespace being syntactically significant in a language, and my only exposure to Python was almost a decade ago ... that was enough to make me cringe. But, that could have been the guy writing it the code that I saw. But, it was complete crap and pretty much soured me on the entire language.
Lost at C:>. Found at C.
While I did start with BASIC at age 7, my first foray into computer programming was with Livecode. LiveCode (Formerly Revolution) is a spinoff of Apple's HyperCard that fares incredibly well in commercial and educational markets. www.runrev.com has the details. I used to teach 5th graders programming with it, and it's so simple yet so powerful that we'd build networked starship simulation software for a local space education center (www.spacecamputah.org). It's an incredible platform to build on, and it has all the types of control structures and interactivity you'd hope for (Except objects, kind-of: I would teach OOP on a limited basis, since your GUI elements behave like objects; but there are no real logic-only objects in LiveCode).
If it's to teach to young children, I think that good choices could be
- scratch (scratch.mit.edu) a graphical langage that may help to understand basic algorithmic on a visual interface
- futurepinball (futurepinball.com) a pinball emulator which uses event-driven basic to manage the controls
Both have a ludic aspect that may appeal to children
If they are a little older, HTML then HTML+PHP could be a good choice. Javascript is a pain in the a** when it comes to complex programming (and I don't even talk about the cross browser nightmares). As a bonus, PHP may be used as command-line.
I'd avoid Python (a missing space may trigger a logic error with no syntax error which could become a pain for debugging), Java, C++ and C# (and other object oriented) as OOP is far from intuitive and C or Pascal (and similar) for the memory allocation problems. PERL seems a little un-intuitive (even if it's a great langage) and Reverse polish (Scheme/Lisp/...) is also a big problem.
If they are a little hardware oriented, Arduino or plain AVR/PIC microcontroller could be great (and there are good cheap devkits including lots of leds, buttons, an LCD screen, ...)
Speaking as one of those persons that got started back in the 70's, the best casual starter that I am aware of today is python -- best to work with print statement oriented programming as you get extremely fast feedback on your code. Best also to have a mentor around.
I've fallen off your lawn, and I can't get up.
If you are looking for a language that is supported out of the box on ever major operating system released in the past 10 years, the answer is Javascript. Editor -- the built in text editor; Execution -- browser; Debugging -- well, if it's a modern OS with a modern browser (IE8+, FF+FireBug, Chrome+FireBug) you can debug.
There are plenty of examples online. It has a visual result that gives instant gratification. It has a syntax that leads towards "real" languages (don't flame, you know what I mean). And, given the future direction of HTML5 + Javascript, it sets you up for future success if you decide to continue.
I wound up taking a similar approach to learning how to program but rather than VB.NET I dove headfirst into VBA (Visual Basic for Applications) for Microsoft Excel. I think it may have been the perfect intro to scripting, working with spreadsheet data you can easily see what all of the data is that you're working with and you can see what it's actually doing. All of the default libraries are Excel related but it seems like it can be expanded out a bit to include other VB libraries if needed. I'd definitely recommend this as an intro to programming.
That is not entirely true. We have many 'whitespace' rules in written language. Like leaving a space between words, after periods or commas, etc. So in effect it is a combination of punctuation and whitespace. Many programming languages use punctuation as well, but not usually in the way written language does or at least not the same types (ending 'lines' in C++ with ; for instance).
we are all invisible unless we choose otherwise
They'll never get excited by very simple things like I have been.
Ah, yes, I remember buying* a "professional" game and thinking "Heck, who published this? If they'll sell this crap they'll probably sell something I can knock up in a weekend. I was right, and while I never joined the "whaddya mean you won't insure my Ferrari until I turn 18" club I did buy a Honda 70 (look - I had parents!) and my computer habit was pretty much self-funding from then on.
However, it would be interesting to put your assertion to the test, and see how satisfied kids would be with simple programming if *they* were in control. After all, some kids still paint pictures, take photos, make videos, form bands and don't seem worried that the output isn't as good as they see on TV. However, even back in the day. making a blob fly around the screen or coaxing a tune out of a Trash-80 clone didn't float everybody's boat.
(*Memory a bit hazy on the "buying" bit actually :-) )
In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
http://smallbasic.com/
Seriously... If you dispense with use strict/use warnings it handles pretty much like basic with a hint of structure. I was asking exactly the same question the other week with regard to what to start my daughter (aged 7) off on. I went through some mental deliberations and settled on perl. She's taken to it as well as I did Sinclair BASIC at a much older age, She can't write anything from scratch (that would be expecting a LOT of such an age group) but she is happy to type in a short dictated program. She chooses the subject (times tables, Fibbonnaci etc) and I work out a strategy for building the program up a few lines at a time, with it being runnable as often as possible. She's demonstrated that she can modify it for basic parameters, eg which "times table", "max size of Fibbonnaci number). The best one we've done to date is one that picks 2 random numbers and asks a question like "What is X times Y?" It prompts for an answer and checks it with a friendly "yea" or "bad luck" message. It's not pretty, it's not trendy, it's not GUI but in my humble opinion, she is learning what computers can *really* do.
Why can't women be like Hedy Lamarr - beautiful, talented and inventors of frequency-hopping spread-spectrum techn
As somebody who writes Python professionally, I'm a bit biased, but can say with some assurance that the whitespace thing is not a major problem in the Real World. It's certainly no more of a problem than any other technique for designating a code block.
Compare these:
' Basic
If a == b Then
do_something()
EndIf
/* C and relatives */
if (a==b) {
do_something()
}
; LISP and friends
(if (== a b)
(do_something))
# Python
if a==b:
do_something()
Are you seriously suggesting that the last one is more confusing than the others? If your blocks are large enough that they can't easily fit on a screenful, you have other problems not related to your language of choice.
There are things to go after Python for, but whitespace is definitely not one of them. My take on its strength as a teaching language is that it can do really simple beginner stuff and really advanced stuff with graphics and sound (with the right libraries installed).
I am officially gone from
I would likely start a beginner not in VB but maybe Perl or Python or VBScript and C. Why not C++? You can program C in C++.
I think the older BASIC should be taught if the student wants to go into microcontroller technology, which some of it still requires a knowledge of assembler to program.
I would teach them how to use the goto in a way that does not create spaghetti code (like when exiting a loop or simulating a control structure that doesn't exist in the programming language).
I showed my daughter BBC BASIC in BeebEm, and she predictably, enjoyed the classic
10 PRINT "DAD SMELLS"
20 GOTO 10
Microsoft Small Basic
It's the best learning tool I've found so far -- it's simple and has an excellent help system. The auto complete has descriptions along side the text (encouraging exploration and discovery), the sidebar help automatically displays help for the current command, and the PDF tutorial is well-designed and simple enough for a bright child to understand.
Some of the changes are a bit odd, but they make sense. Next has been replaced by EndFor, for example, but this does keep things consistent with EndIf, EndWhile, etc.
The program itself is small (6mb download) and incredibly simple -- no weird options or anything to get in the way. It actually makes tools like Scratch look complicated!
Microsoft actually did this one right. I give it my full endorsement.
Required reading for internet skeptics
I'd recommend a compiled language with exception handling. I feel that makes it a little harder to get stuck/frustrated without any clues. The compiler keeps syntax in check. Exception handling gives a better clue as to why something is failing at run time. Of the major languages, I'd take either Java or c#. Eclipse or VS express, both solid and free IDEs. There are also tons of structured "learn this language" tutorials. Most also start with console apps which are a good place to start. I'd lean towards VS because I prefer visual studio. But from the academic value point of view, I don't see any notable difference between c# and java for the beginner. Obviously you'd go for Java if you're on a mac though.
Contrast that against something like javascript. It can be damn near frustrating trying to understand the DOM, the CSS inheritance, etc. That and simple syntax errors can prevent methods from loading, etc. Sometimes too much simplicity leaves a beginner without any sort of help. That doesn't even touch on browser compatibility.
I'd start with one of two options: Web programming or physical devices. Either one lets you make pretty simple programs that actually DO SOMETHING.
For web, I'd obviously start with HTML/Javascript, then go into PHP. Or maybe skip Javascript at first, as it's a huge pain to debug. Point is, you can build something with a nice pretty GUI pretty quickly and easily, and PHP and Javascript will prepare you well (in terms of basic concepts and syntax) for more advanced languages like C or Java.
The other way to go -- the way I really went -- is to start with programming physical devices. I started with Lego Mindstorms -- you start with their programming language (drag-and-drop stuff), but that quickly becomes too basic, so you start looking into things like NQC -- basically a C variant that has a rather limited instruction set, specifically designed for the Lego microcomputer. It's a bit hard to learn on your own (I still remember asking for help with my first program -- "You need semicolons!" "...I do? Where?"), but if you actually read the tutorials or have someone to help you with it, it isn't too bad, and you can immediately see what it's doing. Something like an Arduino could also work, though it may be too complicated. I'm only familiar with the TI MSP430 Launchpad stuff, which is similar in design, but would be way too difficult for a beginner....but I gather that the Arduino has some easier programming tools.
Any language that makes whitespace part of syntax is very very badly braindamaged - if you don't like the way someone's source file looks then write a filter that formats the source the way you like to see it but don't force your ideas down other folks throats. While the facts of life are that I may have to cope with other folks python code, I will never write anything in Python. I use Perl, C, Java, shell and in another life Rocky Mountain Basic for original work. Hell, even Fortran and Cobol treated whitespace more intelligently than Python.
Signed,
An old retired fart who has written more in all the above mentioned languages (except Python) than he cares to remember.
I thought about this, and decided to set up a TRS-80 Color Computer emulator in the hopes that the kids would take to it and want to learn how to program it. It's as simple as it gets - real-time basic built right into the OS. The only bummer is that i can't find the original books that came with it - there was one for BASIC, one for EXTENDED BASIC and one for DISK BASIC... Alas the kids just aren't interested. They just don't seem to have the attention span or patience.
As a novice programmer, one thing that kept throwing me off was C++, which I chose as my "beginner" language. I'm all for learning the basic foundations of programming, but Jebus, you can learn that through higher level languages as well. I realized that when I took a break from C++ and tried PHP and Python. The difference was astounding. I finally began to comprehend the principles without having to be incumbered by the complexities of the language getting in the way.
That's a ridiculously dumb statement. If they are too dumb to figure out the tab key, there doesn't exist a programming language to help them.
Your argument boils down to new programmers shouldn't understand scope. That's dumb. That's idiotic. And worst case, you can have the classic, basic-like, linear, non-nested, procedural, rats nest which coders have long associated with learning basic. The only difference is, python encourages something smarter, something saner, and something more professional on which to grow whereas your recommendation re-enforces just about everything bad with undisciplined coding.
Without a doubt, python should be the goto language for newb, wannabe programmers. Pssst - see what I did there.
In my opinion, making whitespace matter is actually a good thing for a beginner programming language. It was much easier for me to learn to make programs based on whitespace which is more visually pleasant and understandable than with C++ where you could accidentally tab a line over making the code work visually, but still wrong in terms of syntax. Beginner programmers automatically turn to that visual cue and the people who maintain python realize that.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." - Albert Einstein
I dunno...I find perl easy to teach to people...especially if they have already experimented with batch files or other rudimentary forms of coding.
I would probably lean towards Python or JavaScript... as they're interpreted and it's easy enough to get into understanding programming decision logic without getting too stuck on low-level semantics. JS is available in every browser, and these days every major browser has a JS console to muck around in. Let alone command-line support via node.js, wscript and other tools. Most of the same can be said for Python. I'm rather fond of JS myself, but either would be better than most compiled alternatives... being able to get hello world with the path of least resistance will inspire further learning, opposed to overwhelming users with complex IDEs or compiler options.
Michael J. Ryan - tracker1.info
My immeadiate reaction to this article was Python. However there is a fun language out there that gives a lot of bang for your typing called "Processing" it's targeted at artists and rank amateurs. It won't get you a cool prgramming job, (maybe I'm wrong), but it will get you programming with a small language and easy to learn libraries. Lots of examples are included in the compiler download. http://processing.org/ [processing.org]
sentences of a paragraph are delimited with punctuation and white space. Words in sentences are delimited by white space.
Once you get over your white space phobia and brainwashing imposed by other languages and closed minded programmers, you'll actually learn to love python's white space scoping. It saves types, prevents common bugs, increases readability and slight consistency in structure. There are literally, only two down sides to python's use of white space. One, some editors do really dumb things. Two, it feels unnatural for the first couple of weeks because of the endless brainwashing from other developers and languages.
A teenager I'm acquainted with has been geeking-out with http://www.qb64.net/ for several years. It seems to fill the niche that C-64 BASIC did for me and MS-BASIC and QBasic did for slightly younger geeks.
They're going to be forced to understand something. The whitespace thing probably is a little odd to a beginner, but if it's presented as "this is how it's done" then maybe it's OK. The worst thing when I was a kid would have been mandatory understanding of objects and data structures. I didn't even know what an array was until I tried to do a pac-man clone and wanted 4 ghosts. I figured they'd each have 2-letter variables: x1,y1,d1 for position and direction, but I'd need to replicate the logic 4 times. I complained to my dad that xn was another specific variable and I wanted to use a for loop with n specifying which x,y,d it was working with. He promptly showed me x(n), y(n), d(n) and I was ecstatic! Now contrast that with someone being told about arrays or data structures prior to them having the need... I think a lot of CS focuses on the abstractions too early. Of course that's what CS is all about, but for someone learning on their own they need to be able to experiment without all that "stuff" and boiler plate or the need to learn objects. I think Python would be ideal and the need for proper white-space can just be presented as a fact of life.
Your parent said 'delimited' by punctuation. That is not the same thing has not having any space inside a sentence so as to delimit words.
spaces also delimit keywords in python just as in a great many other languages so this is not even a point
Your parent was talking about spaces having a value at the sentence value, which does happen in python, unfortunately, but, thankfully nowhere else that I am aware of.
My kids don't mind programming. They both used Alice http://alice.org/ and were meh about it and didn't go back (about two years ago).
They both like Scratch http://scratch.mit.edu and the 12 year old has moved on to building his own blocks in the Squeak interface underneath it -- so as a starter language I think it has done exactly what we'd like it to do. He's now looking forward to learning python, probably using the media computation materials from Guzdial/Ericson.
The 9 year old actually prefers Microsoft's Kodu http://research.microsoft.com/en-us/projects/kodu/.
I'm thinking about working them through some of the material at Bootstrap http://www.bootstrapworld.org/ which is teachScheme for kids.
You should read this, "Does Visual Studio Rot the Mind? Ruminations on the Psychology and Aesthetics of Coding" By Charles Petzold http://charlespetzold.com/etc/DoesVisualStudioRotTheMind.html
We put you on the Internet map,
www.racknine.com
Once you get over your white space phobia and brainwashing imposed by other languages and closed minded programmers, you'll actually learn to love python's white space scoping.
I used to be one of those brain-dead space haters, too. Now ever since I first saw the light, my language of choice has been WhiteSpace and I've never looked back.
It has its uses, but learning programming should not be considered one of them. VB.NET teaches you managed .NET programming - not actual, functional, cross-platform coding.
The only language I would recommend anyone start out with, beyond BASIC, is C and/or C++. Almost everything in the computer world is built from these base languages. Including most of the C#/VB.NET compilers/linkers/MSIL encoders, etc. It's essentially an easier-to-understand wrapper for the ASM and machine code.
Learning C/C++ to start gives you a fundamental understanding of how the data is moved and manipulated - without abstracting into a simple datatype and method to do everything for you.
If the only way you can accept an assertion is by faith, then you are conceding that it can't be taken on its own merits
Which is an obvious fit for Python, because it's creator wanted it to be used that way.
From the Wikipedia page about Guido:
"In 1999, Van Rossum submitted a funding proposal to DARPA called Computer Programming for Everybody,..."
New things are always on the horizon
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
Lua is simple, straightforward, high-level enough, and has the instant gratification factor of being useable in games and graphics.
Possibly the best example of how programming computers actually works, once you realize BASIC was crippleware.
What, no love for Eiffel? I thought it was supposed to be the greatest first-language ever! Can't blame anyone though... I started learning it a few weeks ago, and it's an irritating mess.
If you format nicely, sure, that's true enough, and while I'm a fan of teaching proper indentation, your examples are technically incorrect (the best kind of incorrect!).
Your code in BASIC:
' Basic
If a == b Then
do_something()
EndIf
Functions identically if you do this:
' Basic
If a == b Then
do_something()
EndIf
Or even this:
' Basic
If a == b Then
do_something()
EndIf
However, in Python, I believe this:
# Python
if a==b:
do_something()
is not identical to this:
# Python
if a==b:
do_something()
or more specifically, not identical to this:
# Python
if a==b:
do_something()
And even if that is functionally identical (due to the brevity of the snippet), a larger structure which requires varying levels of indentation would not be. This would, admittedly, be painful to look at from an experienced programmer's point of view, but having no indentation is how I remember learning to write in BASIC the first time (since line numbers and explicit structure end syntax controlled flow anyway).
That all said, from what I know of it (and I've only briefly used it several years back, so my knowledge may be out of date or mis-remembered), I'm in favor of Python as a learning language (and a language in general), but I can see the potential concerns for teaching if one doesn't expect the student to be able to maintain perfect (or even good) indentation formatting for some reason. Having explicit non-whitespace characters control program flow might be slightly easier for a new programmer to understand -- and using an editor that automatically indents code based on those characters would help them understand good formatting (along with helping them see the code structure form as they write), and enable them to transition quickly to Python later, where you're essentially just dropping the explicit curly braces in favor of implicit ones using indentation.
~Anguirel (lit. Living Star-Iron)
QA: The art of telling someone that their baby is ugly without getting punched.
Comment removed based on user account deletion
Maybe someday we'll have the perfect language that satisfies everybody. Right now, every language has quirks. Beginners are going to have to learn that. You are not going to find a language that doesn't have something like this. If it isn't whitespace, it's a missing semicolon. Ruby? How will a beginner grok the idea that 2 has methods? They think numbers are just numbers. You mean all this time 2 has an entire world full of stuff in it? What's in 6? I'll tell you what's in 6. Quirks. And the quirks are based on quirks. After that, it's turtles.
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
All the python fanboys here are totally missing the point. The post is about getting kids to learn programming. Most kids these days will have their first exposure to computers in a web browser. Not a command line, not a text editor, not a compiler or an IDE. A web browser. There is no better choice for instant gratification for someone interested in learning to program. A child learning to program can write any kind of simple program and be able to send a url to their mom, dad, grandma, best friends, facebook, etc.. they don't have to compile anything or then .zip the .exe because emailing it to mom, dad, grandma, etc, and expecting them to unzip and run their little program is just too much to ask. Python does little towards instant gratification, and keeping them interested in learning more. JavaScript is a better choice, it is as ubiquitous as any language, well documented around the net, and it runs in the most used environment by over 2 billion people on a daily basis. If I were a kid these days JavaScript would be the best language to start with. If wanting to go further there are plenty of back-end platforms that also run JavaScript. They can even write iPhone apps with it.
The "back-story" was always there, unless you go back to the 1940s or something. The BASIC programmer of 1981 didn't think about things like how does PRINT really work, the garbage collection that kept string variable storage from growing to infinity, etc. The abstraction and (temporary?) ignorance of the back-story is what lets you "just code something quick."
I think the reason things "feel" different now, is just that the back-story is longer and the abstractions are higher. When the 1981 BASIC programmer decided to dig deeper, it wasn't very long before he was working in assembly language, whereas when the 2011 Python programmer digs deeper, he's reading the source code to the library (most of which is itself written in Python) or maybe down in C and learning the OS' API calls. It's a deeper dig before you're thinking about transistors, but I'm not sure that's really important. You've got to start somewhere and really no matter where that is, you're going to start learning new things if you're interested.
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
Visual Basic only has the name "basic" in it and is in no way comparable with classic basics the story is talking about.
The fact that you don't know that and feel the need to post, is closely related to that story ;D
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
I like to teach students with Python and Pygame. By the end of the first semester programming class they can create some fairly complex games. I have videos of these games on-line, along with a free draft version of the textbook we use:
http://cs.simpson.edu/?q=python_pygame_examples
Java's great.
If you don't mind that you'll probably lose support for it and get sued by Oracle now.
If the only way you can accept an assertion is by faith, then you are conceding that it can't be taken on its own merits
How do you explain to a new programmer the _self_ thing in Python?
While I agree that Python might be a great language for someone who actually already can a little bit program, it certainly is not a starter language.
I met lots of people, regardless from which background they came (C/C++/Java/Shell) who shoot themselves into the foot very badly.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
DarkBasic Pro doesn't have line numbers. DOES have functions. Add-on libraries. It's compiled, free, and high on the instant gratification scale. With a bit of work, (less than just about any other language I can think of off hand,) it can be used to create games that contemporary kids would actually recognize as the sort of games they play.
Then you never had a mix of spaces and tabs in your code, had you?
I also really doubt you ever used white spaces in a natural langue similar to it is used in python. Your claim regarding that makes no sense (or is simply factual untrue). Show me a singel "if" you ever wrote in a letter to someone where you indented the following text.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
I agree with Pascal--first "real" programming I used after playing around with Basic interpreters on the Mac II. It's much easier to start with than C, but has C-like syntax so it's not hard to transition.
Ceci n'est pas un post
There's a lot of different questions and concepts going on here.
Has the level of abstraction in computer systems reached a point where beginners can't just code something quick without a huge amount of back-story?
No. But that's not learning to be a programmer. Yes, you can point a beginner at any number of languages with a bit of a reference book or online dictionary and they can hack out something that works. But that is only the most rudimentary lesson in programming.
I find this to be the case now; scripting languages are good, but limited in what you can do...
Which sounds perfect for a beginner language. You start with basic concepts like flow control, variables, data structures, and other rudimentary things. If they "get it" and are excited by the potential for doing more, then they are on their way to being programmers. If not, they have been exposed some basic computer science concepts which will do them good in today's world.
Think of English or History or Art or Mathematics. Most people take classes in those subjects, but few are enthralled to the point of making a career out of any of them. An introductory programming course using Python may help someone hack together some tool later in life, but it does not make them a professional programmer.
and GUI creation requires students to be familiar with a lot of concepts (event handling, etc.) that aren't intuitive for beginners.
And is there something wrong with that? GUIs are advanced topics. They require understanding of advanced topics.
What would you show a beginner first â" JavaScript? Python? How do you get the instant gratification we oldies got when sitting down in front of the early-80s home computers?"
There are many languages available today that would work fine as introductory languages. And many students will check off the requirement box and move on. A few will "get the instant gratification" regardless of the language used and move on to more advanced learning.
You seem to have the implied assumption that if you can make the results of coding "exciting" - flashy graphics, sounds, 3D animations, explosions - then students will be more interested in coding. I doubt that is true. At the end of the day you still sit in front of a computer and push buttons over and over.
- Jasen.
yet I understand better if you use only spaces for delimiting then you ll have more troubles i think in a semantical sense
I rarely respond to comments. Also, don't ask for clarifications: a brain and Google are faster, believe me!
You're a freak. You probably try to eat a turkey by putting one end in your mouth and pushing really hard.
Seriously, good on you for picking it up the right way at 12, but you're extremely unique in terms of people, their optimal learning strategies, and what they're likely to keep working at without payoff.
Anyone who loves or hates any language, platform, or manufacturer, doesn't know what they're talking about.
Back in the day I learned a lot from programming Hypertalk (Hypercard) on my parent's Mac LC. Despite the somewhat heavy syntax sugar, it really let you do a lot with very little, and all of that sugar meant that you could figure out what is going on by simply looking at the code. I'm still annoyed at Apple when they started shipping the player instead of the full development environment, and when they eventually dropped it entirely. The code is still around, but it's wildly overpriced for kids and example code is much harder to find.
Still, the ability to put a button on the screen, and then pull up the code in the button to find:
on mouseUp
ask "Please enter a number"
put it into theNumber
answer "You entered " theNumber
end mouseUp
That's the sort of thing you can build off of very easily.
I read the internet for the articles.
I could just as easily say that forcing beginners to understand that the semicolon at the end of a statement is not optional is asking for trouble. Forcing beginners to understand that a program might not behave as it looks is also asking for trouble. Beginners will have trouble with one particular kind of thing in syntax: features that seem useless or redundant. Forgetting the semicolon at the end of a statement is a common error in C/C++, precisely because it looks redundant with the line break, and that multi-line statements are comparatively rare. For this reason, line breaks should be significant. In general, significant whitespace is not intuitive: it makes no sense to differentiate "a + b" from "a+b", or "( a )" from "(a)". Languages that do these things are very annoying, and Python is not one of them.
As for significant indent, it depends on whether there is a block terminator or not. If your block is of the form "if condition then ... end if", requiring indent for statements inside the block is completely redundant. However, if, as in Python, the block is precisely the statements that are indented, then there is no problem, because it is impossible to forget to indent. Once your block ends, you will wonder how to close it, and you will remember that "oh yeah, I need to indent". This is something all beginners can understand.
Beginners will actually have way less problems with Python's rules than with C's if statement. If you can write something like "if (cond)\n[indent]statement", and you want to add a new statement, the immediate intuition (of a beginner, anyway) is to add a second statement after the first one, indented the same. Of course, IDEs will help, but I can see a lot of beginners mess it up or wonder why it doesn't work.
That is complete bullshit.
Every programmer I ever met lays out his code very similar to pythons requirements. ONLY that they in addition use { and } or other markers.
There is no brain washing. There is only SPACE versus TAB bullshit. There is the REQUIREMENT to have a newline and indent the block after the 'if' while it might sometimes be more natural to write 'if (a!=b) { do something; and even more; }
And the claim that the "proper python indention" prevents bugs is utter nonsense.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
What about Lua? The syntax is very simple, and you can find Lua interpreters in all sorts of projects these days. It's designed to be light weight, so the beginner isn't overwhelmed by libraries.
With Lua, a kid can write programs for his Rockbox enabled mp3 player for instance. Many games use Lua scripting, which a kid could hack and alter the game. This is an awesome way to get kids interested in what you can do with programming.
Give me Classic Slashdot or give me death!
Turbo Pascal on the IBM PC worked extremely well and was cheap enough for everyone to afford. It was a killer-app all on its own. I don't even remember a C compiler being offered in the early days of the PC. And I don't know why there wasnt one. But all the Microsoft development kit was expensive except for the assembler.
Holy shit dude, you broke out of the comment box!
"When information is power, privacy is freedom" - Jah-Wren Ryel
You aren't thinking as a beginner: you are thinking as a programmer. When I learned to program, If I wanted to emphasize a certain line of code with a tab, or use tabs and spaces wherever I wanted, why shouldn't I? Why restrict the student? I'm learning programming, not style. Eventually, after I learned how to program, I understood how useful was to have a coding style, or Hungarian notation, or whatever. Python is a great second language, but not the first one.
There's also a great notion that has escaped you, now that you are a Python programmer: as a normal person, you don't see the blank and the tab characters, they are "empty", therefore they surely don't alter the program at all! They don't alter the meaning on a newspaper or a book. It's common sense, and a huge downer for beginners. Of course, we, as pythonists, know better, but if you want to teach you have to think in their terms, not yours!
I rarely respond to comments. Also, don't ask for clarifications: a brain and Google are faster, believe me!
if a == b: do_something()
Doesn't work.
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on
...
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> if 1 + 1 == 2: print "yes"
yes
>>>
Python is pretty nice and simple and if you need GUI is not hard to learn PyQt once you know Python.
"It is our choices, Harry, that show what we truly are, far more than our abilities." -- Prof. Dumbledore
That's even worse than Python! :O
You said that he/she can distribute a URL, so you're assuming a server is available; why should a beginner care for such things, I wonder. Then you have to deal with different browsers. Then with different libraries (so you don't suffer so much from the previous point). Then with setting an ad hoc environment (remember, we are talking beginners here). Then with CSS. Then with JavaScript's magic (there wouldn't be questionnaires asking why "undefined !== undefined" if it were so simple).
A lot of people here just isn't thinking in how to learn to program! They are thinking in how cool or useful is Derp Programming Language because of certain features. Python is crap because of blank spaces and tabs: empty characters, IRL, don't alter meaning, yet it glorifies spaces and tabs semantically, and it's a massive downer for newcomers (I literally chose to learn C when I was 15 because the other language I could choose had that feature). JavaScript is crappy, as I said above, because of all the hassle.
Yes, I programmed in both Python and Javascript, I like certain aspects of both, and do enjoy programming in both. But I wouldn't recommend those languages as your first brush with programming. They are more like a second or third choice.
I rarely respond to comments. Also, don't ask for clarifications: a brain and Google are faster, believe me!
If you want instant gratification and know how to code then you can call into C libraries with one-liners.
If you don't know any programming at all then there's a whole series for you too.
And if you write PHP then imagine what it'd be like without the bad hangovers from v3-4, with all the planned improvements from the 6.0 they abandoned, and with functions that use a consistent needle-haystack order everywhere.
Perl makes the easy things easy and the hard things possible. I hated programming until I was exposed to Perl. Now I have been doing it professionally for 13 years.
- Interpreted, so you can quickly test things.
- Structured enough, but isn't all up in your face about it. Based on natural whitespacing instead of annoying brackets/braces, etc.
- Only as OO as you want it to be.
- More words and less cryptic symbols. I absolutely despise C and its ilk because of all the asterisk/ampersand/bracket/brace/parenthesis shit I have to keep track of. If x86 assembly wasn't so godawful itself, I'd even opt for that over C. At least it's easier to read what's going on. Some encourage C++ because of a "just throw 'em into the deep end" mentality. I did okay in C++ classes in college, but knowing that this is what the programming world was predominantly built on completely turned me off to it as a career. Oops, digressing...
And the execution of your C program shouldn't be changed by the lack of curly braces... See, I can make dumbshit statements also.
Python is a pretty good language overall, but forcing beginners to understand that whitespace makes a difference in how something executes is asking for trouble.
Even a computer-illiterate person can usually understand the concept of bullet points which have sub-bullets and possible sub-sub-bullets, and they "get" that the sublevels are encompassed by and related to the higher levels. They're non-programmers, it doesn't mean they're idiots.
sentences are delimited by punctuation, not white space.
Sentences are delimited by small pauses. It's almost as if there was some blank... space... between them.
Oh, you mean those sequences of symbols we write on paper to encode information that we'd otherwise communicate using speech. Yeah, the convention seems to be to put a dot or something between the written representation of sentences. But that's arbitrary -- the reality is, all languages of all humans have the feature that individual statements are separated from each other by silence (the lack of something), not the presence of something.
But I don't know FULL STOP Maybe people in your neck of the woods say "full stop" between each sentence they speak FULL STOP
or more specifically, not identical to this:
# Python
if a==b:
do_something()
That is not permitted in Python. It is a syntax error. You must either list a statement on the same line, or begin an indented block. If you want an empty block, you use the 'pass' statement. See, it's almost as if there are features designed into the syntax to help prevent mistakes. How odd.
Even if you used "Elseif" I would still think you strange. Seriously was the "se" just too many letters to type out?
If your looking for a simple language to start kids on, COBOL is pretty simple stuff.
Though it might give them the wrong idea about programing. It also isn't really fun, nor can you do "cool" thinks with it... so maybe not. You can make constructs and move data around pretty good, and I can make a mean text menu!
Your argument boils down to new programmers shouldn't understand scope.
Wow, you're an idiot. In no way does the parent's argument "boild down" to that. Sorry, it's just not even the least bit true.
That's dumb. That's idiotic.
It would be, if it were true. The parent in no way implies that scope isn't important.
And worst case, you can have the classic, basic-like, linear, non-nested, procedural, rats nest which coders have long associated with learning basic.
Fail again! Where did you even come up with "non-nested"? Do you even know what nesting is? Did you know that BASIC had that from the very beginning? Also, what's wrong with "procedural"? It's really out-of-place, even in your idiotic list of words you seem to think mean "bad".
Sorry, it's obvious that you're just (badly) repeating some nonsense (that you don't even understand) that you read on a forum somewhere. Way to not form your own opinions!
As for the "long associated" bit, it's a tired old meme that was Never true. Again, you're just repeating nonsense that you clearly don't understand.
The only difference is, python encourages something smarter, something saner, and something more professional on which to grow
No, it doesn't. Love or hate Python's whitespace rules, they're a HUGE barrier to a beginning programmer. Even if they "get" the whitespace thing right away, they'll need to constantly remind themselves that spaces and tabs are different, and what you see on the screen may look correct, but may in fact harbor errant spaces that'll ruin their program.
The only argument for python's white space is that it forces your code to look "nice". Absurd, as pretty printers have been around for ages. I'll bet your IDE even has one built-in. This isn't sane, "professional", smarter, or anything else. It's just another stupid barrier for new programmers to overcome.
whereas your recommendation re-enforces just about everything bad with undisciplined coding.
What on earth are you talking about? The parent gave exactly one reason why he doesn't think python makes a good beginners language. How does that "re-enforce just about everything bad with undisciplined coding"?
Did you even read his post before you started in on your incoherent rant?
Really, judging from this post, you're the LAST person I'd take advice about programming from. The incompetence you've displayed here is staggering.
Required reading for internet skeptics
As someone who learnt it as a first language, java is a horrible first language. Just look at Java's hello world (it's about eight lines, one of which starts "public static void main") - it's intimidating as hell compared to something like python ("print 'hello world'"). Java forces you to understand the notion of classes from the get-go (or cargo-cult a bunch of arbitrary crap before and after your actual program), which is a whole load of trouble you don't need when you're learning basic concepts like a for loop. And that's without even going into the lack of an interpreter or first-class functions.
I am trolling
..or languages.
When I started computing in the early 80th there were plenty of magazines, which 'taught' programming. Small games, which explanations, which one had to type in oneself. This automatically invited to experiment with the code. Change a line here or there and see what happens. Today? Download everything from the internet. Even if the sourcecode is available, there is no real reason even to see it.
Beginner programmers automatically turn to that visual cue
Oddly enough, the visual bit is why Python's controversial white space is bad for beginners. See, spaces and tabs are obviously different to *us*, but NOT to a beginner.
They could very easily slip and accidentally space a line over "making the code work visually, but still wrong in terms of syntax". Lean over and help them find that! A quick visual inspection won't tell you anything. Even worse, with the abundance of errors in typical beginner code, it may very well remain hidden and obscure other problems.
Required reading for internet skeptics
I would start with PASCAL or similar to teach basics such as for loops, conditional operators, boolean operators. Then to teach OOP I would probably use C++ (although if there was a simpler language available I'd rather not use C++ to teach OOP).
Life is about being a Phoenix!
Pascal was my first programing language. I learned Basic after Pascal. Of course I was lucky enough to have used the good old Commodore SuperPET which came with Interpreted Pascal, FORTRAN, COBOL, APL, and BASIC. We didn't really get into the FORTRAN or COBOL but I did play with APL which at the time was really cool. Frankly I would say that the SuperPET was the best computer for learning about programing available around 1982. We even had a primitive network that allowed us to share drives. I would love to find the manual for the MUPPET yes that is what the sharing device was called that we used.
See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
Oh god, this.
Years ago I got into a bit of a row with a co-worker. He liked two space tabs, and insisted on using emacs, which is fine ... except emacs replaced a series of tabs with a single tab (or something) that it interpreted as needing to be indented according to its own rules. But left the file unusable for everyone else because they weren't privy to these fancy rules, they were just text editors.
Basically, every commit he made looked like the entire fscking file had changed. It took days for him to understand that I don't care if he sees tabs as 2, 4, or 8 chars ... but if he couldn't make the resulting output something which I could still edit in vi or every other editor we used, I was going to lock him out of CVS. Because once the file had been edited in emacs, it was fucked up for anybody not using emacs. When the display preferences of your editor start to affect other things, it's bad -- you can't break it for the lowest common editor just so you can have syntax highlighting in emacs. He didn't seem to understand that I wasn't complaining about his visual preferences, I was complaining about what it was doing to the actual source files.
I'm not sure I agree with your arguments in favor of whitespace being syntactically meaningful (I personally think it's stupid) ... but, the amount that I code has dwindled over the years, and it is what it is. My exposure to Python a bunch of years ago left me with a very bad impression of it as a language as it seemed to rely on/advocate some really poor coding choices that when carried into a different language made for absolute shit code -- C does not benefit from that kind of layout, in fact, it becomes absolute crap.
(Actually, I vaguely remember letting someone else go who wouldn't adhere to our coding standards ... he didn't seem to understand that it wasn't his own personal code base, and that far more than just him was affected by his choices. He seemed to think that I was stifling his creativity, as opposed to protecting the integrity of a huge code base which had been around for some years and represented the product as built by people far smarter. No great loss, he was fairly useless anyway.)
Lost at C:>. Found at C.
Maybe that's because too many people thing CS is programming.
IMHO you should learn programming before learning CS. Just like you learn calculating before you learn proper math.
The Tao of math: The numbers you can count are not the real numbers.
However, whitespace is easily changed by non-programming-aware software (heck, even Slashdot's <ecode> doesn't always perfectly preserve whitespace!), while accidental changing of non-whitespace is much more rare (at least as long as it is in the ASCII range).
The Tao of math: The numbers you can count are not the real numbers.
You'd dump your new programmer straight into OO concepts and writing their own classes?
I'd argue that requiring self in methods wouldn't be much of problem to someone who had mastered functions and stuff and was actually ready for OO.
Don't forget Unlambda. After all, you have to know functional programming.
Oh, and visual programming is all the hype, therefore you should also consider Piet.
The Tao of math: The numbers you can count are not the real numbers.
No, he was not incorrect. Your interpretation of what he wrote is in error. His point is that every language has a set of rules used to indicate scope. Indent blocks equally is no more difficult to grasp than wrap blocks of scope with { and } . In both cases it is a matter of what you get used to, and if you are used to one the other seems more difficult. Python indentation is "harder" if you are used to something else in exactly the same way that Linux is "harder to use" than Windows if all you have ever used is Windows.
Your "good editor" point works against you. A good editor will handle indentation for you in Python as well as it will with any other language.
Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
javascript:getinput=prompt("what is your name);alert("hello "+getinput) This is as simple as any programming language gets these days, and you can type this into the address bar of any web browser and get instant results. It is the first step towards learning to program, using javascript. It really couldn't be any simpler. Something this simple illustrates how easy it is to get started. Ok, so you will eventually need a server. Well, there are servers built in to many operating systems these days, including windows, mac osx, and linux. It's either install python or install a web server, and in some cases a web server is already installed. Even XP comes with IIS, all you have to click a check-box in the Programs and Options to get it installed, and then you have C:\inetpub where you can write all the javascript you like, with ease, with notepad or whatever you like. There are also plenty of free online hosting options, and there are free online javascript editors/hosting to make it even easier to get started and share your code. jsbin.com and jsfiddle.net come to mind. No python to install, compile. Javascript is a natural choice for the beginner, not because of it's syntax, or it's features, but because people already know web browsers. They don't know python or why they'd even want to know it. They want to make websites. They don't want to make desktop applications, or console applications. This is the flaw in thinking that they should be using something like Python, beginners don't know why they'd want to code in something named after a snake. But, they've heard of javascript and it is widespread around the internet, and well documented. Every language has quirks, and that is a non-issue in terms of why people shouldn't use javascript. Also, Javascript's dynamic typing and lack of boilerplate make the bar to entry very much lower than most other languages, and for a beginner this is a huge win.
The original story was about newcomers to programming. Not about programmers new to OO. ... there are so many things people won't get or are difficult to teach if they don't already have a programming back ground ..
And you still did not answer my question, very likely for the simple reason: you did not understand it.
Why the heck do I need to declare an explicit _self_ in Python? How do you explain that?
I assume you never tought programming
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
... there are fantastic 'teach yourself' books now published. There are primers that explain everything step by step. C++ console programming is perfect for beginners once you have c++ primer plus. It is one of the best books I have found for having the most cogent pedagogy. Stephen is really good at explaining everything so that you "Get it", plus it also gives you a language that *has power* so you're not stuck in la-la land.
http://www.amazon.com/Primer-Plus-5th-Stephen-Prata/dp/0672326973/
So you didn't learn about arrays until you needed them. A beginner python programmer could wait to learn about lists/tuples until they need them to (I think that might be the toughest early thing, the difference between a list and a tuple...)
if a != b: do something; and even more;
or
if(a!=b):do_something;and_even_more;
These are valid python statements. You can also (and typically do) omit the final semicolon. You talk about a requirement that isn't exactly what you think it is.
And you mean "utter nonsense" to and for you. Many a programmer have erroneously added an indented second line to a braceless C if-statement (usually somebody else's code), expecting the obvious. Of course, you might say that you are a very thorough programmer and you'd never make this misteak, and those that did are not worthy of the "programmer" title, but then you would justify my point at the start of this paragraph.
PS since I don't want to make you run to the python documentation just to find another ugly construct, here is some help:
if a!=b: do_this
else: do_that
Ugly, I know. Nobody in their right mind does that, though, and python isn't the only language that, if insisting enough, one can write attrocities in.
I speak England very best
I consider BASIC the primary reason why I'm a sysadmin now, instead of a programmer. The problem I had with BASIC is that after years of tinkering with it as a kid [TI 99/4A, C64, GWBASIC on PC], I had a horrible time learning to get away from the 'GOTO' way of thinking.
In high school, I took the "Computer Math" class, which was basically learning how to do algebra in BASIC. I took that class because I had experience with BASIC at home, and thought it would help bring me to the next level. It was only years later that I realized that I should have taken the "Computer Science" class, which taught Pascal.
As a result of only being exposed to BASIC, when I tried to learn other languages or do anything more complicated than drawing circles randomly around the screen, I could never get the hang of functions and pointers and passing variables or whatever. So I decided I was too dumb to be a programmer, and wasted all my time playing games instead. I think if I had taken the Pascal class early on, I'd have had a much better foundation on which to build.
In the years since, I've become somewhat proficient with bash scripting (with functions and everything) as a sysadmin. I can sorta-kinda read some perl if it's not too obfuscated. I keep trying to learn Python, but I don't do it often enough for it to stick in my head.
While I have no desire to push my daughter to be a programmer [or do anything computer-centric] I do expect to ensure that she's at least exposed to some sort of programming, so that she has at least a reasonable idea of what makes all her computers and gadgets actually work. I have no desire for BASIC to be the thing that I use for showing her programming. Perhaps LOGO [how can you beat moving a turtle around for a kid?], and maybe Python.
I like the idea of python because, much like BASIC back in the day, you can very easily start a command line interface, and get action immediately.
BASIC:
10 print"Hello"
RUN
Python
>>> print "Hello"
Quick and simple, but without the danger of getting stuck in the rut of GOTOs.
Nothing to see here
I really believe you should also mention that in Python there is the following option:
from __future__ import braces
I speak England very best
> Without a doubt, python should be the goto language for newb, wannabe programmers. Pssst - see what I did there.
http://entrian.com/goto/
One of the best April fools' prank I've seen; just like that April Fools' day, when Google announced the eternally expanding storage space for GMail. They're still expanding.
I speak England very best
I'm not defending perl as the best language. But were talking about a starter language replacement for basic, and perl is super good for that.
Of all the O'reily pocket referecne books perl, is the shortest. Moreover the core language is not evolving and it can do an awful lot, very easily before you import any libraries. The same can't be said of any other language I know of.
It ubiquitously installed, and there is no compilation environment issue, or library linking. It's portable across machines. And it's machine model is pretty rich so you can interact with the OS very well.
PLus it's very easy to learn.
So I would say perl is the best BASIC replacement for starting programming.
Perl also happens to be one of the very best languages to learn HOW object oriented programming works. It's actually very brutal to do object oriented programming but it is the best one I know of to see how objects hold date, resolve inheritance, psedohash, or introspect. Other languages do all that but they hide it so well you don't have a good understanding of how they do it until you
After that I would reccomend python when it comes time to write re-usuable programms and modules.
Some drink at the fountain of knowledge. Others just gargle.
Um. One would write this class:
class Accumulator:
def __init__(self, value=0):
self.data = value
def add(self, other):
self.data += other
because an Adder is just
my_adder= value.__add__
or
import functools, operator
my_adder= functools.partial(operator.add, value)
I speak England very best
Object-oriented programming is a cult.
It exists to make it more difficult for people to learn programming.
It does not actually provide any of its stated benefits (such as code re-use).
Yes, it is nice to have big class libraries, but those could also be big function libraries with little change in benefit.
I'm 14, so this comment is obviously a little biased. Anyway, a big problem for me has been that, for almost anything you'd want to do, there's a program that already exists that does it. I mean, back in the BASIC days, if you wanted to do anything useful, you had to do it yourself.
My first "computer" was a hand-built 2650-based system with just 1Kbyte of RAM and the only programming language available was machine code (hand-coded from assembler and) entered through a hex keypad and debug ROM monitor.
You kids with your BASIC, Ruby, Javascript etc, you don't know how good you've got it :-)
If you are going to make a comment like that then you should provide an example else don't bother fi.
Fascism should more properly be called corporatism because it is the merger of state and corporate power. -- Mussolini
my problem with significant whitespace is that when merging conflicting changes in a source control system, you can quite often end up with some lines being indented differently than their surrounding change, especially if change 1 indents a block for some reason and change 2 just changes one of those lines. When you have significant whitespace, you have to make sure that your merge tool understands that the whitespace from one change has to match the whitespace from the other change, otherwise the semantics of the merge is incorrect. with insignificant whitespace, the source file can be poorly indented, but at least the semantics of the merge remain intact.
brainfuck is too large a language for beginners. i'd recommend FRACTRAN for which the programmer only has to learn a single operation and a halting condition.
Completely disagreed. First, a beginner is a beginner programmer. They are learning to think like a programmer and should be given every incentive to learn best practices right away. Python enforces this. Guess what, so does BASIC, my first language. Not as much as Python, but it was. As soon as I picked up Perl I began playing around with single line programs and good lord was that a bad idea.
Also I take offense to you and anyone else that thinks programming languages should be treated as a natural language. If you try to teach someone "in their terms" as you put it, you do them a disservice by letting them think programming languages are fuzzy and difficult like English or other natural language. The learning curve is steepened, not lessen by such nonsense.
Again, teach programming, not natural language parsing.
So they'd have to learn LISP before they learned LISP.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
For the C and relatives, you could do something very similar to Python (or at least you can in php):
if (a==b)
do_something();
you sadist!
Many games today come with built in scripting engines. You can learn how to program and have instant gratification of seeing your work being rendered in a 3d intractable environment immediately. I remember seeing a friend learn about object oriented programming by scripting for Unreal Tournament. Pick almost any game and you can start to script for it and it's fun. Just let your imagination come up with all sorts of ideas you wanted to do in game, and go program it. There's no real need to go build your own 3d engine or even have to worry about 3d graphics when you start programming, yet you can easily make use of it all.
I agree. I've programmed in more languages than I can remember (or fit on a resume), and I have found that learning a new language is easiest when I do something that does something cool on screen. IMHO.
BASIC, FORTRAN and COBOL were not so helpful, though BASIC wasn't as toxic as people claim it is.
Batch programming in DCL (The Vax batch language,) DOS Batch files, UNIX Shell Scripts and IBM's REXX (OS/2 and VM/CMS mainfraimes) was also helpful because when I was doing it I was usually trying to accomplish something. REXX actually had useful data structures in it too. Running up against the limitations of these languages and trying to figure out how to work around them was a good way to learn, as well.
Java might be OK if you implemented a framework to build into. I've been working with Jmeter lately and it's kind of neat in that you can use it for what it's designed for but if you run into something it can't do you can always write your own extension to it, bundle it into a jar file and drop it into a directory in order to extend the functionality of the system. You can shield yourself from complexity of the system that you don't necessarily want to be exposed to and focus on just the bits you want to change. Perhaps a java-based turtlegraphics system that could be extended like this would be in order. It wouldn't be hard to implement in android or on a PC.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
As a Perl programmer, I find it strange to see someone arguing that Python has an English-like syntax. For one thing, I guess you've forgotten "def", "len", (for that matter, "print", "return", and "break" are a bit awkward on a natural English level, though obviously not specific to Python. "pass" what? "try"...."except" - so I should try everything except these ones? "while True" (with an unnatural capitalized "True") "yield" a....generator, mkay....). I find it strange because it's usually the opposite of what Python lovers argue. Compared to Perl, which Pythonistas generally abhor due to its complicated (natural!) syntax, Python is supposed to be a model of sterile cleanliness and simplicity -- which is about like trying to write poetry in Lojban.
Pascal: agree. I learned Turbo Pascal about 100 years ago, the compiler I got (for free, from Borland) came with Turbo Debugger/Assembler. Learned Pascal quik, and learned ASM from Looking at the Turbo Debugger output. Coming directly from COBOL to PC programming, it made the landing a lot softer. With that said, now there are so many alternatives than 20 years ago. What ever became of the idea of looking at compiler output in ASM with the input source code as comments?
I am not a big C++ programmer, but as a C programmer, I remember learning C++ as "a better C" (not all the class library complications). If I recall correctly, C++ was pretty much billed as "a better C" back in the early 90's, but I forget things a lot now... way too old.
Comment removed based on user account deletion
Try out boo... http://boo.codehaus.org/
If you won't, then let me advocate Pascal. ISO Pascal adopted most of the OOPL extensions added by Borland's Pascal 4 and Apple's Object Pascal. The resulting OOPL retained most of Pascal's simplicity while integrating all the essentials of OOP. And unlike any practical OOPL I know, ISO Pascal is still explicable in a book of less than 200 pages.
Today's ISO Pascal is that rare example of a language that has escaped the curse that befalls more popular tools -- the accrual of ugly cruft and dross in order to silence too many squeaky wheels.
How do you explain to a new programmer the _self_ thing in Python?
Gee I dunno, how do you explain "this" in C++ which just appears out of thin air? How do you explain that "x += 3" within a "method" or whatever the hell you might call it in your language magically touches one x but not another?
Don't trivialize OO programming.
This became a very interesting discussion. I don't think I have ever bookmarked more sites in one day than today. And I don't program for a living any more. Always a geek I guess. Nice to know I'm not the only one.
Beware of cheap imitations.
Didn't someone actually write a BASIC interpreter in BF?
The new right fascists are bilingual. They speak English and Bullshit.
Personally, I think something like basic is one of the worst languages to start with if you are interested in learning how to program. Sure, it is relatively simple, but therein lies the problem. Basic fosters bad programming habits that tend to transfer over to other languages. I would even recommend avoiding C when starting, even though it is pretty much the backbone to everything out there. I know many excellent C programmers who are very intelligent, but found it difficult to transition over to an object oriented language. I would recommend either C++, Java, or C#. Java and C# are pretty much the same and simpler than C++. C++ is more difficult, however it forces you to think about your applications much more carefully, and if you know C++ transitioning to another language is pretty easy. C++ also exposes you to C. Regardless of the language you choose to learn I would highly recommend picking up a book on design patterns and antipatterns.
Personally, I grew up learning the C-base programming language ( not C++) and, in these days, I'm learning Assembly language programming in x86 and x88 ( because they're identical to each other -- i.e., both is implemented with parallel processing, as far as I know of these two ).
Others might agree or disagree with me, depending on their experience, and the syntax implemented in each language they feel comfortable with.
Even though that I know some people will try to coerce me to learn Java ( in universities, especially ), I'm not leaving the C language behind because of it's capabilities that I'm familiar with ( I hate data classes because they're so mind-blowing, in my opinion ).
Others might even focus about the web developing and leaving the hardware issues we're dealing with under nowadays basis. For example, some told me "hardware programming has no future in it, while web developing has a great deal in the Internet". Well, I have to say that I agree with the deal in the Internet, but I would disagree with the point about the hardware, because the hardware is what eases our nowadays activities like phones, gaming gloves, additional interfaces in the mouse treated as tweaks ( specifically, World of Warcraft gamers demand such tweaks, some, if not all of them ), Network programming ( I recommend people to learn network programming from this book "Linux Network Programming", which is basically limited to Linux and it's done in C programming language ), Linux kernel programming ( Linus Torvalds is a great example here, seach for a book called "advanced Linux programming), and the head-mounted controller. So, there is a lot of hardware programming involved in here which I don't see how it's possible that it has no future.
I had friends who argued with me for only dealing with C/Assembly, but I'm just saying that I'm fine with those languages. However, if they disrespect my opinion about what language I want to use, then there is no need for me to listen to their opinions. The same issue goes with the BASIC programming language. Some people hate it, some people like it, according to their point of view which might be convincingly reasonable or plain lame. If it's the syntax, I can't see the problem with it, which is so far so good.
You don't know what you're talking about. Its all about context. Where i learned programming in the 70s, there was batch FORTRAN / PL/1 & COBOL, and time-shared BASIC. It was the first time the computer talked back to you in real time.
Hewlett-Packard made a fortune off of their HP2000 series. Those $250k minicomputers were replacing million dollar mainframes and giving the users power and control. There was a free library with thousands of programs. You could modify them yourself. They were used in research, education and business and everyone was happy. It was fun!
In my high school, the BASIC programming classes were filled and the terminals were occupied from 7AM until after dark. You could get up to speed quickly and make some really cool stuff. I wrote an instant messaging program in 1975 that was not even supposed to be technically possible. There was an intense sense of competition between the students to learn the entire language, and it gave a focus to kids who weren't playing football or taking drama classes.
With the HP2000, it wasn't just the BASIC language, it was the operating system. You could do things on your terminal that would goof up the other guy. You could share data between users. You could execute operating system commands form within your programs. You got to learn about security and infrastructure, at a very basic level, which stood you well for future endeavors.
The HP2000 evolved into the HP3000 which was widely used from the mid-70s until 2000 when HP discontinued support. There were still a lot of BASIC programs being written up until the end.
Other contemporaries were programming BASIC on DEC PDP hardware. There was another entire infrastructure there that was vibrant and thriving, and BASIC was an integral part of it. Data General was another minicomputer vendor with an entire ecosystem of which BASIC was a part.
I taught the BASIC class in my senior year. When I went to college, my instructors let me skip introduction to structured programming - I had self-taught myself this concept without even realizing it was the most logical way to write code.
A lot of us kids went on to very successful careers in DP as it evolved into IT and learned new languages and operating systems and did quite well, thank you. We started with basic and evolved to cross-platform integrated development environments. I was lucky to meet the guy who decommissioned our school's computer and sold it for scrap in the 80's. he had an image of the last backup taken before disassembling the system. Through the use of SIMH, I have that system running in full on my MBP. I can run the Star Trek and Blackjack games from my high school days.
BASIC taught you the basics, and laid a basic framework to learn everything else that came after. It was also a useful tool for writing your own programs in an era when most computer users did that instead of buying software. Nobody I know uses the same stuff at work that they learned in high-school/college. Go find something else to rant about.
It's wasn't crap and you don't know what you're talking about.
Ask Me About... The 80's!
Check out this http://www.squeakland.org/ . It came from Smalltalk, I guess, and has lot's of visual reward for the kids, very educational. And prepares for OO. It has been tested along OLPC project and has had very good results. Worth a try
The lady doth protest too much, methinks.
Holy shit you're dumb.
Some beginners did pretty well with Hypercard 20 years or so ago. At least it allowed people with no programming background a path to get some things done while learning in the process. That practical application motivated some people that would have never thought of programming otherwise.
I really wish Apple would re-invent Hypercard for modern consumers and education. The current App Store rules wouldn't allow anyone else to do it.
Maybe someone can emulate it in Javascript?
And the claim that the "proper python indention" prevents bugs is utter nonsense.
No, you're position on the subject is entirely bullshit and idiotic. People literally change their coding style to avoid these types of bugs. Python, non-rigorously enforces such concepts.
Basically you are completely wrong, added nothing to the discussion, and have every appearance and not only sever brainwashing, but a willful desire to maintain it and general ignorance. Sad.
What about "C"?? You can get the Watcom compiler and "code away" in "C" for free. Basic was ok in that it let "non programmers" program, but frankly, in terms of "coding" It really was a rather limited interpreted language.....not unlike (but far inferior to) scripted languages like Javascript and others. IMHO Microsoft "bastardized" the term BASIC as a programming language with its many "kit bashes" of the language and misuse of the name. Same as "C#" just a marketing attempt to hitch your wagon onto a industry standard and give it credibility with the "masses" while hiding the fact it is a Java CLONE. BASIC was written in 1968, and was a "1st / 2nd generation language, any attempts to update have it miming "C" and similar languages, therefore ceasing to be BASIC and becoming something else.
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
In C++ methods don't have a this pointer in the argument list .... in Pythons the methods have and you can name it like you want even ... ... so a language which offers less might be easier for a beginner.
My point is: you have this extra thing, that hangs around all the time which a newbie likely don't really grasp in the beginning
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
the only thing I had wrong is that I was not aware that you can write:
if (a!=b): do_something(); and_do_more();
in one single line.
So, where else was I wrong?
You did not so far but claim I was brainwashed, rofl. How can you think that if you don't know anything about me?
Show me one bug that is prevented by Python coding styles ;D
You are here the brainwashed one by repeating this myth all the time without realizing that coding styles or languages have nothing to do with bugs (except perhaps the C habit to write if (CONST == var) to prevent the accidents like if (var=CONST) )
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
In C++ methods don't have a this pointer in the argument list .... in Pythons the methods have and you can name it like you want even ...
My point is: you have this extra thing, that hangs around all the time which a newbie likely don't really grasp in the beginning ... so a language which offers less might be easier for a beginner.
One could argue that pedagogically it makes more sense for the this/self to be explicit.
I'm using "." for indentation here because slashcode removes leading spaces in ecode tags for some stupid reason. Anyway, here we have a module-global counter, a class counter, and an instance counter. Because the instance is explicitly passed in, it is obvious which counter the "add" method is modifying.
Personally I don't have much of a preference either way, but it does cause confusion when I switch between C++ and python.
Try GAMBAS on Linux. If you like BASIC, you'll never look back.
http://gambas.sourceforge.net/
Buy your next Linux PC at eightvirtues.com
That was my point - a newcomer to programming will never see or use the explicit self. It's only later once they move on to OO that it will become something they need to know about.
And Python lets you go a long way before you even need to learn how to create classes.
Yes I have taught people how to program. Learning to program involves an awful lot of stuff that has to just be accepted at first as the way things are - this is with all languages. After all the syntax of any language boils down to a set of arbitrary rules that the language designer decided on. There is no point questioning everything.
You also forget that a newcomer to prgramming doesn't have any baggage from other languages - they are surrounded by seemingly arbitrary rules and they have no inkling for which rules are language specific or which rules are just the way programming is.
And as the student progresses they can gradually start being taught the "whys" as required. You need to get newbies productive and accomplishing something first to build their confidence rather than bombarding them with background theory.
If someone was progressing on to OO and wanted to know why methods had an explicit self, I'd tell them that methods are just like functions attached to an object and self supplies the method the object it is attached to. A newcomer to programming wouldn't even know that other languages don't require it.
If you'd stuck to your other point that Python can trip up programmers from other languages (eg Java and C++), then yes I would've agreed with you. But that is a problem with previous expectations which is not something a newcomer to programming would have.
You have got to be kidding.
In general, managed-code languages killed a whole category of bugs that you find in C/C++ programs.
In particular, Python's "if it isn't properly indented it won't work" approach prevents two kinds of bugs:
1) As noted above, the statement-intended-to-be-under-if-but-isn't.
2) The bugs that follow from misunderstanding weirdly formatted code. I have seen code that looks like
My appologizes, I should have excluded memory bugs from my claim that languages don't change much regarding bugs. Ofc managed environments remove certain bug classes.
However, I waited for an answer like this ;D
As your point is the common repeated myth.
1) if the line with the z is not indented it does not belong to the if. However: I as a reader can not decide if it should unless I know exactly what your code is supposed to do.
2) Yes, the "}" is unintuitively at the wrong place. And?
First of all, IDEs prevent this, they usually format your code for you.
Secondly: it is exactly the "do_something" and "do_something_else" example, the Python enthusiasts always bring.
My counterargument is the same as to 1): unless you know what "do_something" is supposed to mean, and unless you know what "do_something_else" is supposed to mean, you can not decide if a "wrong indented" line actually belongs into the { } pair or behind it.
So bottom line you have to understand what is going on and whether the code is formatted correctly needs to be decided based on the requirements.
This is the exact same problem regardless whether you program in Python or any other { } fancy language.
BTW: I never ever saw a bug that was obscured by wrong indentation. At my university once a study was made regarding bugs and coding habits and language influence. If I remeber correctly most bugs - coding errors - where produced in C/C++. The rest of the bugs where as usual: wrong understood requirements ... missing checks for bounds and other parameters. That was more or less in all languages the same. The only two aspects that reduced bugs signifcantly where programming by contract (not widely supported in any language except Eiffel and Groovy - via annotations only) and refinement based programming (some old obscure languages support that, or crefine, a preprocessor for c/c++ adds refinements to c/c++ - gogle for it)
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
Oh well.
My two examples were really of one principle: Code's look should be a hint to its function, and violating that is a problem. The point of the first example, for instance, was not that the 'z' line is necessarily incorrect; the point was that the programmer who wrote it was unclear about her intentions, effectively saying one thing to the computer and another to human readers. This being a problem is not a myth; it's common sense.
Your claim comes down to: No, such violations do not matter (or never happen in practice). You even claim to have some quantitative argument to support that. I doubt the argument will hold -- most such studies conflate to many factors to make strong positions on one language feature or other. And barring such data, your position seems quite irrational.
Hey! This is not an argument ... in the sense who is right and who is wrong. I only point out my opinion.
I mean, if you want to take an opposie stand and "claim" that python programmers make fewer bugs, you would need to back that up with "numbers" as well.
I did not answer especially to you but also to others about the "right indentation" prevents bugs "idea".
In my experience it does not. As I said before: I myself never made such a bug and never saw one from someone else.
However you are right, the studies I mentioned where done with students (who are not that experienced in programming) and with a pretty low number of participants, perhaps around 100.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
You delimited the words within a sentence, not a sentence between a sentence.
Here is an example of two sentences delimited by a period.
The boy was happy.He had his birthday.
Download a copy of VICE and install it on your Linux/OS X/Windows box, and learn basic properly.
As somebody who writes Python professionally, I'm a bit biased, but can say with some assurance that the whitespace thing is not a major problem in the Real World. [...] There are things to go after Python for, but whitespace is definitely not one of them.
AOL. The whitespace complaint pops up every time non-Python users discuss Python -- but it's just a distraction. Get over it.
"Lean over and help them find that!" Your assuming that every kid will have their own personal coach which can look over every bit of their code and give them tips which wasn't the case for me. Even though part of my programming experience came from formal classes, the professor could only devote so much time to each individual. When learning C++ I spent 95% of my time debugging rather than learning core programming concepts. The experience was like chewing on sandpaper because it was so tedious. When I switched to python I found that I was spending a significantly smaller amount of time debugging and more time learning about core programming concepts.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." - Albert Einstein