Author Topic: The death of BASIC  (Read 9725 times)

0 Members and 1 Guest are viewing this topic.

Offline Flipside

  • əp!sd!l£
  • 212
Hmmm...Yeah, it might have been GOSUB that was the nasty one, the only situation I can remember using GOTO in a loop was the dreaded FOR...NEXT loops because you couldn't define any exit conditions, so you could have something like

10 FOR X=1 TO 10
20 IF (X+Y)>30 THEN GOTO 40
30 NEXT

It may have just been the practice the was drummed into me, but for REPEAT...UNTIL loops, I always used to use a 'flag', so you'd have

10 REPEAT
20 X=X+1
30 UNTIL X=10 OR (X+Y)>30

or

10 LET EXIT = FALSE
20 REPEAT
30 X=X+1
40 IF (X+Y)>30 THEN EXIT=TRUE
50 UNTIL X=10 OR EXIT=TRUE

That, iirc was considered a more 'correct' way of doing it ;)

Sorry, getting my coding brain in gear here for starting at college :D
« Last Edit: September 16, 2006, 01:38:01 am by Flipside »

 
Using exceptions to break out of a loop is a bad idea.  Cluttering and confusing to people who haven't seen your code... Not to mention slower.

I kinda like:
10 LET EXIT = FALSE
20 REPEAT
30 X=X+1
40 IF (X+Y)>30 THEN EXIT=TRUE
50 UNTIL X=10 OR EXIT=TRUE


better.  Easier to step through debug  :)
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline kode

  • The Swedish Chef
  • 28
  • The Swede
    • http://theswe.de
The correct way to break out of nested loops is either a boolean flag or an exception, though.

You do NOT use exceptions for non-exceptional events!

(that's tip 34 from the pragmatic programmers by andrew hunt and david thomas, btw. a book well worth reading, and always keep at your side while programming.)
« Last Edit: September 16, 2006, 03:08:45 am by kode »
Pray, v. To ask that the laws of the universe be annulled in behalf of a single petitioner confessedly unworthy.
- Ambrose Bierce
<Redfang> You're almost like Stryke 9 or an0n
"Facts do not cease to exist because they are ignored."
- Aldous Huxley
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH

 

Offline Flipside

  • əp!sd!l£
  • 212
Heh, I think my least favourite language was 6502 machine code. The problem with 6502 was that it had 3 8-Bit registers to play with, and you couldn't even link them together to make 16 Bit ones like you could in Z80, so if you wanted to access, say, a look-up table (start + offset), you had to use Indirect Referencing, i.e. point to the address that held the adress that you wanted to jump to. Add to that the fact that older computers ALWAYS used lsb-msb ordering for addresses and you had the ultimate migraine recipe ;)

 

Offline Roanoke

  • 210
I sometimes read the Python tuts when I'm hella bored at work........

 

Offline Fragrag

  • 26
*snip*
*snip*

QFT², I tried dabbling in programming several times, when I was 10, 12 and 13. I'm 14 now by the way. Granted, learning C++ and other languages were already too complicated for my age but if making a program just to say 'hello' takes 4 lines of rather incomprehensible lines (What the hell does 'int argc, char *argv' mean?) then I'm not surprise that kids today aren't dabbling in programming, it's just getting complicated. By the way, the simplest language I tried was Python.
"On this day...my pants are filled....with joy" -Singh, doing the pants game
My blog, with 'gorillarape' in the url, who wouldn't visit it?!

 

Offline Ghostavo

  • 210
  • Let it be glue!
    • Skype
    • Steam
    • Twitter
*snip*
*snip*

QFT², I tried dabbling in programming several times, when I was 10, 12 and 13. I'm 14 now by the way. Granted, learning C++ and other languages were already too complicated for my age but if making a program just to say 'hello' takes 4 lines of rather incomprehensible lines (What the hell does 'int argc, char *argv' mean?) then I'm not surprise that kids today aren't dabbling in programming, it's just getting complicated. By the way, the simplest language I tried was Python.

Well, when I learned C++ (my first and only experience with programming) the teachers sort of avoided that by:

Code: [Select]
void main()

And only much later when we made stuff other than the main did they explain what that meant.

C++ sounds simple enough, never understood how people find it complicated. :blah:
« Last Edit: September 16, 2006, 09:03:31 am by Ghostavo »
"Closing the Box" - a campaign in the making :nervous:

Shrike is a dirty dirty admin, he's the destroyer of souls... oh god, let it be glue...

 

Offline Kamikaze

  • A Complacent Wind
  • 29
    • http://www.nodewar.com
Just out of curiosity, how hard is java and lisp compared to c++?

Ever read through Stroustrup's _The_C++_Programming_Language_? C++ is one of the most ridiculously complex programming languages in the world.

Comparatively, Lisp is incredibly simple (Particularly Scheme; it's my favorite Lisp dialect). There's barely any syntax and the basis of the language can be described in about 40 pages (http://www.r6rs.org/r6rs_91.pdf).

Java also aims to be simple, but it's actually just crippled and bloated from the poor "let's make it more like C++ after stripping it way down first" style of design.

I'm also puzzled at why peole still think BASIC is good for teaching anything. The basics of Python, Ruby, or even Perl are pretty easy to pick up. All three have far better libraries than any BASIC dialect except maybe VB.Net (pretty sure CPAN beats the hell out of .Net though). It's also worth keeping in mind that Python runs on .Net (IronPython) and Ruby runs on the Java platform (JRuby) nowadays.

Quote from: Scooby Doo
Using exceptions to break out of a loop is a bad idea.

True, but there are exceptions even to this rule (no pun intended). :p For example, exceptions are the right way to break out of while loops in Objective Caml, because while loops are very weak due to the pure functional design. Though it's often better to use recursion in OCaml anyway.
« Last Edit: September 16, 2006, 11:39:11 pm by Kamikaze »
Science alone of all the subjects contains within itself the lesson of the danger of belief in the infallibility of the greatest teachers in the preceding generation . . .Learn from science that you must doubt the experts. As a matter of fact, I can also define science another way: Science is the belief in the ignorance of experts. - Richard Feynman

 

Offline Flipside

  • əp!sd!l£
  • 212
Pascal was always a good language to start with, it was not much more complex than Basic, but had the beginnings of more modern approaches to programming in it. It's pretty long in the tooth nowadays however, and Delphi, it's supposed 'Next Generation' is confusing as hell :/

Edit : Oh, and COBOL is the language of Satan...

 
Two langauges I wanted to learn... Ocaml and eiffel...
Eiffel isn't well supported and their .NET version is rather blah..

I gave perl 2 tries and gave up... I extremely dislike typeless languages.

I suppose lisp wouldn't be so bad, as long as you don't mind seeing (((())))) the rest of your life  :lol:
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline kode

  • The Swedish Chef
  • 28
  • The Swede
    • http://theswe.de
hah, yeah. back when I did it for a uni class, most of the debugging was to count opening and closing parentheses.
Pray, v. To ask that the laws of the universe be annulled in behalf of a single petitioner confessedly unworthy.
- Ambrose Bierce
<Redfang> You're almost like Stryke 9 or an0n
"Facts do not cease to exist because they are ignored."
- Aldous Huxley
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH

 

Offline Kamikaze

  • A Complacent Wind
  • 29
    • http://www.nodewar.com
That's why you need to use a good editor. I use vim to do all my editing; it automatically matches parantheses as I type.
Science alone of all the subjects contains within itself the lesson of the danger of belief in the infallibility of the greatest teachers in the preceding generation . . .Learn from science that you must doubt the experts. As a matter of fact, I can also define science another way: Science is the belief in the ignorance of experts. - Richard Feynman

 
The correct way to break out of nested loops is either a boolean flag or an exception, though.

You do NOT use exceptions for non-exceptional events!

(that's tip 34 from the pragmatic programmers by andrew hunt and david thomas, btw. a book well worth reading, and always keep at your side while programming.)

Did I say otherwise? But if having to drop out of a deeply-nested loop is not an exceptional event, the loop structure and terminating conditions need to be rethought.

A good general rule is to only throw meaningful exception types and think very carefully before deriving your own exception class. If your loop breakout exception violates either of these, the loop conditions need to be rethought.
'And anyway, I agree - no sig images means more post, less pictures. It's annoying to sit through 40 different sigs telling about how cool, deadly, or assassin like a person is.' --Unknown Target

"You know what they say about the simplest solution."
"Bill Gates avoids it at every possible opportunity?"
-- Nuke and Colonol Drekker

 

Offline kode

  • The Swedish Chef
  • 28
  • The Swede
    • http://theswe.de
nested loops are the devil anyhow.
Pray, v. To ask that the laws of the universe be annulled in behalf of a single petitioner confessedly unworthy.
- Ambrose Bierce
<Redfang> You're almost like Stryke 9 or an0n
"Facts do not cease to exist because they are ignored."
- Aldous Huxley
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH

 
Sometimes they're required, but it's rare that you need to drop out of one under non-exceptional circumstances.
'And anyway, I agree - no sig images means more post, less pictures. It's annoying to sit through 40 different sigs telling about how cool, deadly, or assassin like a person is.' --Unknown Target

"You know what they say about the simplest solution."
"Bill Gates avoids it at every possible opportunity?"
-- Nuke and Colonol Drekker

 
Course one possible solution is to have the inner loop stuck within another function (make it an inline function)
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

  

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
1 print "**** basic"
2 print "use c++"
3 goto 1
run


god i havent touched basic in yonks. a higher level code is awalys better.
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

 

Offline Flipside

  • əp!sd!l£
  • 212
Basic is higher level than C++, the lowest level code is Assembler ;)

 

Offline ZylonBane

  • The Infamous
  • 29
1 print "**** basic"
2 print "use c++"
3 goto 1
run


god i havent touched basic in yonks. a higher level code is awalys better.
And yet you illustrate exactly how much more expressive and easy to remember it is.
ZylonBane's opinions do not represent those of the management.

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
#include <iostream>
using namespace std;

int main()
{
     cout << "**** basic\n" << "use c++";

     return 0;
}




I dont know loops yet, so dont get me on that, but i find that much easier to manage, and much more powerful. and they're both off the top of my head, so i dont claim accountability for errors.

Basic was definately easier to run, but with something like visual studio, c++ isnt hard to compile and run either
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW