Ancalagon wrote:
LordoftheMonkeys wrote:
I don't like the way BASIC is structured. It doesn't teach programming skills very well and is therefore kind of pointless as a beginning language.
I have to disagree. Not that BASIC isn't pretty poorly designed from many standpoints, but that it is an actual programming language, which is enough for the very basics.
BASIC was the first language I ever used, and I learned the concepts of for loops, variables, console I/O, debugging, function calls, and graphical output from it. Although I haven't touched BASIC for over a decade, I use these concepts every time I program.
That said, once you're past the basics it's not so great.
Oh, one other thing it taught me: spaghetti code is bad. I learned it from
This Program. If you think spaghetti code is good, reading it will change your mind.
... and as soon as I looked at your linked example, I started to think about rewriting it in a language that would show the way the algorithm worked.
And, from the point of view of
learning programming, maybe BASIC is a very good choice. Rather than having the language try to prevent you writing code that is poorly structured, start off with a language that has almost no structure (i.e. is very close to machine code, in fact), and learn
why poor coding causes problems.
Even when coding in BASIC, you can use comments to help the reader (which may well be yourself, a few weeks later) understand what the code is doing. The program you linked to has none, which contributes to its incomprehensibility. (I like a nice octosyllabic word, before midday.)
That program also has a little "afterthought" error check, on line 102, which is incredibly silly. It validates that neither the width or height is given an one, which is silly. A "maze" that happens to be just one cell wide or one cell high is perfectly valid - just remarkably simple to thread. The check (for what it's worth) should validate them both as greater than zero, which at least would be worth the effort.
(Exercises:- Does the program draw 1xN and Nx1 mazes correctly? What happens if height or width is entered as zero? What happens if height or width is entered as negative?)
_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports."
Kamran Nazeer