Python is the new BASIC
coffeeghost.net
coffeeghost.net
Actually, it is (it requires a package prefix) and it's:
print "hello"
(Print was never a function in BASIC but a statement)Yes, you can use promises instead of callbacks, and get in promise-hell instead of callback-hell. It's indeed a matter of style.
I didn't start learning to program because I wanted to program, I learned to program because I saw a file called GORILLA.BAS in one of the folders on my MS-DOS machine.
Once I figured out I could open it in QBASIC and just press F5.... that was it... I would be a programmer for my next 20+ years and counting.
EDIT:
I would also like to point out how important the QBASIC IDE was as well. F5 to run. Put your cursor over any function and press F1 and it gave you a full description. It fixed your syntax (somewhat) as you coded too. It would highlight the line where the error happened. It literally held your hand through creating whatever you could dream up at the time.
That Quake 2 and later required Visual-C++ and such kinda took the spark out of the creative mods, as the entry price became too high.
For instance Quake 1 had a "flight sim" of sorts that was basically done by one guy using Quake-C and some simple, freeware, modeling tools.
There was an attempt at making a successor for it in Quake 2, but even with a larger team etc it basically ran out of steam thanks to the complexities involved etc.
This gives me a good idea for teaching my kids to program. Why start from scratch? I'm going to give them a game like this, with code, and see if they can do something crazy with it!
P.S. For me, I became the computer lab teacher's assistant in order to skip recesses or other activities in middle school. Fixed printers, made .bat file menus, good times.
Agreed that Javascript is the new BASIC, Python needs to be installed, just like BASIC javascript is already present on your computer whether you like it or not.
import turtle
turtle.setup()
turtle.forward(100)
turtle.turn(90)
turtle.forward(100)
And so on. That initial experience has been one of the easiest to teach kids outside of a visual environment like Scratch. Some friends of mine have tried teaching Javascript but it's just frustrating: you have to teach looping with intermediate values and mutation, you have to teach the DOM, and if you want to get turtle graphics... well you have to scour the net for a poor implementation that barely works and teach the <script> tag... you get the idea. It's painful.The ubiquitousness is a huge advantage. Installing Python on a Windows machine and running programs is not as easy as "just being there." And being able to share your programs with a URL has so much potential... potential I feel is wasted by the walled-garden nature of code and presentation in modern browsers, crappy developer tools, and a lack of usable built-in batteries.
Python will never be as ubiquitous as Javascript. But it's pretty close: OS X includes a Python distribution as do most Linux distributions. Windows is the place where it hurts. I don't know if it could be, "the new BASIC," but it could certainly be a better one.
(This coming from someone who has fond memories of BASIC on the Apple IIc and Amiga 500).
my first programming language, approx age 9 on the BBC Micro at school :)
What! I've been looking for a nice easy to use turtle program for ages and it's been right in front of me the whole time!
Thank you for this.
The justifications you give for that make it seem like JavaScript is the new BASIC while Python is a better Logo (less ubiquitous language that is structurally better for pedagogy, though disadvantaged simply by being less ubiquitous.)
> Windows is the place where it hurts.
And still the dominant desktop platform. Which would be less important, as mobile eclipses desktop, if mobile environments included a standard, bundled interpreter that users could easily access for tinkering, but that's very much not the case.
That's kind of a constant in the tech world with every technology; I remember as a kid old timers making that complaint about radios. For a long time, its been made about cars. And, yeah, more recently, personal computers.
With radios it has been that moving for tubes to transistors to ICs has upped the minimum tools needed to get anything done.
With cars emission laws and such had introduced something similar via computerized injection etc.
But with computers etc the complexity was there for the start, but the tinker hostility has, IMO, come from a change in business from selling hardware to the hardware being a terminal for "content". Thus the tinkering hostility comes from propping up DRM under the guise of "security".
You quoted me -- I said Python is a better BASIC; implying that while Javascript might be the new BASIC, Python is better at being one. Let that be clear!
The turtle graphics module is only one example. Python ships with plenty of other useful libraries and tools that make it great for experimenting and learning.
Let's not sell BASIC short -- its success wasn't just about ubiquity. It was designed by John G. Kemeny and Thomas E. Kurtz to help Dartmouth students write programs to do work. They thought it was a shame more people didn't know how to program computers. I think they succeeded with their original goals[0].
Python has the advantage of being invented some twenty-five-ish-odd years later. After a couple decades of development it has grown into a language and system that far surpasses BASIC in its ability to teach people how to write programs and be productive right away. It's better than BASIC and teaching more people how to program, imho.
Javascript is definitely more ubiquitous. I wish it was easier to use and came with better libraries and things in the browsers. It's everywhere but it's not easier to use than Python. And Python's not as obscure as you'd think... don't discount the market share of Apple + Linux systems combined. If Windows jumps on board and packages a Python distribution: watch out (as if, but hey).
The new BASIC... jury is still out for me. I like both languages just fine. Javascript is a little bit more ubiquitous but it's not any easier to get into in my experience; at least not with modern browsers hiding the web console and providing little in the way of built-in code editors (and to say nothing of the DOM getting in the way of everything from drawing graphics to the screen to accessing the keyboard).
BTW, a team at Intel put Python into GRUB recently. And IMO they produced something that strongly reminded me of firing up something akin to the C64 and be greeted with a basic prompt.
Also, i swear i recently read about someone making a python enabled shell. Meaning that you could mix shell commands and python code on the same input. Had some small issues where python syntax overlapped with command switches or something.
There's just nothing like that today. Computers today keep regular users as far away from programming as possible.
They aren't meant to.
The de facto OS shell for most personal computers before IBM compatibles and DOS took over (it still came with BASIC, but it was no longer in a shell-equivalent role.)
* Pascal * Prolog * C/C++ * Ada * MATLAB * Eiffel * Erlang * Perl * Tcl
If I were a beginner, I'd take BASIC over most of those. BASIC does have warts and having it ubiquitous did help its adoption, but the language itself was "easy to use" for its day. (Perl is pretty good, but BASIC had a two decade head start on it.)
It is a less verbose subset and superset of Java at the same time, has a solid IDE providing great visual feedback as the code changes and you can introduce real, physical world concepts through classes, polymorphism and what not in a way that doesn't look too abstract. In fact, many visual arts courses have successfully introduced programming to an audience of designers and artists that are usually not fond of it.
Installing it is a 100MB download away and you can even make use of the universal aspect of javascript through ProcessingJS [1] or p5.js [2], or even through Python [3].
[0]: https://processing.org/ [1]: http://processingjs.org/ [2]: http://p5js.org/ [3]: http://py.processing.org/
You can't talk about the joy of learning computers without having a very, very easy way to produce simple graphics. Processing delivers on that, it doesn't even require a main().
Imagine introducing programming to kids at the same time they learn the cartesian coordinate system, or allowing them to grasp f(x) = sin(x) visually through experimentation. And pointed somewhere else on this thread, you can publish your work using the HTML exporter - no need for other people to install languages, open the console, etc, etc...
For those of you who don't know Processing, you can take a tour at http://hello.processing.org/
It's 2015 and we have the brightest minds working on this stuff and it's all shit.
Not sure on publishing but maybe try packaging it properly (I believe python apps can be wrapped into .exe files) and putting the package into something like dropbox folder?
It's 2015 and these problems are solved already.
I take back "brightest minds"
And this happens all the time to professional developers, much less 9-year-old beginners.
With that the whole issue with tabs and spaces no longer exists.
BTW if you are copying snippets of code from website "as is" in any language you will have to reformat it to fit your structure. Also if you copy code so often that this is becoming an issue I'm not sure I would want someone like that working for me.
This seems like a cruel comment in a thread specifically talking about a 9-year-old learning her first language.
Beginners benefit from there being a single way of doing things. Competing tooling just leads new developers to waste time early in their careers writing even more tooling, or writing a bunch of scripts and blogs to talk about how they dealt with tooling.
Tooling in JS is going to discourage some potential developers. It's not that bad in Python.
I ended up doing some simple graphics programming on an old 386sx. Using QB for high-level code, and interfacting with some ASM for lower level graphics and data processing, it was actually quite pleasant.
But then, the reference PCjr that I was targeting/experimenting on finally gave up the ghost and died, and I lost interest in hunting down a new one... Poor little guy.
What I took away from the experience is while the tools were more primitive, it wasn't the languages that sucked when I was learning to program in the mid 80's and early 90's as a kid; it was me. I sucked at programming.
Retro programming can be great fun. I dive into it - a little - every now and then. E.g. Turbo Pascal 3, Turbo C 2, Icon, Forth, BASIC even. I think I still have a copy of Delphi 1 on CD - it came as a promo with a UK computer magazine I bought at a roadside newsstand. And used it to write some small apps. Surprisingly the apps worked even on much later versions of Windows than were current when Delphi 1 was released, though of course the widgets looked old-style.
Also fun is exploring offbeat languages (that are not retro). Pike and ElastiC come to mind as ones I've checked out, and there are others.
console.log("Hello World")
seems pretty simple. Sure, when you get into async it might confuse young kids (or experienced programmers), but most beginner stuff won't need callbacks.
However, I don't think that what made BASIC so magical was just that it was easy -- it was easy and you could make the computer do the things you were interested in. And while the capabilities of Python are vastly greater than BASIC of yore, I think a beginner's expectations of what they should be able to do have grown even more quickly.
These days, typically someone who wants to learn to program wants to do one of two things: (1) make a website or (2) create an app. For a lot of types of sites Python is still a great choice (Flask is definitely one of the easiest frameworks out there to pick up, and I'm actually teaching my wife to program by making a basic Flask app with her). However, for other interests Javascript or even Java or Swift may be more appropriate first languages.
I guess that what I'm trying to say is that the best first language is the one that ignites your imagination with its possibilities, rather than the one that's the absolute easiest to learn.
Python certainly feels, to me, like the most similar language to the old QBasic. Simple syntax, with advanced features that you can use, or not use, pretty robust standard library, not great, but usable IDE built-in (I assume IDLE still comes in the install?)
One of the really cool things about QBasic was that it had support for doing such a wide spectrum of things natively, and easily. In my first semester-long high-school course, we went from Hello World, to doing VGA graphics with the different SCREEN modes and FILL, LINE, etc, making programs that could play christmas carols using the built-in MIDI commands, and doing some animations that relied on some of the old-school page-flipping techniques that we take for granted with modern hardware and APIs.
I don't know of another language that makes it as easy to do all that now. Python with pygame would be a start, but it's still much more complicated to get a window created that you can draw in than it was with QBasic.
I'd consider Javascript closer to Python than to C/C++/Java, for example.
You always have to learn some new things which each language. Doesn't really stop Python from being a good beginners language.
I miss these in the new generation of languages. You could do so much cool stuff with swithcing to graphics mode and using pixel, line and circle commands. I was able to write a (1) shooter where you shoot down a plane that moves horizontally across the screen and the projectile was subject to 'gravity'. (2) A program that 'morphs' one outline to another. (3) A wireframe/3d space shooter.
I was able to build all this without the internet, with plain high school math and physics. And I wonder if I was a kid who grew up in todays environment, I would have been able to build the same. I have the internet, but I doubt I would be enticed into making stuff like that, like I was enticed by QBasic. I mean, one minute you are printing multiplication tables, the next minute you are turning individual pixels on/off on the screen. I remember it being a very empowering feeling.
To truth only a brief celebration of victory is allowed
between the two long periods during which it is condemned
as paradoxical, or disparaged as trivial.
1. https://en.wikipedia.org/wiki/Arthur_SchopenhauerFast forward to today: my 4th grader asked me the other day which language he should learn, and I was stumped. I ran through the languages I know well in my head: Java, PHP, Perl, Python, Ruby, Javascript, Go, Swift... Wasn't sure what to tell him. His expectations are fairly high, due to Minecraft and video games and whatever.
So, on one level I agree with the author: Python (or Ruby) is probably the closest to the original feel of BASIC. You can dive into simple statements without wrapping it in a class. You don't need to worry about functional vs. OOP or methods or functions. You can just write some code.
But, as I thought about it, I realized my son already _is_ programming. He's just using Minecraft's red stones. It isn't turing complete, but it has basic input and output.
What I'd love to see is something like Minecraft, but with a more accessible programming environment. There are a few tools out there that do it, but the gap between the visual building experience and the programming experience is way to wide. I want him to click on a block and write 3 lines of code to change the color and give it some behavior.
tl;dr - Minecraft is the new BASIC for most kids today. It just isn't a very good BASIC.
or python bindings to original minecraft http://www.jjinux.com/2013/05/drawing-sierpinskis-triangle-i...
http://python-minecraft.readthedocs.org/en/latest/contents.h...
It is!
To be fair, BASIC wasn't a very good BASIC either.
I think it is much more common for novice non-programmers to look at some HTML/Javascript that they're curious about and then tweak the javascript a little to change the behavior of the webpage. The tweaking may come from copying a stackoverflow.com answer without unerstanding the underlying principles (aka "cargo cult"). However, these humble beginnings act as the gateway to more systematic learning (.e.g read "Java - The Good Parts by D Crockford", etc).
Because of Javascript's pervasiveness[1], it is much more likely for a beginner to hack around with others' Javascript and then eventually write their own .js rather than download Python and start writing .py files.
Those are my personal observations. Do others see total more beginners downloading Python rather than dipping their toes into Javascript?
[1] google.com search "get started Javascript" ~211 million hits:
https://www.google.com/search?q=get+started+with+javascript
google.com search "get started Python" ~33 million hits:
I'll just point out that Python suffers from a deployment issue. Getting a web project up and running can be a nightmare (no, using Heroku merely hides the problem...it's still there). Even on the desktop it can get really cryptic and confusing for a newbie. And, of course, releasing and sharing your app is --from the vantage point of a newbie-- just about impossible.
On something like VisualBasic you can package-up and create an installer for your app with one click. Anyone can then install it and end-up with an icon on the desktop they can click and run the app. The "path to exe" is simple.
Again, I don't have time to dig deeper. We love Python and use it extensively for our web (with Django) and desktop work professionally. And, yes, I am teaching my kids programming with Python. But, no, I don't think Python is the new Basic, on more than one front.
Edit:
More on topic:
My personal opinion is that scripting languages like Python and Ruby, and for the brave teachers Lisp (Racket, Clojure, etc) make excellent programming languages. Instead of forcing yourself to learn the requirements of C-like languages, you get to focus a lot more on the concepts, and a lot less on syntax issues that I see more than often enough with new students to programming.
(Although I think there was an option to compile to native?)
Being built into home micros was part of it, but it also included built-in switching video modes, drawing, audio, I/O, even inline assembler (not in all variants, but certainly the better ones). This creates a very effective and accessible learning curve.
Javascript is the closest modern equivalent - but the language and it's API's are too complex. A browser-based BASIC (compiling to Javascript of course), exposing all the above in a sane synchronous manner would be interesting.
The link on "No! You can't be serious!" was to Hackety Hack, by _why_the_lucky_stiff. The language was Ruby, not a random, closed-source, "4 kidz" programming language. And it's a good language for teaching.
p 'Hello world'
"Hello world"
1976 to 1985: COBOL (hell)
1985 to 1999: BASIC (joy)
1999 to now: BASIC + Javascript (turbojoy)
When I encounter something I can't easily build with my current toolset, I'll look for the "new BASIC". So far, that's never happened.Javascript doesn't require setting up apache, etc. for a kid to learn like the submission says; you can just use a static html file on your file system or dropbox etc.
edit: ignore the above about apache, missed that that was in the next bullet point about PHP, not javascript
In face, Javascript _does_ (until Node came along) generally require a browser, and some HTML to go with it. Python gets along just fine as a single file from the command line, much like Basic.
* Javascript is incredibly easy to screw up (http://www.codeproject.com/Articles/182416/A-Collection-of-J...)
* Practical use of Javascript requires understanding of HTML, CSS, the DOM, as well as the concept of browser inconsistencies
Not sure I agree with that article.
The shortest well behaved program, for example, looks like this:
if __name__ == "__main__":
print "Hello World!"
and the shortest program that is strictly equivalent to the java program is closer to this: class Hello(object):
@classmethod
def main(cls):
print "Hello World!"
if __name__ == "__main__":
print "Hello World!"
Based on my experience, there's a lot people learning python who spend a lot of time at the stage where they "just don't get OO", and my opinion is that the reason is the language is bad at teaching them. It's like a submarine of complexity waiting under the simplified syntax for basic scripting.What you have there is un-pythonic. Once you have a good reason to build a class with static methods, it will most likely not look too bad.
In my experience namespace pollution because things are written outside a function is a very common cause of bugs and maintenance problems in production python code. People coming from C/Java/similar think that "if" has scope but it doesn't, only functions do. If i see "main()-code" outside a function during a code review i immediately disregard that whole script.
Any program that actually does something, except just printing hello world, would more likely look like this:
import sys
def main(args):
function_local_variable = "yay"
print("hello world")
if __name__ == "__main__"
pollute_global_namespace = "yes"
main(sys.argv)
Short of the braces and the variables i added for clarity it actually has more lines than the java-version.IMV, sloppy unstructured code is a fine place for many (especially very young) programmers to start, and it simplifies the onramp significantly (and, actually, for simple scripts, relatively unstructured code in python is sufficient for lots of real-world uses, too.)
if __name__ == "__main__"
...is the k of thing you need only if you are deliberately designing something to be used as both a script and a library, which there are very good reasons to do for many real world python files, but it certainly is not universally necessary. And using classes for hello world is excessive Java-ism. class Hello(object):
@staticmethod
def main():
print "Hello World!"
if __name__ == "__main__":
Hello.main()
Your version:(1) Unnecessarily uses @classmethod instead of @staticmethod, necessitating an argument to main(). @classmethod and @staticmethod in Python are both related to Java static methods, but @staticmethod is the closest analog for Java static methods that do not depend on static member data. Just doing a one-to-one substitution of Java static to Python @classmethod indicates a lack of understanding.
(2) Doesn't actually call Hello.main() the way the python runtime does, and instead reproduces its function in the if __name__ == "__main__" block.
> Based on my experience, there's a lot people learning python who spend a lot of time at the stage where they "just don't get OO", and my opinion is that the reason is the language is bad at teaching them.
Lots of people learning Java, IME, just don't get OO for a long time, too. Obviously, they have to produce a structure with classes and methods in order to produce anything in Java, but having to use the superficial structure of OO and getting OO aren't the same thing. (If anything, being forced to use its structure for everything impairs understanding of what it is for and how to use it appropriately.)