Qbasicnews.com

Full Version: Pascal VS QB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Yes, we have all seen QB gain its top status among other programming tools, but what if we took a look at Borland's ingenious Turbo Pascal? Turbo Pascal 6.0 or 7.0 is really THE ONE. While QB lacks the DELAY statement and functions for defining interrupt vectors, TP has it all, and it even has a built-in assembler! So it's worth the while to take a good look at Turbo. You don't have to leave QB, but Turbo Pascal is a very good thing to learn about.

God's peace.
I agree with you, TP es a good environment to start learning, but has same anoying things. TP6 for example, is very strict in the Pascal Language, the ; separates sentences and do not finish them as in C. TP7 changes this (also retain the old behavior).

I personally dislike, the way that error are marked, just highlight the line and give an error number.

I have to put "program name;" at first line, and call the program with the same name.

With QB, i just type what i wish and hit F5 and voila. (The error are harder to find in the other way) But a i first learn QB, and you know the first is the first.
It's hardly fair to compare the languages when they're designed for different purposes... QB is to help someone who's never seen languages learn the basics of programming (variables, control structures etc), whereas pascal is designed to make students learn how to program in a careful, controlled way.
I think QB and TP serve the same purpose, though... The only difference, is that the majority of people uses QB, and TP seems to be getting a bit pushed in the background. At least that's what you see from that the enormous amount of downloadable programs for QB can easily compete with those for tP...
All the schools here use Pascal as an introduction to programming (though they don't go very far with it).
Quote:I think QB and TP serve the same purpose, though... The only difference, is that the majority of people uses QB, and TP seems to be getting a bit pushed in the background. At least that's what you see from that the enormous amount of downloadable programs for QB can easily compete with those for tP...

Nah, Oracle said it well. BASIC was introduced in 1965 so everyone at college could use an easy to learn language that was suited to simple tasks, aiming to be a very high-level language easily understandable without having to get very abstract.

PASCAL was based on previous languages (ALGOL, for example) and was introduced to teach students how to code a structured language.

The scope, as you see, was very different. Hence BASIC was never intended to get "low level" (memory management, string management, file management, system calls... everything is wrapped in high-level functions), but PASCAL was never meant not to. QB adds some functionality to access "low level" stuff, but it is minimum simply 'cause BASIC is BASIC and it was designed to be an easy language that made you forget about the computer it was running on. That's why BASIC has always been an interpreted language and only since the 80s compilers began to appear here and there.
Quote:PASCAL was based on previous languages (ALGOL, for example) and was introduced to teach students how to code a structured language.

Yeah Pascal is very strongly typed, which teaches good coding habits, but there are some annoying quirks that come out of that. For example, if you allocate 64k of memory through an untyped pointer, the only way to access it is directly through the mem[seg:off] array.

For me, though, Pascal has been a great bridge to C++, because the syntaxes and program structure are broadly similar. And Pascal introduces the concept of pointers with a much more intuitive syntax.

Additionally, the help system in TP7.0 is EXCELLENT. That's the biggest plus as far as it being a learning language.

Anyhow, even C is the ultimate target, Pascal is a great in-between language.
FreePascal allows me to get say what, a 256mb array (all my memory). I dont have any 64k limits, wizardlife Smile.

The only thing i dont like about pascal is you have to type begin & end instead of { & } in C. Still a good language.

Very structured.

BASIC is indeed different to PASCAL in that in BASIC, you just start typing commands. In PASCAL you define everything: define your structure, libraries, variables, and them start typing. I use both, but I mainly only use QB now to do quick programs that would take a bit longer in PASCAL whereas im only going to use the program once so who cares.
In fact, it is a good practice to define everything. When you go to a lower level, this is important. In a lower level, you gain more control on what the machine is doing for you. BASIC dialects use the BASIC philosophy: automation. That's why in BASIC strings are handled automaticly and in C you have to work them out. Pros and cons are in both approaches. In BASIC you can forget about them and use var$=var1$+var2$, but that is hiding lots of operations that show (you have to actually manage memory) in C, for example. In C you manage memory for yourself, so you can make sure that you will be using just the needed amount and that way you can design better algos. In BASIC you have to rely on how good the runtime is (and in QB the runtime is quite lame!).

One of the good things that VB has is the OPTION EXPLICIT keyword. Placing that keyword at the top of every model makes the compiler to complain whenever you use a variable that has not been defined. Defining variables is a good practice. It gives you more control on what you are doing.

But any valoration relies only on the way of coding you have. I prefer to go purist and have the control as much as I can. That's why I despise PureQB stuff. QB allows some interaction with the machine, and usually Pure QBers are dissing this feature. In my opinion, not using all the capabilities QB has over other BASIC compilers (that is, allowing to use interrupts, ports interaction and other language functions) is not taking advantages on what QB is against BASCOM, GWBASIC and all those old BASIC compilers.

QB dialects (used later on in PDS or VBDOS) allow advanced stuff. Not taking advantage of this feature is just playing fool. If you love QB 'cause it's easy to make good algos on it, the less effort you could put on it is pushing it to its limits and actually using it in all its potential. This potetial is little, but it is there.
Quote:It's hardly fair to compare the languages when they're designed for different purposes... QB is to help someone who's never seen languages learn the basics of programming (variables, control structures etc), whereas pascal is designed to make students learn how to program in a careful, controlled way.

I disagree. QBasic is NOT to help teach control STRUCTURE and variables. That stuff is never in QB! Most people forget the indentations, to declare variables, etc. I like QB otherwise, but I like Pascal better. But if it's just a short program to test an idea or theory of mine, it's easier to go with QB. Long programs, I use Pascal. Pascal Rulez!