Discussion in 'Computer Science & Culture' started by v|i|, Nov 13, 2001.
Does anyone here still program BASIC? I do.
Log in or Sign up to hide all adverts.
the problem with basic is "goto statement" which makes it (the code) spaghettic .it transfers the control quite frequently,in big softwares its going to jumbled up.let me tell you why.
think as a compiler.now when it compiles it does statements by statements,if you give goto the control is transferred to thatstatement,comes back after that execution,in that way it goes crazy.
basic is not very flexible in nature,however graphics programming is pretty KOOL,i learned it in my early high school days.
I played with BASIC on a Commodore-64 back in '85 and '86. My understanding of the problem with the "GOTO" statement is that, if used too often, the programmer finds it difficult to follow his/her own code.
Ah yes, BASIC ...
Haven't in a long time, but enjoyed it much when I did.
GOTO was not the problem, but rather undisciplined programmers. It was a great tool when used with well written, frequently called modules.
Not only the too frequent use of GOTO, but also the lack of adequate documentation (still a problem).
Ah, for the simpler days when content and elegant code meant more than glitz and pizzaz.
I never struggled with goto, from a compilation point of view, whether it's c, pic or basic, you write, you compile (or parse) and you run. Because the compilation is completed off line, all the low level code is ready when the program is executed.
for small time programs,the goto statements are not a problem,but as the programs go bigger,the problem rises.its diffcult for you to follow your own code.like if you"re making some project ,then it will have so many pages of programming and if you use goto you"ll probably start hating it,as you"ll have to go through the other pages to follw your own code since with goto control jump is a common thing.
I used to program my Sinclair ZX Spectrum many years ago, aah the heady days of Basic Please Register or Log in to view the hidden image!
Please Register or Log in to view the hidden image!
I learned QBASIC in a class a few weeks ago. I hated it!
The idiocy of BASIC kept me away from programming for years. I thought, "there has to be something more elegant than this", and there was.
Thought, I do recall writing a program that brought down the school network (of 286s) using QBASIC. That was fun.
Ah Commodre 64 and the Vic-20 were my favourites. even if the Vic-20 was seriously underpowered, it helped me learn to program in a nice simple environment. its amazing the amount of control you could have on those old computers, but then loading was dreadful if you were using a tape drive, no task manager to check if a program locked up either. I never really went beyond Basic though, did some tinkering with Qbasic but the compiler was annoying and didnt always work on large programs. They keep making new Basic's like DarkBasic which gives you access to directx apparently, ah but the old Vic-20, bliss.
I know the PC is far more powerful, but why does it have such a bland name. PC, talk about dull and officey, why not something a bit more imaginative like Vic-20, ZX Spectrum, Dragon 32 etc. I guess they were all reffered to as "Microcomputers" but even that sounds more fun than PC
The version of basic that came with - I think - dos 3.3 didn't like Novell networks at all. I had a simple program that did nothing but basic disk i/o, and it'd kill the network stone dead every time. A bit of messing around after hours revealed that about 90% of the programs I wrote killed the network.
the only Basic I have written in years
002 goto 001.
003 REM Please skip the first 2 lines
. . .
430 ?"Indeed very vague.";
440 REM This is a slightly modified email message I wrote to a 450 REM friend some tim ago Talking about vague:
460 INPUT IsawThat ="Did you see DS-9 (Strar Trek) last night?"
470 ?"tWas very good.";
480 IF (IsawThat ='yes') THEN goto 500
490 ?" You really missed something!";
510 ?"See you next wednesdag";
550 INPUT again="Do you want to reread this message? "
560 IF (again='yes') then goto 002
I remember in the days of Apple II+, I was quite good at doing one line programming to solve some simple math problems, such as finding the square root of a number, or list all the prime numbers. If you guys every tried, basically the problem must be solve with a BASIC program no more than 256 characters in one line.
If you want a small, powerful, and modern BASIC, then buy Powerbasic. I have version 6.0 and it's very fast. Powerbasic claims that code compiled in Powerbasic runs up to 20 times faster than the same code compiled in VB. Believe it or not, the whole language arrives on two floppy disks(including help files and built in assembler).
All others: You don't have to use GOTO if you don't want to. You can use GOSUB or call functions/procedures just like in C/C+. If GOTO is too difficult for you, maybe you shouldn't be programming.
The Entropy of GOTO in Long term software projects is meagre,as estimated.
PS: entropy of GOTO= -log[(probablility of occurence of GOTO)]
I would recommend that you use GOTO if you wish to write small and efficient programs.
If you want to write large and slow bloatware programs, like the ones from Microsoft, then you should replace all the GOTO's with procedures and DLL's.
Note: After all, GOTO is the equivalent to JUMP in assembler. The most powerfull programs are the ones that are written with commands that are closest to machine code, like GOTO.
Real men don't need function calls!
I do hope you realize the absurdity of what you're saying. Yes, every layer of abstraction (eg. procedures, methods, messages) has a cost. But the benefit is the productivity of the programmer. A dynamically bound procedure call, done properly, might take 30 assembly instructions. Given that modern processors can do 2 billion operations per second, I'd much rather have as much abstraction as can be dreamt up.
Small and efficient programs...??
hahahahahahahahahahahahahahahahahaaaaaaaaaa...Please Register or Log in to view the hidden image!
are we talking about "HELLO WORLD" or may be swaping programs here?off course if your pointer is moving in that fashion then go ahead and use GOTO,its KoolPlease Register or Log in to view the hidden image!.But bigger programs??No way...i and my friend were involved with implementation of CSMA/CD algorithm(Carrier sense multiple access with collision detection) with the help of C-sockets programming,the program went on to take 6 separate Files.(*.c i mean)and each program had round about 1500 lines of code.the programs were implementing Slotted ALOHA algorithms,at the same time there was a provision made for abortion of collision of packets(in a network).can you use GOTO here?
had i used GOTO,i wouldnt be able to follow my own code?
And dont compare Asm with Basic...
The Pentium 4 performs up to 6 operations per clock cycle, and Athlon XP performs up to 9 operations per clock cycle. That means that modern processors do up to 15 billion operations per second (1.67GHz*9 or 2.2GHz*6) not two billion like you stated.
Ever wonder why modern programs run so slow on such fast processors? If processors are over 100 times faster than they were ten years ago, why aren't programs a hundred times faster?
Maybe because of the sloppy programming you're suggesting.
Another thing: Just because processors are faster doesn't give you a reason to write slow-ass programs.
I've been programming since I was eight years old, and I consider myself an old-school programmer. By old-school I mean writing programs that are fast and that can fit on a floppy disk. Over the years I've written over a hundred programs, many dealing with complex mathematical formulas(i), and none of them were over 300K when compiled. I am currently writing a broad-based artificial intelligence program, that, when finished, would contain about 400 lines of code.
So forgive me if I find it funny that you've written a networking program that contains 9000 lines of code. An entire operating system can probably be written with less than 9000 lines of code.(Unless it was written by Microsoft, of course)
A small Ping Flood program as i understand takes a hell lot of time and loads of lines.about 6 pages in print out.
a Small part fo NOTEPAD program in windows takes hell lot of space than you can even imagine,even if you try to build a VI, or may be any other unix editor it"ll require loads of lines of source code.
and here we are talking about CSMA/CD,i hope you know what it is,as you are experienced enough as you put it.It involves multiple algorithms,enhancemment features like adding GUI to it.making it more flexible and user friendly for use.currently the software as you might put it is with my Fathers company,and yeah works a hell good.
Funny as you may find it,but Microsoft uses a hell lot of inovative techniques and slip arounds to Give you a dumb window in front of you.needless to say TSRs etc.
and BTW which OS are you talking about?
like Dragon Linux?hahahaha...Please Register or Log in to view the hidden image!
yeah sure its soooo small,are we just talking about the kernal here or the whole thing?
and i am very disappointed that an experienced programmer uses GOTO.you"ll get into trouble later as you"ll find stuck up with your own source codes,and that you"ll yourself find the whole thing confusing...
Separate names with a comma.