Qbasicnews.com

Full Version: New to Qbasic and programming
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey Guys,

I've been trying to learn how to program over the past few years on and off. I know people who are programmers and told me I should learn C++ because its a good all around language. I bought a couple intro C++ books only to not really be able to make much with it.

I've done some research into the best way to get into programming. It seems like everyone says Qbasic is a great language to start with. I downloaded qbasic this morning and got a couple tutorials and was able to start making some basic programs already which is pretty cool.

Ok, so here's my question. Once someone's grasped Qbasic, how difficult is it to make the transition to an OOP like C++ or Java?

Is it just a matter of learning the syntax? Or are there new ideas introduced with OOP that Qbasic tutorials dont cover (i'm guessing yes)?

Do you guys have any suggestions for a good Qbasic book? I checked out Qbasic by example and it got really great reviews. I might pick that up sometime this week.

Thanks for reading, hopefully I'll be a contributing member soon.
OOP is different than procedural programming (Qbasic, C, Pascal...). It is just a different approach, where stuff is done differently. Anyhow, learning a procedural programming language is positive 'cause that way you learn building your own algorithms and thinking logically. Although OOP is another world, it relies on procedural programming to build the core of your objects, so I encourage you to try to master QB 'cause you'll get lots of fun easily and without noticing it you'll become a good programmer if you follow the correct path, and that will be a great aid when respawning yourself to learn OOP.

Many people say that learning C++ directly is good practice, but I discourage it. To me, it is better to build your path to C after QB. C is a full featured procedural language that is in lower level (next to the machine language) than QB, so you'll learn heaps and you'll find that you can do many things easily, easier than coding in QB. When you are fed up with procedural languages, it is time to jump to OOP, but learning Java. Java is pure OOP, so it is the best one to learn OOP. Once you master Java, you really know OOP, so you can code in "good C++". I say this 'cause C++ is not a pure OOP language, but mixes OOP and procedural stuff (you can do a completely procedural program in C++, look at the general programming section to find 10 or more in the first page). To code in C++ properly you should avoid its procedural part and code in pure OOP. Coming from Java, this is easily achieved. Pure OOP in C++ is way better coding than mixed programming.

And about books, I live in Spain and it is virtually impossible to find QB books, for some reason (at least in my area). I learnt QB with the QB help and looking at other people's code, but now you have the internet, this forum and a plethora of tutorials.

The best way to learn to code is trying to code a game. A game includes almost everything of a language (file access, graphics, finite state machines, optimization, AI, timing, abstract data types, etc etc etc).

Welcome to this nice community!
Sounds like sound advice, but then again I really dont know that much comparing the diff languages, but I'll take your word on it. Quick question though. Where does C# factor in? Is it just another OOP language, like the next version of C++?

Which language is best to make programs for windows? Linux? So, you suggest Qbasic > C > Java > C++ once I get the basics down in ...Qbasic.

Any other suggestions from other readers as to what a good path to go down as far as becoming a "well rounded" programmer?

As far as math is concerned. People say you dont really need too much math aside from algebra, but I know that in order to create some complex programs and games, math is fundamental. What aspects of math should I focus on? Calculus, Diffrential equations, Linear algebra, etc?

I'm asking a lot of general questions so I can get a good layout of what I should be doing in order to make the most of learning.
Hi Vic,

Welcome to the forum.

The BASIC Techniques and Utilites Book by Ethan Winer is highly recommended.

Download all the chapters FREE from:
www.ethanwiner.com

Look near the bottom of the homepage for WINER.ZIP. This is what you want to download.

There are nine chapter, a lot of BAS code, ASM code, etc. There's something there for everyone.

Winer is considered the top authority on Basic and QuickBasic.

Also, a word of advice. Before you start to code a program, write down all your ideas on paper. Then convert these ideas into your own psedo-code, like:

*comment* This is a master file update program. The master file is in partnumber sequence as is the updates file which contains the new fields which are to update (replace) those in the master file.
Note: There is a separate program for creating new records on the master file.
open the input file called "master"
open the input file called ¨"updates"
open the output file called "newmast"
open the output file called "errorlog"
perform the read.master logic
perform the read.updates logic
*comment* the read.master and read.updates logic need to check the sequence of the files regarding the partnumber field.
STEP.101
match the partnumber of the master record to the updates record.
if the master is less than the updates:
.... write this master record to the newmast file.
.... perform the read.master logic
.... goto STEP.101.
if the updats is less than the master:
.... error: we have updates to a non existent master record.
.... write an error message with the updates partnumber to the errorlog file.
.... perform the read.updates logic
.... goto STEP.101
*comment* otherwise the updates record is equal to the master.
*comment* So, update the master record accordingly.
.... write the updated record to the newmast file
.... perform the read master and the read updates logic
..... goto STEP.101
*comment* I need some way to know when the program is finished. Maybe use a "high-value" partnumber when I get an end of file when reading the input files. Then, when master is equal to updqtes partnumber and master is equal to the "high-value" then the program is finished.

You can invent your own style of pseudo-code. As you can see above, we touched several important issues for the program before we actually wrote any code. This is really a very good habit to get into.

Good luck!
*****
Listen to Moneo, he's the wisest (if that's correct Big Grin) programmer in this forum. Period.

C# looks like Java so much. We could consider it "Microsoft's attempt to make C++ a pure OOP language". It has to do a lot with Java as it works in a virtual machine, but somewhat differently. Java is more portable 'cause it will work anywhere as long as the machine has the JVM installed. That means a PC under any operating system, a Sun Ultra Sparc workstation, a cell phone or an embeded system (believe it or not, Java was designed to be used in embeded systems in the very beginning).

C/C++ can be really portable if you adjust to the GCC (GNU C compiler) standard. For example, I coded a game using Allegro and other libs which are designed to work with GNU compilers. I coded my game using DJGPP, a port of GCC for MSDOS. As Allegro is available for windows, Linux, Amiga and Mac, my game could be compiled and ran from any of those systems (I compiled it for Windows using MSVC6 without having to alter a single line of code, and I am planning to compile it under linux as fast as I learn how to write a proper makefile). I had to compile manually one of the libs I used (to load JPEGs) but I only had to change two things that were not so standard and it worked like silk.

About math, algebra is the most used I believe, but if you want to go for games you learn 3D maths that have to do with trigonometrics and numeric methods (algebra again). If you wanna do sound applications, calculus is a need (Fast Fourier Transform used 100 times in your program, and Fast Fourier Transform needs you to understand properly the Series of Powers, those the Series of Functions, and those the Numeric Series, so go figure Big Grin).

About my QBasic>C>Java>C++ process, don't follow it point by point. For example, I learned QBasic for fun, and then at college I had to learn C and Java almost at the same time. I don't know C++ for example, and I don't care about it 'cause I don't need it, but most people here will advice you to learn it. You can also feel brave and learn C++ and C at the same time if you are smart enough to be able to separate the procedural way of thinking appart from the OOP oriented. You can use OOP-alike techniques in procedural languages, and that will make your code really good, robust, understandable and reliable. I wrote a small tutorial which covers those topics (good modular programming and OOP-alike techniques which I consider to be a good programming practice) which you can read here: http://faq.qbasicnews.com/?blast=PushingTheLimitsOfQb but I'd suggest you to learn the basics first and then, when you know how to work with SUBs and FUNCTIONs, read the tutorial.

And be sure about one thing: in this forum you can find really good programmers, and not only QBers, but C coders, Java coders, C++ coders, PHP coders, PERL coders and PASCAL coders.
Quote:Which language is best to make programs for windows? Linux? So, you suggest Qbasic > C > Java > C++ once I get the basics down in ...Qbasic.

Qbasic is an easy language to start with, but it cannot be used to make Windows or Linux applications. Java is a good start for making applications for both Windows and Linux because once compiled, the class files can be run on either operating system. Other languages such as C and C++ can also be used to make Windows/Linux applications.

Dont get stuck to much on trying to learn languages in a specific order. Different languages are good for different things, there is no be all and end all programming language. Some of the skills you learn while programming in Qbasic will transfer directly over to other languages like C and Java. Other languages you may want to learn like Prolog require a completely different mindset, but can be used to do things that are very difficult in other languages.

Quote:As far as math is concerned. People say you dont really need too much math aside from algebra,

You will want a basic understanding of algebra to understand how variables work. What areas of math you need to be good depend on what you are doing, for example writing a rag-doll physics engine (Unreal Tournement 2003, Max Payne 2) will require a fair knowledge of physics and calculus, and as na_th_an said, other things like sound programming also require knowledge of calculus. When you are starting out however, you'll get by fine on a basic understanding of algebra.

Quote:I'm asking a lot of general questions so I can get a good layout of what I should be doing in order to make the most of learning.

Instead of focusing on learning languages, learn algorithms and programming techniques. These things work with any language you decide to learn. Anyone can learn the syntax for a dozen languages and write crap code in all of them, a good programmer learns how to write good code, how to reuse code that is already written for them, when and how to use algorithms and can use those skills in any language. Once you learn one language, others are fairly easy to pick up.

Hope this helps,
for me it was Basic -> QBASIC + C (same time, QB for fun) and onward. somewhere along the line i picked up python and found it a good cross between QB and C/C++. I recommend learning one of the structural programming languages such as PHP, Java or C, since they are all very similar. QBasic is for nostalgic hobbyists, the others can get you a job.
Quote:...Instead of focusing on learning languages, learn algorithms and programming techniques. These things work with any language you decide to learn. Anyone can learn the syntax for a dozen languages and write crap code in all of them, a good programmer learns how to write good code, how to reuse code that is already written for them, when and how to use algorithms and can use those skills in any language. Once you learn one language, others are fairly easy to learn.
Bravo, LooseCaboose, now there's a piece of sound advice.
*****
Nathan,
Gracias por considerarme como un programador con sabiduría. Lo dificil es mantenerme actualizado.
Saludos.
*****
Wisdom comes from experience, and everyone here should read carefully your posts and learn from them, as I do.

Cheers, amigo Smile
Pages: 1 2