Programming Options

TUX isn't about programming. That's the disclaimer. Now, let me talk about programming.

Ok, why? Because I have had quite a few people who aren't programmers ask me about learning to program. So, here is my typical answer. In English. I suppose I can then just let Babblefish (or Babel Fish) translate the answer to Spanish as the majority of the people asking me recently don't speak English.

There are really two questions here:

  • What programming language should I learn?
  • Where can I get the software I need?

Let me answer the second one first. The answer is almost universally "it comes with most Linux distributions". This tends to be a shock for the non-Linux people asking me but it also offers a lot of them the incentive to give Linux a try.

Ok, on to languages. There is no universal good answer but there are some good suggestions. My first suggestion is that you learn an interpreted (or byte compiled) rather than a compiled language. This decreases the number of steps you have to go through each time you want to try something. Call it immediate gratification. With very fast computers and efficient interpreters, a compiled language is not likely to be worth the difficulty involved.

Ok, filled with my opinions, here we go--language by language. If you want a different opinion, check out WikiPedia.

BASIC — BASIC, which originally stood for Beginner's All-purpose Symbolic Instruction Code, was supposed to become that first language. Unfortunately, the initial language was not very powerful because of the hardware of 40 years ago. As hardware capabilities improved, "better" versions of basic appeared. Unfortunately, they tended to be incompatible.

C — A categoric no. While C is a good language for writing operating systems, it is not a language for computer newcomers.

C++ — In the professional programming world we can explain why C++ is better than C but, again, for a first language, forget it.

Fortran — It might have been the right answer about 40 years ago. But, today is today.

Java — Java got more hype than a lot of other "new" languages and is available virutally everywhere. But, while the standards process was initiated Java was withdrawn from the process and language specifications remains proprietary property of Sun Microsystems.JavaScript — I mainly mention this to make sure you don't confuse it with Java. They are different langauges. JavaScript is commonly used in client-side web programming--that is, running within your web browser--to handle dynamic aspects of some web pages.

Pascal — Developed as a language to teach programming, Pascal had its place. However, it suffered much like BASIC from everyone having a better version. There is virtually nothing being developed in Pascal today.

Perl — Please, no way. A lot of stuff can be and has been done with Perl but it is probably the most confusing interpreted language ever created for a newcomer. This is because Perl takes the best of awk, grep, UNIX shell programming and all too many other things and tosses them together. For the newcomer, you have to learn how all these different things work and how to put them together.

PHP — For web development, PHP is probably the most popular language. But, it sees virtually no use in other areas and suffers from growing pains. That is, the original syntax looked very much like C but adding modern object oriented features has tended to add confusion. Unless you need to do web work in PHP, forget it.

Python — Python is, in my opinion, a clean interpreted language that will not scare away beginners. It is used extensively in many areas including web development and as a scripting language for various programs such as Scribus and the GIMP.

Ruby — Probably the cleanest object oriented language in common use. Much less popular than Python but possibly easier to learn.

So, what's the bottom line? I recommend going with Python. Python interpreters are available for virtually every computing platform, syntax highlighting exists in most editors and it is supported by many development environments from KDevelop to its own eric and idle. Note that these two program names should help convince you that Python is named after a TV show, not a snake.

Eric, idle and pida are three Python-specific development environments. You should give each a try along with KDevelop. If you really like a screen full of buttons and windows, eric is probably the tool for you. If, on the other hand, you would rather have a separate editor, give kate a try. It offers excellent Python syntax highlighting and is easy to learn and use.

One other program of interest is pychecker. It is an easy to use command-line tool (just type pychecker followed by the name of your python source file) that will spot problems in your program.

Finally, like most programming languages, Python continues to evolve. Version 2.4 is current with 2.5 to be released soon. I highly recommend using at least version 2.4 as there have been some language cleanups recently and version 2.4 defaults to using the newer forms. This will help you prepare for the future.

fyl - Mon, 2020-08-21 17:03.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

First programming languages

First things first: forget C and C++ or Pascal or COBOL or anything like that. We're talking here about the first language for Jane/Joe User, who will at most do some simple, quick and dirty programming tasks. I don't think Joe User will code a new operating system or a compiler with this his/her first approach to programming. Joe/Jane User does not want to meddle with strict variable types, nor with pointers, memory allocation and garbage collection. She/He will want something simple and easy to handle, so the best for Joe/Jane User will be interpreted or scripting languages: Ruby, Python, Perl (yes, even Perl), Lua, bash, Basic (yabasic or X11basic or Gambas or...), or tcl. Heck, even Pilot! (remember that one? like Forth and intended for kids?).
My personal favorites are Perl, Lua and Basic. I have not tried Ruby yet, but will do so soon.

ppyo (not verified) - Tue, 2020-11-28 17:11.

You forgot about assembler

You forgot about assembler .. everyone should begin programming with assembler (or maybe not)

But C++ is a good first programming language to learn because it is pretty easy

An - ymous (not verified) - Sun, 2020-09-24 07:14.

Beginner languages

These articles always end up with lots of comments. That is because to many a programming language is like a religion.

I'll just plug my favorite beginner's language and leave it at that: Euphoria.

It is a very easy to understand language that has some of the best parts of BASIC and PASCAL and yet is easier to read and write than either one. The license isn't perfect for Open Source purists but it is good enough. There is a pretty strong community following it and a library of example programs and libraries to use.

Jas - (not verified) - Wed, 2020-09-06 14:37.

Learned Python, learned Ruby: ....using Lua

Python is great. Real straightforward, powerful, and Guido is a cool guy. But I couldn't get over the whitespace thing...that was just my thing.

Ruby is great. Lots of fun to learn. Elegant. Rails is cool. Matz seems like a cool guy. But it can be bloaty and slow for me.

After more research, my areas of interest became: interpreted, light, fast, quick to write, easy on the eyes, duck-typed, no curly braces, prototyped objects, multi-paradigmatic.

After browsing around the computer language shootout (a great place to study the intrinsic readability of other people's code), one language seemed to be hanging as fast and light as the compiled gang, and was really easy to read.

This was Lua. I never heard of it.

Lua's concept of closures invert the idea of scope in a nice way. And making variables into handles for anything was simple and powerful. Coroutines seemed interesting. It crushes floating point work.

There's this interesting duality where Lua seems syntactically the opposite of C in many ways, but they are in fact meaningfully and usefully interrelated (and easily bindable to each other). This made sense as a design decision, because I would probably be programming in one of two ways: rigorously and in the hardware, or quick and dirty. Lua does the second way well, and is designed to connect to languages that do the first way better. Lua was designed to be a helper for other languages and easily connectable (or embeddable) with them, instead of trying to do all their features. Many complicated OO ideas are left out of the language itself, because they are quckly (and adaptably) done in small closures.

It's not perfect. The scariest thing might be the handling of multiple return values. I haven't gotten the reasoning behind the generic iterator phrasing down yet. And the metatable/metamethod thing is a good idea with clunky phrasing.

Programming in Lua

Enjoy.

An - ymous (not verified) - Fri, 2020-09-01 10:41.

Gambas All The Way

If you really want to learn an easy to use programming language, Basic comes at first and under Linux Gambas is the best choice for Basic Language Programming.
I've been using Gambas (http://gambas.sf.net) for some time and let me tell you it's an excellent IDE and it's very easy to learn and use.

Carlos P - s (not verified) - Tue, 2020-08-29 10:33.

Pascal

Although not used much in general programming, there is nothing wrong with Pascal as a first language, as it's in-built inflexability forces you to learn to program in a better way. Also, with FPK (www.fpk.org) you get a full IDE, compiler and language that's fast and produces programs with little pain.

Also worth a look is GAMBAS, a Basic, again, the in-built IDE makes producing your first and subsequent programs that little bit easier, keeping your enthusiasm for programming alive, unlike learning C++ which can sap your enthusiasm quickly.

An - ymous (not verified) - Thu, 2020-08-24 06:30.

Time for Pascal.

Yes. I like Pascal too. It is logical, pedagogic, and it is easy to read the code you or others have written. Other languages are a mess. In Pascal, you have to use the right data types, and you will have control of what you are doing.
Pascal compiles 9 times faster than C.

And i think Pascal is a good option these days:

For many years there has been limited options for Pascal. You had development tools like Borland Delphi. It cost a lot of money, and it is only for windows.
Now you have the freepascal compiler under GNU-license, and you have a rapid development tools called Lazarus. Everything for free, and for multiple platforms! Lazarus looks like Dephi, and it used to be almost a clone.

http://www.freepascal.org/
http://www.lazarus.freepascal.org/
http://wiki.lazarus.freepascal.org/index.php/Main_Page

An - ymous (not verified) - Fri, 2020-08-25 06:42.

There is no shortcut to programming

While I agree that scripting languages (and I use them a lot) are easy to learn for people with no background in, well programming, I would wish to disagree with you that they are the best to learn how to program. C++ is the best for learners and only takes a few painful hours but once you are up, you are running because the concepts and all have been learned and going on from there is a bit smooth than to the person who learns scripting languages.

Kamau Gatheru (not verified) - Thu, 2020-08-24 00:31.

I disagree, for a good reason

I whole-heartedly disagree with you about 'C' being a poor language choice for newcomers.

The greatest advantage in choosing the 'C' language first is that you are 'forced' to understand how a computer program works.

Concepts like application stack, library function, file handle, and memory allocation require a thorough investigation to properly understand.

Without understanding many of the basic concepts that 'C' forces a student to learn, the programming is reduced to scripting. Scripting is tedious, and mind numbing, whereas programming is challenging and rewarding.

That's the difference between 'C' (and 'C++') and other lesser languages.

Smitty (not verified) - Tue, 2020-08-22 11:35.

C and C++ are still not the best languages to start

I have programmed in C and C++ for years now, and I have taught beginning programming classes in C++. I know what it's like to teach students who don't know anything about C++ or programming in general and have wished for a easier language to work from. C++ suffers from being somewhat too flexible and complex at times. I would vote in favor of C over C++ anyday, but I recommend Python or Ruby even more. Yes, it is still necessary to teach many of the "in's and out's" and every little nuance of how a computer works. But it's better to start them by taking baby steps, and let them work towards to a deeper understanding as they go. So working from a language that at least starts from a level that hides some of the deeper details is a far better way to go then making them start at the bottom.

This way they gain mastery over concepts such as creating an alogrithm, flow control, variables (without worrying about declaring int's, floats, char and how they typecast), templates, function protoypes, header files, and compiler issues.

You say "scripting" is tedious and mind numbing, but I say you don't understand the power of languages such as Python and what you can do with it. It's a powerful and fun language that goes beyond just mere "scripting" (however you define that). I've written some challenging programs with Python. The beauty of Python is that it allows me to focus more on solving my problem instead of fighting extraneous issues to the problem such as wierd compiler errors, memory leaks, and other problems with a lower level languages such as C/C++. Plus, I could quickly test out a function or idea in the interpreter without having to "compile" my whole project for one feature. That's what made it the most fun of all.

In some ways, being able to test out your ideas from the interpreter is the great aide to learning how to program. I wish I had something like that for my students back then.

Now, I'm not knocking either C/C++. I appreciate and understand their power and efficiency, and I enjoy using them for different problem domains.
But for getting your feet wet in general programming, C/C++ is like stepping into a tsunami in some respects.

JGA (not verified) - Thu, 2020-08-31 11:48.

gcc

If the compiler is included in Linux packages, where is it? How can I use it I have Debian 9.3 up. ./configure says "no compiler" ie no gcc, I also look for wgcc.

Claude (not verified) - Sat, 2020-09-30 16:49.