User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Learning a New Programming Language

Fri May 20, 2016 4:24 pm

I am looking to learn a new programming language. I have a a decent amount of python experience, and a tiny bit of HTML and CSS knowledge. Any recommendations for a heavily used, popular language?

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

darkbibble
Posts: 602
Joined: Mon Mar 09, 2015 5:20 pm
Location: corby, england

Re: New Programming Language

Fri May 20, 2016 4:26 pm

if you learn C you can pretty much code for any machine
Q; How many Windows users does it take to fix a Linux problem??
A; Whats a Linux problem

User avatar
lpsw
Posts: 168
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: New Programming Language

Fri May 20, 2016 4:30 pm

IMHO it depends on what you want to do, but two of the more popular languages on Linux based systems are C (and it's variants) and Java (and it's variants). I prefer the former and despise the latter, but that's just my opinion.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

User avatar
B.Goode
Posts: 8987
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: New Programming Language

Fri May 20, 2016 4:44 pm


User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: New Programming Language

Fri May 20, 2016 4:47 pm

darkbibble wrote:if you learn C you can pretty much code for any machine
I was afraid of that...it looks TOUGH.

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

Pithagoros
Posts: 580
Joined: Wed Nov 12, 2014 8:16 pm

Re: New Programming Language

Fri May 20, 2016 4:48 pm

I am with IPSW on preferences there :)

C is not tough to learn. Memory management is sometimes a bit tricky, but not the language.

However, I am thinking that javascript which is not java would augment your HTML and CSS knowledge and let you foray into HTML 5.

User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: New Programming Language

Fri May 20, 2016 5:04 pm

Pithagoros wrote:I am with IPSW on preferences there :)

C is not tough to learn. Memory management is sometimes a bit tricky, but not the language.

However, I am thinking that javascript which is not java would augment your HTML and CSS knowledge and let you foray into HTML 5.
Yes, I was considering Javascript, as it looks easier to learn than Java. I also enjoy making cool stuff for others to see. C (correct me if I am wrong) seems more like a language for hardcore geeks who enjoy wreaking havoc on computers. 8-)

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: New Programming Language

Fri May 20, 2016 5:18 pm

Kratos wrote:I am looking to learn a new programming language. I have a a decent amount of python experience, and a tiny bit of HTML and CSS knowledge. Any recommendations for a heavily used, popular language? Kratos
I would look at something that runs in the JVM and the browser, for example Scala or Clojure. In the case of Scala, it includes a lot from Java and this means you'll see a lot of C like syntax but without the semicolons. Even though Scala is clearly more encompassing, it might be easier to start out with because it requires so much less, they call it "ceremony". I guess that's defined as stuff that you add to your program perhaps every time but you can't explain why to a new user in a clear and non-confusing way. One might argue that the braces used in C like languages but dropped in Python are an example of that, the new user asks: "Why do I indent *and* show the form of the program with the braces too, why both?" A good argument might be made for that one but perhaps not so much with all the stuff added at the start of a Java application. Scala (and Clojure) work in the JVM and in the browser, so you could perhaps create a program that worked in both.

Pithagoros
Posts: 580
Joined: Wed Nov 12, 2014 8:16 pm

Re: New Programming Language

Fri May 20, 2016 5:25 pm

Kratos wrote: Yes, I was considering Javascript, as it looks easier to learn than Java. I also enjoy making cool stuff for others to see. C (correct me if I am wrong) seems more like a language for hardcore geeks who enjoy wreaking havoc on computers. 8-)

Kratos
C is just a language that has been around forever, it can get you a bit closer to the hardware but you can use it anyway you like. You don't have to go straight into hardcore hacking. I mean, you could learn conversational Spanish but you wouldn't need to start analysing Cervantes.
If I were starting again I would probably go straight for C++ with QT.

Heater
Posts: 13933
Joined: Tue Jul 17, 2012 3:02 pm

Re: New Programming Language

Fri May 20, 2016 5:35 pm

Kratos,
Any recommendations for a heavily used, popular language?
That would be Javascript (Which is not Java).

Probably the most widely used language in the world. Certainly with the most reach of users, via the browser.

But, never mind the browser, JS is also great for server side and, well, just normal programming. JS is built into game engines, databases, all kind of things.

You can run Javascript using node.js. There is a great series of articles on getting started with JS on the Pi here:
https://learn.adafruit.com/node-embedde ... ode-dot-js

You will find tutorials, references, blogs about JS and node.js all over the net.

Even today I see this blog post on the Raspi site about an intro to nodered https://www.raspberrypi.org/blog/ring-b ... d-twitter/ which is Javascript.

You can program tiny little, low power, micro-controllers with JS: http://www.espruino.com/

I have an simple JS exapmle that relays Raspi GPIO inputs and outputs to the browser here: https://bitbucket.org/zicog/pigpio2html

Of course you should also learn C/C++. After all the kernel of the operating system you are using is written in C and Javascript engines are written in C++.

Then learn something completely different, like Erlang or Scheme. Just for a different perspective on programming.
Memory in C++ is a leaky abstraction .

User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: New Programming Language

Fri May 20, 2016 5:57 pm

Javascript it is! Thanks for all the advice you guys supplied :D .

Kratos
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

W. H. Heydt
Posts: 11115
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: New Programming Language

Fri May 20, 2016 6:01 pm

Kratos wrote:
darkbibble wrote:if you learn C you can pretty much code for any machine
I was afraid of that...it looks TOUGH.

Kratos
It was originally for writing operating systems, unix specifically. As a result, it's pretty much a glorified assembly language. Learning an *actual* assembly language would also be a good choice. Not so much because you'd be writing a lot of code in it (such languages are very, very hardware specific) but that it will aid you in understanding just what a compiler really does with the higher level code you write. I tend to refer to such languages as getting down there with the hardware to argue right of way with the processor.

Heater
Posts: 13933
Joined: Tue Jul 17, 2012 3:02 pm

Re: New Programming Language

Fri May 20, 2016 6:14 pm

W. H. Heydt,
...it's [C] pretty much a glorified assembly language.
That is so far from true.

I don't know any assembly languages that are portable across processor architectures. Unless you are targeting some kind of virtual machine.

Assembly languages don't support structured programming.

C might be one of the lowest level "high level" languages that can do this but it is conceptually far a way from assembler.

I do agree though. Anyone with an interest in programming should learn at least one assembly language, That is to say one machine instruction set. It's good to know what goes on down in the engine room.

As it happens the ARM processor as used in the Pi is a lot nicer to program in assembler than the Intel x86 of the PC world.
Memory in C++ is a leaky abstraction .

User avatar
jeanleflambeur
Posts: 157
Joined: Mon Jun 16, 2014 6:07 am
Contact: Website

Re: New Programming Language

Fri May 20, 2016 6:18 pm

Give rust a chance: https://www.rust-lang.org/
It's compiled, as fast as C and C++, well supported on many platforms, has an impressive compiler that doesn't allow you to do the classic mistakes, has a pretty complete standard library and interacts very well with existing C code bases and has a very active community.

User avatar
lpsw
Posts: 168
Joined: Thu Jun 25, 2015 4:45 pm
Location: USA

Re: New Programming Language

Fri May 20, 2016 6:25 pm

Heater wrote:W. H. Heydt,
...it's [C] pretty much a glorified assembly language.
As it happens the ARM processor as used in the Pi is a lot nicer to program in assembler than the Intel x86 of the PC world.
Couldn't agree more. If one really wants to learn the fundamentals of programming the Pi (or any ARM chip), that's a good place to start.

Even if you don't actually write a lot of (or any) assembler code, knowing something about the instruction set can help you in whatever language you decide to use.
Self-education is, I firmly believe, the only kind of education there is - Isaac Asimov

W. H. Heydt
Posts: 11115
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: New Programming Language

Fri May 20, 2016 6:28 pm

Heater wrote:W. H. Heydt,
...it's [C] pretty much a glorified assembly language.
That is so far from true.

I don't know any assembly languages that are portable across processor architectures. Unless you are targeting some kind of virtual machine.

Assembly languages don't support structured programming.

C might be one of the lowest level "high level" languages that can do this but it is conceptually far a way from assembler.

I do agree though. Anyone with an interest in programming should learn at least one assembly language, That is to say one machine instruction set. It's good to know what goes on down in the engine room.

As it happens the ARM processor as used in the Pi is a lot nicer to program in assembler than the Intel x86 of the PC world.
You can create any sort of programming structure you want in an assembly language. After all...everything comes down to machine language in the end. It's just a matter of how much abstraction you do above that, from pure symbolic version of machine instructions through macro assembly and on up.

Where it gets ugly is when people insist on making neologisms for old and fundamental concepts (*cough* "methods" *cough*, "rows" and "columns", if you prefer to criticize databases instead of programming languages).

Heater
Posts: 13933
Joined: Tue Jul 17, 2012 3:02 pm

Re: New Programming Language

Fri May 20, 2016 6:57 pm

W. H. Heydt,
You can create any sort of programming structure you want in an assembly language.
Of course that is true. As you say: "everything comes down to machine language in the end".

But you don't get any, or much, support for high level concepts like functions, procedures, methods, lambdas, closures, parameter passing, iteration, functional programming, object oriented programming, list processing, declarative programming, data structures, big numbers, floating point (if your hardware does not support FP), parallel processing, encapsulation, etc, etc.

It's those high level abstractions that make it tolerable to reason about large programs. Allow code reuse. Ease of change. And so on.

I'm not quite sure what you mean by the "neologisms". For example C and other languages have things called "functions". Only problem is they are not functions at all. They can maintain internal state. They can change global state. They have side effects. All things that functions are not supposed to do.

So "methods" in the object oriented world, is a far more appropriate name.

Heck C uses "=", which is an assertion of equality in mathematics, as an assignment operator. How crazy is that?

What is the "columns" and "rows" thing about?
Memory in C++ is a leaky abstraction .

ejolson
Posts: 3838
Joined: Tue Mar 18, 2014 11:47 am

Re: New Programming Language

Fri May 20, 2016 7:43 pm

Kratos wrote:I am looking to learn a new programming language. I have a a decent amount of python experience, and a tiny bit of HTML and CSS knowledge. Any recommendations for a heavily used, popular language?

Kratos
Everyone has recommended powerful and popular languages. Maybe it would be more practical to learn more about Python by looking at PyPy (a compiled version of Python) and also at Parython (a parallel version of Python).

W. H. Heydt
Posts: 11115
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: New Programming Language

Fri May 20, 2016 8:00 pm

Heater wrote:W. H. Heydt,
You can create any sort of programming structure you want in an assembly language.
Of course that is true. As you say: "everything comes down to machine language in the end".

But you don't get any, or much, support for high level concepts like functions, procedures, methods, lambdas, closures, parameter passing, iteration, functional programming, object oriented programming, list processing, declarative programming, data structures, big numbers, floating point (if your hardware does not support FP), parallel processing, encapsulation, etc, etc.
Excuse? Most of the first part of your list boils down to variations on subroutines, which if not supported directly by machine instructions (as was done on the IBM 1620 with the Branch and Transmit operation), are found in programming conventions, such as loading a specific register with a return address before branching to a subroutine (register 14 was the convention on many IBM S/360 and S/370 operating systems, permitting a return using "BR 14", hence the "do nothing" IEFBR14 utility). Floating point can be handled with subroutine libraries if there aren't any machine language instructions for it. As for the rest, *all* of them have to implemented at a machine code level, and--therefore--have to be possible in assembly languages.

Note that I never claimed that writing your own implementation of this sort of stuff is necessarily *easy*, just that it can be done.
It's those high level abstractions that make it tolerable to reason about large programs. Allow code reuse. Ease of change. And so on.

I'm not quite sure what you mean by the "neologisms". For example C and other languages have things called "functions". Only problem is they are not functions at all. They can maintain internal state. They can change global state. They have side effects. All things that functions are not supposed to do.

So "methods" in the object oriented world, is a far more appropriate name.
To misquote a certain author...it's subroutines all the way down.
Heck C uses "=", which is an assertion of equality in mathematics, as an assignment operator. How crazy is that?
C didn't invent that. It goes back to at least the first version of FORTRAN in the 1950s.
What is the "columns" and "rows" thing about?
Those are parts of tables. For "column" read "field". For 'row" read "record". At least for anyone whose programming pre-dates the advent of RDBMS.

yodermk
Posts: 35
Joined: Sat Mar 07, 2015 9:54 pm

Re: New Programming Language

Sat May 21, 2016 2:07 am

Problem with Javascript is that it is a truly horrible language that was thrown together almost thoughtlessly over the last 20 years. It is necessary for Web development, but that fact is a real tragedy. I sure wish browser vendors could standardize on something else. There are some projects working on it, but right now JS it is, or some abstraction on top of JS. If you don't believe me that it's horrible note O'Reilly's book "Javascript: The Good Parts." It is one of the thinnest tech books I've ever seen, and most of it is an appendix describing the bad parts!

Python is certainly a good start. It is useful for a wide variety of projects.

Personally I'm increasingly a fan of modern C++. I strongly recommend going straight to it and skipping C, unless your goal is to be able to maintain existing C code. IMHO there is no good reason to start a new project in plain C. Modern C++ solves most of the issues that made it easy to make big mistakes in previous C/C++ code. Granted, it is a large language with some complex features, but for a typical application (as opposed to, say, low level code or library development), you can get by with a small subset of it. The ability to compile your software directly to a native executable is a powerful feeling. For GUI, Qt on top of C++ is absolutely amazing.

Go and Rust are also compiled and becoming more popular. Probably worth a look unless you want to do GUI programming.

Java and other JVM languages are certainly worth considering. I'm not their biggest proponent, but if you want to do work with Big Data, they're the easiest to hook into the likes of Hadoop and Spark. They're also used very heavily in the enterprise for web application servers.

wolfchild
Posts: 5
Joined: Wed May 11, 2016 11:16 am
Location: Malta

Re: New Programming Language

Sat May 21, 2016 9:01 am

Lots of good advice and diverse opinions. JavaScript is definitely a wise choice.

Some additional advice (coming from someone who for the last 18 years has been earning a living writing software) is to learn well 2 languages. Learn a compiled language and an interpreted language. Get comfortable with a good IDE and the workflows involved in the edit/run/debug cycle. My choice today would be JavaScript + HTML5 + CSS (interpreted) and C# (compiled).

C# will get you quite far in doing nice stuff as it can handle anything from boring server code, to web apps, to GUI apps, to 3D games. You won't be able to develop directly on the RPi, but your apps would probably run fine once you install mono on it.

Ed

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: New Programming Language

Sat May 21, 2016 9:44 am

You might want to improve your Python. Take a look at this book http://www.amazon.com/Programming-Pytho ... ummerfield to see how much you don't know. If you're writing web pages then you unfortunately need Javascript which is the worst language that I've ever tried to learn. Jquery makes it a little bit less obnoxious. C isn't all that difficult. A fair amount of Python is based on C although it's really quite a different language.
The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

Heater
Posts: 13933
Joined: Tue Jul 17, 2012 3:02 pm

Re: Learning a New Programming Language

Sat May 21, 2016 12:37 pm

W. H. Heydt,
Those are parts of tables. For "column" read "field". For 'row" read "record". At least for anyone whose programming pre-dates the advent of RDBMS.
Hmm... This programmers first experience of programming, in Algol, BASIC and assembler, predates the introduction of
the first commercially available RDBMS (Oracle 1979) by six years. I.e. before most people knew what an RDBMS was. I certainly did not. As such when I hear "column" and "row", I think vectors, arrays and matrices. It's natural if your educational background is maths and physics and such.

"records" and "fields" are a totally different thing.

Anyway, now a days we don't have "records" and "fields" we have "documents" and "JSON" :)
C didn't invent that [= assignment]. It goes back to at least the first version of FORTRAN in the 1950s.
Indeed it does. At least Algol did not make that mistake. A mistake that has been perpetuated ever since through the linage of C, C++, Java, C#, Javascript, etc, etc.
To misquote a certain author...it's subroutines all the way down.
I do see what you mean. And to some extent I agree.

On the other hand...

Not really. There are no "subroutines" in assembler or machine instructions. There may well be mechanisms to support them, using the stack, or dedicated registers as you say.

Those things on my list: functions, procedures, lamdas, closures, methods, etc are high level concepts, with perhaps different meanings in different languages, which imply a lot more than just "call" and "return".

On the other hand...

Even today most programming we do is just some version or other of sequence, selection and repetition. All enabled by the underlying machine.
Memory in C++ is a leaky abstraction .

User avatar
davidcoton
Posts: 4264
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Learning a New Programming Language

Sat May 21, 2016 1:16 pm

Heater wrote: There are no "subroutines" in assembler or machine instructions. There may well be mechanisms to support them, using the stack, or dedicated registers as you say.
I'm not sure what you mean. The 6502 (8 bit) microprocessor had JSR-RTS instructions -- the basis of every type of subroutine. The return address was handled automatically, though of course all parameters had to be passed in the three (!) registers, or in memory.

[off-topic] 6502 coding was a joy, with several useful indexed addressing modes to make life easier. The instruction set was almost logical, just spoiled by one or two expected instructions (opcode combined with addressing mode) that weren't implemented. It always looked as though parts of the processor hadn't work out, and were disabled (either just in the documentation, or by a die modification) rather than corrected. I never found out if that was the case.[\off-topic]
Signature retired

Heater
Posts: 13933
Joined: Tue Jul 17, 2012 3:02 pm

Re: Learning a New Programming Language

Sat May 21, 2016 3:16 pm

davidcoton,
I'm not sure what you mean. The 6502 (8 bit) microprocessor had JSR-RTS instructions -- the basis of every type of subroutine.
Certainly the 6502 and many other machines have support for subroutines, functions, procedures etc. Perhaps using the stack, like JSR/RTS, or some register to save a return address or whatever.

I think what I mean is that having support for a concept, a "thing", like subroutines, functions, procedures, is not the thing itself. JSR/RTS knows knows nothing of my idea of parameter passing, returning results, closures, side effects, etc, etc.

For example:

The 6502 can do 16 or 32 bit arithmetic, it can floating point maths, it can do arbrtray big number arithmetic. It has support for those things in it's instruction set but it knows nothing of them. It's a Turing complete machine, give or take memory limitations, so of course it can.

Carried to extremes that sea of gates in my FPGA can do all that as well. Or the bucket of transistors in my junk pile.

Or we could say the whole concept of "subroutine" existed before there was any hardware support for it.

Or further, the whole idea a machine performing logical operations and supporting, sequence, selection and iteration, existed before there was any such machine. See Babbage and Turing.

In short, there is a huge conceptual jump between a machine instruction set and assembler level programming and a high level language like C. Which is where this whole debate started.
Memory in C++ is a leaky abstraction .

Return to “General discussion”