Tuesday, October 6, 2020

Your First Programming Language

 So many people want to learn how to program the computer. The inevitable question is: what should your first computer programming be? And if you can only learn one computer programming language, what should it be?

Anytime somebody asked me that, the answer is obvious: BASIC. It stands for Beginner's All-purpose Symbolic Instruction Code. That language is _designed_ for beginners! And it works. The old computers from 8 bit era all feature BASIC as the default programming language. Microsoft has a lot to do with it. It is not, however, the only version. And that's where trouble lies.

You see, it's not that BASIC is slow or limited. Some dialects of BASIC are very fast and powerful. The slowness with BASIC is a myth. Old style BASIC is slow because old computers are slow. In fact, modern languages such as Python can even be slower than BASIC! Just make sure you use compiled BASIC versus Intrepreted ones.

Today's modern languages are quite powerful, and that includes BASIC. Modern BASIC has structure. They are no longer the flat style coding language of the past. It hasn't been like that for decades. Why do people still hate them? There's absolutely no reason to do so, nowadays.

Should everybody learn BASIC? I think so. The next natural question then becomes, of all BASIC language dialects, which one should your learn? And that question, I cannot answer. I rather like SmileBASIC 3 for Nintendo 3DS. There is SmileBASIC 4 for Nintendo Switch, but I cannot recommend it because I think it's too powerful, not so friendly to beginners. But Nintendo 3DS is on the way out, you say? Well, yes. So I cannot recommend SB3 either! 

Is there a standard version of BASIC? There is Posix BASIC, but it's too primitive, so definitely cannot be recommended. There's GameMaker and Scratch, but support for non mainstream computer platform is weak. QB64 is a Microsoft compatible BASIC, and you should look for it. But in all, there is no Universal BASIC version that I can recommend right now. As a lover of BASIC programming language, this disheartened me.

Why should beginners learn BASIC? Well, it's easy to learn, and that's good for beginners. Any other languages is too complicated for beginners. Do you know that O'Reilly book Learning Python is about 1500 pages? How is that suitable for beginners? It's not suitable at all! Maybe version one is doable, but not version 3! How long does it take to learn BASIC? In my case, 3 hours by reading a book. About the same amount of time for me to learn HTML 2.0. Scratch? It's practically instantenous! I simply looked at the shapes, drag and drop, and there you go. Instant. No learning curve whatsoever.

Is there a reasonable powerful computer programming language today, that is reasonably supported across multiple platforms? Well, there's one: Processing. I love the language, but not the name. Trying to research "Processing" on Google yields so many hits on data processing. But the language is good. I recommend looking over Dan Schiffman wonderful YouTube video series for you to learn the language features. It's too nerdy for me most of the time, but sometimes, it's something accessible for me, too. Highly recommended.

Processing is good because it's based on Java, and it runs anywhere Java runs. In fact, you can compile Java code, which is necessary to unlock the powerful features of computer programming. So, that's my recommendation. It's easy to learn, powerful, and compatible with a lot of platforms, especially considering P5.js and other extensions.

If you can only learn one programming language, should it be Processing? Well, no. I mean, there's nothing wrong with learninig Processing. In fact, I believe it can get you far. However, it is not the most powerful language available. The generally accepted powerful language that is quite fast is C++. I happen to disagree. I prefer C language. I don't think you should learn C language as a first language, or the second for that matter. For your second programming language, better learn some scripting language: Perl, Python, or Ruby. Your choice. I prefer Perl. I learned it in a weekend, by reading a book!

But if you can only learn one computer programming language, then Processing is a good choice for general purpose programming. Beyond that, learn PseudoCode. That's Design and Algorithm. You want to hone your design skill. The sad fact is, that computer languages come and go. Sure there are companies that still uses Fortran or Cobol. C, C++, or Objective C. But most people have moved on. Nowadays, it's Java and Python, but don't bet on these to stay forever. Perl and PHP was once everywhere. People kept looking for more features, more power, more speed, until the language morphed into a monster that is no longer suitable for beginners, and so, the language slowly becoming obsolete, to be replaced by better, more streamlined, more promising programming language.

There is only one language that is not obsolete: English. That's PseudoCode. Learn that, and you can code forever. Even if the specific program features has changed, unless it's something weird, such as LISP or Prolog, once extremely promising ways to program your computer, you can probably depend on your design to stay relevant. I include Python as one of the weird one. Python strings are immutable. I understand the reason why that's done is because it's object oriented language, and a great benefit for garbage collection algorithm, but it dooms string processing algorithms to a crawl. Unfortunately, most of my algorithm depends on arrays and strings, so yeah, Python is too slow for me. Rather unfortunate.

In conclusion: Learn Design skills. You don't need to be a coding hero if you have good design skills. Design is always relevant, and works across many platforms. You still need to learn some kind of computer programming language, just to prove that your design is solid, but that's about it. That's all you need. That's the only computer programming "language" you need to learn.


No comments: