Learning how to code : C++ or Python ?

Creations

sylvain

5 years ago

Python is now on Gamebuino, it is the perfect opportunity to discover that not so recent but very trendy language ! To celebrate this news, we offer you the chance to win a Gamebuino META : hurry up and take part in our raffle, there are only a few days left !

Why would you choose to write code in Python ?

If you have been through some of our tutorials, then you already know why, the C++ was until now the only language compatible with our Gamebuinos. But this era is now over with the introduction of Python! There are similarities between C++ and Python : both are object-oriented coding, and are the  most usually used coded languages in 2019. Both will allow you to learn how to code, and to create more and more advanced games. However, here are some features that might make you want to try or switch to Python if you start learning how to code.

A clearer syntax

With its much easier syntax than C++, it is simpler for a beginner to understand the meaning of an algorithm.

Interpreted language 

Unlike the C++, that is compiled language, Python can execute instructions directly, which speed the testing process : no need to compile your game, you can test it immediately.

Dynamic typing

With Python, there is no need to declare a variable type before using it. It is dynamically typed, which means that it has untyped variable names, the typing is not explicitly specified. It is implicitly linked to the information dealt with. It ensures a lighter coding, that is also easier to use for beginners.

No need to install any software

Unlike the C++ for which you need the IDE Arduino, with Python you do not need any compiler. You can simply use your favorite code editor, then simply slide your file into your Gamebuino and try it.

 Lesser lines of code

All the previous points converge : with Python, you can code in a more synthetic way with lesser lines of code. You will be able to code the prototypes of your games faster and get results in no time!


In conclusion?

As you might have understood it, Python has many benefits including  simplifying the learning process of coding for beginners. Yet, it also allows you to create very advanced programs ! The C++ is nevertheless a very powerful and effective language that we will keep on our Gamebuinos. The choice will be yours!


Take part in the contest now

View full creation

Martisse

NEW 5 years ago

Ça je l'avais remarqué, pour du python il suffit d'écrire print("Hello World") , pour du c++ ( programme console) il faut 7 lignes de codes !

alxm

NEW 5 years ago

Impressive work, I look forward to trying it out when it's ready!

davehoran

NEW 5 years ago

I'm excited to use Python on the Meta!

elefas

NEW 5 years ago

That's great news, looking forward to it, cause C++ is very powerful, but Python is much more easier and friendly. Python will boost up the community!

jicehel

NEW 5 years ago

Yes, have we already the date of the Python launch ?

Steph

NEW 5 years ago

Snake could be a perfect tutorial for launching Python ;-)

jicehel

NEW 5 years ago

Yes, pong solo, pong duo, wall breaker, snake, ... easy examples are alot but all fine to learn

Steph

5 years ago

I meant Snake because... well... Python! You need to get some sleep jicehel ;-)


Steph

NEW 5 years ago

jicehel jicehel

I meant Snake because... well... Python! You need to get some sleep jicehel ;-)


jicehel

NEW 5 years ago

Yes, i missed it...  lol.. Well done Steph  ;)

JPBONNAFOUS

NEW 5 years ago

Et ça arrive qd MicrPython sur META ? trop Hate

jicehel

NEW 5 years ago

Normalement c'est prévu d'ici une semaine / quinze jours mais à confirmer par l'équipe  ;)

Xoff

5 years ago

I was thinking the same thing, but infos below make me doubt:

Un langage interprété
Contrairement au C++, qui doit être compilé, le Python peut être exécuté immédiatement, ce qui accélère grandement les tests : vous pouvez lancer votre jeu instantanément, sans avoir à le compiler.

Xoff

NEW 5 years ago

what about performances between Python (interpreted) and C++ (compiled) ?
in game developement, depending on the game, performance could be a determinant factor..

any ideas ?

eriban

5 years ago

I would assume that to run on the Gamebuino the Python code is compiled and uploaded as binary, just as C++. Given the fairly limited CPU and memory resources of the Gamebuino, I would be surprised if it is interpreted there. I am not sure though, and happy to have that either confirmed or denied though.

eriban

NEW 5 years ago

Xoff Xoff

I would assume that to run on the Gamebuino the Python code is compiled and uploaded as binary, just as C++. Given the fairly limited CPU and memory resources of the Gamebuino, I would be surprised if it is interpreted there. I am not sure though, and happy to have that either confirmed or denied though.

Sorunome

5 years ago

The python port is based on CircuitPython, which, in turn, is based on MicroPython, and thus the code is actually interpreted on the device itself

Thierry

5 years ago

It is possible to precompile your python to reduce memory footprint and improve performance.

That's what libraries uses.

I believe the tool is mpy-cross.

more details on Adafruit website.

Xoff

NEW 5 years ago

jicehel jicehel

I was thinking the same thing, but infos below make me doubt:

Un langage interprété
Contrairement au C++, qui doit être compilé, le Python peut être exécuté immédiatement, ce qui accélère grandement les tests : vous pouvez lancer votre jeu instantanément, sans avoir à le compiler.

eriban

5 years ago

It could be that you test via an emulator, without uploading to your Gamebuino, in which case is interpreted. However, reading the announcement text more carefully, it also says that installation of software is not required, which suggests that there is no emulator nor a compiler. I then not only wonder about performance, but also about error handling. A benefit of compilation is that syntax errors are caught before uploading to the Gamebuino. We just have to wait and see, I guess. 

eriban

NEW 5 years ago

Xoff Xoff

It could be that you test via an emulator, without uploading to your Gamebuino, in which case is interpreted. However, reading the announcement text more carefully, it also says that installation of software is not required, which suggests that there is no emulator nor a compiler. I then not only wonder about performance, but also about error handling. A benefit of compilation is that syntax errors are caught before uploading to the Gamebuino. We just have to wait and see, I guess.