❌ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdayNews from the Ada programming language world

Ada + Machine Learning (Python Framework)

I'm trying to write a simple machine learning application in Ada, and also trying to find a good framework to use. My knowledge of one thing is extremely minimal, and of the other is somewhat minimal.

There are several nifty machine learning frameworks out there, and I'd like to leverage one for use with an Ada program, but I guess I'm just...at a loss. Can I use an existing framework written in Python, for instance and wrap (or I guess, bind?) the API calls in Ada? Should I just pass off the scripting capabilities? I'm trying to figure it out.

Case in point: Scikit (sklearn) https://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html#

This does some neat stuff, and I'd like to be able to leverage this, but with an Ada program. Does anyone have advice from a similar experience?

I am just researching, so I have tried finding information.

http://www.inspirel.com/articles/Ada_Python_Binding.html https://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html#

Which programming language should you learn?

29 December 2016 at 12:56

This question turns out now and then on forums, Facebook, and so on. Since I got tired of writing always the same things, I decided to write my suggestions here once for all.

As usually, with this kind of questions, everything depends on your starting point (are you a beginner? an amateur?) and your target (do you want to do web development? Contribute to open source projects? Program small devices like STM32?). Usually who asks this question is a beginner and does not say anything about specific goals, therefore usually I assume that the objective is to get some “culture” in this field. The answer that follows is written with this generic objective in mind.

Step 1 : learn to program (simplicity is the key)

If you have no experience in programming at all, I will suggest starting with something simple, in order to learn how to program before actually learning a language.

Yes, because “learning to program” is not the same of “learning a programming language.” Learning to program means learning how to decompose a problem into smaller problems and specify a procedure to solve them. Knowing how to do this is a skill that is independent on the specific language and somehow on a higher level than knowing programming languages. You can write programs without even having a PC, but just pen and paper.

Ada Lovelace, daughter of Lord Byron (yes, that Byron!), is considered the first programmer in history because of her notes to the article on the Analytical Engine designed (but never built) by Charles Babbage, a kind of computer of ‘800, but with the register made with gears and powered with steam… (I would suggest reading the Ada Lovelace article, it is very interesting)

Of course, even for learning the skill of programming a language is necessary, but I would stay on something simple.

A language that was suited for beginners, in my opinion, was BASIC. It was fairly popular in the ’80 when every home computer had some kind of BASIC interpreter built-in. Although simple, it had all the necessary features and one could write quite complex stuff with it, although the resulting code was not very maintainable. An advantage of BASIC was that it was interpreted: you could write a single command and having it executed immediately, without the need of an IDE.

Since BASIC is much less popular nowadays, I think that C is another good choice as a starting point since it is fairly simple. C is also quite low-level, giving you visibility of some machine level stuff like pointers and stack and this is useful because it gives you a sensibility about what happens “under the hood” even with other languages. (I find that this kind intuition helps me a lot when I learn a new language). Be sure to learn even all the tiny, obscure details of C such as pointers, struct, unions, functions with variable argument list (such as printf).

Also with C you will learn about macro expansion, a methodology used in several places and that requires a mindset slightly different from the one used in imperative languages like C. To be honest, I do not love macro expansion since it is quite error-prone and it can make the code less readable, but there are context where it is useful.

Second step: best practices & OOP with Ada

Since object-oriented programming (OOP) is widely diffused and fashionable, as a second language many would suggest C++ or Java. However, I am going to be heretic and suggest Ada. Beyond allowing OOP, it is a modern language, very powerful with strong emphasis on correctness and maintainability. It can introduce you also to stuff that it is not common in other languages such as contracts, type invariants and formal checking. Studying it you will learn some “good practices” in programming that will be useful even with other languages.

Since Ada is not widely used, finding information in the network is not easy. Few useful links: you can get an open-source, gcc-based compiler here: http://libre.adacore.com/. For an introduction to the language see the Adacore University, for an easy reference see the Wikibook, for a mix of resources see the Ada Information Clearinghouse (where you can find the reference manual) and the site of Adacore. Finally, you can meet other Ada-ists on the usenet group comp.lang.ada and on some LinkedIn groups.

Now you have the most important basics

Once you have a good experience of C and Ada, learning other languages is just a matter of learning a new syntax and maybe one or two new concepts. I, for example, learned Ruby in few hours just using a tutorial. In the end, most of the current languages are very similar one another.

Polishing it : Ruby/Python and assembly

Finally, to round everything up, I would suggest, as the cake icing, a scripting language like Ruby or Python and maybe some assembly. It is true that assembly is not used much nowadays (although it depends on your context), but some experience of assembly will give you some good understanding of what happens “under the hood.” Moreover, it is so much fun to go so close to the processor that you can almost feel the silicon... :-)

Strange stuff: functional languages, PROLOG, ….

If you really want the widest view, you can also try some fancy stuff like functional languages (Eiffel, Haskell, … even LISP) and logic programming stuff like PROLOG. Those languages have a “model” that is different from the usual “procedural” model. I did not see them used too much and I wonder if they are suited for very large scale and very long lived software, but it is useful to know that they exist and how they work.

Conclusions and final remarks

I hope that you found this useful or that, at least, gave you some ideas about programming. A final suggestion: my experience is that the best way to learn a new language is to use it. After you got acquainted with the syntax, choose a project of intermediate difficulty (even a silly one, it does not necessarily need to be useful) and do it (and, possibly, have fun…)

❌
❌