Python is a cross-platform language
Forum: PC programming Cross-platform programming - which language?
I'm looking for a programming language plus programming environment with which I can program across platforms, namely: - for Windows and under Windows - for Android under Windows - for Raspberry Pi under Windows and on the Pi - tendentially under Linux for Linux, Android and Pi It should be a compiler language for small programs for data acquisition via RS232 (USB, Bluetooth), storage and graphic display and stuff like that. E.g. a serial terminal. It should definitely not be an interpreter language like Java or Python. So far I have found Qt and the Qt Creator, but it probably needs some additional packages like VisualStudio with VisualC ++, which then steers back to MS. Also wxWidgets, or MingW, which probably work with Qt and also with code blocks. But I don't know whether they can also be used for Android. It all boils down to C ++. Alternatively there is Lazarus with Free Pascal, which apparently supports all desired platforms. Does anyone have any experience with that? And it would be nice if the IDE was lean and not so cluttered.
What do you think of Qt with the QtCreator - your own IDE? Find it very clear and easy to use. But it can do everything you need and is available for M $, Apple and unix.
by Rufus Τ. F. (rufus) (Moderator)
Timm T. wrote:> So far I have found Qt and the Qt Creator, this is not a language, but a class library (and development environment adapted to it) For a language. Namely for C ++. > Also wxWidgets, or MingW One is a class library, the other a development environment. wxWidgets does not "work" with Qt, but is an alternative to it.
Timm T. wrote:> I am looking for a programming language plus programming environment with which I can> program across platforms,> - for Windows and under Windows C #, C, C ++, Java, Delphi, (Visual) BASIC (.NET), etc.> - for Android under Windows Java> - for Raspberry Pi under Windows and on the Pi C, C ++, a bunch of scripting languages, Java> - tends to run under Linux for Linux, Android and Pi Doesn't Linux run on the Pi? So what's that supposed to be? C, C ++, Java> It should definitely not be an interpreter language like Java or Python. Bad luck. E.g. even if there is C for Android, Java is the language of choice on Android. > So far I have Qt A GUI library. What does that have to do with a programming language? You will probably have to get out of your comfort corner. It's like in real life: what do you call someone who speaks three languages? Trilingual. What do you call someone who speaks two languages? Bilingual. What do you call someone who speaks a language? An American. As an American of programming languages, you won't get very far. Not beyond your virtual Texas.
Timm T. wrote:> It should definitely not be an interpreter language like Java or Python. Java is not an interpreter language. Java is definitely the method of choice here. But still you probably won't be able to write a program that runs on Android and on PC, the platforms are too different for that.
Hannes J. wrote:> A GUI library. What does this have to do with a programming language>? QT is not just a GUI library. It contains a complete abstraction layer, so that development for all platforms is possible. In principle, QT is exactly what the TE is looking for. The choice of programming language is irrelevant for multi-platform development. The right choice of interfaces is important. QT offers a large number of these, especially in connection with QML. Available platforms: https://de.wikipedia.org/wiki/Qt_%28Bibliothek%29#Unterst.C3.BCtzte_Plattformen
: Edited by user
Timm T. wrote:> It should definitely not be an interpreter language like Java or Python. Then check out Cython: flexibility of Python, with C elements. Or to put it another way: Python-like code with a similar speed to C because it is statically compiled.
Cython project: http://cython.org/ Book about Cython: http://www.amazon.de/Cython-Kurt-W-Smith/dp/1491901551/ref=sr_1_1?ie=UTF8&qid=1458377885&sr=8-1&keywords = CythonTimm T. wrote:> It should definitely not be an interpreter language like Java or Python. Why not? Afraid that python is 'too slow'? I very much doubt that. Yes, of course pure Python is slower than e.g. well-written C code. But that doesn't matter if you have to wait for data from an interface (RS232, network, what ever) anyway. Of course, if you don't use the resources, and celebrate everything old-school in a huge main loop, and leave the other twelve cores of your CPU unused, then that can actually become a problem ... But in times when it does Writing multi-threading / multi-processing applications is no problem at all, language is the smallest problem. Bad code can be written in any language, including C or assembler ... With a script language, I even see that advantage that you don't have to recompile the whole thing for X platforms every time you change (Windows (x86), Linux (x86), Linux (ARM), Android, ...). Just copy over and good. And yes, I see that as a decisive advantage. Because at the latest when your compiler does not support all compiler flags on one platform as it does on another platform, then the whole thing sucks. (Yes, I had this problem with CLang on the RPi. The compiler doesn't support the sanitize flag.) And with Python you also have Qt. And Qt is a really, really good framework. You don't have very many options to choose from: - Java - C / C ++ with Qt - Python with Qt - A mixture of C / C ++ with Python / Cython and Qt But if you cut Java and Python out of the start, the matter is clear. Then take Qt and the Qt Creator as IDE, C / C ++ as language and then hit the keys.
|3||Cython is an optimizing static compiler for both the Python programming|
|4||language and the extended Cython programming language (based on Pyrex).|
|5||It makes writing C extensions for Python as easy as Python itself.|
|7||Cython gives you the combined power of Python and C to let you|
|8||write Python code that calls back and forth from and to C or|
|9||C ++ code natively at any point.|
|11||easily tune readable Python code into plain C performance by|
|12||adding static type declarations.|
|14||use combined source code level debugging to find bugs in your|
|15||Python, Cython and C code.|
|17||interact efficiently with large data sets, e.g. using multi-|
|18||dimensional NumPy arrays.|
|20||quickly build your applications within the large, mature and|
|21||widely used CPython ecosystem.|
|23||integrate natively with existing code and data from legacy,|
|24||low-level or high-performance libraries and applications.|
Rufus Τ. F. wrote:> This is not a language, but a class library (and> adapted development environment) for a language. Namely for C ++. That's why it says under it: Timm T. wrote:> It all comes down to C ++. Hannes J. wrote:> Doesn't Linux run on the Pi? So what's that supposed to be? C, C ++, Java Yes, and Win10 also runs on the Pi. Nevertheless, not all environments for Linux (on x86) can also be used on the Pi (ARM).
Kaj wrote:> Why not? Afraid that Python is 'too slow'?> I doubt that very much. Well, at least there are people for whom Fhem, which is written in Pyhton, is too slow. And Fhem is "just" a surface to display a few measured values, which runs on a 1GHz processor. Not that I now want to tinker with Fhem ...
Timm T. wrote:> Well, at least there are people for whom Fhem which is written in Pyhton> is too slow. But that doesn't necessarily have to be due to the language. One can in everyone Language writing bad, fast-paced code. But you can also write code with Python that is more than fast enough. And Fhem itself is not written in Python. Fhem is written in Perl: http://fhem.de/fhem_DE.html
However, there may well be a front end that is written in Python. But that's 2 pairs of shoes. And especially with the evaluation / processing / presentation / sorting of data you can do a lot wrong, so the code gets really slow, like in every language. Good example for this: Article "Re: Python 3: Finding new values in a list" You just have to do it "right". Timm T. wrote:> Well, at least there are people for whom Fhem [...] is too slow. Yes, a freshly installed Windows on a brand new SSD with an 8 core processor is also too slow for me ... My 50Mbit internet is also too slow for me ... There are also people who speed 220 on the autobahn too slow ... Feel that speed is subjective, as is volume. In a car you find 25km / h to be slow to snore. But drive 25km / h on an old tractor, without a cab and without a windshield, it will seem pretty quick to you. You do the same with software. Of course, if you are only used to a desktop that has 4 to 8 cores and 3 to 4 GHz, then the RPi will of course seem ultra slow. Take an RPi (it doesn't matter which one) and try to surf the Internet with it ... I find that also very slow. But it can't be the browser, it's written in C ++ ... So, is it the language used in which the browser is written? Or is it because the browser is simply badly programmed? Or is it maybe the hardware? (Yes, a browser is a bad example here, because of course a browser does a lot more!) To spontaneously say: "There are people who say that application X is too slow because it is written in language Y", and So to exclude a language without having tried it yourself is, in my opinion, just stupid. Because then there shouldn't be any applications written in C ++, because C ++ has soooooo an overhead compared to C. Likewise, there shouldn't be any programs that are written in C, because C has sooooooo an overhead in contrast to assembler ... At least there are people who claim that, even in 2016, even if everything has already been refuted a thousand times. You just have to use a language correctly.
|1||FHEM (registered trademark) is a written in perl,|
|2||GPL licensed server for home automation.|
of Stefan Salewski (Guest)
Kaj wrote:> That doesn't necessarily have to be due to the language. You can write bad, very slow code in any> language. For sure. > But you can also> write code with Python that is more than fast enough. What's fast enough already? Python as bytecode that is executed on a VM is about 10 to 50 times slower than compiled machine code. (Also for Ruby.) Cython or PyPy might improve things a bit. Or you try to write the critical parts in C. But none of that is the real thing. Python may be OK for a lot of things, probably also for Mr. Thaler. Especially when essentially only library routines are called, which are mostly written in C. But in terms of languages there are now enough (better) alternatives - unfortunately not with cross-platform GUI, tools, libraries and support.
Stefan Salewski wrote:> Python as bytecode, which is executed on a VM> is about 10 to 50 times slower than compiled> machine code 1. it is executed by an interpreter, not a VM, and 2. cannot be said in general terms . A good interpreter can be as fast or even faster than native code. That once amazed me in one of my benchmarks of asmjs vs js, at that time I increased a variable in a loop until it came back to 0. I tested the increase in asmjs directly (1s), in a module function (5s) and in a module function of another module (6min). The js code counted up the variable in another function, but only needed 1s. The main thing was that the JS interpreter was able to optimize the function call at runtime, but not the compiled asmjs code.
of Stefan Salewski (Guest)
Daniel A. wrote:> 1. It is carried out by an interpreter, not a VM, and 2.> You can't say that across the board. A good interpreter can be as fast> or even faster than native code. Well, you probably know better than Wikipedia and other sources on the net: https://en.wikipedia.org/wiki/Python_(programming_language) "The main Python implementation, named CPython, is written in C meeting the C89 standard. [78 ] It compiles Python programs into intermediate bytecode,  which is executed by the virtual machine. " And I can put it so broadly - my statement was based on Python (or Ruby). In particular, on Guido's usual CPython. I have not yet seen a benchmark where the Python code is not at least 10 times slower than the corresponding code in C or a similarly well compiled language in machine code. Of course, stupid benchmarks where only a C library is called from Python do not count.) I know that Java code is faster than comparable C code in some benchmarks - which actually surprises me a bit. But an extremely large amount of manpower has been invested in Java in the last 20 years.
Daniel A. wrote:> 1. it is carried out by an interpreter, not a VM, and 2.> one cannot say that across the board. A good interpreter can be as fast> or even faster than native code. This will only be a real interpreter if the native code uses poorer algorithms, or if the individual instructions of the interpreted code are complex, optimized operations and the effort involved in interpretation disappears. You may also be referring to just-in-time compilers with pronounced hotspot optimization, such as exist in Java. But these are compilers, not interpreters, only partially at runtime.
: Edited by user
@ Stefan Salewski (guest) Oops, I had the context of the phrase> Python as bytecode, which is executed on a VM Wrongly interpreted. I thought it would say that Python is always executed as bytecode on a VM, which is not the case, since a program that analyzes & executes a script is by definition an interpreter. https://de.wikipedia.org/wiki/Interpreter:> An interpreter (in the sense of software technology) is a computer program> which, unlike assemblers or compilers, does not convert a program source code into a> file that can be executed directly on the system translates, but reads, analyzes and executes the source code. I should have noticed that "Python as bytecode which is executed on a VM" is a specific implementation possibility of a Python interpreter, to which reference was made here. My mistake.
Uninteresting! I had already ruled out Python. After compiling, I want to get an executable that will run on the system. Without any interpreter or VMs hanging in between, regardless of whether the text lines or bytecode are executing. What about Lazarus or Freepascal? Seems to go on all four platforms. In any case, the syntax of Pascal appeals to me more than that of C (++).
Timm T. wrote:> - for Windows and under Windows> - for Android under Windows> - for Raspberry Pi under Windows and on the Pi> - tendentially under Linux for Linux, Android and Pi >> It should be a compiler language for small programs for> data acquisition via RS232 (USB, Bluetooth), storage and graphic> display and stuff like that. E.g. a serial terminal.
- What will happen when Hogwarts is real
- When will the US shut down the penny
- Regret being vegetarian vegan
- If 6x 7 7 what is x
- How do independent sex workers find clients
- What are the best noodle soups
- Why don't a lot of adults play video games
- What is the silver content in groschen
- Vacuum takes up space
- What does meaning
- What is your bad habit of eating
- How can I stop being emotionally detached?
- Should Donald Trump be charged
- Where is NASA located
- Has Quora changed the way they distribute responses
- Is there really a mental disorder
- How does internet speed work 1
- Should I become a Freemason 1
- Accused presidents remain in office
- What happens to error coins
- What is your birthday
- Which gear is the fastest
- Tee brand Nerf darts are good