/ BASIC and APL to what? Scratch? Python? C#?

This topic has been archived, and won't accept reply postings.
Deadeye 03 Dec 2019

I last wrote code a long time ago.  Assembly and BASIC on a z80-based machine then some APL on an early IBM VM.

I'd like to have another go....but it seems things may have moved on a little.

Do I need to goo back to Scratch, or straight to Python?

I'd like to control a Pi/Arduino but also do some bigger crunching of health data.

Andy Johnson 03 Dec 2019
In reply to Deadeye:

Python is probably your best choice. Download it from https://www.python.org/downloads/ and do some of the tutorials. Its an easy language to pick-up, and you'll be able to do fun things on a Pi quite quickly. Its also the default language nowadays for scientific/maths/data computing and there are extremely capable libraries like NumPy and Pandas that will help with your health data project. Good data visualisation libraries too.

For an arduino you'll rally need to learn a bit of C/C++. Grab the arduino IDE from https://www.arduino.cc/en/Main/Software and check out some of the tutorials. Its quite an easy platform to get started with.

Scratch is nice but is designed more for children's education.

Enjoy!

Post edited at 18:22
wintertree 03 Dec 2019
In reply to Deadeye:

From that background...

Get up to speed with modern C in a modern IDE.  The wonder of real time inter-procedural static analysis in XCode as you type - someone a bit dim like me can write a 1,000 line program and have it run first time.

Python with Jupyter Notebooks for organising your data analysis, doing plotting with Matplotlib, probably the “anaconda” environment which packages up all you need.

You’ll probably want to wrap your head around “objects” - pros and cons to the different object models used in Python and C++.

The z80 isn’t dead yet!  C9

Post edited at 18:29
3
Angrypenguin 03 Dec 2019
In reply to Deadeye:

Many people begin programming in Python, it is a good language to start with (full disclosure: it's also my favorite!). In the past, programming tended to be taught in quite an academic/theoretical way, there now seems to be a trend (I think much for the better) to learn by doing.

The Software carpentry group produce lessons which start from an introductory level and are very well designed (https://software-carpentry.org/lessons/). There are also many online courses from providers such as codecademy where you program interactively in your browser. This can be an excellent way to get started quickly.

As for Python itself - learn Python 3 not 2 (2 is about to be retired although beware of resources/tutorials out there which teach 2). If you are interested in health data you may be interested in the functions offered in the popular Pandas library, a very popular library focused on data analysis https://pandas.pydata.org/

I teach as one part of my day job so if you need help with finding more specific resources do let me know.

Philip 03 Dec 2019
In reply to Deadeye:

BBC Microbit can be coded in python.

marsbar 03 Dec 2019
In reply to Deadeye:

Scratch is great for kids.  I'd probably say python for grown ups.  

w3 schools has tutorials.

I think  you can use python for ardunio but I'm not sure

Post edited at 19:06
Deadeye 03 Dec 2019
In reply to Deadeye:

Thanks all.

I am going to get stuck in.

Can anyone recommend a book (physical paper) to go with any of those suggestions?  It's a bit odd, but I find a physical volume comforting and handy when I'm bodging.  On-screen stuff isn't quite the same.

Angrypenguin 03 Dec 2019
In reply to Deadeye:

For Python: https://automatetheboringstuff.com/ is well regarded for Python beginners. The author releases all of his books as free PDFs but you can get physical copies too if preferred. Again it is learning by doing stuff from the first chapter so keeps up the interest.

Looking at his site it appears that there is currently a limited time (free) offer on a video edition of the book here too: https://www.udemy.com/course/automate/?couponCode=DEC2019FREE

I haven't used udemy before but understand it is a popular digital course/learning platform. I guess the offer is a loss leader to bring traffic to the site.

snoop6060 03 Dec 2019
In reply to Deadeye:

C++. That's what the Arduino IDE uses (though you can use micropython on the esp8266 boards which I prefer to the Arduino). And if you are a good C programmer you can probably just learn python in an afternoon anyway  

1
John Stainforth 03 Dec 2019
In reply to Deadeye:

C++ is probably the number 1 modern choice of language. But language choice is a secondary to writing good algorithms. Programming is actually all about algorithms, and once they are into machine code they are more or less the same as each other.

1
wintertree 03 Dec 2019
In reply to snoop6060:

> And if you are a good C programmer you can probably just learn python in an afternoon anyway 

Such a person can pick up writing Python in a day for sure.  The more entrenched someone is in C/C++ however, the bigger their WTF moment when they actually learn how the Python object model works...

SenzuBean 03 Dec 2019
In reply to John Stainforth:

> C++ is probably the number 1 modern choice of language.

I don't think that's the case anymore. The stackoverflow developer survey is probably one of the best places to see the current popularity of various languages, and from that list it's clear python is more popular now: https://insights.stackoverflow.com/survey/2019#technology

Another great list that shows pay associated with a language: https://insights.stackoverflow.com/survey/2019#top-paying-technologies

> But language choice is a secondary to writing good algorithms.

For a number of years now, a developer's time has been considered amongst (or even) the most important resource to optimize for - "make it work then make it fast". As a result of this paradigm, a language choice which improves the developer's productivity is seen as critical. Python is vastly faster to write productive code than C++, faster and easier to test, more forgiving of mistakes and thus most programmers would agree it's the better choice for most cases (given that we have inexorably more computing resources, for cheaper).

* - there is acknowledgement that this attitude causes user experience to suffer, and builds bloaty software, but in my experience in the industry, there was little incentive to do things differently. The programmer who gets the thing done the quickest with an acceptable level of quality, almost always is seen as the best programmer (even if their code falls over 18 months later, requiring a full rewrite, and they've already moved onto another project).

> Programming is actually all about algorithms, and once they are into machine code they are more or less the same as each other.

While this is true, it's a bit misleading. One programming language may have a different programming model, or a compiler - that produces worse machine code, than the other. There can be extremely huge differences for the same code compiled with an older compiler versus a modern one. As mentioned above, the software industry is in a phase where it doesn't even really care very much about performance - I've seen O=n^2 algorithms let out into the wild simply because it just didn't matter given the computing resources at hand.

John Stainforth 04 Dec 2019
In reply to SenzuBean:

Thanks for the information about Python. I confess I have no personal experience of that language but my company did not adopt it for serious number-crunching because it was regarded as (very) slow.

1
wercat 04 Dec 2019
In reply to Deadeye:

If you do buy a Pi and want a sportscar experience then try RISCOS Just for fun.

You can use an incredibly fast BBC BASIC as written for the Archimedes machines but running far faster with lots of memory - faster than assembler on old computers (though I believe there is an ARM assembler included).  Not suggesting this is the way to go, but it's and easy retro-start and the speed will blow you away. 

You can also get BBC Basic for Windows which has been used for some quite serious processing, also very fast.  My son has been doing graphical simulations using it as part of his Chemistry Degree to impress the other students.

wercat 04 Dec 2019
In reply to wintertree:

I've got a RC2014 Z80 computer to build sometime.

wercat 04 Dec 2019
In reply to Deadeye:

I learned Arduino by downloading the environment and playing with an Arduino Nano (less than a fiver) on a breadboard.  I had a working mini Frequency synthesiser based on a programmable Si5351 clock generator working within a day or two and good enough to incorporate into an upgrade of an old Clansman HF radio.

It's great if you want to do a bit of control electronics and very easy to learn from examples which are hardware specific to the device you want to control.

Andy Johnson 04 Dec 2019
In reply to SenzuBean:

I agree that Python is a better and more productive choice than C/C++ for a developer in 2019. The core language can be learned very quickly and it's incredibly well suited to a RasPi.

But for the Arduino environment that the OP mentions, I think there is a lot to be said for the simplicity of C and the "C with classes" subset of C++, which can also be learned quite quickly. If you're targeting an Arduino with only got a few KB of SRAM then the overhead that comes with Python is going to be very limiting.

As a professional developer I don't anticipate writing much new code in C/C++ because as you say higher-level languages like , Pythin are more productive, but as someone who plays with Adrdino/ESP8266 I'd always choose C/C++.

To the OP: I'd also suggest avoiding the temptation to get bogged-down with complex IDEs. The Python IDLE is much better for a beginner than Eclipse because there's much less to think about. The Adrdino IDE is a nice, simple, lightweight environment too. Resist the temptation to complicate things: programs are hard enough to think about without having to deal with complex pro developer tooling too.

(Context: I've been a professional software developer for almost thirty years. Starting with C and then C++ and, over that last decade or so, C# and Python.)

Post edited at 10:59
tom r 04 Dec 2019
In reply to Deadeye:

I've never got past the whole indentation thing in Python. I guess there are dedicated IDEs  that  help? 

elsewhere 04 Dec 2019
In reply to tom r:

> I've never got past the whole indentation thing in Python. I guess there are dedicated IDEs  that  help? 

It  feels freaky to start with, but then quite helpful and more obvious than brackets with cosmetic indentation.

ActiveState python has a nice editor, you can highlight space and tab for indentation.

Post edited at 20:18
wintertree 04 Dec 2019
In reply to John Stainforth:

> Thanks for the information about Python. I confess I have no personal experience of that language but my company did not adopt it for serious number-crunching because it was regarded as (very) slow.

It’s pretty slow but it has serious number crunching libraries in highly optimised C++.  I process about 1 petabyte of images a week in Python using it to glue together those fast modules.  Stuff like “Numba” can run time compile native CPU or GPU code in a highly parallel way for custom maths as well.   You can always write your critical sections in C/C++/FORTRAN/vector assembly and link it seamlessly to Python.  Using it for the high level stuff (configuration, IO, logic) makes stuff so clear and maintainable.

I only had to do about 60 lines of code in altivec intrinsic laden C out of > 10000 lines of Python to get the high performance I need.  These days Clang + LLVM does a better job of vectorising than me so I’d probably just write some plain C code.

wintertree 04 Dec 2019
In reply to wercat:

hWnd variables have no place in BBC Basic.  That’s like seeing your parents in Klute.

That language looks like the illegitimate offspring of BBC Basic and Visual Basic 3.0 - which I think was the “pinnacle” (loosely speaking) of accessible programming in the late 90s Windows era and still leaves a bit of a hole today.  It’s so involved in most modern languages to get interactive, exciting graphical outputs of the sort that so engage youngsters.

SenzuBean 04 Dec 2019
In reply to Andy Johnson:

> But for the Arduino environment that the OP mentions, I think there is a lot to be said for the simplicity of C and the "C with classes" subset of C++, which can also be learned quite quickly. If you're targeting an Arduino with only got a few KB of SRAM then the overhead that comes with Python is going to be very limiting.

Yes, for the Arduino I'd probably agree (no experience with it actually). I should've made clear I was only commenting on programming in general, and the Pi.

snoop6060 05 Dec 2019
In reply to tom r:

> I've never got past the whole indentation thing in Python. I guess there are dedicated IDEs  that  help? 

It's actually one of the things that makes python neat. It literally forces you to style the code correctly to a certain extent. It's nearly always readable no matter what muppet has written it. IDEs help but some of them are too bloated. I find notepad++ is what I end up going back to. I don't do huge dev projects that might benefit from a big bloated IDE though. 

wercat 05 Dec 2019
In reply to wintertree:

Still by original developer of the BBC BASIC ported  to other platforms right back then!  So its pedigree is good even if it has got involved with Windows.  I've seen what my son can do (and he began on an Electron and then a proper BBC which I repaired for him, back around 2009).  (Odd story - I had no scope then and identified the faulty RAM IC by using a crystal earpiece to detect the chip that had the wrong waveforms by ear, while cycling the memory accesses in BBC BASIC)

gravy 05 Dec 2019
In reply to tom r:

"I've never got past the whole indentation thing in Python. I guess there are dedicated IDEs  that  help? "

It's all a bit retro FORTRAN'70 isn't it? it offends my sense of style!

planetmarshall 05 Dec 2019
In reply to Deadeye:

This feels a lot like the Martial Arts thread...

Personally, as a C++ programmer, C++ is an inexplicable choice unless there's something very specific for which you need to use it. These days in the wild its main applications are in Medical and Scientific data processing, Finance and Games. And increasingly in automated vehicles.

For anything else, use Python.

Also,

#pragma pet_hate
"C/C++ is not a thing."

planetmarshall 05 Dec 2019
In reply to SenzuBean:

> I don't think that's the case anymore. The stackoverflow developer survey is probably one of the best places to see the current popularity of various languages, and from that list it's clear python is more popular now: https://insights.stackoverflow.com/survey/2019#technology

The TIOBE index does much the same thing by collating search engine results.

https://www.tiobe.com/tiobe-index/

wintertree 05 Dec 2019
In reply to planetmarshall:

After a decade in the doldrums, Python is steadily climbing up Tiobe - a resurgence I think due to the rapidly rising interest in what is now called “data science”.   Poor old ObjectiveC.  I had high hopes there but it’s headed for deep obscurity.

wintertree 05 Dec 2019
In reply to planetmarshall:

> This feels a lot like the Martial Arts thread...

> Personally, as a C++ programmer, C++ is an inexplicable choice unless there's something very specific for which you need to use it. 

 

The OP mentioned Arduino; the main language there is a C++ although you’ll rarely need to get in to making your own objects with the complexity of a typical Arduino project.  

Andy Johnson 05 Dec 2019
In reply to planetmarshall:

> #pragma pet_hate

> "C/C++ is not a thing."

For myself I just meant C or C++ or the common subset  of the two languages.

Deadeye 05 Dec 2019
In reply to planetmarshall:

> This feels a lot like the Martial Arts thread...

Yes - I thought I'd made it clear I'm massively out of date and rusty, but willies must be waved!

wercat 05 Dec 2019
In reply to Deadeye:

don't mistake interest in obscure subjects for crude memberdisplay


This topic has been archived, and won't accept reply postings.