## BASIC vs. C (BASIC wins, obviously)

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### BASIC vs. C (BASIC wins, obviously)

I like BASIC more than C.

Why?

To answer that, you need to understand the purpose of a programming language is and is not.

The purpose of a programming language is NOT to increase the amount of work you need to do. It's NOT to increase the amount of archaic minutiae you need to know to do a job. It's NOT to get a bunch of pretty but useless tools.

The purpose of a programming language is to abstract away the more complicated elements of getting a computer to do what you want to do. The purpose of a programming language is to act as an in-between between the language the human speaks and the language the computer speaks. The purpose of a programming language is to make life easier so you can get more done.

To this end, it only makes sense that BASIC is a purer implementation of the concept than C.

-BASIC looks like regular algebra. C looks like gobbledygook.
-BASIC commands are human-like, and thus easy to remember. C<&&==<>##++z(translation: C looks like gobbledygook.)
-BASIC is usually implemented to bring libraries into itself from the source file '#include <SDL/sdl_lib.bi>' in BASIC will deal with all the linker stuff you don't want to care about so when you go 'fbc mygame.bas' it just compiles, where in C, '#include <SDL/sdl_lib.h>' will leave you with a bunch of linker errors and a desperate hope that your internet is working so you can google a solution.
-BASIC comes stock with string manipulation commands, reducing the amount of 'reinventing the wheel' a coder needs to do in order to get a codebase running, and with a more intuitive interface than null terminated arrays of char.
-BASIC is structured in such a way that the compiler can give meaningful error messages. gcc will spit out "ERROR: Expected } ON LINE 700" when your problem was a missed quotation mark, while BASIC compilers will spit out at worst "SYNTAX ERROR ON LINE 10", or at best "ERROR: EXPECTED " LINE 10".
-BASIC base commands are built into the language, and thus very simple to learn due to the documentation inherent with having something built into the language. By contrast, C is a very minimalistic language, forcing you to go googling for the library you want to do simple things, unless they just want you to write your own routine.

Sure, C might make sense if you're programming a microcontroller and actually care about karnaugh tables and digital output lines, but for anything else, it pays too much attention to details that nobody has or cares about.

Freebasic .17 with the -lang deprecated switch is my drug of choice. When I've got a list of 50,000 files to sort (I did last year), I know it's got my back with simple, consistent, human syntax. With C....Well, I hope Google is up and running.

Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

### Re: BASIC vs. C (BASIC wins, obviously)

This shitstorm will blot out the SUN!
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Cheese> I love you

fazzone
Posts: 186
Joined: Wed Dec 10, 2008 9:38 pm UTC
Location: A boat

### Re: BASIC vs. C (BASIC wins, obviously)

in concept I agree, this is why the Linux kernel is written in C and small everyday programs (even simple games) are more often written in languages like Java or Python (or should be), and C is (should) only be used where speed is critical.

But BASIC....
*/

You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:-BASIC looks like regular algebra. C looks like gobbledygook.

Basic arithmetic looks the same as C arithmetic in almost all operators, and you won't find the rest in regular algebra.

SJ Zero wrote:-BASIC commands are human-like, and thus easy to remember. C<&&==<>##++z(translation: C looks like gobbledygook.)

BASIC commands are also 5 letters longer. And the symbols you use in formal logic are no easier to follow (that is ∧ signifies AND, v signifies OR, ⊕ signifies XOR, etc.) Furthermore, if you really want long commands, you can use the preprocessor to rename the operators.

SJ Zero wrote:-BASIC is usually implemented to bring libraries into itself from the source file '#include <SDL/sdl_lib.bi>' in BASIC will deal with all the linker stuff you don't want to care about so when you go 'fbc mygame.bas' it just compiles, where in C, '#include <SDL/sdl_lib.h>' will leave you with a bunch of linker errors and a desperate hope that your internet is working so you can google a solution.

If you don't know how to build your SDL code, you obviously haven't read the manual that it's bundled with.

SJ Zero wrote:-BASIC comes stock with string manipulation commands, reducing the amount of 'reinventing the wheel' a coder needs to do in order to get a codebase running, and with a more intuitive interface than null terminated arrays of char.

Ever heard of the standard library? String manipulation is part of that. (In <string.h>). If you are afraid of null terminated arrays, you are free to write your own code to conceal the fact, and it's not particularly difficult at that.

SJ Zero wrote:-BASIC is structured in such a way that the compiler can give meaningful error messages. gcc will spit out "ERROR: Expected } ON LINE 700" when your problem was a missed quotation mark, while BASIC compilers will spit out at worst "SYNTAX ERROR ON LINE 10", or at best "ERROR: EXPECTED " LINE 10".

C is not GCC. Don't confuse an implementation with a language.

SJ Zero wrote:-BASIC base commands are built into the language, and thus very simple to learn due to the documentation inherent with having something built into the language. By contrast, C is a very minimalistic language, forcing you to go googling for the library you want to do simple things, unless they just want you to write your own routine.

Freebasic .17 with the -lang deprecated switch is my drug of choice. When I've got a list of 50,000 files to sort (I did last year), I know it's got my back with simple, consistent, human syntax. With C....Well, I hope Google is up and running.

You clearly are doing something wrong when you need to google all the time. Especially over and over again. Maybe like once year when you are starting a new project or something.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

Area Man
Posts: 256
Joined: Thu Dec 25, 2008 8:08 pm UTC
Location: Local

### Re: BASIC vs. C (BASIC wins, obviously)

"Gobbledygook"? in other words, a language you do know looks better to you than a language you DON'T know, and it's easier for you to get things done in this language you do know... a shocking assertion.

Ever hear of the concept of "the right tool for the right job"? C is often the right tool, while BASIC is nigh never the right tool, bearing in mind that there are many other options.
BASIC was necessary for windows systems because of the feeble DOS shell.
Bisquick boxes are a dead medium.

fazzone
Posts: 186
Joined: Wed Dec 10, 2008 9:38 pm UTC
Location: A boat

### Re: BASIC vs. C (BASIC wins, obviously)

Just found this gem:
Edsger Wybe Dijkstra wrote: Programming in Basic causes brain damage.
*/

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Then we shall fight in the shade!

"Gobbledygook"? in other words, a language you do know looks better to you than a language you DON'T know, and it's easier for you to get things done in this language you do know... a shocking assertion.

Where do I write that I don't know C? I know it rather well. Back in the old days of DOS, I wrote a graphics library for DOS for fun. In high school, I re-created the majority of my RPG engine in C before realising I didn't like coding in it. I created a version of FreeBASIC which created xbox executables, and thus have the only games programmed in BASIC for the xbox (not xbox linux, the xbox proper. You run them from the dashboard). To do that required rewriting portions of the rtlib to use an embedded version of glibc. rtlib isn't written in FreeBASIC. It doesn't mean that the language I used makes a bit of sense, or follows any sort of ergonomic convention.

BASIC commands are also 5 letters longer. And the symbols you use in formal logic are no easier to follow (that is ∧ signifies AND, v signifies OR, ⊕ signifies XOR, etc.) Furthermore, if you really want long commands, you can use the preprocessor to rename the operators.

First, formal logic is a non-sequitur. want to know the basic command for and? AND. or? OR. xor? XOR. not? NOT.

It's 2009. Readability and maintainability is in, and "NOT (a OR b)" is readable by humans, while "!(a||b)" is robot speak. As I mentioned in my first post, programming languages should be tools that make it easier, not harder for humans to talk to the computer. The computer doesn't need help. This is also why longer but more understandable keywords are a positive thing.

If you don't know how to build your SDL code, you obviously haven't read the manual that it's bundled with.

If I'm using BASIC, I don't need to worry about it anyway. Where is the benefit to wasting my time reconfiguring my linker when the language can (and should) do it for me?

Ever heard of the standard library? String manipulation is part of that. (In <string.h>). If you are afraid of null terminated arrays, you are free to write your own code to conceal the fact, and it's not particularly difficult at that.

Re-inventing the wheel is a bad thing. Yes, we get it, you're in front of a computer. Any good BASIC will have pointer notation, you can re-invent the wheel in it too. The difference is, it's retarded to. Also, integration comes with advantages. BASIC string concatenation involves the following:

newstring = string1 + string2

Yeah, you can add the header for the string library, but why should you have to? What benefit is there to making things more complicated than they need to be? Not to mention, some of the command names are wanked. atoi? What the crap is atoi? Is it anything like val(numberString)? Because it doesn't sound like it.

C is not GCC. Don't confuse an implementation with a language.

Fundamentally, figuring out where and what the problem is becomes more difficult in C than in BASIC, because where multi-line commands are optional in BASIC(ie. you use a symbol to span multiple lines), they're mandatory in C(ie. you use a symbol to end the line), so it's more obvious to the compiler where the problems are. You might be able to guess with a better error parsing mechanism, but implementation follows specification.

You clearly are doing something wrong when you need to google all the time. Especially over and over again. Maybe like once year when you are starting a new project or something.

I use reference material all the time. I've got a lot to remember. I look in my crane tables when I want to determine the flow through a pipe, I look in my fisher book when I want to know the attributes of a certain valve. I've got a dozen binders from a dozen different vendors so I don't need to memorize part numbers. Why would I spend more effort memorizing programming stuff than engineering stuff?

When I'm using most dialects of BASIC, and other programming language with a well-defined command set, I press F1. C compiler documentation, by contrast, is a clusterfuck. I'm better off using google to find someone else who has solved the same problem than trying to actually use the documentation. Often, the documentation assumes you already know how to use the command, and leaves out key details. "oh by the way, you need to create a new variable and allocate the memory you need, use this command, then deallocate the memory, or you're going to get memory leaks" -- good info, shame they don't share it.

And Dijkstra lived in a different era. In the 60s, BASIC still used GOTO as a major structural element, and used line numbers extensively. Today, it's extremely uncommon to see either of those. The BASIC Dijkstra attacked was a pain in the ass that promoted spaghetti programming. The BASIC of today is a structured programming lanugage that should never see the use of GOTO, or line numbers.

qbg
Posts: 586
Joined: Tue Dec 18, 2007 3:37 pm UTC

### Re: BASIC vs. C (BASIC wins, obviously)

I believe you are forgetting about iso646.h in C

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Funny, when I see "!(a||b)", I instantly recognize it as what it means. I am human*, I read it, ergo it is readable by humans**. Not only that, but it's shorter, and it's not yelling at me by being in all caps. Readability is entirely in the eye of the reader; the trivial amount of time it takes to familiarize yourself with a languages symbols is vastly dwarfed by the time it takes to actually understand any language and the idioms it uses. The only real difference is in symbol length - shorter saves space and typing time, so C wins.

Point #1 fails. Just because you can read robot doesn't mean it's not robot. Good embedded programmers know exactly what code they're looking at and what it does by reading the hexadecimal values. It doesn't mean you're not looking at a screen full of numbers. If you tell some other human what that code does, you'll say "if not both a and b at the same time".

Point #2 is meaningless because the caps are optional. Unlike C, BASIC doesn't waste your time with pedantry regarding capitalization.

Point #3 doesn't work because I don't agree with your first point. C is still robot language, filled with arbitrary symbols. Even if I did, it still fails because space is of near zero cost, and typing time shouldn't be anywhere near the limiting factor in coding throughput. Following your philosophy, whitespace is a waste of time, and comments are a waste of time because any competent coder should be able to figure it out.

Strings don't just concatenate in C because C doesn't treat them like some sort of special category, which makes C simpler and more logically consistent. If you really want, you could modify a compiler to override the + operator to do the same thing. But it turns out that you don't need to manipulate strings often enough for this to be a major priority in the language. In any case, the standard libraries of C are fine, and aren't included by default specifically because not everybody needs them and in a language intended for kernels and embedded systems the extra weight of an unneeded library is significant and damaging.

Nothing is simpler or more logically consistent than raw machine code. Why not just enter raw numbers into a hex editor? Because C is meant for humans, and BASIC is meant more for humans.

As for your other argument, it's a circular one. "C isn't set up like that because obviously C doesn't think it's a priority". Well I write programs to manipulate strings constantly, and so do many people (an entire industry exists around web programming, which deals almost exclusively with moving strings around). Since you didn't bother providing any ergonomic argument for leaving easy strings out of the language, why not make things easier rather than harder?

My original post points to Cs properties as useful for hardware level programming. I'm obviously not talking about that.

alethiophile
Posts: 21
Joined: Thu Apr 03, 2008 3:03 pm UTC

### Re: BASIC vs. C (BASIC wins, obviously)

It depends entirely on what you're doing. I dare you to try to implement a kernel in Basic. Myself, I almost never use pure C; it's generally C++/Java/Python. That's because generally I don't implement kernels.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Almost nobody implements kernels. That's my point.

C (and even C++) give a level of granularity and detail you simply don't need, it forces you to make decisions that don't need to be made, that the language should be able to do on it's own. Much like the Vista implementation of UAC.

Given the choice between legwork the compiler can do by itself and actually coding the solution to the problem being solved, I know which I'd rather be doing.

Area Man
Posts: 256
Joined: Thu Dec 25, 2008 8:08 pm UTC
Location: Local

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:Where do I write that I don't know C?
Well, the fact that you call it "gobbledygook" and that you state that you can't write it without google makes you sound like a script-kiddie.
SJ Zero wrote:It's 2009. Readability and maintainability is in, and "NOT (a OR b)" is readable by humans, while "!(a||b)" is robot speak.

It's supposed to be readable to programmers who know the language, not a child off the street. All written languages are just lines and dots and circles; these very words are made of them; it's what your brain interprets it as that matters.
Circuit diagrams are terse and indecipherable to a "regular" person, but undoubtedly much more useful and meaningful than a description in English prose to an electrician. Think about it.

Yes, it is 2009, that's why no one is writing BASIC, but instead C++/Python/C#/SQL/BASH/PHP/PERL/Ruby... (see previous comment about tools&jobs).
Also, FreeBASIC is NOT BASIC -- javascript is not java even though they share a similar name. Title is a lie; Thread failure.
Bisquick boxes are a dead medium.

You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:
BASIC commands are also 5 letters longer. And the symbols you use in formal logic are no easier to follow (that is ∧ signifies AND, v signifies OR, ⊕ signifies XOR, etc.) Furthermore, if you really want long commands, you can use the preprocessor to rename the operators.

First, formal logic is a non-sequitur. want to know the basic command for and? AND. or? OR. xor? XOR. not? NOT.

Injecting text in arithmetic is ugly.

Is LEFT PARENTHESIS 3 PLUS 5 MINUS 30 RIGHT PARENTHESIS DIVIDED BY 20.
clearer than (3 + 5 - 30) / 20
?

If not, why is should (P AND Q) XOR (B AND W)
be clearer than (P ^ Q) ⊕ (B ^ W)
?

SJ Zero wrote:It's 2009. Readability and maintainability is in, and "NOT (a OR b)" is readable by humans, while "!(a||b)" is robot speak. As I mentioned in my first post, programming languages should be tools that make it easier, not harder for humans to talk to the computer. The computer doesn't need help. This is also why longer but more understandable keywords are a positive thing.

I fail to accept your definition of robot language as what you cannot understand. Besides, my point remains that in C, you can do this:

Code: Select all

#define AND &&#define OR ||etc.

and use clunky BASIC logic all day long.

SJ Zero wrote:
If you don't know how to build your SDL code, you obviously haven't read the manual that it's bundled with.

If I'm using BASIC, I don't need to worry about it anyway. Where is the benefit to wasting my time reconfiguring my linker when the language can (and should) do it for me?

How often do you create programs? Configuring the compiler is something you do like once every two or three months tops. And even then it's mostly copypasta from your last Makefile that takes 2 minutes to slap together.

SJ Zero wrote:Yeah, you can add the header for the string library, but why should you have to? What benefit is there to making things more complicated than they need to be? Not to mention, some of the command names are wanked. atoi? What the crap is atoi? Is it anything like val(numberString)? Because it doesn't sound like it.

The reason you can select headers is to cut down on compile time. Instead of constantly searching through every single header file (there is hundreds, perhaps even thousands of them in a moderately large system) the programmer is expected to be smart enough to know what functions he's using and needing. But if such stupidity appeals to you, you can make an uber-header that includes every single header in the system.

atoi is Ascii TO Integer. But it's a pretty antiquated function, and you are probably better off with strtol.

SJ Zero wrote:
You clearly are doing something wrong when you need to google all the time. Especially over and over again. Maybe like once year when you are starting a new project or something.

I use reference material all the time. I've got a lot to remember. I look in my crane tables when I want to determine the flow through a pipe, I look in my fisher book when I want to know the attributes of a certain valve. I've got a dozen binders from a dozen different vendors so I don't need to memorize part numbers. Why would I spend more effort memorizing programming stuff than engineering stuff?

So you want to program, but not learn to use the programming language. Are you sure programming is the thing for you? Besides, you don't use google for determining the flow through a pipe. Google is a pretty terrible reference for most technical stuff. If you program through google, you'll just end up with cargo cult code that you don't understand and certainly shouldn't trust to do what you want it to.

SJ Zero wrote:When I'm using most dialects of BASIC, and other programming language with a well-defined command set, I press F1. C compiler documentation, by contrast, is a clusterfuck. I'm better off using google to find someone else who has solved the same problem than trying to actually use the documentation. Often, the documentation assumes you already know how to use the command, and leaves out key details. "oh by the way, you need to create a new variable and allocate the memory you need, use this command, then deallocate the memory, or you're going to get memory leaks" -- good info, shame they don't share it.

It seems like you are skipping the key step of learning to program C decently well before you start using it to build stuff. Reading K&R before you start is a good tip.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

If you guys are too lazy to learn how to write machine code with a hex editor, and need to use cluttery C, maybe programming isn't for you.

I used a set of LEDs, pushbuttons, and switches to test my logic circuits. If you don't know how to program with LEDs and pushbuttons, maybe programming isn't for you.

And gtk? Really? If don't want to just use xlib, maybe programming isn't for you.

Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

### Re: BASIC vs. C (BASIC wins, obviously)

Hey GUYS! I wrote an emulator for Left 4 Dead in my own computer language. Wanna see? Copy this into l4d.exe:

Code: Select all

I want to play a game with zombies and shotguns

It is the ultimate in readability. You know exactly what it does just by reading it!
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Cheese> I love you

Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Readability is a function of ideas and layout, not strings.

I'm curious, how would your languages' implementation of quicksort hold up against eachother?
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Almost every coding style document makes meaningful function and variable names a high priority. I recall reading plenty of anecdotes from frustrated coders trying to figure out what aa and ab are at a new workplace where they'd be fighting to deal with the antics of a long-fired lone wolf coder who didn't think readability was meaningful.

The ideal programming language WOULD be one where a regular person could just describe what they wanted and get it. I always think of the holodeck in Star Trek. Laymen could walk into it, and simply keep on describing what they want to see until they have it in front of them. Obviously not practical for a million different reasons(that's why it's an ideal), but there's no reason that the interface for a computer has to be on the computer's terms. The reason we have keyboards and monitors is that we're not able to easily perceive electrical signals, and even if they're something we can perceive, they're not something we can easily parse. Same with programming languages. They exist to make our lives easier by demystifying something we can't easily understand. Keeping them archaic makes as much sense as the church forcing all bibles to be printed in latin.

"Also, FreeBASIC is NOT BASIC -- javascript is not java even though they share a similar name. Title is a lie; Thread failure." define BASIC, then. FB will compile code from GWBASIC and QBASIC, even code from Visual Basic for DOS. All I had to do to get my RPG engine running in FB was replace the I/O code, replacing the keyboard code because I was polling the keyboard port, and replacing the graphics code because I was using multi-page modeX you don't have to do in Windows. Is Kaffe not applicable in a conversation about the Java language because it's an open source implementation of the language?

Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:Almost every coding style document makes meaningful function and variable names a high priority. I recall reading plenty of anecdotes from frustrated coders trying to figure out what aa and ab are at a new workplace where they'd be fighting to deal with the antics of a long-fired lone wolf coder who didn't think readability was meaningful.

You are not complaining about function and variable names. You are complaining about syntax, which is constant across every program in that language. If you can't learn the syntax, use a different language, but don't bitch about the other language being inferior. There are more skilled C coders than BASIC coders, and there are more languages that use ^&|! for logic than that spell out the words. Learn the convention. Furthermore, even in BASIC, you are still going to have that asshole who names his shit ab, aa, abbbcaa, etc, and you will have more of them because BASIC is a teaching language.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Cheese> I love you

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

If you keep on repeating "You don't know C" it's not going to suddenly become true. I know it well. I've worked on a number of projects written in C. That's why I can stand back and say "You know what, I know this language, and it's not designed or implemented very well for what most people will use it for". I ported a compiler to a platform it was never meant to run on, and the vast majority of that work was in C. I taught a good friend of mine, who uses C to program embedded systems today, how to use the language.

Further, you keep on repeating "LOL JUST LEARN IT", which isn't suddenly going to make the fact that it's horribly unintuitive for no good reason go away. For the umpteenth time, your arguments apply just as much to assembler or hex code or a 5v supply and a set of switches and LEDs. Why use C? Just learn assembler. Why use assembler? Just use a hex editor. Sure, it's hard now, so quit bitching and just learn it. If you had to learn to drive your car by typing into a command prompt, there's no reason you or I couldn't learn it, but it's not going to magically make that a good method to control a vehicle.

Finally, C syntax isn't constant across every program in the language. It isn't even consistent between platforms of the same program. My BASIC program will compile on several different platforms without a single change. C programs, by contrast, require ridiculous infrastructure, and multiple compilation paths, at times entire operating environments, just to compile because it's so inconsistent. How can you legitimately learn a language that doesn't work consistently?

There's a very good reason that even C and C++ combined (as they often are) aren't the top programming language. It's a horrible platform, and while BASIC isn't the top anymore, it's still superior to the wasteland that is the C programming language and development environment.

Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

All this bitching about languages and no code? You should be able to provide examples of your superiority.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

http://www.fbxl.net/oma/duel/
http://www.fbxl.net/oma/behold/
http://www.fbxl.net/oma/rvk/
http://www.fbxl.net/oma/sp/

Are they the best examples of glowing code in existence? No, I'm not the best coder on the planet, by far. But you know what? In each case, I went from "Know what might be cool?" to what you see before you in less than 2 days.

In each case, I was able to focus on actually doing what I wanted to do, because the language I used had consistency, because the documentation was able to actually lay out what I could do and if I wanted to know how to do something how to do it, and because the compiler rightly took care of linker crap as it should.

And I've got many examples. These are the fun games, but at work I'm constantly whipping out the compiler to make a task that should take weeks take minutes. If I spent all my time worrying about setting up my linker, or worrying about whether the command I wanted to use was still part of the language or if it had been depreciated and shouldn't be used anymore or had an underscore or three put before it because the platform doesn't want you using it, or this or that, I wouldn't be nearly as productive.
Last edited by SJ Zero on Wed Apr 15, 2009 7:08 pm UTC, edited 1 time in total.

fazzone
Posts: 186
Joined: Wed Dec 10, 2008 9:38 pm UTC
Location: A boat

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote: the C programming language and development environment.

Completely different things.

Also, I think I remember hearing all this stuff about verbosity and laymen being able to understand and write code before, somewhere....
Spoiler:
COBOL

But it's never worked well in the past, because just being able to understand that AND is 'and' and so on does not somehow magically make you a programmer. What makes you a programmer is logic and structured approaches to problem solving in the language of your choice, and a multitude of other things I can't think of right now. None of these are in any way related to a particular language syntax or even paradigm.

More programmers understand C operators and syntax intuitively than use BASIC, I'm sure. And if laypeople reading and writing code is a lost cause and always failed in the past, why try? Why not use a more common, expressive language and syntax that more programmers will be able to understand?
*/

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Why should we replace the keyboard interface in cars that forces you to manually set the velocity and angle of each tire? It's what drivers know, and surely regular people will never be able to drive a car, so why not keep using an interface drivers understand?

Also, the territory is the territory, the map is the map. If the dev environment is inconsistent crap that needs thousands of man-hours just to keep compatible with the same compiler on another platform, then that's what the language is good for. Who cares that some well-intentioned spec that wasn't followed would've been great?

(By the way, how many people code in COBOL these days?)

fazzone
Posts: 186
Joined: Wed Dec 10, 2008 9:38 pm UTC
Location: A boat

### Re: BASIC vs. C (BASIC wins, obviously)

COBOL is not an example because many people use it (though Wikipedia says its "still in active use"), but because of things like this:

Code: Select all

MULTIPLY B BY B GIVING B-SQUARED.  MULTIPLY 4 BY A GIVING FOUR-A.  MULTIPLY FOUR-A BY C GIVING FOUR-A-C.  SUBTRACT FOUR-A-C FROM B-SQUARED GIVING RESULT-1.  COMPUTE RESULT-2 = RESULT-1 ** .5.SUBTRACT B FROM RESULT-2 GIVING NUMERATOR.MULTIPLY 2 BY A GIVING DENOMINATOR.DIVIDE NUMERATOR BY DENOMINATOR GIVING X.

This is the result of verbosity and long English-language keywords and operators.

Even a layperson understands
[imath]\begin{array}{*{20}c} {x = \frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}}\end{array}[/imath]
much better.

Also,
SJ Zero wrote:the keyboard interface in cars

What?
*/

stephentyrone
Posts: 778
Joined: Mon Aug 11, 2008 10:58 pm UTC
Location: Palo Alto, CA

### Re: BASIC vs. C (BASIC wins, obviously)

Actual quotes from the webpages you linked to

SJ Zero wrote:http://www.fbxl.net/oma/duel/

"This is the first -- and likely last release of Duel for Win32. It supports creating a server, and flying around trying to kill a bunch of your friends in multiplayer. It's broken at the moment, and all things considered, I'm not sure if it's worth fixing yet again.."

http://www.fbxl.net/oma/behold/

"Enjoy it, because the latest versions of FreeBASIC broke it (But I'm not bitter!)"

http://www.fbxl.net/oma/rvk/

I've updated the beta to run in 16-bit mode instead of 15-bit mode, because many machines had issues with 15-bit mode. If RvK has failed in the past for you, try it again.

In each case, I was able to focus on actually doing what I wanted to do, because the language I used had consistency, because the documentation was able to actually lay out what I could do and if I wanted to know how to do something how to do it, and because the compiler rightly took care of linker crap as it should.

On the one hand, the compiler and linker take care of crap for you. On the other hand, the programming language broke your code.

And I've got many examples. These are the fun games, but at work I'm constantly whipping out the compiler to make a task that should take weeks take minutes. If I spent all my time worrying about setting up my linker, or worrying about whether the command I wanted to use was still part of the language or if it had been depreciated and shouldn't be used anymore or had an underscore or three put before it because the platform doesn't want you using it, or this or that, I wouldn't be nearly as productive.

See above.
Everyone: don't feed the trolls; this is ridiculous, even for religious wars.

GTFO, N00B.
GENERATION -16 + 31i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

I'm using a parallel argument where a hideous unintuitive system is defended because it's what the small number of people who can figure it out use.

Of course, the easier parallel is this: Manual transmissions are far less popular than automatics. Do you argue that the manual transmission is the easiest way to drive a car?

I love my manual transmission, it's what makes driving fun for me. I'll never own a vehicle with an automatic if I have any say. I don't, however, pretend it's intuitive, or that it's easy, or that it's better. Likewise, just because C programmers like C, doesn't mean it's intuitive, or easy, or better.

COBOL obviously isn't very intuitive either. I think it was in Scientific American Mind, I read about a study that showed that english language math problems are more difficult, and students do worse on them, than straight math problems. spelling everything out like that only makes things more difficult than they need to be.

A language like BASIC looks like my math homework, or at worst pseudocode. A language like C looks like programming code.

lmao, I was wondering if someone was going to take my words in context. Yep, they took a project at near perfection and decided to turn it into another Java clone science project like most BASIC clones. Why do you think I'm using an ancient version of fb? Any religious war is at its heart a bunch of trolls. Seriously. C? Why would I even bring a dying language into this if it wasn't meant as troll/flamebait?

If I wanted a legitimate debate, it should be Java, Python, or C# versus BASIC, because any debate regarding C has long since concluded and the programming world has spoken -- C lost about the same time every Windows 2000 computer on the planet was hacked by 32 Ns.

fazzone
Posts: 186
Joined: Wed Dec 10, 2008 9:38 pm UTC
Location: A boat

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:A language like C looks like programming code.

What an egregious fault for a programming language to have.
*/

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Well, look at it this way.

I love the mechwarrior series. The controls are so incredibly unintuitive and clunky that you can't help but feel like anything but being the pilot of a massive and complicated robot.

The controls aren't good because they're intuitive. They're good because they're clunky, painful, and make you work way too hard. They feel like controls and that helps set the tone of the game.

By contrast, a good FPS has much better controls. You can generally control everything without moving your hands around, you have a better freedom of movement, your character is more agile, and it's easier to get to where you want to be.

So in one case, the first set of controls feel like controls, but that's not what good controls want to feel like. The other set of controls feels like a natural extension of your body, which is what good controls SHOULD feel like.

Vault
Posts: 169
Joined: Mon Nov 10, 2008 5:00 pm UTC
Location: Just past the event horizon
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

I'd just like to point out that the reason that COBOL was brought up was to compare it to BASIC and point out how they are similar. Seeing as you yourself said that math problems are more difficult when written out in English (as in the COBOL example), and that BASIC is more readable because it it English like it seems to me like you are contradicting yourself. If BASIC is more like English, and math in English is more difficult to understand, then it would follow that doing any math in BASIC is more difficult to understand. Though in your most recent post you said that BASIC looked more like math, so I suppose that I'm rather confused now about what exactly BASIC does to math. I'd also like to question why a programming language looking like a programming language is a bad thing. It seems to me that if math in English is difficult to understand, then computer programming, which boils down to math, in English would also be difficult to understand. Seeing as we don't want programs to be difficult to understand, we should use a programming language that is not like English. So it seems to me that the logical conclusion, in which the code is the easiest to understand, would be C, rather than BASIC.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Grammar and spelling are different things.

The problem is, english isn't a math language, so instead of having the whole picture in front of you, you've got one step at a time, and you've got to parse it. Looking at a map makes more sense than asking for directions, and looking at an equation makes more sense than following a set of written directions. English as a grammar exists in a different area of the brain than Math as a grammar.

By contrast, you're parsing symbols no matter what the symbols are in a language. Suddenly, you're not parsing grammar, you're heading to a database that holds "what does this mean?". The database holding the English language is better developed than the database for arbitrary programming conventions.

This extends past programming. When I, or anyone I know, look at a logic diagram for electronic circuits, we always end up spelling it out -- "ok, so if this and this, or this... then...". Where the english grammar and the mathematical grammar are different things, the language of logic is always the same, so it becomes easier to understand at a glance.

In the case of other command names, the more recognisable the command name, the more likely it is you'll know what it does without having to ask yourself. When you see PRINT, for example, there's no question as to what it does(protip: it prints). When you see sprintf...well, if you're not a guru, can you tell what sprintf does without looking it up? How about snprintf? (protip: The first is an unsafe version of printf which can print to a char * buffer, the second is the safe version of the same which makes sure bounds length isn't exceeded.) For basic math, however, the symbols are better developed visually to use actual mathematical symbols.

Ended
Posts: 1459
Joined: Fri Apr 20, 2007 3:27 pm UTC
Location: The Tower of Flints. (Also known as: England.)

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:C (and even C++) give a level of granularity and detail you simply don't need
Wait, what? As a matter of fact, I do need that level of granularity and detail. If you don't, then use a language better suited to your needs. It's a no-brainer. Using a language for a purpose to which it is ill-suited reflects poorly on the programmer, not the language.

SJ Zero wrote:I'm using a parallel argument where a hideous unintuitive system is defended because it's what the small number of people who can figure it out use.

Of course, the easier parallel is this: Manual transmissions are far less popular than automatics. Do you argue that the manual transmission is the easiest way to drive a car?
To quote from Wikipedia:
"The driver has more direct control over the car with a manual than with an automatic, which can be employed by an experienced, knowledgeable driver who knows the correct procedure for executing a driving maneuver, and wants the vehicle to realize his or her intentions exactly and instantly."

See the parallel?

SJ Zero wrote:Why use C? Just learn assembler. Why use assembler? Just use a hex editor.
It's a compromise. A similar question might be: why use BASIC? Just use Python. Why use Python? Just hire a coder, give them a project brief, and wait six months.

(Apologies for the somewhat random quote-sniping)
Generally I try to make myself do things I instinctively avoid, in case they are awesome.
-dubsola

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

For what the majority use C for, the granularity is wasted. You plonk this incredibly details oriented language in the middle of an environment where no human being on the planet knows every detail. The result is buggy software. 32 Ns, anyone?

Similarly, a perfect driver will be able to make his car burn less gas and last longer on the road in busy traffic as well as on the highway, but no human can have the perfect knowledge required to break even in the city. That's one of the reasons why automatics have taken off, in fact.
Last edited by SJ Zero on Wed Apr 15, 2009 10:23 pm UTC, edited 1 time in total.

Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

You would rather write an OS in BASIC?
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

I'd rather write the dangerous parts of an OS in a language that takes care of details, definitely. Microsoft obviously agrees with me, since they're moving their OS to a platform that takes care of the details. I'd be embarassed if my code was hacked with 32 Ns.

Vault
Posts: 169
Joined: Mon Nov 10, 2008 5:00 pm UTC
Location: Just past the event horizon
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Just out of curiosity, what do you define as the dangerous parts of the OS?

netcrusher88
Posts: 2166
Joined: Mon Mar 26, 2007 4:35 pm UTC
Location: Seattle

### Re: BASIC vs. C (BASIC wins, obviously)

Thoughts:

I choose tertium quid. I need neither the braindamage that (see this thread) comes with BASIC nor the complexity that comes with C. I use python; perl; and regex wrapped in sed, awk, and bash for a variety of system administration tasks. I know I don't need C to write this sort of thing, but you don't see me trying to compare C and sed.

I have to agree with an earlier poster that FreeBASIC is not BASIC. I pulled up one of those programs on SJ's site, and it looks like a braindamaged combination of C, BASIC, and some other language I can't put my finger on.

Also all of what stephentyrone said. And what is this 32 Ns thing you keep going on about?
Sexothermic
I have only ever made one prayer to God, a very short one: "O Lord, make my enemies ridiculous." And God granted it. -Voltaire
They said we would never have a black president until Swine Flu. -Gears

SJ Zero
Posts: 740
Joined: Wed Sep 03, 2008 3:10 pm UTC
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

That's how the nimda virus attacked Microsoft webservers. A number of Ns to overflow the buffer. A safe programming environment would catch that. It would be 'less powerful', but your foot would be intact.

...and had it occurred to you that maybe you just hadn't seen proper BASIC code before? The only modern feature I use that didn't exist in QB is pointers. The rest works just fine in QB -- I know because a lot of my code is re-used right from there.

Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

Implementing a managed environment in a managed environment is easy. The only catch is you need a managed environment to do it in...
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

dean.menezes
Posts: 135
Joined: Sat Nov 15, 2008 3:47 am UTC

### Re: BASIC vs. C (BASIC wins, obviously)

SJ Zero wrote:Freebasic .17 with the -lang deprecated switch is my drug of choice. When I've got a list of 50,000 files to sort (I did last year), I know it's got my back with simple, consistent, human syntax. With C....Well, I hope Google is up and running.

But C has a built in sort function -- qsort(). Or you can just use the UNIX shell to sort it.

phlip
Restorer of Worlds
Posts: 7565
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

### Re: BASIC vs. C (BASIC wins, obviously)

So, it looks like you're arguing from several different angles here... so I'll break down my reply to match.

First, there's the syntax verbosity angle... which basically boils down to "the middle-ground is superior". A terser syntax is quicker to read, just by virtue of there being less stuff... "!" is a single symbol, "not" is a full word, the former is quicker to recognise. Once you've read it, you need to understand it... and here the time taken is related to how familiar you are with it. You use (I assume) English every day, so it's faster at this step... but if you program in C-like languages regularly, then the difference is heavily diminished.
Overly verbose languages (say COBOL) are really slow at the first bit (look at fazzone's example)... overly terse languages (say Perl) are really slow at the second bit (say, ($_=<>)=~s/\//\\/g; - quick to read, but slow to comprehend). The ideal verbosity is between these somewhere... exactly where is a matter of taste. Personally, I'm familiar enough with ! && || that the terseness outweighs the non-Englishness. But if you're unfamiliar, I can see why the English ones would be more readable. Second, documentation and environment support. I think you're comparing apples with oranges here... you're comparing BASIC with an IDE with C without one. Sure, gcc for one isn't shipped with an IDE... at the extreme low end you could even run it as "gcc -x c -" and forego the editor entirely. But decent IDEs exist, and their value isn't diminished just 'cause they're shipped separately. And a decent IDE will have some form of documentation, where you can point at, say, atoi and hit F1, and get the full documentation (including the recommendation to use strtol instead). Third, memory management and strings and such. Strings are not C's strong point... if you need to do a lot of string manipulation, C is probably not the right tool for the job. A language that has managed strings, bounds-checked arrays, and the like is much easier to code in. Even C++, with std::string, std::vector and std::list is quite helpful. And you don't really lose much if you don't know how C strings work... until the abstraction leaks, and you're stuck. Knowing the way it works behind the scenes will get you out of a lot of jams... whether that means learning C or something else equally low-level isn't the important bit... just as long as you're familiar with how it works. Note that nothing up to here has mentioned BASIC in particular... everything could just as easily be, say, "C vs Python" or "C vs Ruby" (except that Python doesn't come with a fully-featured IDE... IDLE's OK, but it's no Eclipse... I don't know about Ruby). Time to fix that. Much of the flac that BASIC cops is from older dialects... line numbers, no if blocks, gotos everywhere... that newer BASIC dialects get tainted with this is guilt by association. But even modern BASICs have some remnants... the latest VB.net still has On Error Resume Next... it's not even officially deprecated, MSDN just "recommends" you use Try/Catch instead. It also still supports I%, Str$, X&, and friends, which definitely fall outside BASIC's usual level of verbosity.

And speaking of verbosity, I definitely feel BASIC misses the mark on the too-verbose side. As I mentioned, where that mark is is a matter of taste, but tell me how "Dim I As Integer" is more readable than "int i;" other than just syntax familiarity. The redundancy doesn't even add anything, 'cause it's not especially readable for a newcomer... the word "Dim" doesn't have anything to do with declaring variable types... it's a holdover from old BASIC variants that had purely implicit variable declarations (with the previously-mentioned suffixes for type-declarations), and used Dim only for specifying array dimensions ("Dim A%(10)" to declare an array of 11 ints).
Enough "Dim" though, and on to other things. Differentiating the syntax between Sub and Function only makes it more confusing when moving to a different language that treats them identically... returning values from Functions is a bit strange ("FunctionName = value"? Really?). BASIC's "For" syntax is certainly more readable than C's... C's for syntax is more flexible, but it's always a sticking point for a newcomer to a C-like language. "If" and "While" I don't really have anything against, they're slightly more verbose than C, but not by enough to be problematic. Do/Loop While/Until is quite flexible. It's been too long since I've used BASIC to remember anything else.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]