Ask HN: Do you program in Basic?

67 points by vanilla-almond ↗ HN
If so, what flavour of Basic? (PowerBasic, PureBasic, VB.NET, or some custom flavour)

What are your reasons for using Basic? Do you enjoy it? How do other developers react when you tell them you program in Basic?

85 comments

[ 3.9 ms ] story [ 242 ms ] thread
Clasic VB, (aka VB6). Each year it is more difficult to install the IDE, but the runtime is still installed by default.

It is incredible easy to build a nice one screen application with not very a very complicated background logic. Normal people like a nice graphical interface with a few buttons, and with Classic VB you can create them very easily and iterate and customize the form.

My last big problem was that it doesn't have a build in sort function, so you can use a n^2 sort or write a good sorting function by hand :( . When the logic start to be not so easy, there begin to apear problems.

Why not just use VB.Net/Winforms?
Originally: Not a fast enough computer and IIRC the first form editor of VB.Net was not as smooth as the one of VB6. Also it was a language change, let's call it VB#.Net

Now: 50% laziness and 50% don't want to migrate a few big projects that only need a tweak per year. If it ain't broke, don't fix it.

I haven’t tried to install VB6, but you said yourself that it is getting harder every year to install the IDE. What happens when you can no longer install the IDE?
> What happens when you can no longer install the IDE?

I guess a virtual machine with Windows 2000 and with VB6 is still smaller than the modern programming environments.

Depending in what you need to do; when I last tried, for a legacy system, to run under Wine it was flawless. So by the time it becomes impossible to install I would say Wine will be advanced enough to run all you need. All Windows stuff I need these days works perfectly under Wine. I work a lot with software from almost a decade ago and that mostly just works. Maybe at that time (few years) Wine will run on Windows as well (it has been a long term roadmap feature) to offer just this compatibility layer for old software support without having to install a Windows xp virtualbox.
Microsoft made fundamental changes to the Visual Basic language in order to make it run on the CLR, to the point that it feels more like an alternative syntax for C# than the successor of VB6– the superficial similarity between 6 and .Net caused lots of false-friend problems during he transition and most projects would have been better served by being rewritten in C#.
What were the biggest benefits that people got from switching? Where does VB6 most show it’s age? No modern looking controls? Harder to use Unicode?
Being able to get a job and not being a “VB developer” for 15 years, the company lays you off, you look for another job and find that no one wants to hire “VB developers”.

Then post on HN and Reddit and scream “ageism is rampant on our industry”.

Disclaimer: I’m 45.

A lot of VB programming was connecting together 3rd-party COM components, which had to be written in C/C++. After the CLR came along, those vendors slowly stopped supporting VB6 with their new releases as they moved their codebases and workflow to the new system.
That was only true for early VB versions.

VB6 had full support for native AOT compilation and creation of OCXs in pure VB code.

What do you use it for? Just personal apps or professionally?
I completely agree. VB6 was the thing that got me into Windows application programming.So easy to create good looking and functional programs. I ended up building several "real" applications, some commercial and some free, which I still maintain. It's a wonder that it still works as good as it does.
Have a look at Lazarus (https://www.lazarus-ide.org/), an open source clone of what Delphi used to be. Active development, can compile to single executables for Windows, Linux and Mac OS. And the language is way more powerful than Basic.
I would say Basic is/was liked for the same reason as JS; low barrier to entry, no predefined/enforced structure, no strong typing. Easy to just get going and see where you end up. Object Pascal is not that and so it will possibly not appeal to the same crowd although the similarities are obvious.
Visual Basic was actually strongly typed (unlike JavaScript).

What it did differently to Pascal was that it allowed for lazy / inferred typing along with some transparent type conversation in places where the intention was obvious. However in VB once a variable is defined a type (either when defined or when assigned a value - depending on how the variable was defined) you couldn’t change it. Eg you cannot overwrite an integer with a string

Weirdly, despite being branded a toy language, this meant VB actually had one of the more sophisticated type systems out of the languages of that era because you had the laziness of languages like JS and PHP but without having the === et al kludge that some loosely typed languages need.

Perl is another language that frequently gets mocked but it’s eq vs == solution for differentiating between strings and numeric types is genius and again solves the whole type comparison problem that JavaScript has.

Thanks for that enlightenment; underestimated vb there I guess. I did work in vb and vba, but very minimal and very long ago. Now that you mentioned the example of not being able to change a type once set, that seems to ring a bell. I did a lot of code in Delphi. (And also in Perl actually which I liked and P6 looks good to me: many interesting concepts.)
Where does VB infer types? If you don't specify types (which is usually enforced with "Option Explicit"), everything ends up with a Variant type, i.e. a union type that can contain a value of (almost) any actual type and will be implicitly converted on use.
Ahh yes, I’d forgotten about the variant type.

I loved “Option Explicit”. To the extent that it was almost always the first line I’d write for any new project, module and class.

I cut my teeth writing VB programs for enterprises in the 90's.

I still think it's the most productive programming environment I've ever worked in, in terms of actually getting something built.

Since then, I've learned a lot more about programming, and I'm not sure I'd accept the compromises that VB makes any more.

VB6 gets a lot of stick but it’s easily the best environment for rapidly prototyping and development ever created.

Some of Borlands IDEs had the same power for prototyping by C++ and Delphi weren’t as great for rapid development (though I have nothing against those languages themselves).

The closest thing we have these days is Electron but I don’t think that even comes close to ease of development once you factor in the clusterfuck of a mess modern web development is.

I did one project in Delphi, and didn't get on with it too well, but I think I was hampered by my familiarity with VB.

Now, I think I'd be much more comfortable with the compromises that Delphi makes.

I have a XP virtual machine I use for maintaining an old software wrote in VB6 (less and less often). With an old Visual Studio on it.

Problem solved :-)

I'm curious to hear about the people who are using the commercial Basic versions (PowerBasic, PureBasic, etc). It is interesting to me that there is still a market for paid compilers for general purpose languages.
There is a Basic-language IDE called Xojo that has a pretty dedicated user base. https://www.xojo.com/

I used to use it extensively (back when it was called REALbasic) and still occasionally dabble (i.e., tweaking apps I made awhile ago), but it's gotten much too expensive for hobbyist or "scratching my own itch" kinds of projects, which is a shame because I still love the language.

What kinds of projects did you use REALBasic for?
Dozens. Database front ends. Small utility apps. Graphical interfaces to manage workflows where the actual work was done with scripting languages.

Almost every app I did was for either the Mac or Windows, but perhaps the main value prop of REALbasic/Xojo was how easy it was to write one app and have it run on both Mac & Windows. For small applications, it really did Just Work, which seemed kind of magical.

Wow! The memories - I wrote an OpenGL game in Realbasic for the Mac 15 years ago... the trouble with Real Software was that they changed the language and broke backwards compatibility... that turned me off big time. Back in the day I used Amos on the amiga and Microsoft QBX on the PC to write though-the-window display software for real estate agents (this was 26 years ago). The issue with basic in those days was libraries - doing system level stuff (e.g. using Super VGA graphics required a paid 3rd party library)... ahh the memories... these days i’m C++ / C# / PHP / etc. although the most fun I’ve had recently has been with 8088 assembler...

Back in the day basic was frowned upon - but I think these days the stigma is pretty much gone...

So much that people actually pay for them for embedded development.

https://www.mikroe.com/mikrobasic-avr

https://www.mikroe.com/mikropascal-avr

They also have support for PIC, ARM, 8051, dsPIC, FT90.

The QBasic community is excellent and pretty active (peaked around 2008 or so, though). Check out http://www.petesqbsite.com/ to learn more.
Pete's QB Site is what got me into programming and Vic's game design tutorials is what got everything to "click" for me. I left ages ago, but the QBasic community was a wonderful place, and I owe a lot to them.
I might, very rarely, do some maintenance of a BASIC program these days. And that would be because the program I am using might require some minor tweaking.

But invariably, I do all my new programming in C.

The flavor of BASIC I used to use is North Star Disk BASIC, very similar to HP BASIC.

A few lines from an old project:

      1 REM*** THIS PROGRAM CONVERTS A 8080 PROGRAM INTO AN ASMB LISTING*****
     10 DIM A7(256),B7(256),A7$(512),B7$(10*256),B8(256)
     15 DIM K7$(20)
     20 A7$=""\B7$=""
     30 !\!"   FILECRAK: Disassembles 8080 opcode programs"\!
     50 FOR M=1 TO 256
     60 READ A,A$,B,B$
     70 B8(M)=LEN(B$)
     80 B$=B$+"           "
     90 A7$=A7$+A$\B7$=B7$+B$
     100 A7(M)=A\B7(M)=B
     110 NEXT M
     120 INPUT " File name of 8080 program:",V$\!
     130 CLOSE#1\ OPEN#1%1,V$,L6
     135 OPEN#5,"ASSEMBLE"
     140 L6=L6*256
     150 INPUT " 8080 op-codes begin at:",L$
     160 INPUT " Begin disassembling at:",J$
     170 !
     180 INPUT " Output to printer? ",H9$
Yes: MD-BASIC. It transpiles to AppleSoft BASIC. It's more enjoyable than AppleSoft BASIC but it's also enjoyable in its own right.
I wrote a BASIC interpreter in golang, and have amused myself programming in it. There's an example which embeds the interpreter into a HTTP-server, so you can open your browser, and enter BASIC code to draw images.

Naturally enough I call this "visual basic" ;)

I've not "seriously" programmed in BASIC for decades, but this was still enough to make me smile and feel nostalgic.

Excel. Sometimes it is easier to write a couple lines of Basic code than write a ton of formulas. Sometimes models require some complex logic.

Sometimes it is easier to keep some data in Excel and then convert to JSON with a simple macro.

Excel also. Sometimes, in a locked-down corporate environment but where every PC comes with a pretty powerful language and IDE built-in, it's simply easier to DIY than go through a process of approval and budgets. This does raise the very good question of maintainability and legacy use after I'm gone, a medium term solution is to ensure others proficient in VBA and computer science in general are on the team, and a long term auditable solution to ensure the process being automated stays documented and not magic. I enjoy VBA, combined with Excel it can do a lot.
I had to do a mockup of a gui recently for traders, and excel did the job. Not a nice programming language, but fast to get something working. It won't be used in prod, thank god!
(comment deleted)
VB.NET was one of my first languages. I also used VBA, especially in Excel.

Despite BASIC's intent to be simplistic, I think that C-style syntax is more intuitive; moving to C# was a great step. Still, VB.NET felt like magic when I first used it, and VBA is still useful in working with MS-Office documents.

I still occasionally write ZX Basic and am planning to get back into Blitz Basic and AMOS later this year. I also have a project lined up using C64 Basic (but probably mostly asm).

It's a tool like anything else, when it's the right one for the job it's worth using.

I wrote my first complete computer program on a Vic 20 in Commodore BASIC 2, in 1986. My first paid program in 1990, using Thoroughbred BASIC on a PC. Since then I've programmed (or scripted) in Assembler, BASIC, C, C#, C++, COBOL, F#, HTML, Java, JavaScript, LOGO, Pascal, SQL, VBA and XAML. I don't mind C#. Or Java. I stopped programming for my income around 2005 when I moved into architecture and then went the CTO route. Did take on another programming contract in 2011 though, because it was Nokia. Still write a lot of my own code though, and now exclusively in VB.NET because

- VB.NET supports both static and dynamic typing.

- VB.NET is a functional language, supporting local type inference, anonymous functions, monads, and language integrated comonads.

- VB.NET does project-wide namespace imports. C# doesn't.

- I like creating native client apps, and dislike the constraints and fragility of web apps.

- I've always found the Java developer environment to be brittle in comparison.

There are also a metric ton of readability issues in JS, Java and C# that VB.NET doesn't have (braces, == and =, ! instead of Not, separate keywords for inheritance and interface implementation, and so on). I also concede that I learnt Pascal before learning C (and prefer Pascal to C). The fact that Pascal and VB.NET share syntactical similarities (type declarations follow variable and function names, the Not keyword is probably not an insignificant factor.

And to be fair none of the above matter – the rationale came long after the fact that I use BASIC simply because I like BASIC.

The amount of disapproval, verbal abuse, ridicule and actual anger I've received for this over the years (and to this day) is insane. But you learn to deal with it.

PS. Did you know that the first prototype of Nokia Maps for Windows Phone was written in VB.NET? Nokia didn't know either, because they had like zero Windows Phone skills at the time.

I'm guessing we are about the same age, my first BASIC program was on a speccy in 1986, once we got a family PC I moved to Pascal and other than some VB6 at college in the late 90's haven't touched basic since, I still have a soft spot for Object Pascal (Delphi) though.
I embedded VBSScript in one of my applications so get to use that occasionally. Not for much longer though as I’m encouraging my customers to switch to PowerShell.
I really enjoyed working in BlitzBasic and later BlitzMax

https://en.wikipedia.org/wiki/Blitz_BASIC

In early 2000 I made some small, commercial, games using BlitzBasic and Blitzmax. Coming from 7+ years programming in C/C++ it was a breeze to work with. Mark Sibly, the creator BlitzBasic, Blitzmax and Monkey, really has a talent to make beautiful simple languages.

What I took from those years is that the best tools are those that let you hit the ground running.

My longest-lived piece of code is the Excel VBA code I write for my Dad’s company over 20 years ago. I built a custom export documentation generator for his export business, with centralised price list with individual prices for customers, stock control and production tracking. It is still in use, more than 20 years on. Scary and awesome at the same time!

Submitted a simplified version of it as part of my IT coursework in college and got top marks in the class. ;)

An alternate meaning of code reuse. Recycle as coursework!
I learnt to program with VBA for Word and Excel. I found a booklet that my father got along with another IT magazine. My brother and I started self-teaching programming this way.

I still occasionally write some VBA macros.

Kinda, I'm currently learning Idris and compilers by writing a CommodoreBASIC compiler that targets the HP 15-C calculator: https://gitlab.com/michaelzinn/voyc

Compiler output looks like this:

  227 IF Q>0 THEN 230......................................................90 1
                                                                           91 0
                                                                           92 8
                                                                           93 CHS
                                                                           94 STO I
                                                                           95 0
                                                                           96 RCL .1
                                                                           97 TEST 7
                                                                           98 GTO I
  228 P=INT(P/2)...........................................................99 RCL 9
                                                                           100 2
                                                                           101 /
                                                                           102 INT
                                                                           103 STO 9
So far, I can compile Hammurabi, but I actually haven't written any BASIC programs myself yet (except some simple QBasic stuff in the last millennium).

I get the games to compile from the old "101 BASIC Computer Games" book: http://vintage-basic.net/games.html

visual basic .net I like the more humane/natural syntax compared to c#. There are also some very nice programmer productivity features like XML literals.
VB scripting is the de-facto macro language up to MS office 2014 (I don't really know about later versions). It can instantiate COM objects within the windows environment and through those, parse xml, create json, call web services and connect to databases. It is one of the reasons why VB still exists in the industry.
Occasionally I still touch VB.NET, but to be fair it is more related to migrate code from old VB6 into .NET world.

As info, I used Timex 2068 Basic, 48K Basic, GW-Basic, Turbo Basic, AMOS, GFA Basic, QBasic, QuickBasic and VB as well.

And yes, with the native code compiled versions of Basic it was even possible to do system level like programming back then.

So Basic has a special place for me, even if I barely used today.

Also ignore the naysayers about VB.NET vs VB6, there are plenty of features that are comparable, usually what was left behind were GW-Basic and QuickBasic compatibility features.

Just think that even F# doesn't have the amount of platform love that VB.NET enjoys on VS tooling.

I have been using Xojo (Former REALBasic) for about 10 years to code database-driven business apps for several businesses with great success.

I also use x86 asm, Rust, Racket, NewLisp, Scheme, C, Python, JavaScript and shell script (sed, Perl etc) for other clients and uses. Xojo lets me compile for Win, Mac, Linux from the same install, the syntax is delightfully simple to use and to teach. Performance beats interpreted languages (LLVM-based), it compiles to standalone bins that do not rely on .NET, unlike Visual Studio. When I need more power I simply embed a lisp (Chicken or NewLisp) as the provided FFI works well. I’m currently writing a new IDE for NewLisp with Xojo and it’s handling UTF8 like a champ.

Xojo is very mature and most of the bugs have been squashed long ago, I just wish it treated functions as first class citizens. Apart from that, for internal business apps and retail-quality Win/Mac UI apps, I honestly haven’t found anything more effective to go from prototype to binary quickly and painlessly.

It’s our secret weapon, and clients don’t care it isn’t mainstream. Now if one could come up with a similar IDE coupled with a lisp... DrRacket + MrEd come close, but for large projects it becomes a pain. Until then I’ll write basic code for basic business apps. For everything else, there’s a lisp.

>I just wish it treated functions as first class citizens.

So you cannot store a function in a variable (scalar, list, dict)?

And does it have dicts (Python term) or equivalent (associative arrays)?

If not, a lot of things would be more clunky to program, although possible.

My best and biggest projects were written in GfA-BASIC. This language was both very productive, and fun to use.

I could also predict exactly how each line would be translated by the compiler, and that enabled interesting hacks and optimization techniques.

Kinda like Ruby, BASIC let you express what you want in an intuitive way rather than constantly try to work around the restrictions imposed by the language. There are many ways to do the same thing. None is good or bad.

When it comes to being fun, expressive and productive, Ruby is the only language that comes close to BASIC.

Classic ASP for me still, although I believe I'm reaching the sunset here with IIS 6 on a Windows 2003 server still being feasible.

Why not change? I know the language so well, and have so many things I can reuse...ok...fear of change.

You can get pretty much anything done with classic ASP still though. Here are a few of my sites both done with only classic ASP server side.

http://www.dudeiwantthat.com/ https://stockdaddy.io/

Now, Jquery has moved some things I would previously do server side to client side, but these are basically classic ASP, SQL Server driven sites.