Jump to content
Science Forums

Basic: Programming Language or Corrupting Influence


Recommended Posts

Its been a little over 40 years since Basic was first inflicted upon the computer world as an "easy" way for mortals to learn programming thanks to John Kemeny and Tom Kurtz at Dartmouth. While designed long before anyone knew anything important about how to design programming languages, it has gone on to become probably the most widely used programming language in history.

 

Some consider Basic an atrocity going back to Edsger Dijkstra's "Goto Considered Harmful", his oft referenced diatribe on Basic to the ACM in 1968, and most "computer scientists" to this day are horrified that anyone would consider using it for anything

 

It had a huge second chance though by virtue of the fact that Microsoft included it in the DOS operating system, and later pushed it heavily with VisualBasic, and even Borland, which was founded on trying to get people to use Pascal, broke down and produced a TurboBasic. While the language has changed dramatically to be more inline with structured programming techniques (line numbers long ago disappeared), it still has many weaknesses from a programming language theory stand point. In recent years even Microsoft has tried to move its users away from Basic to its C# language, and has met with such an uproar from the huge number of companies (even very large ones) that depend on VisualBasic.

 

Resolved: Basic has its flaws, but its okay to program in. Discuss.

 

("Note to self: Next time, duck." <ducks/> )

 

Cheers,

Buffy

Link to comment
Share on other sites

My first computer language was qbasic, which I learned in fifth grade looking over my brother's shoulder as he did his programming assignments for high school. I remember just playing around with it for hours, trying to program my RPG...I was never able to get the combat system working well enough.

Link to comment
Share on other sites

I often think about this, as a matter of fact. I started off with BASIC on a Sinclair ZX-81 back in 1983 or something, then moved on to the Spectrum before I got my first PC in 1986 (a double 360K floppy/no harddrive 8088 thingy).

 

But the Spectrum was interesting because it had a ROM filled with assembly code. Basically, you could write tiny programs in assembly which used the premade stuff (the same things you called in BASIC, except taking up less space and not needing compilation). So while BASIC was good for learning simple program flow - and getting comfortable with how a computer behaves - assembly was for me a much more interesting language.

 

On the PC I did some 8086 assembly, which resembled Z80 assemly quite well if I remember right, except there was no ROM filled with goodies so I ahd to make all the libraries myself. So when I discovered Pascal a new world opened up...it had the ability to build functions and a skeleton object-oriented program.

 

But I lost interest in programming after I decided to study music full time, so I didn't touch a computer (for programming) between 1989-1995. Then suddenly I began developing websites.

 

While it's good to have programming experience when you create websites (flow, objects, etc) I think it is really a huge step backwards to work with basic HTML and CSS. I have never had the time to properly learn, say, C++ or Java (or even C# now) to create my own components and stuff, but I have worked with ColdFusion since 1995 and also a brief stint at ASP plus some very rudimentary PHP.

 

While web application programming is fun, it is not nearly as fun as programming in "real" programming languages.

 

But, er, the point. I think Basic is a Good Thing. It is easy to learn, it is fun to work with, and it can be deployed on a vast amount of desktops - now with .NET integration Basic is even more useful for those not interested in C++ etc.

 

I think it has some major drawbacks, though - if I'm not mistaken programs written in Visual Basic will only work on Windows, and only certain flavors, whereas C++ programs, for example, can be compiled for any platform.

Link to comment
Share on other sites

I learnt to program in basic (Commodore Basic, that is) on a Vic20, then a Commodore 64. Because it's such an easy language to follow, and probably because I never really need to program anything really complex (except HTML, but I use HTML for that), I still use it on the PC for quick-n-dirty programs.

 

I've used Liberty Basic for this for quite a few years -- still works with WinXP.

Link to comment
Share on other sites

___I began my programming with Basic on a double 5 1/4" floppy 8088 machine I got through a home-study computer course. It was GWBasic, sometimes refered to as 'Gee Whiz' Basic.

___I began using it to run math experiments, particularly cellular automata, & as my programs grew I hit the wall; the dreaded 64K code barrier. The solution I found was the Borland product Buff mentioned, TurboBasic. I didn't know it was supposed to ease me into Pascal (I did once take a course in Pascal), but it did break the 64K code barrier and it is a compiled Basic, not assembled. One keystroke generates an .exe file.

___I still use it because I am as simple as it. My manual for TurboBasic burned up though in a house fire & I once went to the famed Powells Books in Portland but to no avail. I get by only by having old programs to review as to proper syntax etc.

___I don't know how that all falls out on the corruption issue; I leave that for you all to discern. :Alien:

Link to comment
Share on other sites

I often think about this, as a matter of fact. I started off with BASIC on a Sinclair ZX-81...

Me too. I liked the fact that so many of the keywords were just a shifted keystroke instead of having to type out the whole keyword. I liked doing machine code on that machine as well and it made much better use of the 1kb of memory the machine came with and my 2kb expansion cartridge :Alien:

Link to comment
Share on other sites

Gret idea for a topic, Buffy!

 

My CB: I began using the BASIC of any machine I could get my hands on starting late '70s. Meantime I had obtained a TI-57 and I had found a hypersimple circuit design for the 8060 (SC/MP II) processor with a single-cycle mode and no ROM of any sort, just a 256 byte RAM chip! While I was designing a PCB layout for that, with hex IO on the same board, I also started a point to point wiring of it with just a row of 8 LEDs and 8 + 1 buttons but I only had a coarse wire to use; despite my fine tip 16 W iron I couldn't get the RAM in. I couldn't run an actual program on it but I could form a byte and click cycle and display results by executing an out cycle. :) My PCB layout turned out to big, as metallized holes are too expensive to have made for hobby purposes I had made it wide, the all-on-one-board choice made it worse. Very silly, young I was...

 

I finally ordered my ZX80 just as they got the 81 in production and they sent me that. It seemed great despite a few shortcomings. I also did stuff in Z80 assembly, including things for jobs where I also used early MS-BASIC. I later got the Spectrum 48K and what a great BASIC it had! It was very mathematically concieved, unlike other BASICs of the time it was highly expression flexible. No side effects as in C but conditions were expressions worth 0 or 1, you could write

IF anythingnumerical THEN, you could write GOTO 168 * sin x + ln glob and control would go to the next line number, build your very own 'switch' or whatever your wildest imagination could contrive!!!

 

Since around 2K I've had to use VB6, ugh, the only neat thing I found about it, it still has not only Goto but...

 

even Gosub!!!!!

:Alien:

 

A crude thing, of course, but I do believe that in procedural languages it would occasionaly be handy to have procedures inside procedures, maintaining scope. I think PASCAL does but I've never learnt it. C/C++ fiction:

int function(char* str, Class c){
  void proc(int a){
     str = a<5 ? "blah, blah" : "globble globble!!!";
  }
  stuff;
  proc(c.getPlunk());
  morestuff;
  proc(n + B);
  otherstuff;
}

 

I think Basic is a Good Thing. It is easy to learn, it is fun to work with
Yup, but once you get good at C/C++ you wouldn't do without them, even Coffee although the others are better.

 

Visual Basic will only work on Windows, and only certain flavors, whereas C++ programs, for example, can be compiled for any platform.
True and not true...

 

VB is essentially Win32 and meant for Win32.

 

C++ is good for any platform that supports it, you can use it with only standard libraries and a minimal caution and it'll be essentially cross-platform. You can also use it with specific stuff. If you write C code for Win32, it'll only compile and run where you have Win32 i. e. on windows or with layers such as Mainsoft's one for Unix.

Link to comment
Share on other sites

You know what i really miss in these new languages? goto, where in the world did goto go? it was so awesome, and unlike many claims goto makes some of the code easier to read (when used propperly)....
Tsk! Tsk! :shrug: If you can't program just as effectively without goto, you don't know how to program! :circle:

 

Cheers,

Buffy

Link to comment
Share on other sites

I am not a professional programmer. The first language I learned was [brace yourselves] COBOL in 1973. In about 1976, I wrote a program to play the game Othello in Fortran (FortG; WatFor sucked). I made heavy use of [brace yourselves again] arithmetic ifs. I had one subroutine so opaque that friends with degrees in computer science could not figure out what it did, even though it was only 20 statements long. When a friend helped me translate it to Pascal, that subroutine became two statements. I also translated it into C and Algol, and another friend borrowed it as the engine beneath a computer graphics Masters project in about 1978.

An arithmetic if in Fortran is the nastiest form of goto. Based on the value of its arguement, -1, 0, or 1, it branches to one of three places referenced by statement numbers.

Link to comment
Share on other sites

oh and by the way, i think that basic is not a language that should still be teached to people how to program in... i think that Python should take its place, mainly because Python was made to teach people how to propperly program, indent code, right structure... etc :circle:
Python? Why not PHP or Perl? I actually disagree completely: these are "hackers" languages where ease of programming masks the underlying complexities that you need to learn no matter what language you use to understand why your code doesn't work. Python environments may provide code structuring, but heck just about all developers tools do now, and its not a feature of the language. I'd still have people learn in Pascal or even Java, and then move on to the others. Making people type more is good when they're learning! :shrug: :wave: :eek:

 

On the other hand, if all you're gonna do is hack web pages, maybe I'll agree with you...

 

Cheers,

Buffy

Link to comment
Share on other sites

You know what i really miss in these new languages? goto, where in the world did goto go? it was so awesome, and unlike many claims goto makes some of the code easier to read (when used propperly)....
Yeah, I disagree with Buffy on this.

 

Say, Buf, while it is possible to do anything without goto if you're dogmatic and find it blasphemous, this doesn't mean that it's always better to do so. Throwing the odd goto into a block structured procedure isn't necessarily spagetti-like.

 

One thing that even a few Coffe Gurus don't notice is that, while Ra kicked goto out, he at least added the option of using labels with break and continue. Elegant although improveable, less necessary when one can use goto.

 

Block structuring without goto means making an oriented graph that's confined to be a tree, with goto it isn't confined to be a tree. What's wrong with that?

Link to comment
Share on other sites

The first language I learned was [brace yourselves] COBOL in 1973.
What's wrong with COBOL? It's still in use, in many places.

 

An arithmetic if in Fortran is the nastiest form of goto. Based on the value of its arguement, -1, 0, or 1, it branches to one of three places referenced by statement numbers.
There's even nastier in some other languages. The switch in C and Coffee is semi-block structured and semi-nasty. With the help of goto in C, it could be made very nasty indeed. :circle:
Link to comment
Share on other sites

If you can't program just as effectively without goto, you don't know how to program!

I'm merely stating that if the only reason why they took goto out is because it makes code less readable and harder to follow, they are wrong, here's my proof:

here's an example of a "new" code program:

#define SOME_MEGS	1024*1024*24
#define ERROR 		-127
#define YIPPIE			0

char *arr1, *arr2, *arr3;

/* allocation */
if((arr1 = malloc(SOME_MEGS)) == NULL) {
return ERROR;
} else {
if((arr2 = malloc(SOME_MEGS)) == NULL) {
	free(arr1);
	return ERROR;
} else {
	if((arr3 = malloc(SOME_MEGS)) == NULL) {
		free(arr1);
		free(arr2);
		return ERROR;
	}
}
}

/* do some fancy stuff here */

free(arr3);
free(arr2);
free(arr1);
return YIPPIE;

now that is pretty spagetteish and pretty hard to follow (although it is pretty easy code)

now this is the same code written the ancient, goto ways:

#define SOME_MEGS	1024*1024*24
#define ERROR 		-127
#define YIPPIE			0

char *arr1, *arr2, *arr3;
int errcode = YIPPIE;

/* allocation */
arr1 = arr2 = arr3 = NULL;
if((arr1 = malloc(SOME_MEGS)) == NULL) GOTO error;
if((arr2 = malloc(SOME_MEGS)) == NULL) GOTO error;
if((arr3 = malloc(SOME_MEGS)) == NULL) GOTO error;

/* do some fancy stuff here */
GOTO done;

error:
errcode = ERROR;

done:
if(arr1) free(arr1);
if(arr2) free(arr2);
if(arr3) free(arr3);
return errcode;

much, much more readable ane easier to follow, less code, pretty...

Python? Why not PHP or Perl?

because stuff like this:

 

"#!/usr/bin/perl

END{s{}{"@{[map{$%=$_;$_=&{$_{$_}};$%%2&&s%.%u$&%;$_}($|..${$/=

($^A+$|+$?)})]},"}e;print}($,,$,,+$*,$,,$,)=($|..$=/(+++$^A+$^A)*

+++$^A*++$^A);@_{++$|..2**(++$-+$-)}=(sub{(join$',map{+chr($|+$,+

ord($_))}reverse((split$`,&{$_{$=/($,*$,+$,)}})[$...$|]))."${'s'

}".substr(&{$_{2}},$^A,$|)},sub{"anoth".substr(&{$_{$^A}},+$-,$-+

$|)},sub{$a="104101124101";!seek$a,$=/($*+$,)+$|,$;or~~<$a>},

sub{local$";"@{[(split//,(chr($^A-$|+ord(substr(&{$_{$^A-$|}},+$?

..++$?)))).&{$_{$,/($^A-$|)}}.chr(2*$=-$^A*$,-$|))[$,+$|,$|,$--$|

,+-+$|,-$|x$?,+$=/(0+$,*+$*+-+-$*),$,+-+-~~$*+-+-$|]]}"});__END__"

 

is not possible in python?

 

Dont get me wrong, I probram in PHP, and know some Perl, but they were not designed to teach how to program, PHP is more Ok with its synthax, but its limited to its uses, well, but its a pain to setup for newbies (you need to setup a local server, and a database if you really want to learn PHP). But Perl code is has a notoriously combobulating syntax and although you can write clean code with Perl, perl programmers dont tend to. In python you have to write clean code because the language is whitespace sensitive.

I actually disagree completely: these are "hackers" languages

First of all HACKING IS GOOD, if noone ever hacked you would have microsoft quality software all over the place, its thanks to hackers that linux programs code gets fixed, patched and works faster than microsoft anything code. Oh and Perl is many times the choice for crackers, basically because you can write an RSA encryption program in 2 lines of ununderstandable code, and because of all the perl modules that have been written (thousands of them).

where ease of programming masks the underlying complexities that you need to learn no matter what language you use to understand why your code doesn't work.

If you are saying that python lacks complexity you know nothing of it. It is not a procedural language, its not linear in its syntax, it has an awesome Object model, the code is only as hard as programmers make it...

Python environments may provide code structuring, but heck just about all developers tools do now, and its not a feature of the language.

emacs or vim and a terminal so you can pydoc, developers tools make bad programming practices...

I'd still have people learn in Pascal or even Java, and then move on to the others.

Pascal was a good language, and if they open-sourced Delphi, I'd start using it instead of C++, but i utterly, to the depth of my heart, hate Java. Talking about a language that makes for bad programming practices Java is so in the lead... You can write your code in Python, then compile it into p code with jython, and then it runs on Java machines. Plus I've heard it many times now from quite a few people (People responsible for hiring people to program, company executives, system programmers, and so forth) Python programmers write much better Java code than Java programmers, thats why so many companies are starting to requite some Python programming experience for their java programmers, even Sun, i believe.

Making people type more is good when they're learning!

the only comparison you can make there is C, not much else, Python is not that weakly typed...

Python is very much dynamically typed, has modules, classes, exceptions. Its easy to write modules for, both in Python and C/C++, I'd say that no other language is quite like it really, oh and it is as platform independent as Java, actually if not more, so...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...