bitcrafter
Posts: 5
Joined: Sun Dec 11, 2011 11:48 am

Re: BASIC - more harmful than useful?

Sun Dec 18, 2011 11:31 pm

I smell singeing. smoke if not exactly fire. If you wanted to compromise on whether to teach high-level or low level programming, then take a tip from BBC basic, use Peek and poke. Or rather, when you've adjusted to the idea of a language that lets you drop into assembler, should you want to or need to, look at one that lives natively on the hardware, without an operating system as such.

I was going to look at FORTH, (not necessarily ANSI) which can perform well at high level but gives you the opportunity to recode anything that runs too slow in assembler. I understand lua has these fine properties too.

Frankly you need courses for horses; children up to say 12 years probably don't have the patience to type much assembler. for them high-level is fine.

User avatar
johnbeetem
Posts: 945
Joined: Mon Oct 17, 2011 11:18 pm
Location: The Mountains
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 3:50 am

Quote from obarthelemy on December 18, 2011, 23:15
@Johnbeetem: the reason for software bloat is that people like it.

I don't like software bloat. Most people I know complain about overly complex software, and some don't use computers at all because myriad useless features make it hard to use the few features they would use. I guess you and I know different people.

When I said "One could also argue that HLLs are the reason for software bloat" I didn't mean I was arguing that point myself. I was just responding in a gamesome way to jamesh's argument that HLLs were a precondition for PCs.

I think the chief reason for software bloat is that the vast amounts of memory and CPU cycles available allow programmers to be lazy and wasteful. It supports building system upon system upon system as CAR Hoare describes in "The Emperor's Old Clothes", instead of sitting back and designing something clean and simple.

But please do prove me wrong, and do something in ASM?

As I said earlier in the thread, I believe it's best to use the language that's best suited to your problem domain. Sometimes it's ASM. Usually it's something else. I've done oodles of stuff in ASM over my life, enough so that now when I program at the C level it's easy to imagine the ASM code being created without having to key it in myself.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 4:20 am

Quote from bitcrafter on December 18, 2011, 23:31
I smell singeing. smoke if not exactly fire. If you wanted to compromise on whether to teach high-level or low level programming, then take a tip from BBC basic, use Peek and poke. Or rather, when you've adjusted to the idea of a language that lets you drop into assembler, should you want to or need to, look at one that lives natively on the hardware, without an operating system as such.

I was going to look at FORTH, (not necessarily ANSI) which can perform well at high level but gives you the opportunity to recode anything that runs too slow in assembler. I understand lua has these fine properties too.


Wow I love your argument. It is the same as I make in favor of BBC BASIC V, as this allows you to include assembly in a fairly simple and strait forward way. And even with out assembly it supports pointers and SWIs. In its compiled form BBC BASIC V produces better optimized code than current GCC distros (though not for the newer ARMs with there Harvard cache, as it predates this architechure).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

obarthelemy
Posts: 1410
Joined: Tue Aug 09, 2011 10:53 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 7:10 am

@johnbeetem. Oh. OK. Compiled is better than interpreted indeed ^^

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27824
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 9:25 am

Software Bloat : HLL's are not the cause of software bloat. It's quite possible to write in a HLL and produce very tight code. However, a HLL makes it easier to write bloaty code. But they make it also a lot easier to write ANY sort of code.

HLL's : It's a trade off. You trade off the ultimate speed and compactness against ease of development, ease of debugging, ease of maintenance. And the problem for all those writing above about how everything should be written in assembler, is that the trade off is massively on the side of the HLL's. If any of the assembler people writing above were to start a company for the development a commercial product, written entirely in assembler, they would go bust before the first version came out. That's how one sided the trade off is.

Final point. If any of the assembler is the only way people above wish to produce training materials, examples, applications written for the Pi to promote their cause they are more than welcome. However, I doubt that it will captivate the yoof of today quick enough to actually be useful, but I am happy to be proved wrong.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Giles Read
Posts: 3
Joined: Tue Aug 16, 2011 11:33 am

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 2:00 pm

Perhaps the polyglot gurus here are missing a point. 30 years ago I was one of those youngsters that learned BBC Basic from the manual. Since then I've done odd bits of BASIC-like programming (early Word macros plus quite a lot of compiled PICBASIC for embedded controllers).

All this talk of OO languages leaves me completely cold - I can't even understand the Wikipedia article on what I suspect is "Obsessively Obscure" programming. How will the much-vaunted young person in Nepal get on with it?

When I get my RPI it'll probably get played with a bit and maybe - IFF I can find an accessible language like BASIC - it may get programmed a bit. Coming from the Office/PC world, Linux in general scares the heck out of me (even when wrapped in a nice GUI); forcing me to use a wierd, illogical and alien language on top of that will turn me off completely.

I can only speak for myself - but I imagine there are a heck of a lot more people like me out here that just want to learn or work in something fairly simple (like BASIC) and will get an awful lot out of it

obarthelemy
Posts: 1410
Joined: Tue Aug 09, 2011 10:53 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 2:42 pm

@giles same here, but should that be taken as "only basic is simple enough to learn" or "if you start with non-OO basic, you'r lost to OO forever" ?

liam collins
Posts: 17
Joined: Sat Oct 29, 2011 5:06 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 2:51 pm

Quote from Giles Read on December 19, 2011, 14:00
All this talk of OO languages leaves me completely cold - I can't even understand the Wikipedia article on what I suspect is "Obsessively Obscure" programming.


I like "Obsessively Obscure", mind you the acronym for Object Orientated Programming (OOPs) also works... ('oops, I didn't mean to do that' :) )

I would break down my views as follows:

Assembler: Good for hardware/software interfaces and understanding the underlying architecture of computers. It is not good for writing enterprise applications in. Should be taught to all programmers so they have a grounding in the hardware and limitations - my experience is most application programmers seem to have little understanding of this (I work in performance analysis, especially in enterprise storage sub-systems).

Compiled High Level Languages (compiles down to machine binaries and not p-code): Good for general computing/application development. A decent compiler and a good programmer can produce tight/fast code.

Interpreted High Level Languages (a.k.a: 'scripting languages'): Good for teaching (instant feedback), generating simple reports and proof-of-concept work. Bad because of CPU utilisation, memory hogging and bloated code. I'm including languages that compile to p-code as well (stares at Visual Basic, Java, etc...)

OOP: Not overly impressed by it and, as far as I'm concerned, is part of the 'fad' programming styles like 4GL, RAD, etc... Maybe if I saw a proper working implementation of OOPs (not Java, VB, C++, c# etc...) I might change my mind.

Overall, I find that the current wave of application programmers, on the whole, do not understand the physical hardware and its limitations they are working on and have been able to hide the poor performance of their code by with the growth in computing power. In areas where Moore's law does not hold (i.e.: the speed of hard drives) this really does show up.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27824
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 3:16 pm

@giles - don't be afraid of Linux - it's just like Windows - complicated IF you need it.

@liam I don't think its just the current wave of apps programmers who don't know enough about the underneath to prevent the production of bloaty/ineffcient code - look at ANY version of windows past 3.1. Case in point - used to work with a guy who went to work at MS on CE. He is still there I believe. Some of his code was awful - for example, serial port code - instead of indexing the port by number using the same code, he cut and pasted the same driver code FOR EACH PORT. Now that is crap.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 4:06 pm

Awe yes, I agree hole heartedly that it is possible to produce good code in an HLL if you pay attention to what you are doing and make absolute minimal use of libraries. The trouble is that many coders take advantage of the tools to make quick and easy, and they just add to what they already have even if they could do some simple modification and produce the same result. These coders (in my view) need to be taught to be programmers.

It does not mater if we teach BASIC, Pascal, Lua, or another very simple language that has an interpreted form (though the very young should probably learn Logo first), so long as we teach them to do it correctly. BBC BASIC V has the advantage of being an integral part of Risc OS.

Also I wish to note that given proper instruction on any side, some one that has never used a computer tends to take up Risc OS much more quickly than the more standard GUI based systems.

Edit for typo.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 4:30 pm

So as to dispel any illusions I should say, My personal preference in program languages is:
First Compiled BBC BASIC V
Second Assembly
Third Compiled C
And then Compiled Pascal.

OO is a couple hundred further down the list, Lua may be added to the above eventually though for now it is a new language for me.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

hippy
Posts: 8900
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 4:40 pm

Quote from liam collins on December 19, 2011, 14:51
I'm including languages that compile to p-code as well (stares at Visual Basic, Java, etc...)

Just to note that VB has had native code compilation since VB5, 15 years ago. Perhaps some of the bad press VB and Basic in general gets is simply because people have out of date knowledge and incorrect impressions of them ?

On the issue of performance and how to achieve that I largely think it's a red herring; does it do the job in the time expected without other negative effects is the main concern for users and that's what most programmers work towards delivering. Resources used aren't a problem if those resources aren't required for anything else. It is important in some cases but most often not. A system with 99% free resources isn't in practice any better than a 'worse system' with only 90% free resources. Only when you approach the limits of constraint does it become a problem.

gerard
Posts: 4
Joined: Mon Oct 31, 2011 1:37 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 5:03 pm

It is very interesting reading everybody's comments about programming. I have been writing software since the 70s and have written software on everything from micros to super computers. I have seen many changes in software development over the years.

Programming languages are just a tool to create a program. As with any tool, there is a wrong and a right way to use it. A screwdriver is a poor tool for making holes in concrete and a tungsten tipped drill bit is a poor tool for tightening screws.

Each programming language has its pro's can con's which make it good and bad for different things. You choose the tool to suite the job you are doing. Basic was designed as a beginners language and is designed to be simple to use. For that reason some seem to dismiss it out of hand. Like every language it has its place.

liam collins
Posts: 17
Joined: Sat Oct 29, 2011 5:06 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 5:10 pm

Quote from hippy on December 19, 2011, 16:40
Just to note that VB has had native code compilation since VB5, 15 years ago. Perhaps some of the bad press VB and Basic in general gets is simply because people have out of date knowledge and incorrect impressions of them ?
.

- totally sideline question but... How do you switch to native code compilation in VB.net as part of Visual Studio 2010? - I've never found the compiler option that allows it - but, to be honest, I haven't looked too far either - should be the default to be honest.

liam collins
Posts: 17
Joined: Sat Oct 29, 2011 5:06 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 5:31 pm

Quote from hippy on December 19, 2011, 16:40
On the issue of performance and how to achieve that I largely think it's a red herring; does it do the job in the time expected without other negative effects is the main concern for users and that's what most programmers work towards delivering.

Your comment about an environment that is resource free is true, the quality of the code doesn't matter but having it like that means that the system is over specified and you've spent too much money on it :)

Badly written code adds to the requirements of the hardware and the overall cost of the system. In large 'enterprise' environments I've seen millions (in one case 10's of millions) spent on making sure that the hardware can run the bloated, slow and often crashing application code. All too often I come across apps people that code 'SELECT * FROM...' everywhere or think that adding even more indices is a good idea or.... AHHH!!!! - sorry.

Looking back over the last 10 years based on some of the projects I've seen, I would estimate that the cost of badly written application code, just in extra hardware, would run into billions of pounds (and the failure of a couple of companies as well).

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 5:40 pm

Quote from hippy on December 19, 2011, 16:40

On the issue of performance and how to achieve that I largely think it's a red herring; does it do the job in the time expected without other negative effects is the main concern for users and that's what most programmers work towards delivering. Resources used aren't a problem if those resources aren't required for anything else. It is important in some cases but most often not. A system with 99% free resources isn't in practice any better than a 'worse system' with only 90% free resources. Only when you approach the limits of constraint does it become a problem.

I agree if you give the addition:
And so long as it is efficient enough that another application that requires 100% of the systems resources on the current system will not be inhabited by said application, if so started after first.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

obarthelemy
Posts: 1410
Joined: Tue Aug 09, 2011 10:53 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 6:02 pm

Code is like Advertising: I *know* half of it is bad, I just don't know *which* half.
(very bad rip-off of.. someone, frequently quoted in marketing classes ^^)

User avatar
johnbeetem
Posts: 945
Joined: Mon Oct 17, 2011 11:18 pm
Location: The Mountains
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 6:23 pm

Quote from obarthelemy on December 19, 2011, 18:02
Code is like Advertising: I *know* half of it is bad, I just don't know *which* half.
(very bad rip-off of.. someone, frequently quoted in marketing classes ^^)

John Wanamaker: "Half the money I spend on advertising is wasted. The trouble is, I don't know which half."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27824
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 6:36 pm

Quote from DavidS on December 19, 2011, 16:06
Awe yes, I agree hole heartedly that it is possible to produce good code in an HLL if you pay attention to what you are doing and make absolute minimal use of libraries.


Not sure I agree about the libraries bit. In some cases I guess so, but in C (for example) the Standard libraries are often optimised in assembler (if necessary), and at least are optimised C code, and probably better than the average coder could produce.

Also, look at the Boost libraries for C++. In general they are very speed efficient indeed, by design, although not necessarily in size, since they are templated. However that does mean that the compiler can optimise to a particular data type, so, for example, the same templated code is compiled to completely different but optimised machine code (or whatever) depending on the data type. That's an excellent example of code reuse giving good performance for multiple data types, without having to rewrite anything at all.

Like anything, there is good code and bad code in libraries or out.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

adrian.oconnor
Posts: 30
Joined: Mon Nov 14, 2011 9:51 pm
Contact: Website

Re: BASIC - more harmful than useful?

Mon Dec 19, 2011 10:34 pm

Quote from liam collins on December 19, 2011, 17:10
Quote from hippy on December 19, 2011, 16:40
Just to note that VB has had native code compilation since VB5, 15 years ago. Perhaps some of the bad press VB and Basic in general gets is simply because people have out of date knowledge and incorrect impressions of them ?
.

- totally sideline question but... How do you switch to native code compilation in VB.net as part of Visual Studio 2010? - I've never found the compiler option that allows it - but, to be honest, I haven't looked too far either - should be the default to be honest.

The irony of Hippy complaining about people with out of date knowledge :)

You don't compile VB.NET to machine code (VB6 was the last version to do that) -- VB.NET is compiled in to IL (stands for Intermediate Language -- it's a mock assembly language) and then, from IL, into .NET byte-code, which is executed on the .NET virtual machine (which is where the native machine code gets generated, by an advanced JIT compiler). It's akin to Java, and this approach has some real benefits.

I'd like to see something as powerful and engaging as BlitzBasic for Raspberry Pi. Blitz Basic is basic, but with some really advanced features (mostly graphics routines aimed at creating games). It creates fast machine code, and it's pretty easy to get started with. There's nothing wrong with basic -- and I say that as a programmer who works with C#, Java, Objective-C etc on a daily basis. How you learn to programme doesn't matter -- what matters is that you grasp the concepts of assigning variables and creating structure. Basic lets you do that really well, if you have a good guide.

User avatar
croston
Posts: 716
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: BASIC - more harmful than useful?

Tue Dec 20, 2011 12:02 am

I don't that that BASIC is a necessarily a harmful way to learn programming at all. While it is still relevant, things have moved on since the 1980s micros. There are now many other programming languages that are suitable for beginners (for example Scratch or Python). I do however believe that it is beneficial to know assembler at some point, so that you know what is going on 'under the hood'. These days, computing hardware is much more complex and optimised libraries are available - for example OpenGL ES2 on the R-Pi vs. writing directly to the video memory on early computers. The low level work (in assembly) has already been done for you on the R-Pi so it is only natural to use a higher level language.

I think that the reason that BASIC has such a bad name for being harmful is because we have all seen the incredible mess made by 'programmers' knocking together 'applications' using Excel and VBA. These abominations are what hold many companies together. I have spent countless hours during my career clearing up the mess made by those who didn't know what they were doing and were using completely the wrong tools.

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: BASIC - more harmful than useful?

Tue Dec 20, 2011 5:26 am

Quote from DavidS on December 19, 2011, 16:06
Also I wish to note that given proper instruction on any side, some one that has never used a computer tends to take up Risc OS much more quickly than the more standard GUI based systems.
Studies please, or it's just "I think that..."
Quote from DavidS on December 19, 2011, 04:20
In its compiled form BBC BASIC V produces better optimized code than current GCC distros (though not for the newer ARMs with there Harvard cache, as it predates this architechure).
Prove it. Easy enough to do.

Simon

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27824
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Tue Dec 20, 2011 8:41 am

Since Basic is a slightly higher level language than C, I would have expected the latest gcc to outperform any BASIC compiler. Note, latest gcc, the original Arm gcc was a bit pants.

But again, I have no proof, only the thought that C is easier to optimise than BASIC.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
walney
Posts: 233
Joined: Wed Nov 30, 2011 6:57 pm
Contact: Website

Re: BASIC - more harmful than useful?

Tue Dec 20, 2011 9:19 am

Quote from tufty on December 20, 2011, 05:26
...Studies please, or it's just "I think that..."


Ahhhh... you mean Wikipedia?

( ;) )

tomo
Posts: 19
Joined: Mon Dec 12, 2011 12:50 pm

Re: BASIC - more harmful than useful?

Tue Dec 20, 2011 9:45 am

Again no proof, just a thought... but doesn't having more high-level construncts mean leaving more space for compiler optimizations... and the other way around... more low-level code means more tied hands for the compiler/optimizer? Of course, having more space to do something doesn't mean that it's actually done by some particular compiler implementation. And I realize that it depends a lot on the kind of these constructs. But BASIC... is really nothing special or extraordinary here.

And, another thought... now an academic one... I remember they taught us that RISCs are generally more friendly to compilers than to hand programmers... meaning it's easier to write a good compiler for a RISC architecture than for a CISC, while, on the other hand, it's easier to hand code in assembler on a CISC, since it usually has more complex and "higher level" instructions ment to make life easier for humans. So, RISCs - generally speaking - aren't really the best platform to be hand programmed in assembler. That's the theory I've been taught. I believe these days microprocessors with their instructon sets are being designed and heading to be more friendly for compilers (i.e. easier to generate good code) and not assembler programmers, as it used to be in the past. Except, perhaps, in the microcontroller area (i.e., on the lower end of the performance scale, typically "non computer-like" applications). Well, it's just a thought more in this "assembler always" discussion.

Return to “Staffroom, classroom and projects”