BASIC vs. C (BASIC wins, obviously)

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

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

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

Postby phlip » Thu Apr 30, 2009 2:52 pm UTC

So, to both sides: is this thread going to go anywhere new, or are we just going to go around in circles a few more times? 'Cause I'm getting sick of reading it, and I'm about to break out the padlocks.

Code: Select all

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

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

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

Postby SJ Zero » Thu Apr 30, 2009 3:13 pm UTC

This thread hasn't gone anywhere in the 15 years I've been programming in BASIC, I don't see it going anywhere in the end.

As I mentioned before, the discussion is intentionally limited because other languages really do integrate a lot of the benefits of a good BASIC vs. C. Hell, Pascal is a great example, since a good implementation of BASIC actually uses Pascal strings!

At the end of the day, all that matters is the tool you're using is one you're comfortable with and one you can do the job with. I'm sure there's still a few bearded old guys with the stench of death about them who break out a hex editor when they want to write a simple program because they're so familiar with x86 machine code that anything else is just a waste of time. They're comfortable with it, it's what they think in, so it works best for them. Anything higher level and it'd slow them down because they'd be too busy wasting time figuring out what they already know how to say in machine code.

I like BASIC. I really do. In terms of structured languages, I learned C++ first but I didn't like it because of all the ground work I had to do in order to get anything done, then I tried BASIC and found that the commands and the structure tended to be exactly like the pseudocode in my head. That's just me though. If I started today, I'm positive I'd start with something better integrated, a Java or Pascal or a Python, and that'd do the trick for me, and I'd be starting a Java vs. C thread or a Pascal vs. C thread or a Python vs. C thread, making 90% of the same arguments.

It's all in good fun, but go ahead. There really isn't much else to say, so lock the thread if you want to.

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

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

Postby netcrusher88 » Thu Apr 30, 2009 3:54 pm UTC

SJ Zero wrote:Basic is to C, as regular programming is to brand new paradigm of thinking about programming.

No, Basic is to C as WebMD is to Davis's Drug Guide. Sure, it'll do all you need most of the time (as will a lot of other things), but sometimes you need greater detail and precision you just can't get with the former.

What you know as "regular programming" is (judging by your code) object-oriented programming. OO is similar to procedural (traditional BASIC) and structured (well-formed C (i.e. no GOTOs)), and they all fall under the umbrella of imperative programming.

Functional languages use a fundamentally different paradigm, one I've never quite managed to wrap my mind around. I've always just kind of gone with the visualization of S-expressions (despite it supporting all paradigms, a part of me thinks of lisp as the epitome of functional languages, probably because I like parentheses and it's pretty) collapsing like [spoilered below] to give a Result. It is, I understand, a very mathematical way of looking at programming. So yeah, I suppose you could argue it is about pure programming, but it makes sense to me that understanding programming in an even vaguely mathematical way would increase your programming efficiency rather a lot.
Spoiler:
the Guide Mk. II at the end of Mostly Harmless

phlip wrote:So, to both sides: is this thread going to go anywhere new, or are we just going to go around in circles a few more times? 'Cause I'm getting sick of reading it, and I'm about to break out the padlocks.
BRING ON THE TRUMPETSPADLOCKS
Although, the whole bit about functional programming could get interesting. Doubt it.
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

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

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

Postby SJ Zero » Thu Apr 30, 2009 4:47 pm UTC

I'm done arguing since really I don't know enough about functional programming to talk about it without using generic statements like my above ones.

My code isn't anything like oop though. It's pure C-style structured programming. I just like using well-designed structures. When I first started, I kept all my data in arrays. It was awful. I constantly had to bounce around the code because I had problems remember that Object(x,1) through object(x,10) was MajorX, MajorY, Spritenumber, MinorX, MinorY, uiScriptnumber, Movementcode, temp1, and temp2. Way easier just using structures so I can write object(x).x (I hate looking things up even within my own code, as you can see. At least I'm consistent)

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

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

Postby stephentyrone » Thu Apr 30, 2009 4:53 pm UTC

netcrusher88 wrote:Although, the whole bit about functional programming could get interesting.


Only if someone drags up a BASIC with call/cc.
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.

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Thu Apr 30, 2009 5:20 pm UTC

The basic argument seems to be "C is too low level" vs. "BASIC is a crime against syntax". The thing is, both sides are right. However, unlike BASIC, C still has a legitimate use—it is perhaps one of the best languages available for systems programming. There are many situations where one would use C. I can think of no such situations where BASIC is the best choice for a language, however.

You, sir, name? wrote: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.


GCC complains if you don't include headers but it's only a warning (in my recent experience, you can configure compilers differently if you want.)

SJ Zero wrote: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.


No, but if you want a computer program, you have to be specific. Writing a specific enough specification to automatically generate a program like the holodeck does would probably be even more effort than programming in a programming language, because English is such an imprecise language.

SJ Zero wrote: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.


Yes, and you can do this to whatever level is important to you. Machine code is pretty unreadable, but assembler has neat little mneomics like MOV and JMP that tell you what's going on. C has things like "int foo" and "return (foo % 4)" which are a great deal more understandable than managing the stack and heap by hand, and the expressions look just like math to boot. Perl just lets you go "$foo = 'cuckoobananas'", which abstracts over a bunch of stuff C does to handle strings. But remember, Perl is interpreted by a C program.

The thing is, programming requires a mathematically precise language, so if you want a powerful language, it's going to look *less* like English and more like, for instance, Lisp. Further on this note:

SJ Zero wrote:Basic is to C, as regular programming is to brand new paradigm of thinking about programming.

That's fine in the pure programming world, but for most people, programming is a means to an end, not an end by itself.

Maybe that's the issue here. Everyone is so used to the incestuous philosophy of programming for programming's sake, people have forgotten that you can program to solve problems too. C makes sense in this philosophy, because it only makes sense to just go ahead and learn something too complicated for the job at hand so you learn a programming mindset. Learning a completely new philosophy of programming makes sense in this philosophy, again because programming is important enough in this philosophy to learn a new tool for a job you could already do to improve your programming mindset.

I'm not a programmer, though. I'm an engineer, so when I have a problem to solve, the less time I spend thinking about implementing my solution, the more time I spend finding a solution.


As an engineer, you have to learn a completely new philosophy of how to build things that would seem very strange and obtuse to a druid building a thatched hut.

In fact, I don't think you realize how lucky we have it when we program computers. If you're building a combustion engine, you have to know how combustion engines actually work. Whereas most people who make computer programs don't have the slightest idea how the computer program actually works. They just understand an abstract model that's mapped onto the actual execution of the program by yet another program. It just so happens that C makes a very useful abstract model for something intricate and detailed like an OS kernel. Lisp makes a very useful abstract model for algorithms. Object oriented languages make a useful abstract model for fancy data structures like hash tables or AVL trees.

What is BASIC a good model for?

SJ Zero wrote: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.


The Linux kernel is in C. XNU, the Mac OS X kernel, is mostly C with a subset of C++ in parts. The Windows Vista kernel is mostly C, with some C++. When you write an OS that's as widely used as any of these, we can talk.

SJ Zero wrote:I'm focusing more on application development on a non-trivial platform. Windows, for example, contains thousands of interfaces, which are piled on top of other interfaces, which are piled on top of OTHER interfaces. Dealing with minute details in such an environment is stupid, since the underlying platform is so ridiculously complicated you get no benefit from working with the details at the one (AND EXACTLY ONE) layer you have at your disposal.


Which is why Windows has API's in higher level languages like C#.

SJ Zero wrote:Now, this CAN mean trivial applications, and in my case, often does. Setting up a compiler environment and a bunch of includes is a waste of time when all I need is five lines to read a file, make a decision, and spit out an output into another file.


The stereotypical Perl use case.
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

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

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

Postby SJ Zero » Thu Apr 30, 2009 5:29 pm UTC

When you write an OS that's as widely used as any of these, we can talk.


When YOU write an OS that's as widely used as any of those, we can talk.

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

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

Postby stephentyrone » Thu Apr 30, 2009 5:34 pm UTC

SJ Zero wrote:When YOU write an OS that's as widely used as any of those, we can talk.

Hi, I write one of those (not by myself, obviously). Let's talk.
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.

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

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

Postby SJ Zero » Thu Apr 30, 2009 5:55 pm UTC

Let me guess, a patch for linux?

User avatar
MHD
Posts: 630
Joined: Fri Mar 20, 2009 8:21 pm UTC
Location: Denmark

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

Postby MHD » Thu Apr 30, 2009 6:08 pm UTC

<flame>

Code: Select all

10 TAKE BAT
20 HIT OP
30 GOTO 10

</flame>

I think this discussion is becoming quite meaningless.

Comparing BASIC to C is like... I dunno, tried to come up with an example giving an impression of utter absurdity...

Also, BASIC = Beginners All-purpose Symbolic Instruction Code
While C is just C

As for verbosity, go code some ORK.
As for robot language, go code some BrainF***.
EvanED wrote:be aware that when most people say "regular expression" they really mean "something that is almost, but not quite, entirely unlike a regular expression"

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Thu Apr 30, 2009 6:11 pm UTC

SJ Zero wrote:
When you write an OS that's as widely used as any of these, we can talk.


When YOU write an OS that's as widely used as any of those, we can talk.


When either of us writes an OS that's as widely used as any of those, then we can sit and talk to Linus, Ken Thompson, and Dennis Ritchie. And you can tell Dennis in person what you think of his language.

What is BASIC a good model for?
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

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

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

Postby stephentyrone » Thu Apr 30, 2009 6:50 pm UTC

SJ Zero wrote:Let me guess, a patch for linux?


Ewwww, no. Linux has cooties. (This is the RW forum, right?)

Seriously, though. I work in the Core OS group at Apple. I do all my coding in either C or ASM (mostly ASM). As other people have noted, there are things out there for which C is absolutely, unquestionably, the right tool to use, and I happen to do those things some of the time -- like writing OS library code that needs to be portable to new architectures.

In working on OS X, I have never once heard someone utter the phrase, "Gee, I wish we had a BASIC interpreter available on $NEW_ARCHITECTURE so I could use it to implement this scheduler algorithm", or, indeed, any phrase remotely like it.
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.

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

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

Postby SJ Zero » Thu Apr 30, 2009 7:16 pm UTC

You should realise (wow, 4th time? 5th time?) that I've already said repeatedly that BASIC isn't for implementing operating systems or doing other hardware programming. In my first post, I talk about embedded systems, which are a perfect spot for a C program, because you've got huge amounts of control easily accessible. That said, the FreeBASIC compiler is self-hosting, so anything's possible if you know what you're doing.

Coding an operating system is a fairly self-referential exercise. Plenty of programming as programming was created to solve operating system problems. In such cases, it makes sense that a complicated tool would be used, because complicated, computer science oriented solutions are needed.

This is in direct contrast to the majority of the problems I find myself solving, which often turn out as "Move this string from here to here one million times", or "Take these numbers and create a new number ten million times" which don't require a complicated language, and are in fact impeded by excessive implementation detail.

This may not seem relevant, but recall, you couldn't run 80% of the interesting utilities on the web without first installing vbrun300.dll or one of its family. The people solving programming problems ran C, and for a very long time (gwbasic, quickbasic, qbasic, visual basic), BASIC was the goto language(no pun intended) for creating simple but effective utilities to solve simple problems that didn't require any special features of a computer beyond basic input, output, and some computation in the middle.

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Thu Apr 30, 2009 7:30 pm UTC

SJ Zero wrote:This is in direct contrast to the majority of the problems I find myself solving, which often turn out as "Move this string from here to here one million times", or "Take these numbers and create a new number ten million times" which don't require a complicated language, and are in fact impeded by excessive implementation detail.


Yes, but no one would use C for that. The type of person who uses C at all would use Perl for that.
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

User avatar
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)

Postby Berengal » Thu Apr 30, 2009 7:36 pm UTC

How long would it take you to write a converter from sexprs to xml in BASIC and how large would the source code be? I'm asking because this is a simple but effective utility which only requires basic input and output with some computation in the middle. I needed one yesterday and did it in Haskell, and would like something to compare it to.
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.

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

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

Postby SJ Zero » Thu Apr 30, 2009 8:02 pm UTC

Philwelch wrote:
SJ Zero wrote:This is in direct contrast to the majority of the problems I find myself solving, which often turn out as "Move this string from here to here one million times", or "Take these numbers and create a new number ten million times" which don't require a complicated language, and are in fact impeded by excessive implementation detail.


Yes, but no one would use C for that. The type of person who uses C at all would use Perl for that.


There's false logic there.

I use C within the definition of "at all".
I don't use Perl for that.

Therefore, not all types of people who use C at all will use Perl for that.

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

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

Postby stephentyrone » Thu Apr 30, 2009 8:03 pm UTC

Philwelch wrote:
SJ Zero wrote:This is in direct contrast to the majority of the problems I find myself solving, which often turn out as "Move this string from here to here one million times", or "Take these numbers and create a new number ten million times" which don't require a complicated language, and are in fact impeded by excessive implementation detail.


Yes, but no one would use C for that. The type of person who uses C at all would use Perl for that.


This. (Assuming that when you say "perl" you mean "the class of languages people use to do things like this").

When I need to do a complicated context-dependent search and replace on 1m lines of code in 1.5k C files, I don't write a BASIC program or a C program. Personally, I use python. Of the other 4 people on my team, one would use perl, one would use a shell script, one would use his mindboggling vi-fu, and the other would come ask one of us for help (hey, he's the new guy).

Frankly, though, "do some elementary computation a million times" is a toy problem, and it's not going to matter what language you do it in. You should use whatever is most comfortable for you. If that happens to be BASIC, great, more power to you. No one cares but you.
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.

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

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

Postby SJ Zero » Thu Apr 30, 2009 8:07 pm UTC

stephentyrone wrote:
Philwelch wrote:
SJ Zero wrote:This is in direct contrast to the majority of the problems I find myself solving, which often turn out as "Move this string from here to here one million times", or "Take these numbers and create a new number ten million times" which don't require a complicated language, and are in fact impeded by excessive implementation detail.


Yes, but no one would use C for that. The type of person who uses C at all would use Perl for that.


This. (Assuming that when you say "perl" you mean "the class of languages people use to do things like this").

When I need to do a complicated context-dependent search and replace on 1m lines of code in 1.5k C files, I don't write a BASIC program or a C program. Personally, I use python. Of the other 4 people on my team, one would use perl, one would use a shell script, one would use his mindboggling vi-fu, and the other would come ask one of us for help (hey, he's the new guy).

Frankly, though, "do some elementary computation a million times" is a toy problem, and it's not going to matter what language you do it in. You should use whatever is most comfortable for you. If that happens to be BASIC, great, more power to you. No one cares but you.


Wow, that sounds familiar...

Where did I hear that?

At the end of the day, all that matters is the tool you're using is one you're comfortable with and one you can do the job with. I'm sure there's still a few bearded old guys with the stench of death about them who break out a hex editor when they want to write a simple program because they're so familiar with x86 machine code that anything else is just a waste of time. They're comfortable with it, it's what they think in, so it works best for them. Anything higher level and it'd slow them down because they'd be too busy wasting time figuring out what they already know how to say in machine code.

I like BASIC. I really do. In terms of structured languages, I learned C++ first but I didn't like it because of all the ground work I had to do in order to get anything done, then I tried BASIC and found that the commands and the structure tended to be exactly like the pseudocode in my head. That's just me though. If I started today, I'm positive I'd start with something better integrated, a Java or Pascal or a Python, and that'd do the trick for me, and I'd be starting a Java vs. C thread or a Pascal vs. C thread or a Python vs. C thread, making 90% of the same arguments.


OH YEAH! I wrote that an hour ago!

Seriously. I'm just continuing for kicks, since I assume the other people in this thread can read and are continuing to argue because it's fun rather than because they think this is actually a serious issue.

User avatar
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)

Postby Berengal » Thu Apr 30, 2009 8:36 pm UTC

Yeah, I'm just doing this for entertainment.

Anyway, I believe his point was that toy problems can be done in any language, even toy languages, without the language affecting the outcome in any way. While this may be true, it doesn't say anything about the quality of the language used. I'm sure someone (with mad typing skills) could write Hello world in assembly faster than I could write it in python, but that fact alone says nothing.

You need something a little more complex than that to really show the strengths of a language. The task I outlined above should be something like that; simple yet not overly simple.
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.

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

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

Postby SJ Zero » Thu Apr 30, 2009 8:39 pm UTC

I'd love to actually implement one and let you know, but I'm not well versed in either XML or S-Expressions.

If it makes a difference, the FreeBASIC compiler is written in FreeBASIC. Strings are something it can do.

User avatar
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)

Postby Berengal » Thu Apr 30, 2009 8:54 pm UTC

SJ Zero wrote:I'd love to actually implement one and let you know, but I'm not well versed in either XML or S-Expressions.

Neither am I. Well, the xml part anyway. Far as I know, XML is a bunch of elements, each element consisting of a name, a list of attributes (can be empty) and a list of other elements (can also be empty). Apparantly there can also be a single string at the end of the list of elements, but I'm not too sure about that one. I took it to mean either a list of elements, or a single string (but not both).

S-expressions are easier. You've got atoms, which are non-whitespace words or double-quoted strings (as far as I had use for them anyway), or lists, which is a list of atoms and lists separated by whitespace, double-quotes or parenthesis and surrounded in parenthesis. 'hello' is an atom. '"hello world"' is an atom. '(hello world)' is a list of two atoms. '(foo ((bar bar)(baz baz)) quux)' is a list of an atom, a list of lists of two atoms each, and another atom. The last expression would be represented in xml as '<foo bar='bar' baz='baz'><quux></quux></foo>'.

I'm not asking that you implement one though, just suggesting it would be interesting if you did and let me know the time and size of the project. Even just an estimate would be fun to have (although much less useful in a debate setting).
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.

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

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

Postby stephentyrone » Thu Apr 30, 2009 9:23 pm UTC

Berengal wrote:Yeah, I'm just doing this for entertainment.


Can't speak for everyone, but I'm just here for the lulz, too.
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.

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Thu Apr 30, 2009 9:35 pm UTC

SJ Zero wrote:If I started today, I'm positive I'd start with something better integrated, a Java or Pascal or a Python, and that'd do the trick for me, and I'd be starting a Java vs. C thread or a Pascal vs. C thread or a Python vs. C thread, making 90% of the same arguments.


And in that case, 100% of your arguments would be old hat, since Python and Java were designed to be higher level than C in the first place. It's just that, in terms of languages-higher-level-than-C, BASIC is particularly stupid.
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

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

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

Postby SJ Zero » Thu Apr 30, 2009 9:39 pm UTC

That's a bit silly to say since BASIC was designed to be higher level than C in the first place as well?

Anyway, don't you realise that removing case sensitivity, replacing loop syntax, changing IF syntax allowing a line return or colon to do the same job as a semicolon, using an @ instead of a &, and increasing the number of built-in commands, BASIC is fundamentally different from C, and destined for world domination?

@! It's so obvious!

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

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

Postby netcrusher88 » Fri May 01, 2009 2:18 am UTC

The only point you have there is @ for pointers. It's an interesting choice, but I believe C was already using it. Don't recall how.

Case insensitivity is the most brain-damaging part of BASIC, or it's up there. The optional semicolon is a stupid feature too. Now, I say this despite the fact that I like Python, but whitespace is integral to the structure of Python, so you must write code in Python style or it doesn't work. Built-in commands go against the core concept of C. Oh, and I don't know in particular the differences with control structures (loops and if statements and I imagine switch statements if your flavor of BASIC even has those), but I'm willing to bet that C control structures are more... well, structured.
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

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

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

Postby phlip » Fri May 01, 2009 2:25 am UTC

No, BASIC's control structures are just as structured as C's... slightly more so in the case of For/Next (no three-clause for loops here... just begin, end and step... easier to understand, less flexible) and Select Case (no chance of forgetting the break, but no ability to fall through), slightly less so in Do/Loop (but the flexibility there is one of the few bits of BASIC syntax I actually prefer to C's).

Sure, there are some old BASICs that had just "IF x GOTO y" and little else... but then there's also pre-ANSI C.

Code: Select all

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

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Fri May 01, 2009 3:58 am UTC

SJ Zero wrote:That's a bit silly to say since BASIC was designed to be higher level than C in the first place as well?


BASIC was designed for five year olds. By the time you turn six you can learn Python.
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

stone915
Posts: 42
Joined: Wed Jan 07, 2009 4:31 am UTC

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

Postby stone915 » Fri May 01, 2009 4:47 am UTC

Just want to throw out the fact that John Kemeny created BASIC to open up computer science to non-programmers. As a professor and president of Dartmouth, his goal was to increase the computer literacy of the student body, and he did this by creating a language that could be learned by people who lacked the skills needed for legitimate computer programming. Let me remind you of the goals of the Beginner's All-purpose Symbolic Instruction Code:
Be easy for beginners to use.
Be a general-purpose programming language.
Allow advanced features to be added for experts (while keeping the language simple for beginners).
Be interactive.
Provide clear and friendly error messages.
Respond quickly for small programs.
Not to require an understanding of computer hardware.
Shield the user from the operating system.

BASIC is not a language that was designed for understanding computer science and writing complex code; indeed, it was designed to be the opposite of that. It's the language for non-programmers.

SJ Zero wrote:Fundamentally, figuring out where and what the problem is becomes more difficult in C than in BASIC


No. gdb and valgrind. gdb with breakpoints and a couple printf statements as guides makes it really easy to determine what's causing segfaults. I used valgrind with the --leak-check=full and --show-reachable=yes flags on a 1000 line web crawler last week and got rid of all my memory leaks within an hour.

SJ Zero wrote:The ideal programming language WOULD be one where a regular person could just describe what they wanted and get it.


No, that's a system requirements spec. You're talking about something that's ridiculously and horribly abstract. There would be no logic, no efficiency, no software design. What you're talking about with that idea isn't even computer science, because there's no need to understand what your program is actually doing, no need to optimize programs for efficiency and eliminate memory leaks, no need to design your program to use the best data structures for the job. Hell, you wouldn't even have to know what data structures are because the compiler would just be using the same horrible mess of arrays (and maybe linked lists or hash tables if you got lucky) every time.

I don't know about you, but I write code because I love writing code and I love solving problems, not just going "oh, this sounds like a cool idea, wish there was a way I could just write my idea into a computer and have it take care of it for me."

I'd go into more depth about why learning C and understanding how a computer works is essential for good code, but Joel Spolsky does a pretty good job of explaining it in this article, although he contrasts C with Java instead of BASIC. http://www.joelonsoftware.com/articles/ ... hools.html

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

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

Postby SJ Zero » Fri May 01, 2009 2:53 pm UTC

The ideal programming language is exactly that, give the computer a set of requirements and let it deal with the details.

When I want a GPS, I could design one myself and solder it myself and design a plastic case and fab it up, but odds are I'm going to head to the store and say "I want a GPS". The ideal would be a computer that can just give you what you want without forcing you to deal with the details. When I plug my ethernet cable into the PC, I don't need to figure out an IP address and subnet mask to use, after all.

stone915
Posts: 42
Joined: Wed Jan 07, 2009 4:31 am UTC

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

Postby stone915 » Fri May 01, 2009 5:32 pm UTC

SJ Zero wrote:The ideal programming language is exactly that, give the computer a set of requirements and let it deal with the details.

When I want a GPS, I could design one myself and solder it myself and design a plastic case and fab it up, but odds are I'm going to head to the store and say "I want a GPS". The ideal would be a computer that can just give you what you want without forcing you to deal with the details. When I plug my ethernet cable into the PC, I don't need to figure out an IP address and subnet mask to use, after all.


Yes, but when the lovely people in the engineering department at Garmin or TomTom want to make a GPS, they don't go to Target and ask to see the GPS selection. First, they learn and understand the requirements of the piece of technology they're building. Then, they come up with a design that satisfies all the requirements. Finally, they actually build what they designed.

The metaphor here is that you, a programmer, are analogous to the engineers at a GPS maker, because your job consists of understanding what the computer is doing.

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Fri May 01, 2009 9:07 pm UTC

SJ Zero wrote:The ideal programming language is exactly that, give the computer a set of requirements and let it deal with the details.


If you expressed a set of requirements with enough precision that even the ideal compiler would know what to do with it, expressing those requirements in and of itself would be just as difficult as programming. And you would still need some sort of weird arcane language to do it in, because English is not mathematically precise. And the compiler would still bitch to you about incompleteness, inconsistency, or mal-formed language in your requirements.
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

stone915
Posts: 42
Joined: Wed Jan 07, 2009 4:31 am UTC

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

Postby stone915 » Fri May 01, 2009 11:53 pm UTC

Philwelch wrote:If you expressed a set of requirements with enough precision that even the ideal compiler would know what to do with it, expressing those requirements in and of itself would be just as difficult as programming. And you would still need some sort of weird arcane language to do it in, because English is not mathematically precise. And the compiler would still bitch to you about incompleteness, inconsistency, or mal-formed language in your requirements.


What are you talking about? The ideal programming language would be able to understand

Code: Select all

I want a website that does the same thing as ebay except BETTER

User avatar
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)

Postby Berengal » Sat May 02, 2009 12:55 am UTC

stone915 wrote:
Philwelch wrote:If you expressed a set of requirements with enough precision that even the ideal compiler would know what to do with it, expressing those requirements in and of itself would be just as difficult as programming. And you would still need some sort of weird arcane language to do it in, because English is not mathematically precise. And the compiler would still bitch to you about incompleteness, inconsistency, or mal-formed language in your requirements.


What are you talking about? The ideal programming language would be able to understand

Code: Select all

I want a website that does the same thing as ebay except BETTER

Sure, it might, but the chances of it understand that the same way you do is minimal.
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.

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Sat May 02, 2009 1:41 am UTC

stone915 wrote:
Philwelch wrote:If you expressed a set of requirements with enough precision that even the ideal compiler would know what to do with it, expressing those requirements in and of itself would be just as difficult as programming. And you would still need some sort of weird arcane language to do it in, because English is not mathematically precise. And the compiler would still bitch to you about incompleteness, inconsistency, or mal-formed language in your requirements.


What are you talking about? The ideal programming language would be able to understand

Code: Select all

I want a website that does the same thing as ebay except BETTER


That statement won't even communicate what you mean to another human being, let alone to a computer. The challenge of programming isn't translating ideas into a programming language, it's unambiguously and precisely forming those ideas in the first place.
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

stone915
Posts: 42
Joined: Wed Jan 07, 2009 4:31 am UTC

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

Postby stone915 » Sat May 02, 2009 7:03 am UTC

Philwelch wrote:That statement won't even communicate what you mean to another human being, let alone to a computer. The challenge of programming isn't translating ideas into a programming language, it's unambiguously and precisely forming those ideas in the first place.


Exactly.

That "code" was pure sarcasm.

Thank you for understanding the programming mindset, because SJ Zero obviously doesn't.

User avatar
phillipsjk
Posts: 1213
Joined: Wed Nov 05, 2008 4:09 pm UTC
Location: Edmonton AB Canada
Contact:

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

Postby phillipsjk » Sat May 02, 2009 9:49 pm UTC

I am reminded of "The Hitchhiker's Guide to the Galaxy," where "Deep Thought" patiently explains that: the "Answer to the Ultimate Question of Life, the Universe, and Everything" is not very useful without knowing the question.

http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy#Answer_to_Life.2C_the_Universe.2C_and_Everything_.2842.29
Did you get the number on that truck?

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

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

Postby SJ Zero » Tue May 05, 2009 1:35 pm UTC

Seems like it should be more than possible. When someone walks up to me and says "We want level control on this tank", they don't need to have a billion details. Of course, you idiots don't know what "ideal" means. It's like me saying that the ideal car wouldn't burn gas, then you go "But how would the pistons fire! You NEED gasoline!"

Philwelch
Posts: 2904
Joined: Tue Feb 19, 2008 5:33 am UTC
Location: RIGHT BEHIND YOU

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

Postby Philwelch » Tue May 05, 2009 2:47 pm UTC

SJ Zero wrote:Seems like it should be more than possible. When someone walks up to me and says "We want level control on this tank", they don't need to have a billion details.


Due to context. Which means context (i.e. background information) would have to be part of the program's corpus of knowledge to start with. Which means we would have to input all that background information into the computer to start with before we made a single program out of it. Which would be even more effort than simply including the necessary details as we need them.

And you still leave open the risk of bugs! You're probably all thinking of the holodeck in Star Trek: The Next Generation, right? Well, when Geordi asked the holodeck to devise a Sherlock Holmes mystery with an opponent capable of defeating Data, he inadvertently had the computer create a self-aware, strong AI who quickly learned the true nature of the holodeck and was able to gain some degree of control over the Enterprise—all as a logical consequence of being able to defeat Lt. Commander Data in a Sherlock Holmes mystery. A real system would hopefully be more secure than that, but then again, "more secure than that" would require the holodeck to recite a "compiler error" to Geordi rather than comply to his request, and that would have made for a very boring episode.

SJ Zero wrote:Of course, you idiots don't know what "ideal" means. It's like me saying that the ideal car wouldn't burn gas, then you go "But how would the pistons fire! You NEED gasoline!"


It's more like you saying "the ideal car would be 100% energy efficient" and then we go, "but that violates the second law of thermodynamics".
Fascism: If you're not with us you're against us.
Leftism: If you're not part of the solution you're part of the problem.

Perfection is an unattainable goal.

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

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

Postby SJ Zero » Tue May 05, 2009 3:03 pm UTC

So the ideal programming language would be able to have a discussion with a quasi-programmer to determine requirements, just like an actual programmer would.

This seems more like "The ideal car would drive itself." "But cars aren't smart enough to drive themselves!" to me.

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

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

Postby netcrusher88 » Tue May 05, 2009 4:04 pm UTC

See, funny thing. They aren't.
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


Return to “Religious Wars”

Who is online

Users browsing this forum: No registered users and 4 guests