Everything I Needed to Know About Programming I Learned from BASIC

The first program I actually wrote was in Qbasic. Boredom set in after the first few minutes of “typing class” and I needed something better to do with my time. Halfway through the semester, most of the class joined me in my multiplayer q-basic rendition of the arcade game Spy Hunter. I have fond memories of the ridiculous routine I wrote for the collisions, shooting out random polygons and such. Makes me miss the days when it was a hobby instead of writing business objects the like.

OMFG I’m having such crazy flash backs. I had one of those. No way.

@gogole

Basic for programmers starting in the 90’s!

Try the 70’s. By the mid 80’s there were Pascal flavors for the PC, and C compilers.

got to say even for a young programmer like me BASIC was still being used as a teaching tool at A-Level (UK exam type taken 16-18). This was QBASIC through windows then later visual basic. However most of us taking the computing class already had experience in other languages so it seemed a bit backwards but you can demonstrate some algorithms easily like different sort methods so it was good to get everyone on the same language.

Perhaps a better teaching tool now would be a web language.

I became interested in programming in around sophomore year in highschool when I learned I could write a program to take in values and do my repetitive math computations for me (compound continuous and compound interest formulas)

…not sure how strict of basic this is but sorry I can’t resist to post this little program I wrote a little while ago on the TI-83+ which I think is loosly BASIC

0-X
Lbl A
X+1-X

If ((X/3-(int(X/3))=0 and (X/5-(int(X/5))=0)
Disp “FIZZBUZZ”
…(other code here)
If (X100)
GoTo A

you know how this ends

As far as compilers on 8-bit computers go, there were actually a few BASIC compilers for the C-64. I know because I used at least two of them. They were very slow at actually compiling the code, but they did actually create reasonably fast versions of the original BASIC program. One of them (I think it was the official Commodore product) produced what they called “p-code”, which is similar to Java or .Net byte code today, and that one only produced a mild speed-up. The other one put out something close to true assembly code, and thus made much faster executables. Still, like most people who programmed for the C-64, I ended up moving to hand-coded assembly language, since it was the only way to get real speed out of the machine.

I think it shows a lack of understanding here – people’s minds aren’t only shaped by the programming language and its flaws and finesses. If people aren’t agile thinkers, it won’t matter what language they start with – they won’t be agile programmers.

That’s a really interesting viewpoint, I actually hadn’t thought much about that aspect of things.

For me, BASIC actually turned me off from programming. If BASIC was all that had been available to me, I probably would have been bored and maybe never gotten into development. I had a bit of fun programming in TI-BASIC (the calculator language), but that’s because you don’t expect a calculator to be very powerful, and it was a very domain-specific language with an “IDE” that made it very easy to write.

I think you’re right that BASIC doesn’t fundamentally mutilate the mind. I would never laud it with praises as a programming language, but perhaps as a cultural phenomenon, it was valuable.

-Max

I started off by writing scripts within [m]-I-R-C. Very procedural kinda stuff. Everything mashed into one alias. It was ugly - it was horrible. Then I moved on to Visual Basic and wrote up some very simple ‘business apps’ as assignments in school. I learnt a little about functions and encapsulating parts of code. It was still very procedural and event driven stuff.

I continued with my [m]IRC scripting and wrote a few more simple scripts that were much tidier than the previous ones but still nothing special by todays standards.

Then I went onto uni and learnt some java and c/c++ coding. This taught me the basics of OOP and then eventually the advanced OOP. I returned once again to write an [m]IRC script that interacted with a website and discovered I could write it in such a way that slightly mimicked the OOP principles I had learned.

The point if you’re wondering is - you can start with whatever language you like. Once you learn the principles of programming (or of a particular methodology), it’s easy to transpose those ideas into whatever future project or language you choose to use. It’s also easy to put aside previous things you learn if you discover they are no longer relevant, or there’s a better way of doing something.

heh [m]I-R-C is filtered!

It’s also easy to put aside previous things you learn if you discover they are no longer relevant, or there’s a better way of doing something.

  • If you’re worth anything at all.

I have a different opinion: Everything I know about what to forbid in programming, I learned in BASIC.

Goto statements: since I learned basic 20 years ago, I have not found a single case where a goto is acceptable. This INCLUDES web services that return 302 redirects by the way.

Global variables: Since learning to avoid Global variables in Basic, I have learned a refined rule that all variables should remain in the innermost scope possible.

If statements: good programmers can avoid if statements. Your function should not need to ask whether the red button was clicked or the blue button was clicked. The code should be event based so that you have a different function running depending on whether the red or blue button was clicked.

Basic is a good way to contrast the way programmers did things back before they knew any better.

Austin: Any programming language can teach you the basics of programming, but you probably want to learn something with a larger community and more practical application.

I would recommend Ruby or Python, if you want to write useful little personal applications for your computer; PHP or Ruby (on Rails) if you want to write small to medium websites; C# or Java if you want to write more formal applications or websites and take immediate steps toward paying work; or Scheme or Lisp if you want to get a serious theoretical introduction to computing theory.

Ruby or Python would be the most fun, and would stay useful even if you don’t stick with programming. Each language has a legendary guide: the one for a href="http://www.poignantguide.net"Ruby/a is infamously surreal and cutesy, which makes me love it, but your mileage may vary if you are a heartless curmudgeon who hates all beauty and fun.

I somehow missed the giant red “no HTML” sign! http://www.poignantguide.net

Will there be a BASIC section on stackoverflow.com?

Ah yes, the Atari 2600 BASIC programming cart. One of the few that I didn’t actually have (and don’t own now).

I actually started programming on a Sharp MZ-700 Series (http://en.wikipedia.org/wiki/Sharp_MZ) that used a tape drive (audio tapes, btw). I got so good at BASIC that by the time I got to the BASIC programming semester for Maths II in High School, I was banned from talking because I knew more than the teacher.

Ah, yes, fun days.

I think I agree with some of the previous comments. Any programming language can teach you the basics and get your mind receptive to programming, but most people can’t get their brain out of that first way of thinking. You need to be agile enough to change your way of think as appropriate to the task/language you’re dealing with.

Check out this Basic http://en.wikipedia.org/wiki/BBC_BASIC

I started with this 1982. Procedure names, local variables, inline 6502 assembly, it was amazing.

As an introduction to programming, I remember eagerly typing in BASIC programs into the Vic 20. I hated searching for the typo or ‘paper debugging’ the article source. I was always frustrated that there was no possible way I could write a decent program like the ones you could load from disk. The only interesting program I can recall was getting a sprite on the C64 to bounce around the screen, or doing a choose your own adventure style text game. I realized it was more fun to play spy hunter or impossible mission than wallow in that mess.

Upon reflection, I think a better ‘first language’ is LOGO with Turtle graphics. You can understand enough to make a simple shape in 10 minutes, and soon you’re naturally wondering how you can replicate other geometric shapes. Fundamentals of math, geometry, variable assignment, looping, recursion, functions, etc. All easy to demonstrate and get tangible, visible feedback. Brilliant.

http://en.wikipedia.org/wiki/Logo_(programming_language)

My 2 cents.

Since when is VB actually BASIC?

Anyway, I wrote my first piece of code when i was like 6 in basic on a ti99-4a. It was my first experience of creating something… just a few simple lines that solved a problem I needed to solve. Because of that I’m a lazy CS major who enjoys to code. I’ll agree, I was “mentally mutilated beyond hope of regeneration”. Before I was content to do nothing but play games and sleep, and now I want to do something productive as a hobby. Is this regeneration such a good thing, no hope that I’ll regenerate cause I don’t even wish to.

I don’t go round coding in basic though. I need to take a year off or something and actually write a sizable chunk of code. Early years of CS as a major seem to just make you busy with general stuff and you never seem to actually do that much code-wise.

apple][, GWBasic, TS/1000 (aka ZK81) Sinclair QL were my early exposures.

I grant you that my first few reads through a pascal book left me with no freaking clue how to do anythingin pascal - the concepts were mighty foreign and I learned how to use forth long before I did pascal.

Not because Pascal was hard, but because the person who wrote the book failed to explain the fundamental differences between basic development and pascal - mainly the lack of an interpreter editor. Once you understand why all the line numbers are missing and how you get code in and run it, the rest of the differences go away.

I had the strangest interpreted C for my old 8086 system as well - if you wrote something like strcpy(“abc”,“def”); and ran it, the source would magically change to strcpy("abc,“abc”);

Obviously, with no experience in pointers - I was baffled. Time in 6502 and 8086 assembler cleared that up problem.

Basic doesn’t really warp the mind, in fact, I still think its a great starting point for programmers. The problem is there are so few good bridges for the conceptual differences once you move on to other languages like C and Pascal etc. I believe that chasm has actually grown since plain basic all but died of neglect years ago.

Sad really. A good basic interpreter can really get you started in a hurry in ways that C and Pascal just can’t.

For some reason I have the following, my first line of code EVER, stuck in my head. I think I was about 8 or 9 and was walking by a Radio Shack and they had a machine near the front entrance. I watched some guy type his name and it scrolled up and down the screen then he added a semicolon and it repeated until they hit the break button. This is all from memory from almost 30 years ago so it may be a little off but this is what I remember the line to be.

print “Brian”;

which resulted in something like this:
BrianBrianBrianBrianBrianBrianBrianBrianBrianBrianBri
anBrianBrianBrianBrianBrianBrianBrianBrianBrianBrianB
rianBrianBrianBrianBrianBrianBrianBrianBrianBrianBria
nBrianBrianBrianBrianBrianBrianBrianBrianBrianBrianBr
ianBrianBrianBrianBrianBrianBrianBrianBrianBrianBrian

it was the coolest thing I’d ever seen, anyone else do this or remember what machine and language?