PDA

View Full Version : QuickBASIC




Lordskelic
Dec 2, 2011, 12:21 PM
Anybody ever heard of MS Quickbasic or done any programming on it? You can run it with DOSBox for Mac.



Senor Cuete
Dec 2, 2011, 12:44 PM
Anybody ever heard of MS Quickbasic or done any programming on it? You can run it with DOSBox for Mac.

Yes, I had to convert a Quick BASIC program to C years ago. The problem was that interpreted BASIC was so slow that it would take three months of processing time to do the job. Yes, computers were slower back then. I rewrote the program as compiled ANSI C and used all of the optimizations I could, to make it run in 1% of the time. They hired me. I would advise you not to bother with programming in BASIC. For a lot of reasons it is severely deprecated today. If you want to program I would start out with C.

Lordskelic
Dec 2, 2011, 01:48 PM
Yes, I had to convert a Quick BASIC program to C years ago. The problem was that interpreted BASIC was so slow that it would take three months of processing time to do the job. Yes, computers were slower back then. I rewrote the program as compiled ANSI C and used all of the optimizations I could, to make it run in 1% of the time. They hired me. I would advise you not to bother with programming in BASIC. For a lot of reasons it is severely deprecated today. If you want to program I would start out with C.

Why do you recommend C and not C++?

Senor Cuete
Dec 2, 2011, 02:23 PM
Why do you recommend C and not C++?

Because the current paradigm for application programming is object oriented programing with frameworks. This type of programming is done with C# (PC .net framework), Objective C (Mac, Cocoa) and C++ (cross platform) and Java (cross platform) which is a lot like C++. Some schools start out with C++. This seems like it would be very difficult to me. If you got started in C first you would be able to make the jump to the supersets of C more easily. My impression after talking to C++ .net programmers is that due to the nightmare of multiple inheritance in C++ and the vast number of classes in .net that someone with the IQ of Einstein who has no life except programming with this environment can do it but mere mortals will find it very difficult. This doesn't sound like a good place to start. If you learn C you will understand important concepts like pointers that will make sense in object oriented programming. The learning curve to go from zero to OOP is very steep. Nevertheless it can be done. I would begin at the beginning with something approachable.

On the other hand someone will doubtless disagree with me:

Lordskelic
Dec 2, 2011, 02:40 PM
Because the current paradigm for application programming is object oriented programing with frameworks. This type of programming is done with C# (PC .net framework), Objective C (Mac, Cocoa) and C++ (cross platform) and Java (cross platform) which is a lot like C++. Some schools start out with C++. This seems like it would be very difficult to me. If you got started in C first you would be able to make the jump to the supersets of C more easily. My impression after talking to C++ .net programmers is that due to the nightmare of multiple inheritance in C++ and the vast number of classes in .net that someone with the IQ of Einstein who has no life except programming with this environment can do it but mere mortals will find it very difficult. This doesn't sound like a good place to start. If you learn C you will understand important concepts like pointers that will make sense in object oriented programming. The learning curve to go from zero to OOP is very steep. Nevertheless it can be done. I would begin at the beginning with something approachable.

On the other hand someone will doubtless disagree with me:


So what route do you recommend I take? What compiler should I use? What tutorials / resources?

Mac_Max
Dec 2, 2011, 03:11 PM
When I learned C++ in school we learned all the non OO C style procedural stuff first. It's not hard really.

Just wanted to make a correction about C++ on Windows. When you deal with the .Net framework you work in C++/CLI and when using the .Net-look alike WinRT in Windows 8 you use C++/CX. In both of these environments you get some kind of built in memory management (garbage collection and automatic reference counting, respectively) and can use native ISO C++/ANSI C DLLs and code. Multiple inheritance isn't allowed under either runtime. This is because MSIL (what C#, C++/CLI, VB, F#, etc compile to) and the COM interop WinRT uses doesn't support multiple inheritance.

The real problem with C++/CLI is that MS doesn't really support it. Important bits and pieces of the Base Class Library (BCL) aren't available. It gets frustrating to have to write a C# DLL just to do certain trivial tasks. Also WPF support is kinda there but it's not an option given to you from the start. You have to import the libraries manually and build your own template.

The BCL itself is a large library but like anything else, there will be portions you use a lot (in my case GUI, data shuffling (yay Linq!), files, multimedia, networking) and then a lot of things you have to google to remember where they are. I don't consider it particularly daunting 7 months into my Professional .Net career. I mostly program in C# but I sneak in C++/CLI whenever I'm writing something that deals with the Win32 API (since I don't have to deal with COM interop and C++ is fun).

WinRT support is much better since everything in the WinRT library is written in C++ in the first place. The WinRT library is designed to mimic the functionality of the .Net framework so it's similarly sized but still a bit smaller.

Either way, if you want to just do Mac/iOS programming, then none of this really matters. If you want to make money coding, knowing multiple platforms never hurts.

Learning C first isn't a bad idea. If it doesn't "click" for you could try learning to program with Python or Ruby. I would suggest becoming comfortable with C conventions and pointers and then dive into C++ and Objective C. You can then branch out into C# and between those four languages (C, C++, Obj C, C#) you'll be able to program just about anything (including Android devices (http://android.xamarin.com/)).

Senor Cuete
Dec 2, 2011, 03:36 PM
So what route do you recommend I take? What compiler should I use? What tutorials / resources?

OS X comes with free development tools - XCode. It's been too long since I learned C for me to recommend a book about it but there's probably some title like "Learn C on the Mac". Oreilly has a lot of good programing books:

http://oreilly.com/

For Objective C and Cocoa I recommend:

http://www.bignerdranch.com/book/cocoa_programming_for_mac_os_x_th_edition_

----------

...and when using the .Net-look alike WinRT in Windows 8 you use C++/CX...

So do you work for the evil empire? Is that how you get to program for the not-yet-released Windows 8?

robvas
Dec 2, 2011, 03:38 PM
So what route do you recommend I take? What compiler should I use? What tutorials / resources?

If you are looking to do Mac stuff, try here:

http://developer.apple.com/library/ios/#documentation/IDEs/Conceptual/xcode_quick_start/010-Tutorial_Using_Xcode_to_Write_Hello_World/hello_world_tutorial.html#//apple_ref/doc/uid/TP40010575-CH2-SW1

If you just want to learn programming, I would start with JavaScript, Ruby, or Python. QBasic is a good start but it's 20+ years old and there isn't a good way to run it on today's Mac. The bad part about starting with C is you have to go through a lot of technical crap before you can do the simplest of tasks, that's why I recommended those other 3 languages.

firewood
Dec 2, 2011, 03:48 PM
There are several native BASIC interpreters that will run on current Macs, several free. Decimal Basic, Real Basic, GLBasic, Chipmunk Basic, and etc.

Mac_Max
Dec 2, 2011, 04:03 PM
So do you work for the evil empire? Is that how you get to program for the not-yet-released Windows 8?

Haha, no but that would definitely be nice career wise. I work with large Touch Screen multimedia kiosks (Windows based). You can download the dev preview for free off of MS's website (http://msdn.microsoft.com/en-us/windows/apps/br229516).

The Evil Empire helps fund my iOS book collection.

Apple's "The Objective C Programing Language" PDF is good as well and is free.

degsyuk
Dec 3, 2011, 01:18 AM
Anybody ever heard of MS Quickbasic or done any programming on it? You can run it with DOSBox for Mac.

BASIC is as good a place as any to learn about programming if all you want to do is learn about programming. I would recommend MS Visual Basic as it is a modern OOP language with the same functionality and features as c# and MS provide a version for free ($0.00). However, Java and c# will provide more job opportunities and if you intend to program commercially learning one of these will be your best bet.

QuickBASIC is very old and should be avoided as it is unlikely to support things like multi-threaded programming or network connectivity very well.

jiminaus
Dec 3, 2011, 02:01 AM
BASIC is as good a place as any to learn about programming if all you want to do is learn about programming.

I quote Edsger Dijkstra:
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

Although I myself started with BASIC in 80s, and I wouldn't consider myself mentally mutilated (at least not by BASIC).

Senor Cuete
Dec 4, 2011, 09:24 AM
An analogy: When I was a kid private schools taught you Latin. I asked why they were teaching us a dead language and the answer was that it taught you how to learn languages and would make it easier to learn a useful language when the time came. Of course you could have learned the same principles by learning a living language.

There is a standard C language, ANSI C, but there is no such thing as BASIC. BASIC is a bunch of different similar languages:

http://en.wikipedia.org/wiki/List_of_BASIC_dialects

This is because early dialects of BASIC couldn't be used for structured programing, for example, all of the variables were global, it didn't support pointers and it was interpreted. In order for it to be used for serious programing it was modified many times. Microsoft Quick BASIC is one of the earliest, most primitive dialects and the code you write with it won't work with newer dialects.

In my opinion BASIC is also syntactically weak. GOSUB 01 will never be as comprehensible as int doSomething(double myDouble);

robvas
Dec 4, 2011, 10:54 AM
The advantage BASIC always had, was the same that today's languages like Python and Ruby have: You can see the result of a single line of code, instantly.

BASIC:

PRINT "Hello!"

Hello!

Ruby:

>> puts "Hello!"
Hello!
=> nil
>>

Python:

>>> print "Hello!"
Hello!
>>>

Compare that to something like C - you've got include files, a main function, compiling, linking, running a separate program. An IDE makes this easier, but remember this is what 'hello' looks like in C:


#include<stdio.h>

main()
{
printf("Hello World");
}

KnightWRX
Dec 4, 2011, 11:35 AM
Compare that to something like C - you've got include files, a main function, compiling, linking, running a separate program. An IDE makes this easier, but remember this is what 'hello' looks like in C:


#include<stdio.h>

main()
{
printf("Hello World");
}


C is so complicated, you managed to get Hello World wrong in multiple ways. ;)

$ gcc -o hello -Wall test.c
test.c:4: warning: return type defaults to 'int'
test.c: In function 'main':
test.c:6: warning: control reaches end of non-void function
$ ./hello
Hello World$

So let's fix it up for the sake of the op :


#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("Hello World\n");
return EXIT_SUCCESS;
}


That is what Hello World looks like in proper, portable ANSI C :

$ gcc -o hello -Wall test.c
$ ./hello
Hello World
$

Blakeasd
Dec 4, 2011, 12:50 PM
OR Objective-C


-(void)sayHello{

NSLog(@"Hello, World!");



}

Sydde
Dec 4, 2011, 12:53 PM
C is so complicated, you managed to get Hello World wrong in multiple ways. ;)

$ gcc -o hello -Wall test.c
test.c:4: warning: return type defaults to 'int'
test.c: In function 'main':
test.c:6: warning: control reaches end of non-void function
$ ./hello
Hello World$

So let's fix it up for the sake of the op :


#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("Hello World\n");
return EXIT_SUCCESS;
}


That is what Hello World looks like in proper, portable ANSI C :

$ gcc -o hello -Wall test.c
$ ./hello
Hello World
$

To be complete, should you not have the "int argc, char *argv" arguments in main, even if you ignore them?

C is a challenging thing to learn, but when you get past simple things, you come to appreciate the flexibility of the multiple file structure. If writing all that extra stuff is a nuisance, you can just start out with an IDE that puts up a template with most of it already there.

subsonix
Dec 4, 2011, 01:04 PM
Compare that to something like C - you've got include files, a main function, compiling, linking, running a separate program.


Eh, you've got include files and a main function and a separate program in pyhon as well as soon as you go beyond "Hello world" running in the interactive python shell. i.e when you want to do something useful with it.

Compiling your code means you get notified of your errors before you run your program instead of while you run it. Excluding pure runtime errors of course.

The actual line of code that prints in C looks like this (with or without \n):

printf("Hello world");

Where as the pyhon line, if part of a complete program (like your C example) would look like this:


#!/bin/pyhon -tt

def main():
print "Hello!"

if __name__ == '__main__':
main()

KnightWRX
Dec 4, 2011, 01:48 PM
To be complete, should you not have the "int argc, char *argv" arguments in main, even if you ignore them?

Both declarations (int main() and int main(int argc, char ** argv)) are valid in C99 :

http://c-faq.com/ansi/maindecl.html

firewood
Dec 4, 2011, 02:34 PM
The advantage BASIC always had...

That advantage that any programming language has is that someone already knows how to code in it fairly well.

Little kids who grow up in Hungary can speak perfect Hungarian. The path to speaking passable Hungarian (Japanese, et.al.) for someone who grew up in a monolingual Bronx household is usually far different. Learning a 2nd (on Nth) programming language is easier, but still non-trivial and certainly not instantaneous.

Lordskelic
Dec 4, 2011, 05:53 PM
Thanks for the responses everyone. It helped.